:root {
  /* 主题系统（P10 美化：血月哥特——血黑底 + 猩红星云 + 金红强调） */
  --bg: #130a0e;
  --bg-secondary: #20111a;
  --bg-tertiary: #2c1622;
  --card: #261320;
  --overlay: rgba(10, 4, 8, 0.85);
  --primary: #2e7d32;
  --primary-bright: #3d9b43;
  --accent: #e0a53a;
  --accent-dim: rgba(224, 165, 58, 0.45);
  --blood: #b3121f;
  --danger: #ff4757;
  --success: #10b981;
  --night-purple: #7a1630;
  --muted: #b39a9a;
  --border: #4a2330;
  --border-strong: #6b3040;
  --text: #f2e8e8;
  --text-inverse: #1a0c12;
  --dur: 200ms;
  --elevation-1: 0 1px 3px rgba(0, 0, 0, 0.25);
  --elevation-2: 0 4px 8px rgba(0, 0, 0, 0.3);
  --elevation-3: 0 10px 20px rgba(0, 0, 0, 0.35);
  --elevation-4: 0 20px 40px rgba(0, 0, 0, 0.4);
  --blur-amount: 8px;
  --night-badge: #7a1630;
  --panel-title: #EAB308;
  --discord: #5865F2;
  --speaker-color: #fbbf24;
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur: 0ms; }
  * { transition: none !important; animation: none !important; }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(179, 18, 31, 0.16), transparent 55%),
    radial-gradient(ellipse at 85% 100%, rgba(122, 22, 48, 0.14), transparent 50%),
    radial-gradient(ellipse at 50% 45%, rgba(60, 10, 20, 0.55), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: Inter, "Noto Sans SC", sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: contain;
  -webkit-tap-highlight-color: transparent;
}

.view { display: none; padding: 8px; }
.view.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--elevation-2);
  transition: box-shadow var(--dur), transform var(--dur);
}
.card.clickable:hover {
  box-shadow: var(--elevation-3);
  transform: translateY(-1px);
}

.title { margin: 0 0 4px; font-size: 22px; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); font-size: 13px; }

/* 按钮（≥44px 触控目标保持） */
.btn {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur), opacity var(--dur), transform 150ms, border-color var(--dur), box-shadow var(--dur);
}
.btn:hover:not(:disabled) { background: var(--bg-tertiary); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: rgba(255, 255, 255, 0.12); }
.btn-primary:hover:not(:disabled) { background: var(--primary-bright); border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); }
.btn-sm { min-height: 36px; padding: 6px 12px; }
.btn.accent { border-color: var(--accent); color: var(--accent); }
.btn-discord { background: var(--discord); border-color: transparent; }
.btn-discord:hover:not(:disabled) { background: #4752C4; box-shadow: var(--elevation-3); }
.btn-vote:hover:not(:disabled) { border-color: var(--accent); }

input {
  width: 100%;
  min-height: 44px;
  margin: 6px 0 12px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  transition: border-color var(--dur), box-shadow var(--dur);
}
input:focus {
  outline: none;
  border-color: var(--primary-bright);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.3);
}

label { font-size: 13px; color: var(--muted); }

/* 顶栏 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  background: rgba(32, 17, 26, 0.85);
  -webkit-backdrop-filter: blur(var(--blur-amount));
  backdrop-filter: blur(var(--blur-amount));
  box-shadow: var(--elevation-1);
  position: relative;
  z-index: 10;
}
.me-chip { display: flex; align-items: center; gap: 8px; }
.me-name { font-weight: 600; }
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--night-purple);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; flex: none;
}
.game-title {
  font-weight: 800; letter-spacing: 0.08em;
  background: linear-gradient(90deg, #ff6b6b, #e0a53a 55%, #ffb3b3);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* 登录 */
.login-card {
  max-width: 360px;
  margin: 60px auto;
  box-shadow: var(--elevation-3);
  animation: card-in var(--dur) ease-out;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* P11 统一 keyframes 区块（log-in / pick-flash / die / pulse / breathe-accent / modal-up） */
@keyframes log-in {
  from { opacity: 0; transform: translateY(-6px); }
}
@keyframes pick-flash {
  0% { box-shadow: 0 0 0 6px rgba(224, 165, 58, 0.5); }
  100% { box-shadow: 0 0 0 0 rgba(224, 165, 58, 0); }
}
@keyframes die {
  to { filter: grayscale(1); opacity: 0.45; transform: scale(0.96); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
@keyframes breathe-accent {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 165, 58, 0.40); }
  50% { box-shadow: 0 0 0 5px rgba(224, 165, 58, 0.10); }
}
@keyframes modal-up {
  from { transform: translateY(24px); opacity: 0; }
}

/* 大厅 */
.lobby-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin: 12px 0;
}
.room-list { display: flex; flex-direction: column; gap: 8px; }
.room-row {
  display: flex; align-items: center; gap: 8px;
  padding: 12px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--card); flex-wrap: wrap;
  box-shadow: var(--elevation-2);
  transition: box-shadow var(--dur), transform var(--dur), border-color var(--dur);
  cursor: default;
}
.room-row:hover {
  box-shadow: var(--elevation-3);
  transform: translateY(-1px);
  border-color: var(--border-strong);
}
.room-row.empty { color: var(--muted); box-shadow: none; }
.room-row.mine {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(46, 125, 50, 0.4), var(--elevation-2);
}
.btn.confirm-danger {
  background: var(--danger);
  border-color: #FCA5A5;
  color: #fff;
}
.room-id { font-weight: 600; margin-right: auto; }
.badge {
  font-size: 12px; padding: 3px 8px; border-radius: 999px;
  background: var(--bg-secondary); border: 1px solid var(--border); color: var(--muted);
}
.badge.accent { background: var(--accent); color: var(--text-inverse); }
.badge.primary { background: var(--primary); color: #fff; }
.badge.day { background: rgba(224, 165, 58, 0.15); color: var(--accent); border-color: rgba(224, 165, 58, 0.45); }
.badge.night { background: rgba(122, 22, 48, 0.25); color: #d8a0b0; border-color: rgba(122, 22, 48, 0.55); }
.badge.ended { background: rgba(239, 68, 68, 0.15); color: #FCA5A5; border-color: rgba(239, 68, 68, 0.45); }
.badge.muted { background: var(--bg-secondary); color: var(--muted); }

/* P6-fix2 公屏拉大：游戏视图满屏 flex 列布局——
   公屏（席位+事件流）占主体，事件流撑满剩余可用空间（不再 220px 小条） */
#view-game.active {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  padding: 0; overflow: hidden;
}
#view-game.active > .game-topbar { flex: none; }
#view-game.active > .role-card { flex: none; }
.game-body {
  flex: 1; min-height: 0;
  padding: 8px;
  padding-bottom: 175px;   /* 底部动作区（fixed）高度补偿 */
  overflow-y: auto;        /* P10 修复：hidden 会裁掉公屏/投票，改自然滚动 */
}
.seat-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  flex: none; max-height: 46%; overflow-y: auto;
}

/* 席位卡（借鉴 nakama PlayerSeat：头像圆框 + 状态徽章 + 说话呼吸光圈） */
.seat {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 12px;
  background: var(--card); border: 2px solid transparent;
  cursor: pointer;
  transition: border-color var(--dur), transform var(--dur), opacity 0.9s, box-shadow var(--dur), background var(--dur), filter 0.9s;
  text-align: left; font: inherit; color: var(--text);
  min-height: 60px;
  box-shadow: var(--elevation-1);
}
.seat.mine { border-color: var(--primary); cursor: default; }
.seat.speaking {
  border-color: var(--accent);
  animation: breathe 1.8s ease-in-out infinite;
  z-index: 2;
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 165, 58, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(224, 165, 58, 0.12); }
}
.seat.dead { opacity: 0.45; filter: grayscale(0.75); transform: none; animation: none; }
.seat.just-died { animation: die 1.2s forwards; }
.seat.votable:hover:not(:disabled) {
  border-color: var(--accent);
  box-shadow: var(--elevation-2);
  transform: translateY(-1px);
}
.seat.votable { animation: breathe-accent 2s ease-in-out infinite; }
.seat.vote-picked {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224, 165, 58, 0.3);
  animation: pick-flash 0.6s;
}
.seat.votable:active:not(:disabled) { transform: scale(0.97); }
.seat .speak-flag {
  position: absolute; top: -8px; right: 8px;
  font-size: 11px; background: var(--accent); color: var(--text-inverse);
  padding: 1px 6px; border-radius: 999px;
}
.seat-name { font-weight: 600; }
.seat-role { font-size: 12px; color: var(--muted); }
.seat:not(.dead) .seat-role { display: none; }

