:root {
  --bg: #0d1018;
  --bg-soft: #141926;
  --panel: rgba(23, 28, 42, 0.82);
  --panel-solid: #171c2a;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #edf0f7;
  --muted: #8a93a8;
  --primary: #ffc84a;
  --primary-deep: #e9a91d;
  --coral: #ff6b5e;
  --teal: #46c8a4;
  --violet: #8b7bf0;
  --radius: 20px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.85);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
b { font-weight: 700; }
small { font-size: 12px; }
button, input { font-family: inherit; font-size: inherit; color: inherit; }
input { outline: none; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* 图标 */
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 20px; height: 20px; display: block; flex: 0 0 auto; }
.ico.big { width: 40px; height: 40px; stroke-width: 1.2; }

/* ---------------- 背景装饰 ---------------- */
.bg-decor { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; }
.orb-1 { width: 520px; height: 520px; background: #2b3e8f; top: -180px; left: -140px; }
.orb-2 { width: 460px; height: 460px; background: #6a2a5c; bottom: -200px; right: -120px; opacity: 0.42; }
.orb-3 { width: 380px; height: 380px; background: #17604f; top: 40%; left: 55%; opacity: 0.28; }
.grid-lines {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 80%);
}

/* ---------------- 通用组件 ---------------- */
.screen {
  position: relative; z-index: 1;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  overflow: hidden;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 13px;
  background: linear-gradient(150deg, #ffd479, #ff9d4a);
  color: #3a2505;
  box-shadow: 0 8px 20px -8px rgba(255, 170, 60, 0.9);
}
.brand-mark .ico { width: 25px; height: 25px; stroke-width: 1.9; }
.brand h1 { font-size: 26px; letter-spacing: 0.02em; }
.brand h2 { font-size: 17px; }
.brand p { font-size: 12px; color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase; }
.brand.small { gap: 10px; }
.brand.small .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
.brand.small .brand-mark .ico { width: 19px; height: 19px; }
#roomCodeText { color: var(--primary); font-family: ui-monospace, monospace; letter-spacing: 0.1em; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel h3 { font-size: 15px; }

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 18px;
  background: rgba(255,255,255,.07);
  cursor: pointer;
  font-weight: 600;
  transition: transform .14s ease, background .18s ease, box-shadow .18s ease, border-color .18s;
  white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.btn .ico { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.985); }
.btn:disabled { opacity: .38; cursor: not-allowed; transform: none; }
.btn.primary {
  background: linear-gradient(160deg, #ffd35f, #f5ab26);
  color: #2a1c00;
  box-shadow: 0 10px 26px -12px rgba(255, 180, 40, .95);
}
.btn.primary:hover { box-shadow: 0 14px 30px -12px rgba(255, 190, 60, 1); }
.btn.dark { background: rgba(255,255,255,.09); border-color: var(--line-strong); }
.btn.ghost { background: transparent; border-color: var(--line-strong); color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: rgba(255,255,255,.3); }
.btn.block { width: 100%; }
.btn.large { padding: 15px 22px; font-size: 15px; border-radius: 14px; }
.btn.small { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 9px; border: 1px solid var(--line);
  background: rgba(255,255,255,.04); cursor: pointer; color: var(--muted);
  transition: all .18s;
}
.icon-btn .ico { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,.1); }
.empty { color: var(--muted); font-size: 13px; padding: 26px 0; text-align: center; }

.empty-state {
  margin: auto; padding: 40px 20px; text-align: center; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty-state .ico { color: rgba(255,255,255,.18); margin-bottom: 6px; }
.empty-state p { font-size: 14px; color: #c3c9d7; }
.empty-state small { font-size: 12px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 7px; letter-spacing: .04em; }
.field input, .join-row input, .chat-form input {
  width: 100%; padding: 13px 15px;
  background: rgba(9, 12, 20, .72);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color .18s, box-shadow .18s;
}
.field input:focus, .join-row input:focus, .chat-form input:focus {
  border-color: rgba(255, 200, 74, .55);
  box-shadow: 0 0 0 3px rgba(255, 200, 74, .12);
}
.form-error { color: #ff8b80; font-size: 12px; min-height: 18px; margin: -4px 0 8px; }

/* 下拉选择（建房出题范围） */
.select {
  width: 100%; height: 44px; padding: 0 36px 0 14px;
  background: rgba(9, 12, 20, .72) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a93a8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text); appearance: none; cursor: pointer; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.select:focus { border-color: rgba(255, 200, 74, .55); box-shadow: 0 0 0 3px rgba(255, 200, 74, .12); }
.pool-field { margin-bottom: 14px; }

/* ---------------- 登录 ---------------- */
#authScreen { align-items: center; justify-content: center; padding: 24px; overflow: auto; }
.auth-shell {
  display: grid; grid-template-columns: 1.05fr .95fr;
  width: min(960px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  overflow: hidden;
}
.auth-side {
  padding: 46px 44px;
  background: radial-gradient(circle at 20% 0%, rgba(255,200,74,.15), transparent 55%),
              linear-gradient(200deg, rgba(139,123,240,.14), transparent 60%);
  display: flex; flex-direction: column; gap: 32px;
}
.feature-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.feature-list li { display: flex; align-items: flex-start; gap: 12px; }
.feature-list li > div { display: flex; flex-direction: column; gap: 3px; }
.f-ico {
  width: 34px; height: 34px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 10px; color: var(--primary);
  background: rgba(255,255,255,.055);
  border: 1px solid var(--line);
}
.f-ico .ico { width: 17px; height: 17px; }
.feature-list b { font-size: 14px; }
.feature-list span { font-size: 12.5px; color: var(--muted); }
.auth-stats { display: flex; gap: 26px; margin-top: auto; padding-top: 20px; border-top: 1px solid var(--line); }
.auth-stats div { display: flex; flex-direction: column; }
.auth-stats b { font-size: 21px; color: var(--primary); font-variant-numeric: tabular-nums; }
.auth-stats span { font-size: 11.5px; color: var(--muted); }
.auth-card { padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; }
.seg {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 26px;
  background: rgba(9,12,20,.6); border-radius: 12px; border: 1px solid var(--line);
}
.seg-btn {
  flex: 1; padding: 10px; border: 0; border-radius: 9px; background: transparent;
  color: var(--muted); cursor: pointer; font-weight: 600; transition: all .18s;
}
.seg-btn.active { background: rgba(255,255,255,.1); color: var(--text); box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.auth-card .hint { margin-top: 18px; font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.6; }

/* ---------------- 大厅 ---------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 30px; flex: 0 0 auto;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 999px; }
.user-chip .avatar { width: 32px; height: 32px; }
.user-chip b { display: block; font-size: 13px; line-height: 1.2; }
.user-chip small { color: var(--muted); font-size: 11px; }

.avatar {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  font-weight: 700; color: #16181f; font-size: 14px;
  flex: 0 0 auto;
  box-shadow: inset 0 -2px 6px rgba(0,0,0,.18);
}

.lobby-grid {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 330px minmax(0,1fr) 300px;
  gap: 20px; padding: 0 30px 28px;
  max-width: 1440px; width: 100%; margin: 0 auto;
  overflow: auto;
}
.lobby-grid .panel { display: flex; flex-direction: column; min-height: 0; }
.create-panel { align-self: start; }
.create-panel .muted { font-size: 12.5px; margin: 8px 0 20px; line-height: 1.65; }
.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 16px; color: var(--muted); font-size: 11.5px; }
.divider::before, .divider::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.join-row { display: flex; gap: 8px; }
.join-row input { text-align: center; letter-spacing: .3em; font-family: ui-monospace, monospace; font-size: 16px; padding: 12px; }
.join-row .btn { padding: 12px 20px; }

.my-record { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.record-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.record-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.record-nums div { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 11px; padding: 10px; text-align: center; }
.record-nums b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.record-nums span { font-size: 11px; color: var(--muted); }
.record-recent { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; max-height: 108px; overflow: auto; }
.record-recent div { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); padding: 3px 0; }
.record-recent .ok { color: var(--teal); }
.record-recent .no { color: var(--coral); }

.room-list { display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.room-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: 14px;
  background: rgba(255,255,255,.035); border: 1px solid var(--line);
  cursor: pointer; transition: all .18s;
}
.room-item:hover { background: rgba(255,200,74,.09); border-color: rgba(255,200,74,.4); transform: translateX(3px); }
.room-item .r-code { font-family: ui-monospace, monospace; font-size: 19px; letter-spacing: .12em; color: var(--primary); }
.room-item .r-meta { flex: 1; min-width: 0; }
.room-item .r-meta b { display: block; font-size: 13px; }
.room-item .r-meta small { color: var(--muted); }
.room-item .r-count { font-size: 12px; color: var(--muted); background: rgba(255,255,255,.06); padding: 4px 10px; border-radius: 999px; }
.room-item .pool-tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; color: var(--primary);
  background: rgba(255,200,74,.14); border: 1px solid rgba(255,200,74,.28);
}

.leader-list { display: flex; flex-direction: column; gap: 4px; overflow: auto; flex: 1; }
.leader-list .empty { margin: auto; }
.leader-row { display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: 10px; }
.leader-row:nth-child(1) { background: rgba(255,200,74,.1); }
.leader-row .rank { width: 20px; text-align: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.leader-row:nth-child(1) .rank { color: var(--primary); font-weight: 700; }
.leader-row .name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader-row .score { font-size: 13px; color: var(--primary); font-variant-numeric: tabular-nums; }
.mini-stats { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 11.5px; color: var(--muted); }
.mini-stats b { color: var(--text); }

/* ---------------- 房间 ---------------- */
.room-main {
  flex: 1; min-height: 0; overflow: auto;
  display: grid; grid-template-columns: minmax(0,1fr) 330px; gap: 20px;
  padding: 0 30px 28px; max-width: 1180px; width: 100%; margin: 0 auto;
}
.room-card { display: flex; flex-direction: column; }
.room-code-block { text-align: center; padding: 6px 0 24px; border-bottom: 1px solid var(--line); }
.room-code-block small { color: var(--muted); font-size: 11.5px; letter-spacing: .2em; }
.room-code { font-family: ui-monospace, monospace; font-size: 52px; letter-spacing: .22em; color: var(--primary); line-height: 1.25; text-shadow: 0 0 40px rgba(255,200,74,.35); }
.room-pool {
  display: flex; align-items: center; gap: 10px;
  margin-top: 18px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255, 255, 255, .03);
}
.room-pool .pool-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.room-pool .select { width: 190px; height: 38px; font-size: 13px; }
.room-pool .select:disabled { opacity: .6; cursor: not-allowed; }
.room-pool .small { color: var(--muted); }
.room-players-head { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 14px; }
.room-players-head h3 span { color: var(--primary); }
.room-players-head .muted { font-size: 11.5px; }
.room-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.room-player {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border-radius: 13px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line);
}
.room-player.host { border-color: rgba(255,200,74,.35); background: rgba(255,200,74,.07); }
.room-player .rp-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-player .rp-tag { font-size: 10px; color: var(--primary); }
.room-actions { margin-top: auto; padding-top: 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.room-actions .btn { width: min(340px, 100%); }
.room-rules ol { margin: 14px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; font-size: 13px; color: #c2c8d6; line-height: 1.7; }
.room-rules li::marker { color: var(--primary); font-weight: 700; }

/* ---------------- 游戏 ---------------- */
.game-top {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 16px;
  padding: 12px 24px; flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  background: rgba(13,16,24,.6);
  backdrop-filter: blur(14px);
}
.turn-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.round-pill { font-size: 11.5px; padding: 4px 10px; border-radius: 999px; background: rgba(139,123,240,.18); color: #b6abff; border: 1px solid rgba(139,123,240,.3); white-space: nowrap; }
.drawer-text { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-text b { color: var(--text); }

.word-area { text-align: center; min-width: 220px; min-height: 58px; display: flex; flex-direction: column; justify-content: center; }
.word-mask { display: flex; gap: 7px; justify-content: center; }
.word-mask span {
  display: grid; place-items: center;
  min-width: 30px; height: 38px; padding: 0 8px;
  font-size: 21px; font-weight: 700; letter-spacing: .04em;
  background: rgba(255,255,255,.05);
  border-bottom: 2px solid rgba(255,255,255,.18);
  border-radius: 8px 8px 0 0;
}
.word-mask span.revealed { color: var(--primary); border-bottom-color: var(--primary); background: rgba(255,200,74,.1); }
.word-mask span.blank { background: transparent; border-bottom-color: rgba(255,255,255,.22); }
.word-mask span.blank::after { content: '?'; color: rgba(255,255,255,.22); font-size: 16px; }
.word-cat { font-size: 11px; color: var(--muted); margin-top: 6px; height: 14px; letter-spacing: .12em; }

.timer-wrap { justify-self: end; position: relative; width: 54px; height: 54px; display: grid; place-items: center; }
.timer-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,.09); stroke-width: 3.5; }
.ring-fg {
  fill: none; stroke: var(--teal); stroke-width: 3.5; stroke-linecap: round;
  stroke-dasharray: 119.4; stroke-dashoffset: 0;
  transition: stroke-dashoffset .95s linear, stroke .3s;
}
.timer-wrap.warn .ring-fg { stroke: var(--coral); }
.timer-wrap.warn #timerNum { color: var(--coral); }
#timerNum { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

.game-body {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(0,1fr) 336px;
  gap: 14px; padding: 14px 18px 16px;
}
.canvas-col { display: flex; flex-direction: column; gap: 12px; min-height: 0; min-width: 0; }
.canvas-frame {
  position: relative; flex: 1; min-height: 0;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  touch-action: none;
}
.board-shell { position: relative; flex: 0 0 auto; }
#board {
  display: block;
  width: 100%; height: 100%;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px -18px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.08);
  touch-action: none;
  cursor: crosshair;
}
#board.readonly { cursor: default; }
.canvas-hint {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  padding: 8px 16px; border-radius: 999px;
  background: rgba(20,24,34,.9); color: var(--muted); font-size: 12px;
  border: 1px solid var(--line); pointer-events: none;
}

/* 选词 */
.choice-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(15,20,30,.14);
  border-radius: 16px; z-index: 5;
  padding: 12px; overflow-y: auto;
}
.choice-card {
  width: min(460px, 94%); max-height: 100%; overflow-y: auto; padding: 26px;
  background: #151a28; border: 1px solid rgba(255,255,255,.16);
  border-radius: 18px; text-align: center;
  box-shadow: 0 30px 70px -20px rgba(0,0,0,.85), 0 0 0 1px rgba(0,0,0,.3);
}
.choice-card h4 { font-size: 17px; margin-bottom: 6px; }
.choices { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 20px; }
.choice-btn {
  padding: 16px; border-radius: 13px; cursor: pointer;
  background: rgba(255,255,255,.05); border: 1px solid var(--line-strong);
  font-size: 18px; font-weight: 700; letter-spacing: .06em;
  transition: all .16s;
}
.choice-btn small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-top: 3px; }
.choice-btn:hover { background: rgba(255,200,74,.14); border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }

.turn-banner {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(10,13,20,.6);
  border-radius: 16px; z-index: 4;
  font-size: 28px; font-weight: 800; letter-spacing: .1em;
  color: var(--primary); text-shadow: 0 4px 30px rgba(255,200,74,.5);
  animation: pop .35s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }

/* 工具栏 */
.toolbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 15px;
}
.toolbar.disabled { opacity: .42; pointer-events: none; }
.tool-group { display: flex; align-items: center; gap: 6px; }
.tool-sep { width: 1px; height: 24px; background: var(--line); }
.tool-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid transparent;
  background: rgba(255,255,255,.05); cursor: pointer; color: #d5dae6;
  transition: all .16s;
}
.tool-btn .ico { width: 19px; height: 19px; }
.tool-btn.active { color: var(--primary); }
.tool-btn:hover { background: rgba(255,255,255,.12); }
.tool-btn.active { background: rgba(255,200,74,.18); border-color: rgba(255,200,74,.55); }
.colors { gap: 7px; }
.color-dot {
  width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15);
  transition: transform .14s, box-shadow .14s;
  padding: 0;
}
.color-dot:hover { transform: scale(1.12); }
.color-dot.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px currentColor; }
.sizes .size-dot {
  width: 30px; height: 30px; display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; border-radius: 50%; cursor: pointer;
}
.sizes .size-dot i { display: block; border-radius: 50%; background: #d9dee9; }
.sizes .size-dot.active { background: rgba(255,200,74,.14); border-color: rgba(255,200,74,.35); }
.sizes .size-dot.active i { background: var(--primary); }
.pressure-toggle { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); cursor: pointer; padding-left: 4px; user-select: none; }
.pressure-toggle input { accent-color: var(--primary); width: 14px; height: 14px; cursor: pointer; }

