/* ==========================================================
   你描述我来猜 · 双人 P2P 联机猜词
   纯 CSS，无外部字体 / 图片依赖，全部相对路径
   ========================================================== */

:root {
  --bg: #f4f6ff;
  --surface: #ffffff;
  --surface-2: #f7f8fe;
  --text: #1d2440;
  --text-2: #6d7595;
  --text-3: #9ba3c0;
  --line: #e7eaf7;
  --primary: #5b6cff;
  --primary-2: #8258f5;
  --primary-soft: #eceeff;
  --accent: #12b8ac;
  --success: #0ca678;
  --success-soft: #e5f8f1;
  --danger: #ef4b5c;
  --danger-soft: #fdecee;
  --warning: #efa619;
  --shadow: 0 8px 28px rgba(38, 48, 100, .08);
  --shadow-lg: 0 18px 50px rgba(32, 40, 90, .16);
  --radius: 18px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12162a;
    --surface: #1b2039;
    --surface-2: #232947;
    --text: #eef1ff;
    --text-2: #a5aed2;
    --text-3: #7b85ad;
    --line: #2d3454;
    --primary: #7d8bff;
    --primary-2: #a179ff;
    --primary-soft: #2b3160;
    --success-soft: #173c35;
    --danger-soft: #40222d;
    --shadow: 0 8px 28px rgba(0, 0, 0, .22);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; margin: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(91, 108, 255, .16), transparent 60%),
    radial-gradient(900px 560px at 92% 105%, rgba(18, 184, 172, .14), transparent 58%),
    var(--bg);
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior: none;
}

button, input, select, textarea { font-family: inherit; }
button { -webkit-appearance: none; }
h1, h2, h3, h4, p, ol, ul { margin: 0; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 19px; height: 19px; flex: 0 0 auto; fill: none; stroke: currentColor;
        stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 外壳 ---------- */
.app {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
@media (min-width: 600px) {
  .app {
    height: min(calc(100vh - 32px), 880px);
    height: min(calc(100dvh - 32px), 880px);
    min-height: 620px;
    margin: 16px auto;
    border: 1px solid var(--line);
    border-radius: 26px;
    box-shadow: var(--shadow-lg);
  }
}

/* ---------- 顶栏 ---------- */
.topbar {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 36px; height: 36px; flex: 0 0 auto; border-radius: 12px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 6px 14px rgba(91, 108, 255, .3);
}
.brand-mark .icon { width: 20px; height: 20px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand-text strong { font-size: 15px; letter-spacing: .2px; }
.brand-text small { font-size: 10.5px; color: var(--text-3); }
.top-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface-2); color: var(--text-2); cursor: pointer;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn .icon { width: 17px; height: 17px; }
.conn-badge {
  display: inline-flex; align-items: center; gap: 5px; margin-right: 2px;
  padding: 5px 9px; border-radius: 20px; font-size: 11px; font-weight: 600;
  background: var(--success-soft); color: var(--success);
}
.conn-badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- 视图 ---------- */
.view { display: none; flex: 1 1 auto; min-height: 0; }
.view.active { display: block; }
.view-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px 26px; }
.view-game.active { display: flex; flex-direction: column; }
.view-scroll::-webkit-scrollbar, .messages::-webkit-scrollbar, .modal-card::-webkit-scrollbar { width: 6px; }
.view-scroll::-webkit-scrollbar-thumb, .messages::-webkit-scrollbar-thumb, .modal-card::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 6px;
}

/* ---------- 通用控件 ---------- */
.btn {
  min-height: 46px; padding: 0 16px; border-radius: 14px; border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 15px; font-weight: 650; cursor: pointer; transition: transform .15s, opacity .15s, box-shadow .15s;
}
.btn .icon { width: 17px; height: 17px; }
.btn-block { width: 100%; }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2));
               box-shadow: 0 8px 20px rgba(91, 108, 255, .26); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-text { background: transparent; color: var(--text-2); font-weight: 500; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .48; cursor: not-allowed; box-shadow: none; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 0 0 7px 3px; }