/* 头像圆框 + 状态徽章（存活绿点 / 死亡灰点加叉） */
.seat-avatar { position: relative; flex: none; }
.status-dot {
  position: absolute; right: -2px; bottom: -2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--card);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; line-height: 1;
}
.status-dot.alive { background: var(--success); }
.status-dot.dead { background: #5a4a4a; color: #fff; }

/* 死人亮牌 / 终局亮牌立绘缩略（同映射） */
.seat-revealed {
  display: flex; align-items: center; gap: 6px;
}
.seat-card {
  height: 34px; width: auto; border-radius: 5px;
  border: 1px solid var(--border-strong);
  display: block;
}

/* 身份卡（立绘卡 + 阵营底色：狼红 / 神蓝 / 民绿） */
.board-banner {
  margin: 6px auto; padding: 6px 12px;
  font-size: 13px; text-align: center;
  color: var(--text-primary, #e8d9b5);
  background: var(--card, rgba(30, 26, 22, 0.85));
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-left: 3px solid rgba(212, 175, 55, 0.7);
  border-radius: 8px;
  max-width: 640px; width: calc(100% - 24px);
}
.role-card {
  margin: 8px; padding: 10px 16px;
  border-radius: 12px;
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  box-shadow: var(--elevation-4);
  -webkit-backdrop-filter: blur(var(--blur-amount));
  backdrop-filter: blur(var(--blur-amount));
}
.role-card.fac-wolf {
  background: linear-gradient(135deg, rgba(139, 0, 0, 0.85), rgba(120, 20, 20, 0.7));
  border-color: rgba(239, 68, 68, 0.6);
}
.role-card.fac-god {
  background: linear-gradient(135deg, rgba(26, 58, 110, 0.8), rgba(16, 24, 48, 0.7));
  border-color: rgba(96, 140, 220, 0.55);
}
.role-card.fac-villager {
  background: linear-gradient(135deg, rgba(46, 125, 50, 0.8), rgba(26, 26, 58, 0.7));
  border-color: rgba(61, 155, 67, 0.6);
}
.role-img {
  height: 72px; width: auto; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: block;
}
.role-img-fallback {
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; background: rgba(0, 0, 0, 0.3);
}
.role-text { display: flex; flex-direction: column; }
.role-label { font-size: 15px; opacity: 0.85; }

/* P3-T4 字号加大：身份文字 ≥1.5 倍 */
.role-name { font-size: 28px; font-weight: 700; }
/* 倒计时（width transition 300ms） */
.timer-wrap { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 120px; }
.timer-bar {
  flex: 1; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--blood), var(--accent));
  transition: width 300ms linear;
}
.timer-text { font-size: 12px; }
.timer-wrap.urgent .timer-text { color: var(--danger); font-weight: 800; animation: pulse 1s infinite; }
.timer-wrap.urgent .timer-bar { background: var(--danger); }

/* 事件日志（P6-fix2 拉大：撑满剩余空间，滚动流畅） */
.event-log {
  margin-top: 8px;
  flex: 1; min-height: 180px; max-height: none;
  overflow-y: auto;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--card); padding: 8px 12px;
  display: flex; flex-direction: column; gap: 4px;
  scroll-behavior: smooth;
}
.log-line {
  font-size: 13px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  transition: background var(--dur);
}
.log-line:hover { background: rgba(255, 255, 255, 0.06); }
.log-line, .log-announce, .vote-card, .log-banner { animation: log-in 220ms ease-out; }
.log-line .speaker { color: var(--speaker-color); font-weight: 600; }
.log-line.sys { color: var(--muted); font-style: italic; font-size: 12px; background: transparent; border-color: transparent; }