/* 侧栏 */
.side-col {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; }
.side-head h3 { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .06em; }
.score-list { padding: 0 10px 8px; overflow: auto; max-height: 42%; flex: 0 0 auto; }
.score-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; border-radius: 10px; transition: background .2s;
}
.score-row.is-drawer { background: rgba(255,200,74,.1); }
.score-row.is-me .sp-name { color: var(--primary); }
.score-row .avatar { width: 28px; height: 28px; font-size: 12px; }
.sp-name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 5px; }
.sp-score { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--muted); }
.sp-badge { font-size: 10px; padding: 1px 6px; border-radius: 999px; background: rgba(70,200,164,.18); color: var(--teal); font-weight: 500; }
.sp-badge.drawer { background: rgba(255,200,74,.16); color: var(--primary); }
.sp-pen { width: 12px; height: 12px; color: var(--primary); stroke-width: 2; }
.offline-dot { width: 6px; height: 6px; border-radius: 50%; background: #6b7280; }

.chat-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; scroll-behavior: smooth; }
.chat-log::-webkit-scrollbar, .score-list::-webkit-scrollbar, .room-list::-webkit-scrollbar,
.leader-list::-webkit-scrollbar, .record-recent::-webkit-scrollbar { width: 6px; }
.chat-log::-webkit-scrollbar-thumb, .score-list::-webkit-scrollbar-thumb, .room-list::-webkit-scrollbar-thumb,
.leader-list::-webkit-scrollbar-thumb, .record-recent::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }

.msg { font-size: 13px; line-height: 1.5; word-break: break-word; }
.msg .who { color: var(--muted); margin-right: 5px; font-size: 12px; }
.msg.correct { display: flex; align-items: center; gap: 6px; background: rgba(70,200,164,.14); border: 1px solid rgba(70,200,164,.3); color: var(--teal); padding: 7px 10px; border-radius: 9px; font-weight: 600; }
.msg.correct .ck { width: 14px; height: 14px; }
.msg.system { color: var(--muted); font-size: 11.5px; text-align: center; padding: 2px 0; }
.msg.mine .who { color: var(--primary); }
.msg .near { display: block; font-size: 11px; color: var(--primary); margin-top: 2px; }

.chat-form { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; padding: 11px 13px; font-size: 13px; }
.chat-form input:disabled { opacity: .5; }
.chat-lock { padding: 0 14px 12px; font-size: 11.5px; color: var(--teal); }

/* ---------------- 弹窗 ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(7,9,14,.62);
  padding: 24px;
}
.modal-card {
  width: min(460px, 100%);
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: 24px; padding: 32px;
  box-shadow: 0 40px 80px -30px #000;
  text-align: center;
  animation: rise .3s cubic-bezier(.2,.8,.3,1);
  max-height: 90vh; overflow: auto;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-kicker { color: var(--muted); letter-spacing: .24em; font-size: 11px; }
.answer-word {
  font-size: 40px; font-weight: 800; letter-spacing: .1em; color: var(--primary);
  margin: 8px 0 4px; text-shadow: 0 6px 40px rgba(255,200,74,.4);
}
.answer-sub { font-size: 12.5px; color: var(--muted); }
.turn-scores { margin: 22px 0 18px; display: flex; flex-direction: column; gap: 6px; }
.turn-scores .ts-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: rgba(255,255,255,.04); }
.turn-scores .ts-row .name { flex: 1; text-align: left; font-size: 13px; }
.turn-scores .ts-row .delta { font-size: 13px; font-weight: 700; color: var(--teal); font-variant-numeric: tabular-nums; }
.turn-scores .ts-row.zero .delta { color: var(--muted); font-weight: 400; }
.next-hint { font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 8px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .25; } 40% { opacity: 1; } }

.trophy { color: var(--primary); display: flex; justify-content: center; margin-bottom: 10px; }
.trophy .ico { width: 54px; height: 54px; stroke-width: 1.3; }
.over-card h2 { font-size: 22px; margin-bottom: 20px; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin-bottom: 22px; }
.podium-item { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.podium-item .p-avatar { width: 44px; height: 44px; font-size: 16px; }
.podium-item .p-name { font-size: 11.5px; color: var(--muted); max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-item .p-bar {
  width: 62px; border-radius: 10px 10px 0 0;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: linear-gradient(180deg, rgba(255,200,74,.35), rgba(255,200,74,.08));
  border: 1px solid rgba(255,200,74,.35); border-bottom: 0;
}
.podium-item:nth-child(1) .p-bar { height: 90px; }
.podium-item:nth-child(2) .p-bar { height: 120px; background: linear-gradient(180deg, rgba(255,200,74,.55), rgba(255,200,74,.12)); }
.podium-item:nth-child(3) .p-bar { height: 70px; }

.over-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 22px; max-height: 200px; overflow: auto; }
.over-list .orow { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; background: rgba(255,255,255,.03); font-size: 13px; }
.over-list .orow .idx { width: 18px; color: var(--muted); font-size: 12px; }
.over-list .orow .name { flex: 1; text-align: left; }
.over-list .orow .pts { color: var(--primary); font-variant-numeric: tabular-nums; }
.over-actions { display: flex; gap: 10px; }
.over-actions .btn { flex: 1; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px);
  padding: 11px 20px; border-radius: 12px;
  background: rgba(30,36,50,.96); border: 1px solid var(--line-strong);
  font-size: 13px; opacity: 0; pointer-events: none;
  transition: all .26s; z-index: 100;
  box-shadow: 0 20px 40px -20px #000;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255,107,94,.5); color: #ffb0a8; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1080px) {
  .lobby-grid { grid-template-columns: 300px minmax(0,1fr); }
  .stats-panel { display: none; }
}
@media (max-width: 860px) {
  body { font-size: 13.5px; }
  .auth-shell { grid-template-columns: 1fr; max-width: 460px; }
  .auth-side { padding: 30px 28px 24px; gap: 20px; }
  .auth-card { padding: 26px 28px 32px; }
  .auth-stats { padding-top: 14px; }
  .feature-list { display: none; }
  .topbar { padding: 14px 16px; }
  .lobby-grid { grid-template-columns: 1fr; padding: 0 16px 20px; }
  .room-main { grid-template-columns: 1fr; padding: 0 16px 20px; align-content: start; }
  .room-card { height: auto; }
  .room-actions { margin-top: 26px; padding-top: 18px; }
  .room-players { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .room-rules { display: none; }
  .game-top { padding: 10px 14px; gap: 8px; }
  .word-area { min-width: 0; }
  .word-mask span { min-width: 24px; height: 32px; font-size: 17px; }
  .drawer-text { display: none; }
  .game-body { grid-template-columns: 1fr; grid-template-rows: minmax(0,1fr) 37vh; padding: 10px 12px 12px; gap: 10px; }
  .side-col { min-height: 0; }
  .score-list { max-height: 96px; }
  .toolbar { padding: 6px 8px; gap: 7px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .toolbar::-webkit-scrollbar { display: none; }
  .tool-sep { flex: 0 0 auto; }
  .tool-group { flex: 0 0 auto; }
  .color-dot { width: 20px; height: 20px; }
  .timer-wrap { width: 46px; height: 46px; }
  #timerNum { font-size: 14px; }
  .canvas-hint { display: none; }
  .choice-overlay {
    position: fixed; inset: 0; border-radius: 0;
    background: rgba(7,9,14,.9); z-index: 40;
    display: grid; place-items: center;
    padding: 0 16px;
  }
  .choice-card { padding: 20px 16px; width: 100%; max-height: 88vh; }
  .choice-card h4 { font-size: 16px; }
  .choices { gap: 9px; margin-top: 14px; }
  .choice-btn { padding: 12px; font-size: 16px; }
}