input[type=text], input[type=number], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 13px; padding: 12px 13px; font-size: 16px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.55; }
textarea.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; word-break: break-all; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%),
         linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
         background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
         background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.code-input { text-align: center; text-transform: uppercase; letter-spacing: .4em;
              font-size: 22px !important; font-weight: 800; padding-left: 20px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.row2 > * { min-width: 0; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--text-2);
         margin: 4px 0 14px; cursor: pointer; line-height: 1.5; }
.check input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--primary); flex: 0 0 auto; }
.hint { font-size: 12px; color: var(--text-3); line-height: 1.65; margin: 10px 2px 0; }
.hint.small { font-size: 11.5px; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em;
       padding: 1px 5px; border-radius: 5px; background: var(--surface-2); color: var(--primary); }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.pill { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px;
        display: inline-grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 700; }

/* ---------- 大厅 ---------- */
.hero { padding: 26px 4px 20px; }
.hero-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 20px;
              font-size: 11.5px; font-weight: 600; color: var(--primary); background: var(--primary-soft); }
.hero-badge .icon { width: 14px; height: 14px; }
.hero h1 { font-size: 30px; line-height: 1.32; letter-spacing: -.5px; margin: 16px 0 10px; font-weight: 800; }
.hero h1 em { font-style: normal; background: linear-gradient(100deg, var(--primary), var(--primary-2));
              -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 13.5px; color: var(--text-2); line-height: 1.75; }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line);
        border-radius: 14px; margin-bottom: 16px; }
.tab { flex: 1; min-height: 38px; border: 0; border-radius: 11px; background: transparent;
       color: var(--text-2); font-size: 14px; font-weight: 600; cursor: pointer; }
.tab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.tabs.small .tab { min-height: 34px; font-size: 13px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
         padding: 18px 16px 16px; box-shadow: var(--shadow); }
.panel .btn-block { margin-top: 4px; }
.panel .hint { text-align: center; }