/* 动作区（焦点保护机制所在 DOM，保持独立于重渲染） */
.action-area {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: rgba(26, 10, 16, 0.92);
  -webkit-backdrop-filter: blur(var(--blur-amount));
  backdrop-filter: blur(var(--blur-amount));
  border-top: 1px solid var(--border);
  padding: 12px 8px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--elevation-3);
  z-index: 20;
}
.action-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.action-row input { flex: 1; min-width: 160px; margin: 0; }
.speak-wrap { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.speak-wrap .action-row { margin: 0; }

/* 快捷短语条（借鉴 nakama QuickPhrases） */
.quick-phrases {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px;
}
.quick-chip {
  flex-shrink: 0;
  min-height: 30px;
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
.quick-chip:hover { background: var(--night-purple); border-color: var(--night-purple); color: #fff; }

/* 夜晚氛围（借鉴 nakama NightOverlay）：星星 + 暗角 vignette，不只压暗。
   P9-T2 天黑减淡：压暗从纯黑调降到深蓝紫调（亮度 0.72→0.86，
   罩层 rgba(15,15,35,.28)→rgba(30,27,75,.30) 深蓝紫），星空保留，
   文字对比度不降（easter/通报亮字不受影响） */
#view-game { transition: filter 300ms ease; }
body.night #view-game { filter: brightness(0.82) saturate(1.15); }
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 300ms ease;
  z-index: 4;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, rgba(255, 255, 255, 0.9), transparent 60%),
    radial-gradient(1px 1px at 32% 8%, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(2px 2px at 48% 24%, rgba(255, 255, 255, 0.8), transparent 60%),
    radial-gradient(1px 1px at 64% 12%, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(1.5px 1.5px at 78% 20%, rgba(255, 255, 255, 0.85), transparent 60%),
    radial-gradient(1px 1px at 88% 6%, rgba(255, 255, 255, 0.6), transparent 60%),
    radial-gradient(1.5px 1.5px at 22% 34%, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(1px 1px at 56% 38%, rgba(255, 255, 255, 0.6), transparent 60%),
    radial-gradient(2px 2px at 92% 30%, rgba(255, 255, 255, 0.75), transparent 60%),
    radial-gradient(ellipse at 50% 50%, transparent 45%, rgba(5, 5, 20, 0.55) 100%);
}
body.night::before { opacity: 1; }
body::after {
  content: "";
  position: fixed; inset: 0;
  background: rgba(15, 15, 35, 0);
  pointer-events: none;
  transition: background 300ms ease;
  z-index: 5;
}
body.night::after {
  background: rgba(30, 27, 75, 0.30);   /* P9-T2 天黑减淡：深蓝紫而非纯黑 */
}

/* P6-fix2 公屏通报条带（替代全屏过场层）：系统通报=金边大字、
   夜晚=紫调、天亮=金调、死亡=暗红、查验=蓝紫、行动回执=绿 */
.log-announce {
  font-size: 17px; font-weight: 700; letter-spacing: 0.08em;
  color: #F3ECDF;
  background: rgba(224, 165, 58, 0.10);
  border: 1px solid var(--accent-dim, rgba(224, 165, 58, 0.55));
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 9px 14px;
  padding-left: 10px;
  text-shadow: 0 0 14px rgba(224, 165, 58, 0.25);
}
.log-announce.night {
  color: #d8a0b0;
  background: rgba(122, 22, 48, 0.22);
  border-color: rgba(122, 22, 48, 0.65);
  text-shadow: 0 0 14px rgba(122, 22, 48, 0.45);
}
.log-announce.dawn {
  color: #FDE68A;
  background: rgba(224, 165, 58, 0.14);
  border-color: rgba(224, 165, 58, 0.65);
}
.log-line.log-check {
  color: #8fa3e0; font-weight: 600;
  background: rgba(21, 101, 192, 0.18);
  border-color: rgba(59, 130, 246, 0.5);
}
.log-line.log-ack {
  color: #86EFAC;
  background: rgba(46, 125, 50, 0.12);
  border-color: rgba(61, 155, 67, 0.45);
}

/* P11 空状态统一（emoji 由 JS 注入，CSS 只管样式） */
.wolf-empty, .grave-empty, .lb-empty, .room-row.empty { opacity: 0.85; }
.ring-loading {
  min-height: 160px; border: 1px dashed var(--border); border-radius: 12px;
  animation: pulse 1.4s ease-in-out infinite;
}
.ring-wrap img { opacity: 0; transition: opacity 0.3s; }
.ring-wrap img.ring-on { opacity: 1; }

/* P11 重大事件通报（比 .log-announce 更重） */
.log-major {
  font-size: 18px; font-weight: 800; letter-spacing: 0.08em;
  color: #F3ECDF;
  background: rgba(224, 165, 58, 0.08);
  border: 1px solid var(--accent-dim);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 9px 14px; padding-left: 10px;
  text-shadow: 0 0 16px rgba(224, 165, 58, 0.3);
}

/* P6-fix2 关键词高亮（白名单词条 → 阵营色 span） */
.kw { font-weight: 700; }
.kw.kw-wolf { color: #f87171; }
.kw.kw-wwolf { color: #b91c1c; text-shadow: 0 0 8px rgba(185, 28, 28, 0.6); }
.kw.kw-seer { color: #8fa3e0; }
.kw.kw-witch { color: #c084fc; }
.kw.kw-guard { color: #86efac; }
.kw.kw-hunter { color: #fdba74; }
.kw.kw-sheriff { color: #facc15; text-shadow: 0 0 8px rgba(250, 204, 21, 0.4); }
.kw.kw-villager { color: #6ee7b7; }
.kw.kw-other { color: #d8b4fe; }

/* 终局全屏 end-banner 层已删除：胜利图整合进结算面板（.settle-victory-img） */

/* toast */
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 16px; font-size: 14px;
  z-index: 50; max-width: 90vw;
  box-shadow: var(--elevation-4);
}
.toast.err { border-color: var(--danger); color: #FCA5A5; border-left: 3px solid var(--danger); }

/* ---------- P2-T3 夜晚私屏 ---------- */
/* 夜晚身份大立绘卡（动作区内，复用阵营底色） */
.night-card {
  margin: 4px 0; padding: 12px 20px;
  border-radius: 14px;
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  box-shadow: var(--elevation-4);
  -webkit-backdrop-filter: blur(var(--blur-amount));
  backdrop-filter: blur(var(--blur-amount));
}
.night-card.fac-wolf {
  background: linear-gradient(135deg, rgba(139, 0, 0, 0.9), rgba(120, 20, 20, 0.75));
  border-color: rgba(239, 68, 68, 0.6);
}
.night-card.fac-god {
  background: linear-gradient(135deg, rgba(26, 58, 110, 0.85), rgba(16, 24, 48, 0.75));
  border-color: rgba(96, 140, 220, 0.55);
}
.night-card.fac-villager {
  background: linear-gradient(135deg, rgba(46, 125, 50, 0.85), rgba(26, 26, 58, 0.75));
  border-color: rgba(61, 155, 67, 0.6);
}
.night-card-img {
  height: 96px; width: auto; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: block;
}
.night-card-img.night-img-fallback {
  height: 96px; width: 72px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.night-card-text { display: flex; flex-direction: column; gap: 2px; }
.night-card-label { font-size: 14px; opacity: 0.75; color: #E5E7EB; }
/* P3-T4 字号加大：夜晚私屏身份文字 ≥1.5 倍 */
.night-card-name { font-size: 33px; font-weight: 700; color: #fff; }

/* ---------- P3-T2 夜晚进度/面板/墓园/观战/竞猜/UI 质感 ---------- */

/* 白天晨光渐变底（与夜晚星空对称，替代纯色底） */
body {
  background: radial-gradient(ellipse at 50% -10%, rgba(15, 15, 35, 0), rgba(15, 15, 35, 0)), var(--bg);
  transition: background 400ms ease;
}
body.day {
  background:
    radial-gradient(ellipse at 50% -20%, rgba(224, 165, 58, 0.10), transparent 55%),
    radial-gradient(ellipse at 85% 110%, rgba(179, 18, 31, 0.06), transparent 50%),
    var(--bg);
}

/* 顶栏夜晚进度徽章 */
.night-progress {
  font-size: 12px; padding: 4px 12px; border-radius: 999px;
  background: rgba(122, 22, 48, 0.25); color: #d8a0b0;
  border: 1px solid rgba(122, 22, 48, 0.55);
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
/* P4-fix：「轮到你了」横幅关闭钮（点掉后本阶段不再弹出） */
.np-close {
  border: none; background: transparent; color: inherit;
  font-size: 14px; line-height: 1; padding: 0 2px; cursor: pointer;
  opacity: 0.7;
}
.np-close:hover { opacity: 1; }
.night-progress.mine {
  background: rgba(224, 165, 58, 0.18); color: var(--accent);
  border-color: var(--accent);
  animation: turn-glow 1.6s ease-in-out infinite;
}
@keyframes turn-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 165, 58, 0.45); }
  50% { box-shadow: 0 0 0 7px rgba(224, 165, 58, 0.10); }
}

/* 双栏布局（P6-fix2 公屏占主体）：主区撑满高度，侧栏收窄；
   窄屏折叠到下方（公屏在动作区上方） */
.game-columns {
  display: flex; gap: 8px; align-items: flex-start;
  height: 100%; min-height: 0;
}
.game-main {
  flex: 1; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
}
.side-panels {
  width: 280px; flex: none;
  max-height: 100%; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  animation: card-in var(--dur) ease-out;
}
@media (max-width: 860px) {
  .game-columns { flex-direction: column; height: auto; }
  .game-main { min-height: 52vh; }
  .side-panels { width: 100%; max-height: none; }
  .seat-grid { max-height: 34%; }
}

/* 面板 tab（借鉴 nakama ChatPanel 标签页） */
.panel-tabs { display: flex; gap: 6px; }
.panel-tab {
  flex: 1; min-height: 36px; padding: 6px 10px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-secondary); color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.panel-tab.active { background: var(--bg-tertiary); color: var(--text); border-color: var(--accent); }
.panel-tab:hover:not(.active) { background: var(--bg-tertiary); color: var(--text); }

/* 玻璃质感面板（backdrop-filter + 渐变边框） */
.glass-panel {
  border-radius: 12px;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    linear-gradient(135deg, rgba(224, 165, 58, 0.45), rgba(123, 31, 162, 0.45), rgba(46, 125, 50, 0.35)) border-box;
  padding: 10px;
  -webkit-backdrop-filter: blur(var(--blur-amount));
  backdrop-filter: blur(var(--blur-amount));
  box-shadow: var(--elevation-2);
  max-height: 380px; overflow-y: auto;
}

/* 狼队频道（借鉴 nakama ChatPanel：消息流 + 输入框） */
.wolf-msgs { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.wolf-msg { font-size: 13px; line-height: 1.45; }
.wolf-msg .w-name { color: #FCA5A5; font-weight: 600; margin-right: 4px; }
.wolf-msg .w-text {
  display: inline-block; max-width: 88%;
  background: rgba(139, 0, 0, 0.35); border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 10px; padding: 5px 10px; color: #FEE2E2;
  word-break: break-word;
}
.wolf-msg.own { text-align: right; }
.wolf-msg.own .w-text { background: rgba(139, 0, 0, 0.6); }
.wolf-empty { color: #c4adad; font-size: 13px; text-align: center; padding: 12px 0; }
.wolf-progress { font-size: 12px; color: #FCA5A5; margin-bottom: 6px; }
.wolf-input-row { display: flex; gap: 6px; }
.wolf-input-row input { margin: 0; min-height: 44px; }

/* P8 观战频道（仅观战者；蓝紫色调与狼队血红区隔） */
.spec-msgs { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.spec-msg { font-size: 13px; line-height: 1.45; }
.spec-msg .s-name { color: #A5B4FC; font-weight: 600; margin-right: 4px; }
.spec-msg .s-text {
  display: inline-block; max-width: 88%;
  background: rgba(49, 46, 129, 0.4); border: 1px solid rgba(129, 140, 248, 0.4);
  border-radius: 10px; padding: 5px 10px; color: #E0E7FF;
  word-break: break-word;
}
.spec-msg.own { text-align: right; }
.spec-msg.own .s-text { background: rgba(67, 56, 202, 0.6); }
.spec-input-row { display: flex; gap: 6px; }
.spec-input-row input { margin: 0; min-height: 44px; }

/* P8 席位环（白天公开视角圆桌图：金环描边 + 投影，宽随主列自适应）。
   P10 修复：限高——原图 560px 宽约 450px 高，笔记本视口装不下，
   会把公屏/投票区挤到 overflow hidden 外（只能看到环图的根因） */
.seat-ring-img {
  display: block;
  width: auto; max-width: 100%;
  max-height: min(34vh, 320px);
  margin: 0 auto 10px;
  border-radius: 14px;
  border: 1px solid rgba(201, 162, 92, 0.55);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

/* 墓园卡片（立绘缩略 + 名字 + 角色 + 死因 + 天数 + 遗言） */
.grave-list { display: flex; flex-direction: column; gap: 8px; }
.grave-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--border);
}
.grave-card img {
  height: 48px; width: auto; border-radius: 6px;
  filter: grayscale(0.85); border: 1px solid var(--border-strong);
  flex: none;
}
.grave-info { min-width: 0; font-size: 12px; }
.grave-name { font-weight: 700; font-size: 13px; }
.grave-meta { color: #c4adad; }
.grave-words {
  color: #C4B5FD; font-style: italic; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.grave-empty { color: #c4adad; font-size: 13px; text-align: center; padding: 16px 0; }

/* P3-T3 墓园私密频道（仅死者；照抄狼队频道配色，灰紫墓园色调） */
.grave-chat { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.grave-msgs {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 8px; max-height: 220px; overflow-y: auto;
}
.grave-msg { font-size: 13px; line-height: 1.45; }
.grave-msg .g-name { color: #C4B5FD; font-weight: 600; margin-right: 4px; }
.grave-msg .g-text {
  display: inline-block; max-width: 88%;
  background: rgba(49, 46, 79, 0.6); border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 10px; padding: 5px 10px; color: #EDE9FE;
  word-break: break-word;
}
.grave-msg.own { text-align: right; }
.grave-msg.own .g-text { background: rgba(76, 29, 149, 0.7); }
.grave-input-row { display: flex; gap: 6px; }
.grave-input-row input { margin: 0; min-height: 44px; }

/* 竞猜押注面板 */
.bet-row { display: flex; gap: 6px; margin-bottom: 8px; }
.bet-row .side-btn { flex: 1; }
.bet-row .side-btn.on-wolf { border-color: rgba(239, 68, 68, 0.7); color: #FCA5A5; }
.bet-row .side-btn.on-villager { border-color: rgba(61, 155, 67, 0.7); color: #86EFAC; }
.bet-amount { margin: 0 0 8px; }
.bet-mine { font-size: 12px; color: #c4adad; margin-top: 6px; }
.bet-mine .b-item { margin-right: 8px; }

/* 死亡特效 P6 版定义见上方（全屏暗红渐变闪烁 + 死者名浮现，1.5s） */

/* 围观徽章 */
.badge.spec { background: rgba(88, 101, 242, 0.18); color: #A5B4FC; border-color: rgba(88, 101, 242, 0.5); }

/* 死者本人：身份立绘灰化 */
.role-card.gone .role-img, .role-card.gone .role-img-fallback { filter: grayscale(1) brightness(0.7); }
.role-card.gone { opacity: 0.75; }

/* 轮到你了高亮（P3-T4 加大：横幅式大字 + 呼吸光圈，顶栏下方显眼位置） */
.turn-pill {
  padding: 8px 20px; border-radius: 999px; align-self: flex-start;
  font-size: 14px; font-weight: 700;
  background: var(--bg-tertiary); color: var(--muted);
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; gap: 8px;
}
.turn-pill:not(.mine) { opacity: 0.7; }
.turn-pill.mine {
  font-size: 22px; padding: 12px 28px; width: 100%; text-align: center;
  background: rgba(224, 165, 58, 0.15); color: var(--accent);
  border-color: var(--accent);
  animation: turn-glow 1.6s ease-in-out infinite;
}

/* ---------- P3-T4 终局结算面板（语义照搬 DC 结算） ---------- */
.settle {
  display: flex; flex-direction: column; gap: 12px;
  padding: 4px 2px;
}
.settle-banner {
  font-size: 30px; font-weight: 800; text-align: center;
  padding: 16px 12px; border-radius: 14px; letter-spacing: 2px;
}
.settle-banner.win-good {
  color: #86EFAC;
  background: linear-gradient(135deg, rgba(46, 125, 50, 0.30), rgba(46, 125, 50, 0.10));
  border: 1px solid rgba(61, 155, 67, 0.7);
}
.settle-banner.win-wolf {
  color: #FCA5A5;
  background: linear-gradient(135deg, rgba(139, 0, 0, 0.35), rgba(139, 0, 0, 0.12));
  border: 1px solid rgba(239, 68, 68, 0.7);
}
.settle-victory-img {
  width: 100%;
  max-width: 560px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
}
.settle-camp-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.settle-camp { border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.settle-camp.camp-wolf { border-color: rgba(239, 68, 68, 0.45); }
.settle-camp.camp-good { border-color: rgba(61, 155, 67, 0.45); }
.settle-camp-rows { display: flex; flex-direction: column; gap: 3px; }
.settle-camp-line { font-size: 14px; line-height: 1.5; }
.settle-mark { opacity: 0.85; }

/* P11 面板小标题统一色体系：默认 var(--panel-title)，语义 modifier 覆盖 */
.settle-camp-title, .vote-card .vc-title { color: var(--panel-title); }
.settle-camp.camp-wolf .settle-camp-title { color: #FCA5A5; }   /* camp-lose 狼胜 */
.settle-camp.camp-good .settle-camp-title { color: #86EFAC; }   /* camp-win 好人 */
.settle-achievements .settle-camp-title { color: #EAB308; }
.settle-honors .settle-camp-title { color: #C9A25C; }
.settle-vote-matrix .settle-camp-title { color: #94A3B8; }
.settle-timeline, .settle-stats {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px;
}
.settle > * + * { margin-top: 4px; border-top: 1px dashed var(--border); padding-top: 12px; }
.settle-timeline-line, .settle-stat-line { font-size: 14px; line-height: 1.6; }
.settle-stats { color: var(--text); }

/* ---------- P5 彩蛋氛围（金色斜体，P6-fix2 提亮加大确保可见） ---------- */
.log-line.easter {
  font-style: italic; font-size: 14px; color: #FCD34D;
  text-shadow: 0 0 14px rgba(252, 211, 77, 0.35);
  border-left: 3px solid rgba(252, 211, 77, 0.7); padding-left: 10px;
  background: rgba(252, 211, 77, 0.06);
  border-top: none; border-right: none; border-bottom: none;
}
.settle-remarks { display: flex; flex-direction: column; gap: 4px; }
.settle-remark { font-size: 14px; line-height: 1.6; }
.settle-achievements { border: 1px solid rgba(234, 179, 8, 0.45); border-radius: 10px; padding: 10px; }
/* P7 荣誉墙（金纹）+ 复盘投票矩阵 */
.settle-honors { border-color: rgba(201, 162, 92, 0.55); }
.settle-vote-matrix {
  border: 1px solid rgba(148, 163, 184, 0.35); border-radius: 10px; padding: 10px;
}
.settle-vote-matrix pre {
  margin: 6px 0 0; font-family: ui-monospace, Consolas, monospace;
  font-size: 12px; line-height: 1.6; white-space: pre-wrap; color: #CBD5E1;
}
/* P7 大通报配图（天亮横幅条带） */
.log-banner { padding: 2px 0; }
.log-banner img {
  display: block; width: 100%; max-width: 460px; border-radius: 8px;
  border: 1px solid rgba(201, 162, 92, 0.35);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}
.settle-ach-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.settle-ach-badge {
  font-size: 13px; line-height: 1.6; border-radius: 8px;
  background: rgba(234, 179, 8, 0.10); padding: 5px 8px;
  border: 1px solid rgba(234, 179, 8, 0.30);
}
.btn.btn-danger {
  background: rgba(239, 68, 68, 0.18); color: #FCA5A5;
  border: 1px solid rgba(239, 68, 68, 0.55);
}
.btn.btn-danger:hover { background: rgba(239, 68, 68, 0.30); }
.rename-wrap { display: flex; gap: 8px; align-items: center; }
.rename-wrap input { flex: 1; min-width: 0; }
/* 玩家卡踢出按钮（admin/房主） */
.seat .kick-btn {
  position: absolute; top: 4px; right: 4px;
  min-height: 28px; font-size: 12px; font-weight: 700; padding: 6px 12px;
  border-radius: 999px; cursor: pointer; z-index: 2;
  background: rgba(239, 68, 68, 0.20); color: #FCA5A5;
  border: 1px solid rgba(239, 68, 68, 0.6);
}
.seat .kick-btn:hover { background: rgba(239, 68, 68, 0.40); }
/* P6-fix2 天亮横幅关闭钮已随全屏过场层一并删除（改公屏通报） */

/* P6 时间胶囊封存按钮行（遗言环节动作区） */
.seal-capsule-row { margin-top: 4px; }

/* ---------- P4 Hero-Centric 落地页（未登录） ---------- */
.hero {
  position: relative;
  min-height: calc(100vh - 16px);
  min-height: calc(100dvh - 16px);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  border-radius: 16px;
  background:
    radial-gradient(ellipse at 50% 118%, rgba(123, 31, 162, 0.35), transparent 55%),
    radial-gradient(ellipse at 82% -10%, rgba(224, 165, 58, 0.10), transparent 45%),
    radial-gradient(ellipse at 12% 22%, rgba(88, 101, 242, 0.14), transparent 50%),
    linear-gradient(180deg, #1a0508 0%, #130a0e 45%, #2c1622 100%);
  box-shadow: var(--elevation-4);
}
.hero-moon {
  position: absolute; top: 8%; right: 10%;
  width: 96px; height: 96px; border-radius: 50%;
  background: radial-gradient(circle at 34% 34%, #fde68a, #f59e0b 62%, #b45309);
  box-shadow: 0 0 60px rgba(224, 165, 58, 0.45), 0 0 140px rgba(224, 165, 58, 0.18);
  opacity: 0.92;
}
.hero-cards { position: absolute; inset: 0; pointer-events: none; }
.hero-card {
  position: absolute;
  height: 190px; width: auto; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  opacity: 0.88;
  animation: hero-float 5.5s ease-in-out infinite;
}
.hc-1 { left: 5%; top: 16%; transform: rotate(-11deg); }
.hc-2 { right: 7%; bottom: 12%; transform: rotate(10deg); animation-delay: 1.4s; }
.hc-3 { right: 20%; top: 9%; transform: rotate(6deg); height: 140px; animation-delay: 2.6s; }
@keyframes hero-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -12px; }
}
.hero-inner {
  position: relative; z-index: 2;
  max-width: 640px; text-align: center;
  padding: 40px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  animation: card-in 400ms ease-out;
}
.hero-title {
  margin: 0;
  font-size: clamp(42px, 8vw, 76px);
  font-weight: 800; letter-spacing: 6px;
  color: #fff;
  text-shadow: 0 0 34px rgba(123, 31, 162, 0.9), 0 4px 22px rgba(0, 0, 0, 0.6);
}
.hero-sub {
  margin: 0;
  font-size: clamp(15px, 2.4vw, 19px);
  color: #d4d4e8;
}
.btn-hero {
  min-height: 52px; padding: 14px 44px;
  font-size: 18px; font-weight: 700;
  margin-top: 8px;
  box-shadow: 0 10px 30px rgba(88, 101, 242, 0.45);
}
.hero-features {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 18px; justify-content: center;
}
.hero-features span {
  font-size: 13px; color: #c4b5fd;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid rgba(196, 181, 253, 0.35);
  background: rgba(123, 31, 162, 0.18);
}
@media (max-width: 640px) {
  .hero-card { height: 120px; opacity: 0.55; }
  .hero-moon { width: 64px; height: 64px; top: 5%; right: 6%; }
}

/* ---------- P4 弹窗（创建房间 / 回放） ---------- */
.modal {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(10, 4, 8, 0.78);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    }
.modal[hidden] { display: none !important; }
[hidden] { display: none !important; }
.modal-card {
  width: 100%; max-width: 460px; max-height: 86vh; overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--elevation-4);
  animation: modal-up 220ms ease-out;
}
.modal-title { margin: 0 0 10px; font-size: 20px; }
.modal-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.timing-presets { display: flex; gap: 8px; margin-bottom: 12px; }
.timing-preset {
  flex: 1; min-height: 44px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-secondary); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer;
  transition: background var(--dur), border-color var(--dur);
}
.timing-preset:hover { background: var(--bg-tertiary); }
.timing-preset.active {
  background: var(--bg-tertiary); color: var(--accent);
  border-color: var(--accent);
}
.timing-inputs { display: flex; gap: 8px; }
.timing-inputs label { flex: 1; font-size: 12px; color: var(--muted); }
.timing-inputs input { margin: 4px 0 8px; min-width: 0; }
.modal .action-row { margin-top: 6px; }
.modal .action-row .btn { flex: 1; }
#create-err { margin: 6px 0 0; }

/* ---------- P4 对局回放时间线（按天分组，借鉴 nakama ReplayPanel） ---------- */
.replay-card { max-width: 560px; }
.replay-timeline {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 60vh; overflow-y: auto;
}
.replay-day {
  font-size: 14px; font-weight: 700; color: var(--accent);
  padding: 4px 2px;
  border-bottom: 1px solid var(--border);
}
.replay-group {
  display: flex; flex-direction: column; gap: 4px;
  border-left: 2px solid rgba(224, 165, 58, 0.4);
  padding-left: 10px; margin-left: 4px;
}
.replay-line {
  font-size: 13px; line-height: 1.5;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
}
.replay-line:hover { background: rgba(255, 255, 255, 0.06); }

/* ===== P6-fix 可读性大修：身份揭示 / 上警状态 / 发言顺序 / 日志区隔 ===== */
/* 身份揭示全屏动画（开局即揭示：立绘 + 大字 + 阵营底色） */
.role-reveal {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 8, 18, 0.9);
  opacity: 0; transition: opacity 0.3s ease;
  pointer-events: auto;
}
.role-reveal.show { opacity: 1; }
.role-reveal.fac-wolf { background: linear-gradient(160deg, rgba(80, 8, 14, 0.94), rgba(20, 6, 10, 0.95)); }
.role-reveal.fac-god { background: linear-gradient(160deg, rgba(10, 30, 70, 0.94), rgba(6, 12, 28, 0.95)); }
.role-reveal.fac-villager { background: linear-gradient(160deg, rgba(8, 52, 34, 0.94), rgba(6, 18, 14, 0.95)); }
.rr-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  animation: rr-in 0.5s ease;
}
@keyframes rr-in {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.rr-img { width: 150px; height: 210px; object-fit: cover; border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6); }
.rr-fallback {
  width: 150px; height: 210px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 64px; font-weight: 700; color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.rr-label { color: rgba(255, 255, 255, 0.7); font-size: 15px; letter-spacing: 2px; }
.rr-name { color: #fff; font-size: 42px; font-weight: 700; letter-spacing: 4px; }
.rr-fac { color: var(--accent); font-size: 15px; font-weight: 600; }
.rr-close {
  position: absolute; top: 18px; right: 22px;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.08);
  color: #fff; font-size: 18px; cursor: pointer;
}
/* 上警状态面板 */
.camp-status {
  display: flex; flex-direction: column; gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 8px;
  width: 100%; max-width: 640px;
}
.cs-row { font-size: 14px; }
.cs-label { color: rgba(255, 255, 255, 0.55); margin-right: 6px; }
.cs-val { color: var(--accent); font-weight: 600; }
.cs-badge {
  align-self: flex-start;
  background: rgba(34, 197, 94, 0.15); color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: 999px; padding: 3px 12px;
  font-size: 13px; font-weight: 700;
}
/* 白天发言顺序前置展示 */
.order-panel {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 8px;
  width: 100%; max-width: 640px;
}
.op-head { font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 6px; }
.op-list { display: flex; flex-wrap: wrap; gap: 6px; }
.op-item {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; padding: 3px 10px;
  border-radius: 999px; border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}
.op-item.current { border-color: var(--accent); background: rgba(224, 165, 58, 0.12); }
.op-item.mine { border-color: rgba(59, 130, 246, 0.6); }
.op-idx { color: rgba(255, 255, 255, 0.45); }
.op-name { font-weight: 600; }
.op-flag { color: var(--accent); font-size: 12px; font-weight: 700; }
/* 事件日志重要事件颜色区隔（P6 华丽化） */
.log-line.log-death { color: #f87171; }
.log-line.log-dawn { color: #fbbf24; }
.log-line.log-sheriff { color: #facc15; font-weight: 600; }
.log-line.log-over { color: var(--accent); font-weight: 700; }

/* ===== P9-T2 DC 票型卡（公屏：票型明细 + 计票票型条） ===== */
.vote-card {
  border: 1px solid rgba(224, 165, 58, 0.45);
  border-radius: 10px;
  background: rgba(224, 165, 58, 0.06);
  padding: 8px 12px;
}
.vote-card.sheriff {
  border-color: rgba(250, 204, 21, 0.6);
  background: rgba(250, 204, 21, 0.07);
}
.vote-card .vc-title {
  font-size: 14px; font-weight: 700; margin-bottom: 4px;
}
.vote-card .vc-ballots, .vote-card .vc-counts {
  margin: 4px 0 0; padding: 0;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px; line-height: 1.7; white-space: pre-wrap; color: #E5E7EB;
}
.vote-card .vc-ballots { color: #C4B5FD; }
.vote-card .vc-counts { color: var(--accent); }

/* ===== P9-T2 排行榜/段位榜页面 ===== */
.lb-title { margin: 0; font-size: 20px; }
.lb-body { max-width: 680px; margin: 16px auto; padding: 0 4px; }
.lb-list, .tier-list { display: flex; flex-direction: column; gap: 8px; }
.lb-empty {
  color: #c4adad; font-size: 14px; text-align: center; padding: 32px 0;
  opacity: 0.85;
}
.lb-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--elevation-1);
  transition: border-color var(--dur), box-shadow var(--dur);
}
.lb-row:hover { border-color: var(--border-strong); box-shadow: var(--elevation-2); }
.lb-rank {
  min-width: 2.2em; width: 34px; flex: none; text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 800; font-size: 16px; color: var(--accent);
}
.lb-name { font-weight: 600; margin-right: auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-tier { font-size: 13px; color: #C4B5FD; flex: none; }
.lb-meta { font-size: 12px; color: #c4adad; flex: none; }
.lb-score {
  font-weight: 800; font-size: 18px; color: var(--accent); flex: none;
  min-width: 52px; text-align: right;
}
.tier-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--elevation-1);
}
.tier-badge { font-size: 24px; flex: none; }
.tier-name { font-weight: 700; font-size: 16px; }
.tier-threshold { margin-left: auto; font-size: 13px; color: var(--muted); }
/* 页面切换导航 */
.view-nav { display: flex; gap: 4px; }
.nav-btn { opacity: 0.7; }
.nav-btn.active {
  opacity: 1; color: var(--accent); border-color: var(--accent);
  background: rgba(224, 165, 58, 0.10);
}
.cs-val.sheriff { color: #facc15; }
.cs-badge.sheriff {
  background: rgba(250, 204, 21, 0.15); color: #facc15;
  border: 1px solid rgba(250, 204, 21, 0.45);
}

/* ===== P9-T2 手机端全面适配（≤768px 系统性断点） =====
   席位 2 列 / 公屏高度自适应 / 动作区不遮挡 / 面板全宽 / 触控 ≥44px / 禁横向滚动 */
@media (max-width: 768px) {
  body { overflow-x: hidden; }
  /* P10 修复：游戏视图恢复自然滚动——原 overflow:hidden 满屏 flex 布局
     在窄屏单列堆叠时会把公屏/发言/竞选面板裁掉（看不到公屏的根因） */
  #view-game.active { height: auto; min-height: 100dvh; overflow: visible; }
  .view { padding: 4px; }
  /* 顶栏：换行不溢出，字号收紧 */
  .topbar { padding: 6px 4px; gap: 6px; }
  .game-title { font-size: 15px; }
  .view-nav { order: 3; width: 100%; justify-content: center; }
  .nav-btn { flex: 1; }
  /* 席位网格：小屏 2 列，卡内布局收紧 */
  .seat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px; max-height: none; flex: none;
  }
  .seat { padding: 8px; gap: 8px; min-height: 56px; }
  .seat .speak-flag { font-size: 10px; top: -7px; }
  /* 席位环图收紧 */
  .seat-ring-img { margin-bottom: 6px; }
  /* 公屏流：固定可读高度（不再 flex 撑满被裁） */
  .game-main { min-height: 0; }
  .event-log { margin-top: 6px; min-height: 200px; max-height: 60vh;
    flex: none; padding: 6px 8px; }
  .log-line { font-size: 13px; padding: 6px 8px; }
  .log-announce { font-size: 14px; padding: 7px 10px; }
  /* 双栏 → 单列：侧面板全宽抽屉化 */
  .game-columns { flex-direction: column; height: auto; }
  .game-main { min-height: 48vh; }
  .side-panels { width: 100%; max-height: none; }
  .glass-panel { max-height: 300px; }
  /* 动作区：改文档流尾部（不再 fixed 悬浮遮挡），输入 44px 保持触控目标 */
  .game-body { overflow: visible; padding-bottom: 12px; flex: none; }
  .action-area { position: static; max-height: none; overflow: visible;
    padding: 8px 6px; gap: 6px; }
  .turn-pill.mine { font-size: 18px; padding: 10px 18px; }
  /* P10 修复：身份卡过曝防御——iOS Safari backdrop-filter 在渐变底上
     会渲染成整块白（白成一团），小屏一律实底 + 去 blur */
  .role-card { -webkit-backdrop-filter: none; backdrop-filter: none;
    background-color: #1a0c12; }
  .action-area { -webkit-backdrop-filter: none; backdrop-filter: none;
    background: #200d14; }
  .glass-panel, .modal-card { -webkit-backdrop-filter: none; backdrop-filter: none; }
  body.day { background: var(--bg); }
  /* 身份卡/夜晚私屏：小屏字号缩放 */
  .role-card { margin: 4px; padding: 8px 12px; gap: 8px; }
  .role-img, .night-card-img, .night-card-img.night-img-fallback {
    height: 52px;
  }
  .role-name { font-size: 20px; }
  .night-card-name { font-size: 22px; }
  .night-card { padding: 10px 14px; gap: 10px; }
  /* 结算/票型卡/弹窗：小屏字号 */
  .settle-banner { font-size: 22px; padding: 12px 8px; }
  .vote-card .vc-ballots, .vote-card .vc-counts { font-size: 12px; }
  .modal { padding: 8px; align-items: flex-end; }
  .modal-card { max-height: 82vh; padding: 14px; }
  /* 排行榜行：小屏收紧不溢出 */
  .lb-row { padding: 10px; gap: 8px; }
  .lb-meta { display: none; }
  .lb-score { font-size: 16px; min-width: 40px; }
  /* 落地页 Hero：小屏标题缩放（clamp 已有，卡片/月亮再收） */
  .hero-inner { padding: 24px 12px; gap: 10px; }
  .hero-card { height: 96px; opacity: 0.45; }
  .hc-3 { display: none; }
  .hero-moon { width: 52px; height: 52px; top: 4%; right: 5%; }
  .btn-hero { min-height: 48px; padding: 12px 32px; font-size: 16px; }
  /* 大字横幅（终局）：小屏缩放 */
  /* 房间行 */
  .room-row { padding: 10px; }
  .toast { font-size: 13px; max-width: 94vw; }
}
/* 超窄屏（≤380px）：席位保持 2 列不横向滚动 */
@media (max-width: 380px) {
  .seat-grid { grid-template-columns: repeat(2, 1fr); }
  .seat-name { font-size: 13px; }
  .lb-name { max-width: 30vw; }
}

/* ===== P10 广场（教程/板子/图鉴/全员聊天） ===== */
.plaza-body { padding: 8px; }
.plaza-columns { display: flex; gap: 8px; align-items: flex-start; }
.plaza-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.plaza-side { width: 300px; flex: none; display: flex; flex-direction: column; gap: 8px; }
.plaza-panel { max-height: calc(100vh - 170px); overflow-y: auto; padding: 12px; }
.pg-head { font-size: 20px; font-weight: 800; margin-bottom: 12px;
  background: linear-gradient(90deg, #ff6b6b, var(--accent) 55%, #ffb3b3);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.pg-card { background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 8px;
  transition: border-color var(--dur), transform var(--dur); }
.pg-card:hover { border-color: rgba(224, 165, 58, 0.45); transform: translateY(-1px); }
.pg-title { font-size: 15px; font-weight: 700; color: var(--accent); margin-bottom: 5px; }
.pg-body { font-size: 14px; line-height: 1.65; color: var(--text); }
.pg-foot { font-size: 12px; color: var(--muted); font-style: italic; margin-top: 10px; }
.pb-row { display: grid; grid-template-columns: 56px 52px 1fr 56px 64px;
  gap: 8px; padding: 9px 10px; font-size: 13px; border-radius: 10px;
  align-items: center; }
.pb-row:nth-child(odd):not(.pb-head) { background: rgba(255, 255, 255, 0.03); }
.pb-row.pb-head { font-weight: 700; color: var(--muted); font-size: 12px; }
.pb-wolf { color: var(--danger); font-weight: 700; }
.pb-rand { color: #c4b5fd; font-size: 11px; }
.rg-camp { margin-bottom: 14px; }
.rg-camp-title { font-size: 15px; font-weight: 700; color: var(--accent);
  margin: 10px 0 8px; }
.rg-card { background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; }
.rg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.rg-emoji { font-size: 18px; }
.rg-name { font-size: 15px; font-weight: 700; }
.rg-skill { font-size: 13px; line-height: 1.6; }
.rg-tips { font-size: 12px; color: var(--accent); margin-top: 4px; opacity: 0.9;
  padding-left: 10px; border-left: 2px solid rgba(224, 165, 58, 0.4); }
.plaza-chat-log { height: calc(100vh - 250px); min-height: 240px;
  overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.pc-line { font-size: 13px; padding: 6px 9px; border-radius: 9px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border);
  line-height: 1.5; }
.pc-line.own { background: rgba(46, 125, 50, 0.16); border-color: rgba(61, 155, 67, 0.4); }
.pc-name { font-weight: 700; margin-right: 6px; }
.pc-text { word-break: break-word; }
/* 广场聊天行（公屏日志复用 log-chat 样式） */
.log-line.log-chat { background: rgba(88, 101, 242, 0.10);
  border-color: rgba(88, 101, 242, 0.35); }
/* P10 狼刀回执行（仅狼队可见，狼红底） */
.log-line.log-wolf-relay { background: rgba(179, 18, 31, 0.12);
  border-color: rgba(179, 18, 31, 0.4); }
/* P10 竞选警长高亮徽标（金色，座位右上） */
.speak-flag.cand-flag { background: var(--accent); color: #1a0c12;
  right: auto; left: 8px; }

/* 终局横幅关闭钮（P10）：全屏 end-banner 层删除后 .eb-close 一并清理 */

/* ===== P11 新组件（JS 侧生成结构，类名契约） ===== */
/* 天气横条（游戏头部）：左天数 / 中天气 / 右效果说明 */
.weather-banner {
  display: flex; align-items: center; gap: 12px;
  margin: 8px 0; padding: 10px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(122, 22, 48, 0.35), rgba(19, 10, 14, 0.85));
  border: 1px solid var(--accent);
  box-shadow: var(--elevation-1);
}
.weather-day {
  font-size: 20px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent); white-space: nowrap;
}
.weather-name { font-size: 16px; font-weight: 700; color: var(--text); white-space: nowrap; }
.weather-effect { font-size: 12px; color: #c4adad; line-height: 1.5; margin-left: auto; text-align: right; }
/* 折叠技能组（<details>） */
.skill-fold { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.skill-fold > summary {
  list-style: none; cursor: pointer;
  min-height: 44px; display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; font-weight: 600;
  background: var(--bg-secondary);
}
.skill-fold > summary::-webkit-details-marker { display: none; }
.skill-fold > summary::after {
  content: "▸"; margin-left: auto; color: var(--accent);
  transition: transform var(--dur);
}
.skill-fold[open] > summary::after { transform: rotate(90deg); }
.skill-fold > summary:hover { background: var(--bg-tertiary); }

@media (max-width: 768px) {
  .weather-banner { flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 10px; }
  .weather-effect { margin-left: 0; text-align: left; }
}

/* 板子表格超窄屏：只留 序号+名称 两列 */
@media (max-width: 480px) {
  .pb-row { grid-template-columns: 56px 1fr; grid-auto-rows: auto; }
}


@media (max-width: 768px) {
  .plaza-columns { flex-direction: column; }
  .plaza-side { width: 100%; }
  .plaza-panel { max-height: none; }
  .plaza-chat-log { height: 40vh; }
  .pb-row { grid-template-columns: 48px 40px 1fr 40px 52px; font-size: 12px; }
  .board-banner { font-size: 11px; padding: 4px 8px; }
}

/* ===== P12b 聊天气泡（玩家发言与系统通报明确区分） ===== */
.chat-msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  font-size: 13px;
  line-height: 1.45;
  max-width: 100%;
}

/* 名字徽标：小型胶囊（底色随玩家色相 inline，边框走 token） */
.chat-msg .chat-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 1px 8px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  white-space: nowrap;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 气泡：圆角面板底色 + 左侧轻微色条 */
.chat-msg .chat-bubble {
  padding: 6px 10px;
  border-radius: 4px 12px 12px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  color: var(--text);
  word-break: break-word;
  max-width: 100%;
  box-shadow: var(--elevation-1);
}

/* 自己的发言：右对齐 + 金边 + 特殊底色 */
.chat-msg.mine { align-items: flex-end; text-align: right; }
.chat-msg.mine .chat-bubble {
  border-radius: 12px 4px 12px 12px;
  border: 1px solid var(--accent-dim);
  border-right: 3px solid var(--accent);
  background: var(--bg-tertiary);
}

/* 渠道色条变体（全部走现有 token，不引入新色系） */
.chat-msg.chan-wolf .chat-bubble {
  border-left-color: var(--blood);
  background: rgba(139, 0, 0, 0.35);
}
.chat-msg.chan-grave .chat-bubble {
  border-left-color: var(--night-purple);
  background: rgba(122, 22, 48, 0.30);
}
.chat-msg.chan-spec .chat-bubble {
  border-left-color: var(--discord);
  background: rgba(88, 101, 242, 0.14);
}
.chat-msg.chan-plaza .chat-bubble {
  border-left-color: var(--primary);
  background: rgba(46, 125, 50, 0.14);
}

/* 系统「轮到 X 发言」通报：比气泡更小更灰更「系统」，拉开视觉距离 */
.log-line.log-turn {
  font-size: 12px;
  color: var(--muted);
  padding: 2px 10px;
}

@media (max-width: 768px) {
  .chat-msg { max-width: 100%; }
  .chat-msg .chat-bubble { max-width: 86vw; padding: 5px 9px; }
  .chat-msg .chat-name { font-size: 10px; padding: 1px 6px; flex-shrink: 0; max-width: 50vw; }
  .log-line.log-turn { font-size: 11px; }
}

/* P12c 死亡通告（.log-major.death 红色强调，文案「☠ X 死亡（死因）」） */
.log-line.log-major.death {
  color: #f87171;
  background: rgba(255, 71, 87, 0.1);
  border-color: rgba(255, 71, 87, 0.55);
  border-left: 4px solid var(--danger);
  text-shadow: 0 0 16px rgba(255, 71, 87, 0.35);
}
.log-line.log-major.death .speaker { font-weight: 800; }

/* P12c 观战频道空状态占位（复用 grave-empty 基础样式） */
.spec-empty { color: #c4adad; font-size: 13px; text-align: center; padding: 16px 0; }

/* P12c 段位榜档内玩家行（在档位名下缩进排列） */
.tier-player { padding-left: 38px; font-size: 13px; }
