/* ============================================================
   三合一游戏合集 · 共享设计系统
   设计语言：深炭黑 + 暖金，衬线大标题，克制的边线与留白
   ============================================================ */
:root {
  --bg: #14161b;
  --bg-soft: #191c22;
  --surface: #1e2128;
  --surface-2: #262a33;
  --surface-3: #2f3440;
  --text: #e8e6e3;
  --muted: #8f9099;
  --gold: #e5b567;
  --gold-dim: rgba(229, 181, 103, 0.14);
  --gold-line: rgba(229, 181, 103, 0.35);
  --red: #e5484d;
  --green: #30a46c;
  --blue: #5b7cfa;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
  --serif: "Songti SC", "Source Han Serif SC", "Noto Serif SC", "STSong", "SimSun", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--sans); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
  background-image: radial-gradient(1200px 600px at 50% -10%, rgba(229, 181, 103, 0.06), transparent 70%);
}
::selection { background: var(--gold-dim); color: var(--gold); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
button, input, textarea { font-family: inherit; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ============ 顶栏 ============ */
.topbar {
  display: flex; align-items: center; gap: 12px; height: 62px; padding: 0 24px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(20, 22, 27, 0.94);
  backdrop-filter: blur(10px); z-index: 30;
}
.brand {
  font-family: var(--serif); font-size: 19px; letter-spacing: 2px; color: var(--gold);
  font-weight: 600; flex: 0 0 auto; text-decoration: none;
}
.brand small { font-family: var(--sans); font-size: 11px; color: var(--muted); letter-spacing: 0; margin-left: 8px; }
.code-chip {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 6px 12px; font-size: 13px; font-family: var(--mono);
  letter-spacing: 1.5px; cursor: pointer; transition: border-color .15s, color .15s;
}
.code-chip:hover { border-color: var(--gold); color: var(--gold); }
.pill {
  font-size: 12px; color: var(--muted); background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}
.pill.gold { color: var(--gold); border-color: var(--gold-line); background: var(--gold-dim); }
.pill.red { color: #ff8f92; border-color: rgba(229, 72, 77, .45); }
.pill.green { color: #7ee2ae; border-color: rgba(48, 164, 108, .4); }
.pill.warn { color: #ff8f92; border-color: rgba(229, 72, 77, .45); background: rgba(229, 72, 77, .1); }
.timer { font-family: var(--mono); font-size: 22px; color: var(--gold); min-width: 52px; text-align: right; line-height: 1; }
.timer.danger { color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* ============ 布局 ============ */
.app { max-width: 1240px; margin: 0 auto; padding: 22px 24px 40px; }
.layout { display: grid; grid-template-columns: 292px minmax(0, 1fr); gap: 22px; align-items: start; }
.sidebar {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px; position: sticky; top: 84px; display: flex; flex-direction: column; gap: 10px;
}
.side-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase;
}

/* ============ 玩家列表 ============ */
.player-list { display: flex; flex-direction: column; gap: 6px; }
.prow {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  border: 1px solid transparent; background: var(--surface); transition: border-color .15s, background .15s;
  position: relative;
}
.prow.turn { border-color: var(--gold); background: var(--gold-dim); }
.prow.me { background: var(--surface-2); }
.prow.offline { opacity: .5; }
.prow.dead { opacity: .4; filter: grayscale(1); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; color: #16181d; font-weight: 700; flex: 0 0 auto; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
}
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.av0 { background: linear-gradient(150deg, #f0cf9a, #c8974f); }
.av1 { background: linear-gradient(150deg, #a8c9f0, #5b86c7); }
.av2 { background: linear-gradient(150deg, #f3b0ad, #c96b68); }
.av3 { background: linear-gradient(150deg, #b9e0c6, #6aa77f); }
.av4 { background: linear-gradient(150deg, #d9c2ee, #9a79c2); }
.av5 { background: linear-gradient(150deg, #f0d9a8, #bfa05a); }
.prow-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.prow-name { font-size: 14px; display: flex; align-items: center; gap: 5px; min-width: 0; }
.prow-name b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow-meta { font-size: 11px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.avatar-wrap { position: relative; flex: 0 0 auto; }
.catch {
  position: absolute; top: -6px; right: -8px; background: var(--red); color: #fff; border: none;
  font-size: 10px; padding: 2px 6px; border-radius: 999px; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.4);
  transition: opacity .15s, transform .15s;
}
.catch.risky { background: #4a4f5c; opacity: .55; }
.catch.risky:hover { opacity: .9; }
.catch[disabled] { opacity: .35; cursor: not-allowed; }
.catch.ready { animation: catchPulse 1.4s ease-in-out infinite; }
@keyframes catchPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, .5); }
  50% { box-shadow: 0 0 0 6px rgba(229, 72, 77, 0); }
}
.tag {
  font-style: normal; font-size: 10px; border-radius: 4px; padding: 1px 5px; line-height: 1.6;
  border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.tag.host { color: var(--gold); border-color: var(--gold-line); }
.tag.me { color: var(--text); border-color: var(--border-strong); }
.tag.gold { color: var(--gold); border-color: rgba(229, 181, 103, .5); background: var(--gold-dim); }
.tag.red { color: #ff8f92; border-color: rgba(229, 72, 77, .45); }
.tag.green { color: #7ee2ae; border-color: rgba(48, 164, 108, .4); }
.tag.blue { color: #9db4ff; border-color: rgba(91, 124, 250, .45); }

/* ============ 面板 ============ */
.panel {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px;
}
.panel-title {
  font-family: var(--serif); font-size: 16px; letter-spacing: 1px; color: var(--text);
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.panel-title .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }

/* ============ 按钮 ============ */
.btn {
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  border-radius: 10px; padding: 10px 18px; font-size: 14px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #eec37c, #d9a44f); color: #1a1a1a; border-color: rgba(229, 181, 103, .6);
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #f3cd8d, #e0ad5c); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-uno { background: linear-gradient(180deg, #f0616a, #cf3b43); border-color: rgba(229, 72, 77, .5); color: #fff; font-weight: 700; letter-spacing: 1px; }
.btn-block { width: 100%; }

/* ============ 输入 ============ */
.input, input[type=text], textarea {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-size: 14px; outline: none; width: 100%;
}
.input:focus, input[type=text]:focus, textarea:focus { border-color: var(--gold-line); }

/* ============ 大厅 ============ */
.hero { padding: 46px 0 10px; }
.hero h1 { font-family: var(--serif); font-size: 44px; letter-spacing: 6px; margin: 0 0 12px; font-weight: 600; }
.hero p { color: var(--muted); margin: 0; font-size: 15px; }
.hero .accent { color: var(--gold); }
.rules-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.rules-table th, .rules-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); }
.rules-table th { color: var(--muted); font-weight: 400; font-size: 12px; letter-spacing: .5px; }
.rules-table tr:last-child td { border-bottom: none; }
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; margin-top: 26px; }
.lobby-players { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.lobby-foot { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* 座位卡（Codenames 选座） */
.seat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.seat-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.seat-col h3 { font-size: 13px; margin: 0 0 10px; letter-spacing: 1px; color: var(--muted); }
.seat-col.R h3 { color: #ff9a9d; }
.seat-col.B h3 { color: #9db4ff; }
.seat-row { font-size: 13px; padding: 6px 8px; border-radius: 8px; display: flex; align-items: center; gap: 6px; }
.seat-row.filled { background: var(--bg-soft); }
.seat-actions { display: flex; gap: 6px; margin-top: 10px; }

/* ============ 桌面（牌堆区）============ */
.table-wrap { display: flex; flex-direction: column; gap: 16px; }
.table-area {
  position: relative; border-radius: var(--radius-lg); border: 1px solid var(--border);
  background:
    radial-gradient(420px 240px at 50% 42%, rgba(229, 181, 103, 0.09), transparent 70%),
    linear-gradient(180deg, #191c22, #16181d);
  padding: 26px 20px 20px; min-height: 300px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
}
.table-area .state-line { font-size: 13px; color: var(--muted); letter-spacing: .5px; }
.table-area .state-line b { color: var(--gold); font-weight: 500; }
.piles { display: flex; align-items: center; gap: 26px; }
.pile-label { font-size: 11px; color: var(--muted); text-align: center; margin-top: 6px; letter-spacing: 1px; }
.deck {
  width: 84px; height: 118px; border-radius: 12px; background: linear-gradient(160deg, #2b3040, #1d212c);
  border: 1px solid var(--border-strong); display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .15s, border-color .15s;
  /* 用多层投影模拟"一叠牌"的厚度 */
  box-shadow:
    3px 3px 0 0 #1c212b, 3px 3px 0 1px rgba(255, 255, 255, .07),
    6px 6px 0 0 #191d26, 6px 6px 0 1px rgba(255, 255, 255, .05),
    0 18px 34px rgba(0, 0, 0, .45);
}
.deck:hover { transform: translateY(-2px); border-color: var(--gold-line); }
.deck .n { font-family: var(--mono); font-size: 26px; color: var(--gold); }
.deck .t { font-size: 10px; color: var(--muted); letter-spacing: 1px; }
.discard-slot { width: 84px; height: 118px; border-radius: 12px; border: 1px dashed var(--border); display: flex; align-items: center; justify-content: center; }

/* 最近打出（空位占位） */
.slot-empty {
  width: 74px; height: 102px; border-radius: 11px; border: 1px dashed var(--border-strong);
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; letter-spacing: 1px;
}
.pile-who { font-size: 11px; color: var(--muted); text-align: center; margin-top: 6px; min-height: 14px; }

/* 炸弹进度点 */
.bomb-meter { display: flex; flex-direction: column; align-items: center; }
.bm-row { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; justify-content: center; max-width: 176px; }
.bm-dot {
  width: 31px; height: 31px; border-radius: 9px; display: grid; place-items: center; font-size: 15px;
  border: 1px solid var(--border-strong); background: #171b23; color: #6b7080;
  filter: grayscale(1) brightness(.8); opacity: .7;
}
.bm-dot.on {
  border-color: rgba(229, 72, 77, .6); filter: none; opacity: 1;
  background: linear-gradient(165deg, #5c2129, #3a1116); box-shadow: 0 0 14px rgba(229, 72, 77, .22);
}

/* ============ UNO 卡 ============ */
.ucard {
  width: 66px; height: 96px; border-radius: 11px; position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-weight: 700; font-size: 21px; color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35); cursor: pointer; user-select: none;
  border: 1px solid rgba(255, 255, 255, .18); box-shadow: 0 8px 18px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform .13s, box-shadow .13s, opacity .13s;
}
.ucard::after {
  content: ""; position: absolute; inset: 6px; border-radius: 7px; border: 1px solid rgba(255, 255, 255, .16);
  pointer-events: none;
}
.ucard small { font-size: 10px; font-weight: 500; opacity: .9; margin-top: 2px; letter-spacing: .5px; }
.ucard:hover { transform: translateY(-4px); }
.ucard.dim { opacity: .52; cursor: default; transform: none; box-shadow: none; }
.ucard.playable { box-shadow: 0 0 0 2px var(--gold), 0 8px 20px rgba(0, 0, 0, .4); }
.ucard.sel { transform: translateY(-8px); box-shadow: 0 0 0 2px var(--gold), 0 12px 24px rgba(0,0,0,.45); }
.ucR { background: linear-gradient(160deg, #f0646a, #c2313a); }
.ucY { background: linear-gradient(160deg, #f7c948, #d99b12); color: #3a2a00; text-shadow: none; }
.ucG { background: linear-gradient(160deg, #3fbf87, #1f8a5b); }
.ucB { background: linear-gradient(160deg, #5b7cfa, #2f4cc4); }
.ucW { background: conic-gradient(from 210deg, #f0646a, #f7c948, #3fbf87, #5b7cfa, #f0646a); color: #14161b; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.ucW::after { border-color: rgba(20, 22, 27, .25); }
.ucard .corner { position: absolute; top: 5px; left: 7px; font-size: 11px; font-weight: 600; opacity: .85; }
.ucard .corner.b { top: auto; bottom: 5px; left: auto; right: 7px; transform: rotate(180deg); }
.color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1px solid rgba(255,255,255,.3); }

/* ============ 手牌区 ============ */
.handbar {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 16px 14px;
}
.hand-head { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); margin-bottom: 10px; letter-spacing: .5px; }
.hand-head .mine { color: var(--text); font-size: 13px; }
.hand { display: flex; flex-wrap: wrap; gap: 8px; min-height: 96px; align-items: center; }
.hand-actions { display: flex; gap: 10px; margin-top: 12px; }

/* ============ 炸弹猫卡 ============ */
.bcard {
  width: 74px; height: 102px; border-radius: 11px; background: linear-gradient(165deg, #2b3040, #1d212c);
  border: 1px solid var(--border-strong); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; cursor: pointer; user-select: none; font-size: 13px; color: var(--text); text-align: center;
  transition: transform .13s, border-color .13s, box-shadow .13s; position: relative; padding: 4px; overflow: hidden;
}
.bcard::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--surface-3); }
.bcard .ico { font-size: 21px; line-height: 1.15; }
.bcard .nm { font-size: 12.5px; color: var(--text); font-weight: 500; letter-spacing: .5px; }
.bcard:hover { transform: translateY(-3px); border-color: var(--gold-line); }
.bcard.sel { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-dim), 0 10px 22px rgba(0,0,0,.4); transform: translateY(-6px); }
.bcard.k_bomb { background: linear-gradient(165deg, #5c2129, #3a1116); border-color: rgba(229,72,77,.6); }
.bcard.k_bomb::before { background: var(--red); }
.bcard.k_bomb .nm { color: #ffb3b5; }
.bcard.k_defuse { background: linear-gradient(165deg, #1f3c46, #12262d); border-color: rgba(90, 200, 220, .45); }
.bcard.k_defuse::before { background: #5ac8dc; }
.bcard.k_defuse .nm { color: #a8e4ef; }
.bcard.k_attack::before { background: #e5484d; }
.bcard.k_skip::before { background: #8f9099; }
.bcard.k_foresee::before { background: #a888e0; }
.bcard.k_peek::before { background: #5ac8dc; }
.bcard.k_shuffle::before { background: #e5b567; }
.bcard.k_gift::before { background: #e08ab0; }
.bcard.k_dodge::before { background: #30a46c; }
.bcard.k_cat::before, .bcard.k_wildcat::before { background: linear-gradient(90deg, #e5b567, #e08ab0, #a888e0); }
.bcard.dim { opacity: .5; cursor: default; transform: none; }

/* ============ Codenames 棋盘 ============ */
.clue-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 18px;
}
.clue-word { font-family: var(--serif); font-size: 30px; letter-spacing: 4px; color: var(--gold); line-height: 1.1; }
.clue-word.empty { color: var(--muted); }
.clue-meta { font-size: 12px; color: var(--muted); letter-spacing: 1px; }
.footprints { font-size: 15px; letter-spacing: 2px; }
.board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; margin: 16px 0; }
.wcard {
  position: relative; aspect-ratio: 5 / 3.1; border-radius: 10px; background: linear-gradient(170deg, #232833, #1b1f28);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: clamp(12px, 2.2vw, 17px); font-weight: 500; letter-spacing: 1px; cursor: pointer; padding: 6px;
  transition: transform .12s, border-color .12s, box-shadow .12s; color: var(--text);
}
.wcard:hover { transform: translateY(-2px); border-color: var(--gold-line); }
.wcard.spym { font-weight: 600; }
.wcard.tR { background: linear-gradient(170deg, #6a262c, #431419); border-color: rgba(229, 72, 77, .55); color: #ffe1e2; }
.wcard.tB { background: linear-gradient(170deg, #26356b, #161f42); border-color: rgba(91, 124, 250, .55); color: #dce4ff; }
.wcard.tN { background: linear-gradient(170deg, #3a3730, #272521); border-color: rgba(210, 190, 150, .4); color: #efe6d2; }
.wcard.tA { background: linear-gradient(170deg, #1b1216, #0b0c10); border-color: rgba(229, 72, 77, .8); color: #ff9a9d; box-shadow: 0 0 24px rgba(229, 72, 77, .25) inset; }
.wcard.tA.spym { border-style: dashed; }
.wcard .a-badge {
  position: absolute; top: 5px; right: 8px; font-style: normal; font-size: 12px; line-height: 1;
  color: #ff9a9d; opacity: .9;
}
.wcard.opened { cursor: default; transform: none; }
.wcard.opened::after {
  content: ""; position: absolute; inset: 0; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.wcard .role-dot { position: absolute; top: 6px; left: 7px; width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.5); }

/* ============ 日志 ============ */
.log { max-height: 168px; overflow-y: auto; font-size: 12px; color: var(--muted); line-height: 1.85; }
.log div { padding-left: 10px; position: relative; }
.log div::before { content: ""; position: absolute; left: 0; top: 9px; width: 3px; height: 3px; border-radius: 50%; background: var(--surface-3); }

/* ============ 模态 ============ */
.modal { position: fixed; inset: 0; background: rgba(8, 9, 12, .72); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 60; }
.modal.show { display: flex; }
.modal .box {
  background: var(--bg-soft); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  padding: 22px; max-width: 92vw; max-height: 86vh; overflow-y: auto; box-shadow: var(--shadow);
}
.modal h3 { font-family: var(--serif); font-size: 18px; letter-spacing: 1px; margin: 0 0 6px; font-weight: 600; }
.modal .sub { color: var(--muted); font-size: 13px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
/* 队长线索：底部抽屉 */
#clueModal { background: rgba(8, 9, 12, .32); align-items: flex-end; }
#clueModal .box { width: min(640px, 94vw); border-radius: 16px 16px 0 0; }

/* ============ Toast ============ */
#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(90px);
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text);
  padding: 10px 20px; border-radius: 999px; font-size: 13px; transition: transform .25s, opacity .25s;
  z-index: 99; max-width: 90vw; opacity: 0; box-shadow: var(--shadow);
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ============ 结果页 ============ */
.result { text-align: center; padding: 54px 20px; margin: 0 auto; }
.result .mark { font-family: var(--serif); font-size: 34px; letter-spacing: 4px; color: var(--gold); }
.result .sub { color: var(--muted); margin-top: 10px; }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .app { padding: 14px 14px 28px; }
  .topbar { height: 56px; padding: 0 14px; gap: 8px; }
  .brand { font-size: 16px; letter-spacing: 1px; }
  .brand small { display: none; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .player-list { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 2px; }
  .prow { min-width: 132px; }
  .lobby-grid { grid-template-columns: 1fr; gap: 18px; }
  .hero h1 { font-size: 32px; letter-spacing: 3px; }
  .seat-grid { grid-template-columns: 1fr; }
  .ucard { width: 56px; height: 82px; font-size: 18px; }
  .bcard { width: 62px; height: 88px; }
  .pile, .deck { width: 70px; height: 98px; }
  .discard-slot { width: 70px; height: 98px; }
  .table-area { min-height: 240px; padding: 18px 12px; }
  .board { gap: 6px; }
  .wcard { font-size: 12px; }
}

/* ============ 互动坞（表情 / 道具 / 催人） ============ */
.ix-root { position: fixed; inset: auto 0 0 auto; z-index: 45; pointer-events: none; }
.ix-root > * { pointer-events: auto; }
[data-seat] { position: relative; }

.ix-handle {
  position: fixed; right: 22px; bottom: 22px; width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(180deg, #2a2f39, #1d2027);
  border: 1px solid rgba(229, 181, 103, .38); color: var(--text); font-size: 22px;
  display: none; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .48), inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: transform .16s, border-color .16s;
}
.ix-root.ix-on .ix-handle { display: flex; }
.ix-handle:hover { transform: translateY(-2px); border-color: var(--gold); }
.ix-handle.open { border-color: var(--gold); color: var(--gold); }
.ix-dot { position: absolute; top: 9px; right: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); opacity: 0; }
.ix-root.ix-off .ix-handle { opacity: .45; border-style: dashed; }

.ix-panel {
  position: fixed; right: 22px; bottom: 88px; width: 312px; padding: 12px 12px 10px;
  background: linear-gradient(180deg, #232730, #1b1e25);
  border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow);
  animation: ixIn .16s ease-out;
}
@keyframes ixIn { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.ix-head { display: flex; align-items: center; gap: 8px; margin: 0 2px 10px; }
.ix-title { font-family: var(--serif); font-size: 15px; letter-spacing: 2px; color: var(--gold); }
.ix-tag { margin-left: auto; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.ix-x { background: none; border: 0; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 4px; }
.ix-x:hover { color: var(--text); }

.ix-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
#ixEmoji { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; }
.ix-emo { min-width: 0; padding: 0; height: 34px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); font-size: 16px; cursor: pointer; transition: transform .12s, border-color .12s, background .12s; }
.ix-emo:hover { transform: translateY(-2px); border-color: var(--gold-line); background: var(--surface-2); }
.ix-row.ix-locked { opacity: .4; }
.ix-row.ix-locked .ix-emo, .ix-row.ix-locked .ix-item { cursor: not-allowed; }

.ix-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px 6px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--text); cursor: pointer; transition: border-color .12s, transform .12s; position: relative; }
.ix-item b { font-size: 17px; line-height: 1; }
.ix-item span { font-size: 11px; color: var(--muted); }
.ix-item:hover { transform: translateY(-2px); border-color: var(--gold-line); }
.ix-item.on { border-color: var(--gold); background: var(--gold-dim); }
.ix-item.ix-locked { opacity: .4; }
.ix-item.ix-locked::after { content: attr(data-wait); position: absolute; top: 4px; right: 6px; font-size: 10px; color: var(--gold); font-family: var(--mono); }

.ix-foot { display: flex; gap: 8px; margin-top: 2px; }
.ix-btn { flex: 1; height: 32px; border-radius: 9px; border: 1px solid var(--gold-line); background: var(--gold-dim); color: var(--gold); font-size: 12.5px; cursor: pointer; transition: background .14s, opacity .14s; }
.ix-btn:hover:not(:disabled) { background: rgba(229, 181, 103, .24); }
.ix-btn:disabled { opacity: .42; cursor: not-allowed; }
.ix-btn.ghost { border-color: var(--border); background: var(--surface); color: var(--muted); flex: 0 0 auto; padding: 0 12px; }
.ix-hint { margin: 8px 2px 0; font-size: 11px; color: var(--muted); }

/* 选择目标 */
body.ix-picking [data-seat] { cursor: crosshair; }
.ix-pickable { outline: 1px dashed var(--gold-line); outline-offset: 2px; border-radius: 10px; }
.ix-pickable:hover { outline: 2px solid var(--gold); background: rgba(229, 181, 103, .07); }

/* 污渍与连击 */
.ix-marks { position: absolute; right: -2px; bottom: -4px; display: inline-flex; align-items: center; gap: 1px; padding: 1px 4px; border-radius: 8px; background: rgba(20, 22, 27, .92); border: 1px solid var(--border); font-size: 10px; line-height: 1.4; pointer-events: none; }
.ix-marks i { font-style: normal; color: var(--muted); font-size: 9px; }
.ix-marks .ix-cb { color: var(--gold); font-size: 9px; font-family: var(--mono); margin-left: 2px; }

/* 表情气泡 / 飞行道具 / 大横幅 */
.ix-bubble { position: absolute; z-index: 6; font-size: 22px; padding: 2px 8px; border-radius: 12px; background: #23262e; border: 1px solid var(--border-strong); opacity: 0; transform: translateY(6px) scale(.8); transition: opacity .18s, transform .18s; pointer-events: none; }
.ix-bubble.go { opacity: 1; transform: translateY(0) scale(1); }

.ix-fly { position: fixed; z-index: 60; font-size: 26px; transform: translate(-50%, -50%); transition: transform .38s cubic-bezier(.3, .1, .4, 1), opacity .38s; pointer-events: none; }
.ix-fly.go { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.7) rotate(24deg); }
.ix-splash { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 24px; animation: ixSplash .7s ease-out forwards; pointer-events: none; }
@keyframes ixSplash { 0% { opacity: .95; transform: translate(-50%, -50%) scale(.6); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.9); } }

.ix-stage { position: fixed; left: 0; right: 0; top: 22vh; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.ix-banner { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 30px; border-radius: 16px; background: rgba(20, 22, 27, .93); border: 1px solid var(--gold-line); box-shadow: var(--shadow); opacity: 0; transform: translateY(-10px) scale(.94); transition: opacity .2s, transform .2s; }
.ix-banner.go { opacity: 1; transform: none; }
.ix-banner.out { opacity: 0; transform: translateY(-6px); }
.ix-banner b { font-family: var(--serif); font-size: 30px; letter-spacing: 6px; color: var(--gold); }
.ix-banner span { font-size: 12px; color: var(--muted); }

.ix-root.open .ix-strip { opacity: 0; }
.ix-strip { position: fixed; right: 88px; bottom: 26px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; pointer-events: none; }
.ix-line { font-size: 12px; color: var(--text); background: rgba(20, 22, 27, .9); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; opacity: 1; transition: opacity .5s, transform .5s; max-width: 62vw; }
.ix-line b { color: var(--gold); font-weight: 600; }
.ix-line.warn { border-color: var(--gold-line); }
.ix-line.out { opacity: 0; transform: translateX(10px); }

.ix-hit { animation: ixHit .4s; }
@keyframes ixHit { 0%, 100% { transform: none; } 25% { transform: translate(-3px, 1px) rotate(-.6deg); } 60% { transform: translate(4px, -1px) rotate(.5deg); } }
.ix-poked { animation: ixPoke 1.1s; }
@keyframes ixPoke { 0%, 100% { box-shadow: none; } 30%, 70% { box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(229, 181, 103, .4); } }

@media (max-width: 700px) {
  .ix-handle { right: 14px; bottom: 14px; width: 46px; height: 46px; font-size: 19px; }
  .ix-panel { left: 10px; right: 10px; width: auto; bottom: 72px; padding: 10px; }
  .ix-strip { right: 70px; bottom: 18px; }
  .ix-line { font-size: 11px; padding: 4px 9px; max-width: 58vw; }
  .ix-banner b { font-size: 24px; letter-spacing: 4px; }
  .ix-emo { height: 32px; font-size: 15px; }
}

/* ===== 站点接入（moyu12138.top）：返回胶囊 ===== */
.site-back { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: 12.5px; text-decoration: none; white-space: nowrap; flex: 0 0 auto;
  transition: border-color .15s, color .15s; }
.site-back:hover { border-color: var(--gold-line); color: var(--gold); }
.site-back svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.site-back .sb-short { display: none; }
@media (max-width: 900px) {
  .site-back { padding: 0 9px; }
  .site-back .sb-full { display: none; }
  .site-back .sb-short { display: inline; }
}
@media (max-width: 430px) {
  .site-back { width: 30px; height: 30px; padding: 0; justify-content: center; }
  .site-back .sb-short { display: none; }
}

/* ===== 手机端顶栏：原包 4 个 pill + 计时 + 退出 会把页面撑到 625px（390 屏）=====
   让顶栏自己横向滚动，页面不再整体溢出；滑一下能看到计时和退出。 */
@media (max-width: 700px) {
  .topbar { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .topbar::-webkit-scrollbar { display: none; }
  .topbar > * { flex: 0 0 auto; }
  .topbar .spacer { flex: 1 0 8px; }
}

/* ===== 手机端栅格：1fr 的默认 min-width:auto 会被侧栏内容顶宽（4 人局 452px）===== */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .table-wrap { min-width: 0; }
}

/* ===================== 公开牌桌（大厅列表） =====================
   hub 页（/games/）与三款游戏的等待页共用；hub 多一列游戏标签。 */
.lobby-sec { margin-top: 44px; }
.lobby-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.lobby-head h2 { font-family: var(--serif); font-size: 20px; letter-spacing: 2px; margin: 0; font-weight: 600; }
.lobby-head .hint { color: var(--muted); font-size: 12px; }
.lobby-head .spacer { flex: 1; }
.btn-lite {
  background: transparent; border: 1px solid var(--border-strong); color: var(--muted);
  border-radius: 8px; padding: 5px 12px; font-size: 12px; cursor: pointer; transition: color .15s, border-color .15s;
}
.btn-lite:hover:not(:disabled) { color: var(--gold); border-color: var(--gold-line); }
.btn-lite:disabled { opacity: .5; cursor: default; }

.lobby-tables { display: flex; flex-direction: column; gap: 8px; }
.tbl-row {
  display: grid; grid-template-columns: auto auto 1fr auto auto; align-items: center; gap: 12px;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-soft);
  color: var(--text); text-decoration: none; font-size: 13px;
  transition: border-color .15s, background .15s, transform .15s;
}
.tbl-row:hover { border-color: var(--gold-line); background: var(--surface); transform: translateY(-1px); }
.tbl-row.mine { border-color: var(--gold-line); background: var(--gold-dim); }
.tbl-game { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); letter-spacing: .5px; white-space: nowrap; }
.tbl-game.g-uno { color: #7fd8c8; }
.tbl-game.g-bombs { color: #f08fb8; }
.tbl-game.g-codenames { color: #9aa8ff; }
.tbl-no { color: var(--gold); letter-spacing: 2px; }
.tbl-host { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl-seats { color: var(--text); font-size: 12px; }
.tbl-go { color: var(--gold); font-size: 12px; white-space: nowrap; }
.tbl-row.mine .tbl-go { color: var(--gold); opacity: .85; }
.tbl-empty {
  padding: 18px 14px; border: 1px dashed var(--border-strong); border-radius: 10px;
  color: var(--muted); font-size: 12.5px; text-align: center; line-height: 1.9;
}

/* 游戏等待页的侧栏版本：去掉房主列，更紧凑 */
.lobby-tables.compact .tbl-row { grid-template-columns: auto 1fr auto; gap: 8px; padding: 9px 10px; font-size: 12px; }
.lobby-tables.compact .tbl-no { letter-spacing: 1.5px; }
.lobby-tables.compact .tbl-host { display: none; }
.lobby-tables.compact .tbl-empty { padding: 14px 10px; font-size: 12px; }

/* 大厅开关 */
.open-row {
  display: flex; align-items: flex-start; gap: 8px; margin: 0 0 10px;
  font-size: 12px; color: var(--muted); line-height: 1.6; cursor: pointer;
}
.open-row input { margin: 3px 0 0; accent-color: var(--gold); }
.open-row input:disabled + span { opacity: .6; }

@media (max-width: 700px) {
  /* hub 行有游戏标签，游戏页没有，列数分开写，否则会多出一格空位 */
  .tbl-row { grid-template-columns: auto auto 1fr auto; gap: 8px; padding: 9px 11px; }
  .lobby-tables.compact .tbl-row { grid-template-columns: auto 1fr auto; }
  .tbl-host { display: none; }
  .lobby-sec { margin-top: 30px; }
}

/* ================= v1.3.2：动态倒计时 / 座位顺序 / 出牌流水 / 互动加强 ================= */

/* 顶栏下方的细进度条：把「还剩多少」画出来，比数字更直观 */
#cdBar {
  position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 70;
  background: rgba(255, 255, 255, .05); pointer-events: none;
}
#cdBar > i {
  display: block; height: 100%; width: 100%; background: var(--gold);
  transition: width .2s linear, background .2s;
  box-shadow: 0 0 8px rgba(229, 181, 103, .55);
}
#cdBar.warn > i { background: var(--red); box-shadow: 0 0 10px rgba(229, 72, 77, .6); }
.timer.cd-warn { color: var(--red); }
.timer.cd-done { color: var(--red); opacity: .7; }

/* 座位号 + 出牌顺序 */
.prow .seat-no {
  flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  border: 1px solid var(--border-strong); background: #14171e;
}
.prow.turn .seat-no { color: #14171e; background: var(--gold); border-color: var(--gold); }
.prow.you-row { border-color: var(--gold-line); }
.prow .tag-you { color: var(--gold); border-color: var(--gold-line); background: var(--gold-dim); }

.order-strip {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.order-strip .os-label { font-size: 11px; color: var(--muted); letter-spacing: 1px; margin-right: 2px; }
.order-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--border-strong); background: #191d25; color: var(--muted);
  max-width: 132px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.order-chip.on { border-color: var(--gold); color: var(--gold); background: var(--gold-dim); }
.order-chip.you { border-color: var(--gold-line); color: var(--text); }
.order-chip.done { opacity: .45; text-decoration: line-through; }
.order-arrow { color: var(--surface-3); font-size: 11px; }

/* 记牌 / 出牌流水：按轮次分组，seq 单调递增，顺序永远稳定 */
.feed { max-height: 260px; overflow-y: auto; font-size: 12px; line-height: 1.7; }
.feed-round {
  display: flex; align-items: center; gap: 8px; margin: 10px 0 6px;
  font-size: 10.5px; letter-spacing: 1.5px; color: var(--muted);
}
.feed-round::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.feed-round:first-child { margin-top: 0; }
.feed-row { display: flex; align-items: center; gap: 7px; padding: 3px 0; color: var(--muted); }
.feed-row b { color: var(--text); font-weight: 500; }
.feed-row.warn { color: #ffb0b2; }
.feed-row .fc {
  flex: 0 0 auto; min-width: 30px; text-align: center; padding: 1px 5px;
  border-radius: 5px; font-size: 10.5px; font-family: var(--mono);
  border: 1px solid var(--border-strong); color: var(--text);
}
.feed-row .fc.c-R { background: rgba(229, 72, 77, .22); border-color: rgba(229, 72, 77, .5); }
.feed-row .fc.c-Y { background: rgba(245, 184, 0, .2); border-color: rgba(245, 184, 0, .5); }
.feed-row .fc.c-G { background: rgba(48, 164, 108, .2); border-color: rgba(48, 164, 108, .5); }
.feed-row .fc.c-B { background: rgba(91, 124, 250, .22); border-color: rgba(91, 124, 250, .5); }
.feed-row .fc.c-W { background: #2a2d36; border-color: var(--border-strong); }

/* 行动代号的「本回合谁动」横条 */
.me-band {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); font-size: 13px;
}
.me-band .mb-team { font-size: 11px; letter-spacing: 1px; padding: 2px 8px; border-radius: 999px; }
.me-band .mb-team.R { color: #ffb0b2; background: rgba(229, 72, 77, .14); border: 1px solid rgba(229, 72, 77, .4); }
.me-band .mb-team.B { color: #b7c6ff; background: rgba(91, 124, 250, .14); border: 1px solid rgba(91, 124, 250, .4); }
.me-band .mb-who { color: var(--gold); font-weight: 600; }
.me-band .mb-do { color: var(--muted); }
.me-band.done { border-color: var(--gold-line); background: var(--gold-dim); }

/* 规则说明弹窗 */
.rules-doc { max-height: 62vh; overflow-y: auto; text-align: left; font-size: 13px; line-height: 1.85; color: var(--text); }
.rules-doc h4 { margin: 14px 0 6px; font-size: 13px; color: var(--gold); letter-spacing: .5px; }
.rules-doc h4:first-child { margin-top: 0; }
.rules-doc p { margin: 0 0 6px; color: var(--muted); }
.rules-doc ul { margin: 0 0 8px; padding-left: 18px; color: var(--muted); }
.rules-doc li { margin: 2px 0; }
.rules-doc b { color: var(--text); font-weight: 500; }
.rules-doc code {
  font-family: var(--mono); font-size: 11.5px; padding: 1px 5px; border-radius: 4px;
  background: #191d25; border: 1px solid var(--border); color: var(--gold);
}

/* 互动加强：受击抖动 + 表情爆发 */
@keyframes ixShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px) rotate(-.6deg); }
  40% { transform: translateX(5px) rotate(.6deg); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
.ix-shake { animation: ixShake .42s ease-in-out; }
@keyframes ixBurst {
  0% { transform: translate(-50%, 0) scale(.4); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translate(-50%, -78px) scale(1.5); opacity: 0; }
}
.ix-burst {
  position: fixed; z-index: 65; font-size: 34px; pointer-events: none;
  animation: ixBurst 1.05s ease-out forwards;
}

/* 补喊 UNO：按钮要抢眼，否则玩家根本不知道还能救 */
@keyframes unoUrgent {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, .55); }
  50% { box-shadow: 0 0 0 7px rgba(229, 72, 77, 0); }
}
.btn-uno.urgent { animation: unoUrgent 1s ease-out infinite; }
.btn-uno[disabled] { opacity: .45; animation: none; }
.ix-banner.warn { border-color: rgba(229, 72, 77, .6); }
.ix-banner.warn b { color: #ff8f92; }