.tool-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.tool-btn { min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 7px;
            border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
            color: var(--text); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.tool-btn .icon { width: 17px; height: 17px; color: var(--primary); }
.tool-btn:active { transform: translateY(1px); }
.tool-btn .pill { margin-left: 2px; }

.advanced { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.advanced summary { padding: 13px 15px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; list-style: none; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::after { content: "+"; float: right; font-size: 17px; line-height: 1; color: var(--text-3); }
.advanced[open] summary::after { content: "−"; }
.advanced-body { padding: 0 15px 16px; border-top: 1px solid var(--line); }
.advanced-body .hint { margin: 12px 0; }
.foot-note { text-align: center; font-size: 11px; color: var(--text-3); padding: 22px 0 6px; }

/* ---------- 等待房间 ---------- */
.room-card { margin-top: 20px; padding: 22px 18px 18px; border-radius: 22px; text-align: center;
             color: #fff; background: linear-gradient(135deg, #5b6cff, #8258f5 62%, #a45cf0);
             box-shadow: 0 14px 34px rgba(91, 108, 255, .3); }
.room-label { font-size: 12.5px; opacity: .86; }
.room-code { font-size: 42px; font-weight: 800; letter-spacing: .16em; margin: 8px 0 14px;
             padding-left: .16em; font-family: ui-monospace, Menlo, Consolas, monospace; }
.room-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.room-actions .btn { min-height: 40px; font-size: 12.5px; border: 1px solid rgba(255,255,255,.28);
                     background: rgba(255,255,255,.16); color: #fff; backdrop-filter: blur(4px); }
.room-status { display: flex; align-items: center; justify-content: center; gap: 7px;
               font-size: 12px; margin-top: 15px; opacity: .92; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #b9ffdf; }
.dot.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.75); } }

.slots { display: flex; flex-direction: column; gap: 10px; margin: 16px 0 14px; }
.slot { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px;
        background: var(--surface); border: 1px dashed var(--line); color: var(--text-2); }
.slot.filled { border-style: solid; border-color: var(--primary-soft); color: var(--text); }
.slot > .icon { margin-left: auto; color: var(--success); width: 17px; height: 17px; }
.avatar { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center;
          font-size: 13px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #7b8bff, #9b72ff); }
.avatar.guest { background: linear-gradient(135deg, #2fc4b6, #21a3c9); }
.slot-info { display: flex; flex-direction: column; min-width: 0; }
.slot-info strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-info small { font-size: 11.5px; color: var(--text-3); }
.summary-line { text-align: center; font-size: 12px; color: var(--text-2); margin: 4px 0 14px; min-height: 18px; }
.btn.small-text { min-height: 36px; font-size: 12px; text-decoration: underline; }
.hint.warn { color: var(--danger); font-weight: 600; }

/* ---------- 游戏 ---------- */
.game-head { flex: 0 0 auto; background: var(--surface); border-bottom: 1px solid var(--line); }
.round-line { display: flex; align-items: center; gap: 8px; padding: 10px 14px 4px; }
.round-chip { font-size: 12px; color: var(--text-2); }
.round-chip b { font-size: 16px; color: var(--text); }
.role-chip { margin-left: auto; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 20px;
             color: var(--primary); background: var(--primary-soft); }
.role-chip.guesser { color: var(--accent); background: rgba(18,184,172,.12); }
.timer { display: inline-flex; align-items: center; gap: 4px; min-width: 54px; justify-content: flex-end;
         font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.timer .icon { width: 14px; height: 14px; }
.timer b { font-size: 15px; color: var(--text); }
.timer.urgent b { color: var(--danger); }

.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; gap: 7px; align-items: center; padding: 6px 12px 12px; }
.score-card { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 8px 9px;
              background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.score-card.active { border-color: var(--primary); background: var(--primary-soft); }
.score-card .avatar { width: 30px; height: 30px; border-radius: 10px; font-size: 11px; }
.score-info { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.score-info strong { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-info small { font-size: 10.5px; color: var(--text-2); }
.score-num { display: flex; align-items: baseline; gap: 2px; }
.score-num b { font-size: 21px; color: var(--primary); font-variant-numeric: tabular-nums; }
.score-num small { font-size: 10px; color: var(--text-3); }
.vs { font-size: 10px; font-weight: 800; color: var(--text-3); }

.word-card { flex: 0 0 auto; margin: 10px 14px 0; padding: 12px 14px 13px; border-radius: 18px;
             text-align: center; background: linear-gradient(135deg, #edefff, #f6eaff);
             border: 1px solid #dfe2ff; }
.word-label { display: flex; align-items: center; justify-content: center; gap: 10px;
              font-size: 11.5px; color: #7b76aa; font-weight: 600; }
.word-text { font-size: 30px; font-weight: 800; letter-spacing: 2px; color: #4140c4; margin: 3px 0 2px;
             word-break: break-all; line-height: 1.35; }
.word-warn { font-size: 11px; color: #a181b8; }
.mini-btn { display: inline-flex; align-items: center; gap: 3px; border: 1px solid rgba(91,108,255,.22);
            background: rgba(255,255,255,.7); color: #5b55c9; border-radius: 9px; padding: 3px 7px;
            font-size: 11px; font-weight: 600; cursor: pointer; }
.mini-btn .icon { width: 12px; height: 12px; }
.mini-btn:disabled { opacity: .45; }
@media (prefers-color-scheme: dark) {
  .word-card { background: linear-gradient(135deg, #2a2c5c, #3a2b57); border-color: #3c3a6d; }
  .word-text { color: #c3c2ff; }
  .word-label, .word-warn { color: #a9a5d6; }
  .mini-btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); color: #c9c4ff; }
}

.guess-tip { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 7px;
             margin: 10px 14px 0; padding: 10px; border-radius: 14px; font-size: 12px;
             color: #0b8177; background: rgba(18,184,172,.11); }
.guess-tip .icon { width: 16px; height: 16px; }

.messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
            display: flex; flex-direction: column; gap: 9px; padding: 14px 14px 8px; }
.empty-tip { margin: auto; text-align: center; color: var(--text-3); font-size: 13px; line-height: 1.8; padding: 20px; }
.empty-tip .icon { width: 30px; height: 30px; display: block; margin: 0 auto 8px; opacity: .5; }
.msg { max-width: 84%; padding: 9px 12px; border-radius: 16px; font-size: 14.5px; line-height: 1.6;
       word-break: break-word; white-space: pre-wrap; box-shadow: 0 2px 8px rgba(30,40,90,.05); }
.msg.mine { align-self: flex-end; color: #fff; border-bottom-right-radius: 5px;
            background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.msg.theirs { align-self: flex-start; background: var(--surface); border: 1px solid var(--line);
              border-bottom-left-radius: 5px; }
.msg .meta { display: block; font-size: 10.5px; opacity: .68; margin-top: 3px; }
.sys { align-self: center; max-width: 92%; text-align: center; font-size: 12px; padding: 5px 11px;
       border-radius: 20px; color: var(--text-2); background: var(--surface-2); line-height: 1.5; }
.sys.ok { color: var(--success); background: var(--success-soft); font-weight: 600; }
.sys.bad { color: var(--danger); background: var(--danger-soft); }

.composer { flex: 0 0 auto; background: var(--surface); border-top: 1px solid var(--line);
            padding: 10px 12px calc(9px + env(safe-area-inset-bottom)); }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 100px; resize: none;
                     border-radius: 14px; padding: 11px 12px; font-size: 16px; line-height: 1.4;
                     background: var(--surface-2); border: 1px solid var(--line); }
.send-btn { width: 46px; height: 46px; flex: 0 0 auto; border: 0; border-radius: 14px; color: #fff;
            display: grid; place-items: center; cursor: pointer;
            background: linear-gradient(135deg, var(--primary), var(--primary-2));
            box-shadow: 0 6px 16px rgba(91,108,255,.28); }
.send-btn:active { transform: scale(.95); }
.send-btn:disabled { opacity: .45; }
.send-btn .icon { width: 20px; height: 20px; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px;
                 margin-top: 7px; font-size: 11.5px; color: var(--text-3); }
.link-btn { border: 0; background: none; color: var(--text-2); font-size: 11.5px;
            text-decoration: underline; cursor: pointer; padding: 2px 0; white-space: nowrap; }

/* ---------- 结算 ---------- */
.result-card { margin: 22px 0; padding: 26px 20px 20px; border-radius: 22px; text-align: center;
               background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.result-crown { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 18px; display: grid; place-items: center;
                color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.result-crown .icon { width: 28px; height: 28px; }
.result-card h2 { font-size: 20px; }
.result-score { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 20px 0 8px; }
.result-score > div { display: flex; flex-direction: column; min-width: 72px; }
.result-score span { font-size: 12px; color: var(--text-2); }
.result-score b { font-size: 42px; line-height: 1.15; color: var(--primary); font-variant-numeric: tabular-nums; }
.result-score i { font-style: normal; font-size: 24px; color: var(--text-3); }
.result-winner { font-size: 15px; font-weight: 700; color: var(--warning); }
.result-stats { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.result-list { text-align: left; margin: 18px 0; max-height: 230px; overflow-y: auto; }
.result-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 11px;
               font-size: 12.5px; background: var(--surface-2); margin-bottom: 6px; }
.result-item .idx { color: var(--text-3); font-size: 11px; min-width: 26px; }
.result-item .w { font-weight: 700; flex: 1; }
.result-item .tag { padding: 2px 7px; border-radius: 8px; font-size: 10.5px; }
.result-item .tag.ok { color: var(--success); background: var(--success-soft); }
.result-item .tag.no { color: var(--text-2); background: var(--surface); }

/* ---------- 浮层 / 弹窗 ---------- */
.overlay { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center;
           padding: 20px; background: rgba(18, 23, 51, .48); backdrop-filter: blur(5px); }
.reveal-card { width: 100%; max-width: 340px; padding: 26px 22px 22px; border-radius: 24px; text-align: center;
               background: var(--surface); box-shadow: var(--shadow-lg); animation: pop .28s ease-out; }
@keyframes pop { from { opacity: 0; transform: scale(.9) translateY(12px); } to { opacity: 1; transform: none; } }
.reveal-icon { width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 20px; display: grid; place-items: center;
               color: #fff; background: linear-gradient(135deg, #21c79a, #0ca678); box-shadow: 0 10px 22px rgba(12,166,120,.28); }
.reveal-icon .icon { width: 30px; height: 30px; stroke-width: 2.5; }
.reveal-icon.fail { background: linear-gradient(135deg, #ffa26b, #ef4b5c); box-shadow: 0 10px 22px rgba(239,75,92,.24); }
.reveal-icon.off { background: linear-gradient(135deg, #98a2c8, #6d7595); box-shadow: none; }
.reveal-card h2 { font-size: 21px; margin-bottom: 8px; }
.reveal-card > p { font-size: 13px; color: var(--text-2); line-height: 1.7; }
.reveal-answer { font-size: 12.5px; color: var(--text-2); }
.reveal-answer b { display: block; font-size: 27px; color: var(--primary); margin-top: 2px; word-break: break-all; }
.reveal-next { font-size: 11.5px; color: var(--text-3); margin: 16px 0 12px; }
.reveal-next b { color: var(--primary); }

.modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 600px) { .modal { align-items: center; } }
.modal-backdrop { position: absolute; inset: 0; background: rgba(18, 23, 51, .45); backdrop-filter: blur(3px); }
.modal-card { position: relative; width: 100%; max-width: 520px; max-height: 88vh; max-height: 88dvh; overflow-y: auto;
              background: var(--surface); border-radius: 22px 22px 0 0;
              padding-bottom: calc(18px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg);
              animation: slideup .24s ease-out; }
@keyframes slideup { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (min-width: 600px) { .modal-card { margin: 16px; border-radius: 22px; max-height: 84vh; animation: pop .2s ease-out; } }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between;
              padding: 16px 18px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 14px 18px 4px; }
.modal-body .hint { margin-top: 0; margin-bottom: 12px; }
.modal-meta { font-size: 12px; color: var(--text-2); margin: 10px 2px 14px; }
.modal-meta b { color: var(--primary); }
.modal-body .row2 { margin-top: 4px; }
.help-body h4 { font-size: 13.5px; margin: 16px 0 7px; color: var(--primary); }
.help-body h4:first-child { margin-top: 2px; }
.help-body p, .help-body li { font-size: 12.8px; color: var(--text-2); line-height: 1.8; }
.help-body ol, .help-body ul { padding-left: 20px; }
.help-body strong { color: var(--text); }
.m-status { margin-top: 12px; padding: 10px 12px; border-radius: 12px; font-size: 12.5px;
            color: var(--primary); background: var(--primary-soft); line-height: 1.6; }
.m-status.error { color: var(--danger); background: var(--danger-soft); }

.toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%);
         z-index: 100; max-width: 86vw; padding: 10px 18px; border-radius: 14px; font-size: 13px;
         color: #fff; background: rgba(28, 34, 64, .92); box-shadow: var(--shadow-lg);
         text-align: center; animation: pop .2s ease-out; }
@media (min-width: 600px) { .toast { bottom: 40px; } }

/* ---------- 扩展：计时进度条 / 回合进度 / 词库分类 ---------- */
.timer-track { height: 3px; flex: 0 0 auto; background: var(--line); overflow: hidden; }
.timer-fill { height: 100%; width: 100%; border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .25s linear, background-color .2s; }
.timer-track.urgent .timer-fill { background: var(--danger); }

.round-dots { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px 11px; }
.rdot { display: block; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--line); transition: transform .2s; }
.rdot.ok { background: var(--success); }
.rdot.no { background: var(--text-3); }
.rdot.current { background: var(--primary); transform: scale(1.5); box-shadow: 0 0 0 3px var(--primary-soft); }

.section-label { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12.5px; font-weight: 700; color: var(--text-2); margin: 2px 2px 10px; }
.section-label b { color: var(--primary); }
.section-actions { display: flex; gap: 6px; }
.section-actions .mini-btn { background: var(--surface-2); border-color: var(--line); color: var(--text-2); }
.category-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 4px; }
.cat-chip { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 7px 10px;
  border-radius: 12px; cursor: pointer; text-align: left; font-size: 12.5px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); transition: .15s; }
.cat-chip .cat-name { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-chip .cat-num { font-size: 11px; opacity: .75; flex: 0 0 auto; }
.cat-chip .cat-check { width: 14px; height: 14px; flex: 0 0 auto; opacity: 0; }
.cat-chip.selected { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.cat-chip.selected .cat-check { opacity: 1; }
.cat-chip:active { transform: translateY(1px); }
#btn-test-sound { margin: 4px 0 10px; font-size: 13px; }

[hidden] { display: none !important; }
