body {
    background: linear-gradient(120deg, #d6f7d6 44%, #effce1 100%);
    font-family: "微软雅黑","Arial",sans-serif;
    margin:0;
    min-height:100vh;
}
.main-bg {
    position:fixed; left:0;top:0; width:100%;height:100%; z-index:-1;
    background: radial-gradient(circle at 35% 12%, #b3f8da 7%, #eaffed 44%),
                radial-gradient(ellipse at 90% 93%, #c8eec0 9%, #f0fff0 72%);
    opacity:.7;
}
/* PC端正常居中显示 */
.container {
    max-width: 440px;
    margin: 55px auto;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 8px 24px #bcd1ff33;
    padding: 32px 30px 18px 30px;
}

.logo-title {
    display: flex; align-items: center;justify-content: center;
    font-size: 1.45em;
    letter-spacing: .02em;
    color: #47659b;
    margin: 0 0 10px 0;
}
.mahjong-icon {
    width: 33px; height:33px;vertical-align:middle;
    margin-right: 12px; border-radius:3px;
    box-shadow:0 0 8px #acdeff66;
    background: transparent;
}
.desc {
    color: #5f6b80;
    font-size: 1.07em;
    margin-bottom: 15px;
    font-family:"微软雅黑","Arial",sans-serif;
    background: #f5f7fb;
    border-radius: 7px;
    padding: 9px 10px 7px 12px;
    box-shadow:0 2px 8px #eaf1ff33;
}
.desc-header,.desc-demo {color:#415892;font-weight:bold;}
.desc-key {color:#ad39bc;border-radius:2px;background:#eae4fb;padding:0 3px;}
.demo-code {padding:0 2px;color:#1caf82;}

.input-row {
    display:flex;gap:6px;
    align-items:center;
    margin-bottom:13px;
}
input[type="text"] {
    flex:1; font-size:1.13em;
    padding: 10px 13px;
    border: 1.5px solid #badde9;
    border-radius: 7px;
    transition:border 0.18s;
}

input[type="text"]:focus {
    border:1.5px solid #47659b;
    outline:none;
    background:#f7faff;
}

button {
    background: #47659b;
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 10px 30px;
    font-size: 1.05em;
    cursor: pointer;
    transition: background 0.18s,box-shadow 0.16s;
    box-shadow:0 2px 10px #bcd1ff22;
    display: flex; align-items: center; gap:8px;
}
button svg {margin-right:2px;}
button:hover {
    background: #273584;
    box-shadow:0 6px 12px #bcd1ff28;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 99; left:0; top:0; width:100%;height:100%;
    background: rgba(40,53,86,0.14);
    animation: modal-fadeIn .19s;
}
@keyframes modal-fadeIn {from{opacity:0;}to{opacity:1;}}

.modal-content {
    background-color: #fff;
    margin: 8% auto;
    padding: 32px 28px 14px 28px;
    border-radius: 17px;
    box-shadow: 0 10px 34px #829dd533;
    width: 100%;
    max-width: 360px;
    min-width: 220px;
    position: relative;
    font-size: 1.13em;
    font-family: "微软雅黑","Arial",sans-serif;
    animation: modal-content-up .22s;
}
@keyframes modal-content-up {from{transform:translateY(22px);opacity:0;}to{transform:translateY(0);opacity:1;}}

.modal-close {
    color: #47659b;
    position: absolute;
    right: 21px; top: 17px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.14s;
    user-select:none;
}
.modal-close:hover, .modal-close:focus {
    color: #d43c3c;
}
#modalText {
    min-height: 64px;
    white-space: pre-wrap;
    word-break: break-all;
    margin-top:17px;
    color: #283047;
}

/* 页脚 */
.page-footer {
    margin-top:40px;
    text-align:center;
    color:#8ea0bc;
    background:transparent;
    font-size:1.01em;
    border-top:1.5px solid #e7effc;
    padding:14px 0 18px 0;
    letter-spacing:.02em;
}
.footer-inner {display:inline-flex;align-items:center;gap:18px;}
.github-link a {color:inherit;text-decoration:none;transition:color .17s;}
.github-link a:hover {color:#2e3a77;}

/* ... 保留之前风格 ... */

#mahjong-keyboard {
    margin:15px 2px 12px 2px;
    user-select: none;
}
.kb-row {
    display:flex;
    justify-content:center;
    gap:6px; margin-bottom:7px;
}
.kb-btn {
    border:none; background:#eceffd;
    border-radius:7px; font-size:1.07em;
    padding:6px 9px; cursor: pointer;
    box-shadow:0 1.5px 8px #bcd1ff22;
    transition:background .14s,box-shadow .17s;
    outline:none;
    min-width:32px; min-height:32px;
    position: relative;
}
.kb-btn-tile {
    /* 这是前四排 tile 专用：麻将牌按钮的底色/圆角/大小 */
    /* 改这里：比如调高底色饱和度与按钮尺寸 */
    background: #dee8fa;        /* 更蓝更深，也可用 #dce3fa #cadcff #e7ecf7 #cfd8ff */
    border-radius: 11px;
    min-width: 48px;            /* 调宽按钮 */
    min-height: 54px;           /* 调高按钮，图片不会被压缩 */
    padding: 4px 6px;
    box-shadow:0 2.5px 14px #bcd1ff45;
    display: flex; align-items: center; justify-content: center;
    transition:background 0.15s, box-shadow 0.18s;
}

.kb-btn-tile img {
    /* 控制tile图标图片的宽高，推荐纵向略大、object-fit:contain不变形 */
    width: 36px;
    height: 44px;
    object-fit: contain;
    display:block;
    margin:0 auto;
}
.kb-btn img {
    width:36px;height:36px;vertical-align:middle;display:inline-block;
    margin:-2px 0;
}
.kb-btn:hover {
    background: #cff4e7;
    box-shadow:0 5px 12px #cafcfa44;
}

.kb-btn-del {
    background: #fff6ed;
    color: #c7752d;
    border-radius: 13px;
    font-size: 1.09em;
    font-weight: 600;
    min-width: 100px;
    min-height: 54px;
    box-shadow:0 2.5px 15px #ffcc9740;
    margin-left: 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.kb-btn-del:hover {
    background:#ffe4cc;
}
.kb-btn-wind, .kb-btn-mode, .kb-btn-meld, .kb-btn-hand {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 13px;
    font-size: 1.13em;
    font-weight: 500;
    margin: 0;
    padding: 0 2px;
    /* 可自行调整底色和 hover 配色 */
}
/* 按钮专属宽度+高度，可以分别给每个类型指定宽度 */
.kb-btn-wind {
    background: #d9d6fa;
    min-width: 88px;
    min-height: 44px;
    max-width: 105px;
    color: #273584;
}
.kb-btn-wind:hover {
    background: #bbaef6;
}

.kb-btn-mode {
    background: #e1faea;
    min-width: 88px;
    min-height: 41px;
    max-width: 105px;
    color: #168c53;
}
.kb-btn-mode:hover {
    background: #bbf2d6;
}

.kb-btn-meld {
    background: #faeaf3;
    min-width: 88px;
    min-height: 41px;
    max-width: 105px;
    color: #c74286;
}
.kb-btn-meld:hover {
    background: #fa96c7;
}

.kb-btn-hand {
    background: #faeaf3;
    min-width: 184px;
    min-height: 41px;
    max-width: 210px;
    color: #c74286;
}
.kb-btn-hand:hover {
    background: #fa96c7;
}

.kb-btn-clear {
    background: #ffe4ed;
    color: #d63384;
    border-radius: 13px;
    font-size: 1.09em;
    font-weight: 600;
    min-width: 100px;
    min-height: 54px;
    box-shadow:0 2. 5px 15px #ff97c740;
    margin-left: 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.kb-btn-clear:hover {
    background:#ffc7dd;
}

.kb-btn.active {
    border: 2.5px solid #47659b;
    background: #f5faff !important;
    box-shadow: 0 0 0 2px #8cc8ec88;
}

html, body {
    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    min-height: 100vh !important;
    max-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    background: linear-gradient(120deg, #d6f7d6 44%, #effce1 100%) !important;
}

.tile-counter {
    font-size: 0.95em;
    color: #666;
    text-align: center;
    margin: 6px 0 10px 0;
    min-height: 20px;
}
.tile-counter.warning {
    color: #d9534f;
    font-weight: 600;
}
.tile-counter.normal {
    color: #5cb85c;
}

@media (max-width:640px) {
  .tile-counter {
    font-size: 0.9em;
    margin: 4px 0 8px 0;
  }
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f9fbff 100%);
    margin: 8% auto;
    padding: 28px 24px 20px 24px;
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(71, 101, 155, 0.18);
    width: 100%;
    max-width: 420px;
    min-width: 280px;
    position: relative;
    font-size: 1.08em;
    font-family: "微软雅黑","Arial",sans-serif;
    animation: modal-content-up .22s;
    border: 1.5px solid #e3ecf8;
}

#modalText {
    min-height: 60px;
    margin-top: 12px;
    color: #283047;
    line-height: 1.5;  /* 从 1.7 改为 1.5，缩小行间距 */
}

/* 结果样式 - 错误 */
.result-error {
    font-size: 1.3em;
    font-weight: bold;
    color: #d9534f;
    margin-bottom: 12px;
    text-align: center;
}

.result-desc {
    background: #fff3f3;
    border-left: 4px solid #d9534f;
    padding: 12px 14px;
    border-radius: 8px;
    color: #a94442;
    font-size: 1.05em;
}

/* 结果样式 - 状态标题 */
.result-status {
    font-size: 1.25em;
    font-weight: bold;
    color: #47659b;
    margin-bottom: 10px;  /* 从 14px 改为 10px */
    text-align: center;
    padding-bottom: 8px;  /* 从 10px 改为 8px */
    border-bottom: 2px solid #e3ecf8;
}

/* 结果样式 - 总番数 */
.result-total {
    background: linear-gradient(135deg, #5cb85c 0%, #4cae4c 100%);
    color: #fff;
    font-size: 1.3em;    /* 从 1.4em 改为 1.3em */
    font-weight: bold;
    padding: 12px 16px;  /* 从 14px 18px 改为 12px 16px */
    border-radius: 12px;
    text-align: center;
    margin: 12px 0;      /* 从 16px 改为 12px */
    box-shadow: 0 4px 16px rgba(92, 184, 92, 0.3);
}

/* 结果样式 - 番型明细 */
.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;   /* 从 10px 14px 改为 8px 12px */
    margin: 4px 0;       /* 从 6px 改为 4px */
    background: #f7f9fc;
    border-radius: 8px;
    border-left: 3px solid #47659b;
    transition: background 0.2s;
}

.result-item:hover {
    background: #eef2f9;
}

.item-name {
    font-weight: 600;
    color: #415892;
    flex: 1;
}

.item-value {
    font-weight: bold;
    color: #5cb85c;
    margin-left: 12px;
}

/* 结果样式 - 普通行 */
.result-line {
    padding: 4px 0;      /* 从 6px 改为 4px */
    color: #5f6b80;
    font-size: 1.02em;
    line-height: 1.4;    /* 新增 */
}

/* 结果样式 - JSON */
.result-json {
    background: #f5f7fb;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 0.95em;
    color: #283047;
    overflow-x: auto;
    border: 1px solid #e3ecf8;
}

/* 弹窗底部链接区域 */
.modal-footer {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1. 5px solid #e3ecf8;
    text-align: center;
}

.fan-info-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #47659b;
    font-size: 1.02em;
    font-weight: 500;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    background: #f5f9ff;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(71, 101, 155, 0.1);
}

.fan-info-link:hover {
    background: #e3ecf8;
    color: #273584;
    box-shadow: 0 4px 12px rgba(71, 101, 155, 0.18);
}

.fan-info-link:active {
    transform: translateY(1px);
}

/* ========== 移动端完整适配 ========== */
@media (max-width:640px) {
  /* 容器 */
  .container {
    width: calc(100vw - 20px);
    margin: 16px auto 0 auto;
    padding: 16px 12px 12px 12px;
    border-radius: 14px;
    box-shadow: 0 4px 15px #bcd1ff33;
    background: #fff;
    box-sizing: border-box;
  }

  /* 标题 */
  .logo-title {
    font-size: 1.25em;
    margin-bottom: 8px;
  }
  .mahjong-icon {
    width: 28px;
    height: 28px;
  }

  /* 说明区 */
  .desc {
    font-size: 0.92em;
    padding: 8px 10px;
    margin-bottom: 12px;
  }

  /* 输入行 */
  .input-row {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
  }

  input[type="text"] {
    flex: 1;
    font-size: 1em;
    padding: 9px 10px;
    min-width: 0;
  }

  /* 计算按钮 */
  #btnCalc {
    flex: 0 0 auto;
    font-size: 0.95em;
    padding: 9px 14px;
    min-width: 72px;
    white-space: nowrap;
  }

  /* 手牌统计 */
  .tile-counter {
    font-size: 0.88em;
    margin: 4px 0 8px 0;
  }

  /* 虚拟键盘整体 */
  #mahjong-keyboard {
    margin: 10px 0 8px 0;
    font-size: 0.92em;
  }

  .kb-row {
    gap: 4px;
    margin-bottom: 5px;
  }

  /* 麻将牌按钮（前四排） */
  .kb-btn-tile {
    min-width: 36px;
    min-height: 46px;
    padding: 3px 4px;
    border-radius: 9px;
  }

  .kb-btn-tile img {
    width: 28px;
    height: 36px;
  }

  /* 删除按钮 */
  .kb-btn-del {
    min-width: 70px;
    min-height: 46px;
    font-size: 0.95em;
    border-radius: 10px;
  }

  /* 清空按钮 */
  .kb-btn-clear {
    min-width: 70px;
    min-height: 40px;
    font-size: 0.95em;
    border-radius: 10px;
  }

  /* 门风按钮 */
  .kb-btn-wind {
    min-width: 72px;
    max-width: 80px;
    min-height: 38px;
    font-size: 0.98em;
    border-radius: 10px;
  }

  /* 和牌方式按钮 */
  .kb-btn-mode {
    min-width: 72px;
    max-width: 86px;
    min-height: 36px;
    font-size: 0.96em;
    border-radius: 10px;
  }

  /* 副露/暗杠按钮 */
  .kb-btn-meld {
    min-width: 72px;
    max-width: 86px;
    min-height: 36px;
    font-size: 0. 96em;
    border-radius: 10px;
  }

  /* 手牌按钮 */
  .kb-btn-hand {
    min-width: 150px;
    max-width: 180px;
    min-height: 36px;
    font-size: 0.96em;
    border-radius: 10px;
  }

  .modal-content {
    max-width: 90vw;
    padding: 18px 14px 14px 14px;  /* 从 20px 16px 改为 18px 14px */
    font-size: 0.98em;              /* 从 1em 改为 0.98em，略小 */
    margin: 12% auto;               /* 从 15% 改为 12%，距顶部更近 */
    border-radius: 16px;
    max-height: 80vh;               /* 新增：最大高度80%屏幕 */
    overflow-y: auto;               /* 新增：超出内容可滚动 */
  }

  #modalText {
    line-height: 1.4;  /* 移动端进一步缩小行间距 */
  }

  .result-status {
    font-size: 1.15em;     /* 从 1.25em 缩小 */
    margin-bottom: 8px;
    padding-bottom: 6px;
  }

  .result-total {
    font-size: 1.15em;     /* 从 1.2em 缩小 */
    padding: 10px 12px;    /* 从 12px 14px 缩小 */
    margin: 10px 0;
  }

  .result-item {
    padding: 6px 10px;     /* 从 8px 10px 缩小 */
    margin: 3px 0;         /* 从 4px 缩小 */
    font-size: 0.92em;     /* 从 0.94em 缩小 */
  }

  .result-line {
    padding: 3px 0;
    font-size: 0. 96em;
    line-height: 1.35;
  }

  .modal-footer {
    margin-top: 12px;      /* 从 14px 缩小 */
    padding-top: 8px;      /* 从 10px 缩小 */
  }

  .fan-info-link {
    font-size: 0.9em;      /* 从 0.92em 缩小 */
    padding: 6px 10px;     /* 从 7px 12px 缩小 */
  }
}

/* 超小屏幕（iPhone SE 等） */
@media (max-width:380px) {
  .kb-btn-tile {
    min-width: 32px;
    min-height: 42px;
  }

  .kb-btn-tile img {
    width: 24px;
    height: 32px;
  }

  .kb-btn-wind,
  .kb-btn-mode,
  .kb-btn-meld {
    min-width: 66px;
    font-size: 0.9em;
  }

  .kb-btn-hand {
    min-width: 136px;
  }

  .kb-btn-del,
  .kb-btn-clear {
    min-width: 64px;
    min-height: 42px;
    font-size: 0. 9em;
  }
}
