/* ============================================================
   阿瓦隆 · 发牌助手 —— H5 样式
   设计定位：移动端优先 · Operate 模式
   - 浅色底 + 白色卡片 + 蓝/红阵营色，克制、清晰、拇指可达
   - 主操作按钮全宽置底，流程步骤条明示当前阶段
   - 仅使用系统字体；图标统一 1.8 线宽 SVG
   ============================================================ */

:root {
  /* 颜色 */
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #6b6e76;
  --line: rgba(28, 28, 30, .10);
  --line-soft: rgba(28, 28, 30, .06);
  --accent: #0a6cff;
  --accent-deep: #0055d8;
  --accent-soft: rgba(10, 108, 255, .10);
  --good: #1769e0;            /* 好人 · 蓝方 */
  --good-deep: #0f4fb3;
  --good-soft: rgba(23, 105, 224, .10);
  --evil: #d5382f;            /* 坏人 · 红方 */
  --evil-deep: #b0231c;
  --evil-soft: rgba(213, 56, 47, .10);
  --flower: #b63c75;
  --egg: #8a6515;

  /* 间距节奏（4 的倍数） */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;

  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(20, 24, 34, .04), 0 8px 24px rgba(20, 24, 34, .08);
  --shadow-sm: 0 1px 2px rgba(20, 24, 34, .05);
  --shadow-md: 0 2px 8px rgba(20, 24, 34, .06), 0 14px 34px rgba(20, 24, 34, .09);
  --grad-brand: linear-gradient(135deg, #0a6cff 0%, #5b8cff 100%);
  --grad-good: linear-gradient(135deg, #1769e0 0%, #4a8df0 100%);
  --grad-evil: linear-gradient(135deg, #d5382f 0%, #e5736a 100%);
  --t-fast: .15s;
  --t-med: .25s;
  --nav-h: 58px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, rgba(10, 108, 255, .08), transparent 34rem),
    radial-gradient(circle at 100% 25%, rgba(213, 56, 47, .04), transparent 28rem),
    var(--bg);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
        "Helvetica Neue", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

button, input, select, textarea { font: inherit; }
button, a { touch-action: manipulation; }
::selection { background: rgba(10, 108, 255, .16); }
:focus-visible { outline: 3px solid rgba(10, 108, 255, .38); outline-offset: 2px; }

.page {
  width: min(100%, 640px);
  min-height: 100vh;
  margin: 0 auto;
  padding: var(--s4) var(--s4) calc(var(--nav-h) + 40px + env(safe-area-inset-bottom));
  animation: page-in .24s ease-out;
}
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ============ 基础排版 ============ */
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: clamp(25px, 6vw, 31px); line-height: 1.18; }
h2 { font-size: 16.5px; line-height: 1.35; font-weight: 750; }
h3 { font-size: 15.5px; line-height: 1.4; font-weight: 750; }
p { margin: var(--s2) 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; line-height: 1.6; }
.hint { margin: var(--s2) 0 var(--s3); color: var(--muted); font-size: 12.5px; line-height: 1.65; }
.notice {
  margin: var(--s2) 0 var(--s3);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: rgba(107, 110, 118, .08);
  font-size: 12.5px;
}

/* ============ 首页 ============ */
.hero { padding: 26px 4px var(--s5); text-align: center; }
.hero h1 {
  margin: 2px 0 6px;
  background: linear-gradient(135deg, #0a6cff, #7a5cff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .muted { font-size: 13px; margin-top: 0; }
.home-hero { padding-top: 34px; }
.home-room-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
}
.home-room-head h2 { margin: 0; }
.reset-all-rooms-btn {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid rgba(213, 56, 47, .28);
  border-radius: 999px;
  color: var(--evil-deep);
  background: rgba(213, 56, 47, .055);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.reset-all-rooms-btn:active { transform: scale(.97); background: rgba(213, 56, 47, .11); }

.room-list { display: grid; gap: var(--s3); margin-top: var(--s3); }
.room-entry {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px var(--s3);
  align-items: center;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--text);
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-med), border-color var(--t-fast);
}
.room-entry:active { transform: scale(.985); box-shadow: var(--shadow-sm); }
.room-entry-icon {
  display: inline-flex;
  width: 40px;
  height: 40px;
  grid-row: 1 / 3;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
}
.room-entry-icon .ic { width: 20px; height: 20px; }
.room-entry-name { font-size: 16px; font-weight: 750; }
.room-entry-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 13px;
  border-radius: 999px;
  color: #fff;
  background: var(--grad-brand);
  box-shadow: 0 4px 10px rgba(10, 108, 255, .22);
  font-weight: 700;
  font-size: 13px;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.room-entry:active .room-entry-cta { transform: scale(.96); box-shadow: 0 2px 6px rgba(10, 108, 255, .16); }
.room-entry-cta .ic { width: 15px; height: 15px; }
.room-entry-hint { grid-column: 2 / -1; color: var(--muted); font-size: 12px; }

/* ============ 卡片 ============ */
.card, .role-card {
  position: relative;
  margin: var(--s3) 0;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  transition: box-shadow var(--t-med), transform var(--t-fast);
}
.card + .card { margin-top: var(--s3); }
a.card { display: block; color: var(--text); text-decoration: none; }
a.card:active { transform: scale(.99); }
.form-card { padding: 20px 18px; }

.loading-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 120px;
  color: var(--muted);
}
.loading-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .loading-dot { animation: none; } }

/* ============ 房间页 ============ */
.room-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s4) var(--s2) var(--s3);
}
.room-header > div { min-width: 0; }
.room-header h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(22px, 6vw, 27px); }
.room-code { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.room-code-value { color: var(--accent); font-weight: 850; }
.room-exit-btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid rgba(213, 56, 47, .25);
  border-radius: 999px;
  color: var(--evil-deep);
  background: rgba(213, 56, 47, .06);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.room-exit-btn:active { transform: scale(.97); background: rgba(213, 56, 47, .12); }
.room-more-btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, .78);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.room-more-btn:active { transform: scale(.97); background: rgba(107, 110, 118, .10); }

/* 流程步骤条 */
.flow-steps {
  display: flex;
  gap: var(--s2);
  margin: 0 0 var(--s4);
  padding: 0;
  list-style: none;
}
.flow-steps li {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-height: 34px;
  justify-content: center;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(107, 110, 118, .08);
  font-size: 12px;
  font-weight: 650;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.flow-steps li.current {
  color: #fff;
  background: var(--grad-brand);
  box-shadow: 0 4px 12px rgba(10, 108, 255, .28);
  font-weight: 800;
}
.flow-steps li.done { color: var(--good-deep); background: var(--good-soft); font-weight: 700; }
.flow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .55;
}
.flow-steps li.current .flow-dot { opacity: .9; }

.count-pill {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(107, 110, 118, .10);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.count-pill { margin-left: var(--s3); vertical-align: 2px; }
.count-line { margin: var(--s2) 0 var(--s3); color: var(--muted); font-size: 13px; }
.count-line b { color: var(--text); font-weight: 800; }
.members,  .ranking-list  { margin: 0; padding: 0; list-style: none; }
.members li {
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--line-soft);
}
.members li:last-child { border-bottom: 0; }
.player-number {
  display: inline-flex;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text);
  background: rgba(107, 110, 118, .11);
  font-size: 14px;
  font-weight: 800;
}
.members li.me .player-number { color: #fff; background: var(--accent); }
.player-name { flex: 1; }
.members li.me .player-name { color: var(--accent); font-weight: 700; }

/* ============ 身份卡 ============ */
.role-card { padding: 26px 18px 22px; text-align: center; overflow: hidden; }
.role-card.good, .role-card.evil {
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}
.role-card.good { background: linear-gradient(180deg, rgba(23, 105, 224, .07), #fff 62%); }
.role-card.evil { background: linear-gradient(180deg, rgba(213, 56, 47, .06), #fff 62%); }
.role-card.good .role-name { color: #fff; background: var(--grad-good); box-shadow: 0 6px 14px rgba(23, 105, 224, .3); }
.role-card.evil .role-name { color: #fff; background: var(--grad-evil); box-shadow: 0 6px 14px rgba(213, 56, 47, .3); }
.role-name {
  width: fit-content;
  max-width: 100%;
  margin: var(--s1) auto var(--s3);
  padding: 7px 18px;
  border-radius: 12px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: .03em;
}
.role-card .tag { position: relative; top: -3px; }
.role-dealt-time { width: fit-content; margin: var(--s2) auto 0; padding: 4px 9px; border-radius: 999px; color: var(--muted); background: rgba(107, 110, 118, .08); font-size: 11px; }
.role-desc { margin: var(--s3) auto 0; max-width: 30rem; color: var(--muted); font-size: 13px; line-height: 1.65; }
.clue-numbers { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2); margin: var(--s3) 0 var(--s1); }
.clue-numbers span {
  min-width: 46px;
  padding: 8px 14px;
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
  color: var(--accent-deep);
}
/* 身份卡：大字号排版（方便老年人阅读） */
.role-card.compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--s3) var(--s4);
  padding: 20px 14px;
  text-align: left;
}
.role-identity-main { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--s3) var(--s4); min-width: 0; }
.role-card.compact .role-name { flex: 0 0 auto; margin: 0; padding: 10px 24px; font-size: 36px; line-height: 1.2; white-space: nowrap; }
.role-card.compact .role-dealt-time { margin: 0; padding: 0; border-radius: 0; background: transparent; color: var(--muted); font-size: 14px; line-height: 1.4; }
.role-card.compact .role-dealt-time strong { display: block; margin-top: 3px; color: var(--text); font-size: 21px; font-weight: 800; letter-spacing: .02em; }
.role-visible-numbers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--s2) var(--s3);
  width: 100%;
  padding: var(--s3) 0 0;
  border-top: 1px dashed var(--line);
}
.role-visible-numbers > small { flex: 0 0 auto; color: var(--muted); font-size: 14px; font-weight: 600; }
.role-card.compact .clue-numbers { flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; }
.role-card.compact .clue-numbers span { min-width: 50px; padding: 10px 18px; font-size: 18px; text-align: center; }
.role-view-waiting { margin: var(--s3) 0 0; color: var(--muted); font-size: 13px; }

/* 阵营标签 */
.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 750;
}
.tag.good { color: var(--good-deep); background: var(--good-soft); }
.tag.evil { color: var(--evil-deep); background: var(--evil-soft); }

/* ============ 按钮（主操作全宽，层级清晰） ============ */
.btn {
  display: inline-flex;
  min-height: 50px;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  margin-top: var(--s2);
  padding: 11px 16px;
  border: 0;
  border-radius: 13px;
  color: var(--text);
  background: rgba(107, 110, 118, .09);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast), color var(--t-fast), opacity var(--t-fast);
}
.btn:active:not(:disabled) { transform: scale(.985); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary {
  color: #fff;
  background: var(--grad-brand);
  box-shadow: 0 6px 16px rgba(10, 108, 255, .26);
}
.btn.primary:active:not(:disabled) { background: var(--accent-deep); box-shadow: 0 3px 10px rgba(10, 108, 255, .2); }
.btn.secondary { color: var(--accent); background: var(--accent-soft); }
.btn.secondary:active:not(:disabled) { background: rgba(10, 108, 255, .16); }
.btn.ghost { color: var(--muted); background: rgba(107, 110, 118, .08); }
.btn.text {
  min-height: 46px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-weight: 650;
}
.btn-row { display: flex; gap: var(--s2); }
.btn-row .btn { flex: 1; margin-top: 0; }
.form-label { margin: var(--s3) 0 var(--s2); color: var(--muted); font-size: 13px; font-weight: 650; }
.action-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
}
.action-card-head h2 { flex: 0 0 auto; margin: 0; }
.action-card-tools { display: flex; min-width: 0; flex: 1 1 auto; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.deal-auto-quick {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
}
.deal-auto-quick:active:not(:disabled) { color: var(--accent-deep); border-color: rgba(10, 108, 255, .28); background: var(--accent-soft); transform: scale(.97); }
.deal-auto-quick:disabled { opacity: .42; cursor: default; }
.test-players-btn {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(10, 108, 255, .22);
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.test-players-btn:active:not(:disabled) { transform: scale(.97); background: var(--accent-deep); }
.test-players-btn:disabled { opacity: .42; cursor: default; }
.deal-primary-action { margin-top: var(--s3); }
.deal-primary-action .btn { margin-top: 0; }
.mission-result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.mission-result-btn {
  min-height: 58px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.3;
  cursor: pointer;
}
.mission-result-btn:active { transform: scale(.985); }
.mission-result-btn.good { color: var(--good-deep); border-color: rgba(23, 105, 224, .35); background: var(--good-soft); }
.mission-result-btn.evil { color: var(--evil-deep); border-color: rgba(213, 56, 47, .32); background: var(--evil-soft); }
.mission-result-btn.evil.selected { color: #fff; border-color: var(--evil); background: var(--evil); }
.mission-result-btn.good.selected { color: #fff; border-color: var(--good); background: var(--good); }
.assassin-target-box { margin-top: var(--s3); padding: 10px 12px 0; border: 1px solid rgba(23, 105, 224, .22); border-radius: 12px; background: var(--good-soft); }
.assassin-target-box label { margin-top: 0; color: var(--good-deep); }
.action-card, .settle-card { background: linear-gradient(180deg, #f7faff, #ffffff 55%); }
.host-guide {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: var(--s3);
  padding: 10px 12px;
  border: 1px dashed rgba(10, 108, 255, .28);
  border-radius: 11px;
  background: rgba(10, 108, 255, .045);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
}
.host-guide strong { color: var(--accent-deep); font-size: 12px; }

/* ============ 表单 ============ */
/*
 * font-size 必须 ≥ 16px：iOS Safari / 微信内置浏览器在聚焦字号小于 16px 的
 * 表单控件时，会把整个页面自动放大（点管理员密码框时页面突然变大的原因）。
 * body 是 15px，控件 `font: inherit` 会继承成 15px，所以这里显式兜回 16px。
 * 需要更小字号的控件（下拉框等）自行覆盖，但会重新触发放大，非必要不要调小。
 */
input, select, textarea {
  width: 100%;
  min-height: 48px;
  margin: var(--s1) 0 var(--s3);
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  color: var(--text);
  background: rgba(255, 255, 255, .95);
  font-size: 16px;
}
textarea { min-height: 104px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(10, 108, 255, .12);
}
input:disabled, select:disabled { opacity: .55; background: rgba(107, 110, 118, .06); }
label { display: block; margin-top: var(--s3); color: var(--muted); font-size: 13px; font-weight: 650; }

/* ============ 历史对局 ============ */
.game-list { display: grid; gap: var(--s2); }
/* 历史红蓝胜率 PK */
.faction-pk { margin-top: 4px; }
.faction-pk-head { display: flex; align-items: center; justify-content: space-between; }
.history-menu { padding: 0; overflow: hidden; }
.history-menu > summary, .game-accordion > summary {
  list-style: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.history-menu > summary::-webkit-details-marker, .game-accordion > summary::-webkit-details-marker { display: none; }
.history-menu > summary {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: 14px 16px;
}
.history-menu > summary > span:first-child strong, .history-menu > summary > span:first-child small { display: block; }
.history-menu > summary > span:first-child small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.history-menu-body { padding: 0 10px 12px; border-top: 1px solid var(--line-soft); }
.history-menu[open] > summary, .game-accordion[open] > summary { background: var(--accent-soft); }
.accordion-chevron { display: inline-flex; flex: 0 0 auto; color: var(--muted); transition: transform .18s; }
.accordion-chevron .ic { width: 17px; height: 17px; }
.history-menu[open] > summary .accordion-chevron, .game-accordion[open] > summary .accordion-chevron { transform: rotate(90deg); }
.history-games-section { margin-top: var(--s5); }
.history-section-title { display: flex; align-items: center; justify-content: space-between; margin: 0 3px var(--s2); }
.history-section-title > span { color: var(--muted); font-size: 12px; }
.game-accordion { margin: 0; padding: 0; overflow: hidden; }
.game-summary {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(110px, auto) auto 18px;
  align-items: center;
  gap: var(--s2);
  min-height: 78px;
  padding: 12px 14px;
}
.game-summary-main { min-width: 0; }
.game-summary-main .chip { margin: 5px 0 0; }
.game-summary-meta strong, .game-summary-meta small { display: block; text-align: right; }
.game-summary-meta strong { font-size: 12px; }
.game-summary-meta small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.game-summary-votes { color: var(--muted); font-size: 11px; white-space: nowrap; }
.game-summary-votes .ic { width: 12px; height: 12px; }
.game-accordion-body { padding: 12px; border-top: 1px solid var(--line-soft); background: rgba(107, 110, 118, .025); }
.history-my-result, .history-assassin { padding: 9px 10px; border-radius: 10px; font-size: 12px; }
.history-my-result { margin-bottom: var(--s2); background: rgba(107, 110, 118, .07); }
.history-my-result.win { color: var(--good-deep); background: var(--good-soft); }
.history-my-result.lose { color: var(--evil-deep); background: var(--evil-soft); }
.history-assassin { margin-bottom: var(--s2); background: #fff; }
.history-player-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.history-player-row {
  display: flex;
  min-width: 0;
  min-height: 78px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 3px;
  border-radius: 9px;
  background: #fff;
  text-align: center;
}
.history-player-row.me { box-shadow: inset 3px 0 var(--accent); }
/* 对局记录展开：按阵营红蓝标注。用 background + outline 而不是 border，
   既不改变网格布局，也不会和上面 .me 的左侧蓝条互相覆盖。 */
.history-player-row.faction-good { background: rgba(23, 105, 224, .13); outline: 1px solid rgba(23, 105, 224, .28); outline-offset: -1px; }
.history-player-row.faction-evil { background: rgba(213, 56, 47, .13); outline: 1px solid rgba(213, 56, 47, .28); outline-offset: -1px; }
.history-player-row.faction-good .history-player-role { color: var(--good-deep); font-weight: 800; }
.history-player-row.faction-evil .history-player-role { color: var(--evil-deep); font-weight: 800; }
.history-player-row.faction-good .history-seat { color: var(--good-deep); }
.history-player-row.faction-evil .history-seat { color: var(--evil-deep); }
.history-seat { color: var(--muted); font-size: 10px; font-weight: 800; }
.history-player-name, .history-player-role { display: block; width: 100%; line-height: 1.2; overflow-wrap: anywhere; }
.history-player-name { font-size: 11px; }
.history-player-role { color: var(--muted); font-size: 9.5px; }
.history-full-link { min-height: 44px; margin: 0 0 var(--s3); }
.admin-game-editor {
  margin-bottom: var(--s3);
  padding: 10px;
  border: 1px solid rgba(10, 108, 255, .18);
  border-radius: 11px;
  background: var(--accent-soft);
}
.admin-game-editor h3 { color: var(--accent-deep); font-size: 13px; }
.admin-game-editor-fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.admin-game-editor label { margin-top: var(--s2); color: var(--muted); font-size: 11px; }
.admin-game-editor select { width: 100%; min-height: 34px; margin-top: 3px; padding: 5px 7px; font-size: 12px; }
.admin-game-editor-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin-top: var(--s2); }
.admin-game-editor-actions .btn { min-height: 38px; margin-top: 0; padding: 7px 9px; font-size: 12px; }
.winner-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}
.winner-badge.good { background: var(--good); }
.winner-badge.evil { background: var(--evil); }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-top: var(--s2);
}
.chip.me-outcome.win { color: var(--good-deep); background: var(--good-soft); }
.chip.me-outcome.lose { color: var(--evil-deep); background: var(--evil-soft); }
.chip.muted-chip { color: var(--muted); background: rgba(107, 110, 118, .10); }

/* ============ 对局详情 ============ */
.btn-back-room {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 var(--s3);
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-deep);
  background: rgba(255, 255, 255, .8);
  font-size: 14px;
  font-weight: 700;
}
.btn-back-room .ic { width: 14px; height: 14px; transform: rotate(180deg); }
.btn-back-room:active { transform: scale(.96); }
.result-hero { border-radius: var(--radius); padding: 24px 16px var(--s4); margin-bottom: var(--s3); }
.result-hero.good { background: linear-gradient(180deg, #eaf2ff, #ffffff 78%); color: var(--good-deep); }
.result-hero.evil { background: linear-gradient(180deg, #fdecea, #ffffff 78%); color: var(--evil-deep); }
.result-hero h1 { margin-bottom: 4px; }
.result-hero .muted { color: inherit; opacity: .72; }
.result-line { margin: var(--s3) 0 0; font-weight: 700; }

.my-result { padding: 18px; }
.my-result.won { background: linear-gradient(180deg, #f2f8ff, #ffffff 70%); }
.my-result.lost { background: linear-gradient(180deg, #fdf2f0, #ffffff 70%); }
.my-result-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.outcome-badge {
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}
.outcome-badge.win { background: var(--good); }
.outcome-badge.lose { background: var(--evil); }
.my-result-role { margin: var(--s2) 0; font-size: 18px; font-weight: 800; }
.my-result-role .tag { vertical-align: 2px; margin-left: var(--s1); }

/* 投票：先选号码，再选鲜花/鸡蛋 */
.vote-card { padding-bottom: var(--s3); }
.vote-target-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: var(--s3); }
.vote-target-btn {
  position: relative;
  min-width: 0;
  min-height: 112px;
  padding: 8px 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  background: rgba(107, 110, 118, .045);
  cursor: pointer;
}
.vote-target-btn.faction-good { background: rgba(23, 105, 224, .13); border-color: rgba(23, 105, 224, .20); }
.vote-target-btn.faction-evil { background: rgba(213, 56, 47, .13); border-color: rgba(213, 56, 47, .20); }
.vote-target-btn strong, .vote-target-btn small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vote-target-btn strong { color: var(--accent-deep); font-size: 15px; }
.vote-target-btn small { margin-top: 2px; color: var(--text); font-size: 12px; font-weight: 700; }
.vote-target-role {
  display: inline-block;
  margin-top: 6px;
  max-width: 100%;
  padding: 3px 9px;
  border-radius: 999px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.vote-target-btn.faction-good .vote-target-role { background: var(--good); }
.vote-target-btn.faction-evil .vote-target-role { background: var(--evil); }
.vote-target-btn.has-my-vote { border-color: rgba(10, 108, 255, .28); }
.vote-target-btn.selected { border-color: var(--accent); border-width: 2px; padding: 7px 2px; }
.vote-target-btn:active:not(:disabled) { transform: scale(.97); }
.vote-target-btn:disabled { opacity: .55; cursor: not-allowed; }
.vote-target-btn.empty { border-style: dashed; background: transparent; opacity: .38; }
.vote-choice-panel { margin-top: var(--s4); padding: 12px; border-radius: 13px; background: rgba(107, 110, 118, .055); }
.vote-choice-panel > p { margin: 0 0 var(--s2); font-size: 12px; }
.vote-choice-panel > p strong { color: var(--accent-deep); }
.vote-type-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.vote-type-btn {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-weight: 750;
  cursor: pointer;
}
.vote-type-btn .ic { width: 17px; height: 17px; }
.vote-type-btn.flower { color: var(--flower); border-color: rgba(182, 60, 117, .28); background: rgba(182, 60, 117, .07); }
.vote-type-btn.egg { color: var(--egg); border-color: rgba(138, 101, 21, .28); background: rgba(224, 180, 75, .11); }
.vote-type-btn.flower.selected { color: #fff; background: var(--flower); }
.vote-type-btn.egg.selected { color: #fff; background: var(--egg); }
.vote-type-btn:disabled { opacity: .45; cursor: not-allowed; }
.vote-skip-link {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  margin-top: var(--s3);
  padding: 10px 12px;
  border-radius: 11px;
  color: #fff;
  background: var(--accent);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
}
.vote-skip-link:active { background: var(--accent-deep); transform: scale(.985); }
.leaderboard { margin-top: 0; }
.leaderboard h2, .leaderboard h3 { display: flex; align-items: center; gap: var(--s2); }
.combined-leaderboard > h2 { display: flex; align-items: baseline; justify-content: space-between; }
.combined-board-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-top: var(--s3); }
.combined-board-grid .leaderboard { min-width: 0; padding: 10px; border-radius: 12px; background: rgba(107, 110, 118, .045); }
.combined-board-grid .leaderboard h3 { margin-bottom: 5px; font-size: 13px; }
.combined-board-grid .ranking-list li { gap: 5px; padding: 7px 0; font-size: 11px; }
.combined-board-grid .rank { flex-basis: 16px; }
.combined-board-grid .rank-count { font-size: 11px; }
.ranking-list li {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.ranking-list li:last-child { border-bottom: 0; }
.ranking-list li.me .rank-name { color: var(--accent); font-weight: 750; }
.rank { flex: 0 0 22px; color: var(--muted); font-weight: 750; }
.rank-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-count { display: inline-flex; align-items: center; gap: 3px; font-weight: 800; color: var(--text); }
.rank-count .ic { width: 14px; height: 14px; }

.identity-details { padding-bottom: var(--s2); }
.identity-details summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 750;
  cursor: pointer;
  color: var(--accent);
  list-style: none;
}
.identity-details summary::-webkit-details-marker { display: none; }
.identity-details summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
.identity-details[open] summary { margin-bottom: var(--s2); }
.identity-details[open] summary::after { transform: rotate(180deg); }
.good-text { color: var(--good-deep); font-weight: 750; }
.evil-text { color: var(--evil-deep); font-weight: 750; }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { padding: 10px 7px; border-bottom: 1px solid var(--line-soft); text-align: center; white-space: nowrap; }
th { color: var(--muted); font-weight: 650; font-size: 12px; }
td code { font-family: inherit; background: rgba(107, 110, 118, .08); padding: 2px 7px; border-radius: 7px; }
/* ============ 图标 ============ */
.ic { width: 1em; height: 1em; display: inline-block; vertical-align: -0.12em; }
h2 .ic,  .leaderboard h2 .ic { width: 18px; height: 18px; }
.icon-wrap { display: inline-flex; align-items: center; justify-content: center; }

/* ============ 底部导航 ============ */
.nav {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 640px);
  margin: 0 auto;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(250, 250, 252, .92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 -6px 20px rgba(20, 24, 34, .06);
}
.nav a {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}
.nav a:active { background: rgba(107, 110, 118, .08); }
.nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 750; }

/* ============ 适配 ============ */
@media (max-width: 420px) {
  .room-header { align-items: flex-start; flex-direction: row; }
  .game-summary { grid-template-columns: minmax(110px, 1fr) minmax(96px, auto) auto 16px; }
  .flow-steps li { font-size: 11px; }
}
/* 横屏 / 平板：内容更宽、留白更从容 */
@media (min-width: 720px) {
  .page { width: min(100%, 780px); }
  .hero { padding-top: 44px; }
  .room-header { padding-top: var(--s5); }
  .room-list { grid-template-columns: 1fr 1fr; }
  .seat-grid { gap: var(--s3); }
  .seat-button { min-height: 84px; }
  .history-player-list { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .vote-target-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .vote-target-btn { min-height: 118px; }
  .role-card.compact { padding: 24px 20px; }
  .mission-result-actions { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* ============ 五栏底部导航 ============ */
.nav { grid-template-columns: repeat(5, 1fr); gap: 2px; }
.nav a { font-size: 12px; min-height: 44px; }

/* ============ 发牌方式、座位与抽牌 ============ */
.btn-lg { width: 100%; min-height: 52px; padding: 14px; font-size: 16px; }
.seat-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
}
.seat-card-head h2 { display: flex; align-items: center; gap: var(--s2); min-width: 0; margin: 0; }
.seat-host-summary {
  display: flex;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  border: 1px solid rgba(10, 108, 255, .16);
  border-radius: 999px;
  color: var(--accent-deep);
  background: var(--accent-soft);
  white-space: nowrap;
}
.host-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
  background: var(--grad-brand);
  box-shadow: 0 2px 6px rgba(10, 108, 255, .24);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
}
.seat-host-summary strong { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.seat-host-summary select { width: auto; min-width: 0; max-width: 160px; min-height: 30px; margin: 0; padding: 3px 18px 3px 4px; border: 1px solid rgba(10, 108, 255, .18); border-radius: 7px; color: var(--accent-deep); background: #fff; font-size: 10px; }
.seat-transfer-btn { flex: 0 0 auto; padding: 4px 7px; border: 0; border-radius: 7px; color: #fff; background: var(--accent); font-size: 10px; font-weight: 800; cursor: pointer; }
.seat-transfer-btn:active { background: var(--accent-deep); transform: scale(.97); }
.seat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s2); margin-top: var(--s3); }
.seat-button {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 74px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0;
  padding: 9px 4px;
  overflow: hidden;
  isolation: isolate;
  border: 1px dashed rgba(107, 110, 118, .28);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(107, 110, 118, .045);
  text-align: center;
  cursor: pointer;
}
.seat-button .seat-number {
  position: relative;
  z-index: 0;
  display: block;
  width: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--accent-deep);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seat-button.occupied { gap: 4px; }
.seat-button.occupied .seat-number {
  font-size: 18px;
  opacity: 1;
}
.seat-button .seat-player-name {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--text);
  background: transparent;
  pointer-events: none;
}
.seat-button .seat-player-name > span {
  display: block;
  width: 100%;
  overflow: hidden;
  color: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}
.seat-button.occupied { border-style: solid; border-color: rgba(34, 166, 90, .32); color: var(--text); background: rgba(34, 166, 90, .11); }
.seat-button.my-seat { color: var(--text); border-color: rgba(34, 166, 90, .38); background: rgba(34, 166, 90, .15); box-shadow: inset 0 0 0 1px rgba(34, 166, 90, .24); }
.seat-button.my-seat .seat-number { color: var(--accent-deep); }
.seat-button.my-seat .seat-player-name { color: var(--text); }
.seat-button.fairy-seat { color: #a33576; border-color: #d26aa2; background: #ffe9f4; box-shadow: inset 0 0 0 1px rgba(210, 106, 162, .35); }
.seat-button.fairy-seat .seat-number { color: var(--accent-deep); }
.seat-button.fairy-seat .seat-player-name { color: var(--text); }
.draw-check {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  color: #22a65a;
  background: rgba(34, 166, 90, .08);
  font-size: clamp(44px, 13vw, 58px);
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}
.seat-button.seat-picked { border-width: 3px; border-color: currentColor; box-shadow: inset 0 0 0 1px currentColor; }
.seat-button:active:not(:disabled) { transform: scale(.97); }
.seat-button:disabled { opacity: .7; cursor: default; }

.seat-card.locked .seat-button.occupied { opacity: 1; }
/* 管理员身份座位图：与主座位图一致的直观展示 */
.admin-seat-grid { margin-top: var(--s3); }
.admin-seat {
  min-width: 0;
  min-height: 88px;
  padding: 10px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
}
.admin-seat strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-seat strong { color: var(--text); font-size: 15px; font-weight: 800; }
.admin-seat b { display: block; margin-top: 10px; padding: 6px 2px; border-radius: 9px; color: #fff; font-size: clamp(10px, 2.8vw, 14px); font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.admin-seat.faction-good { background: rgba(23, 105, 224, .13); border-color: rgba(23, 105, 224, .22); }
.admin-seat.faction-evil { background: rgba(213, 56, 47, .13); border-color: rgba(213, 56, 47, .22); }
.admin-seat.faction-good b { background: var(--good); }
.admin-seat.faction-evil b { background: var(--evil); }
.admin-seat.role-neutral { background: transparent; border-color: var(--line); }
.admin-seat.role-neutral b { color: var(--text); background: transparent; }
.admin-seat.empty { border-style: dashed; color: var(--muted); background: transparent; opacity: .38; }
.fairy-btn-row { display: flex; gap: var(--s2); }
.fairy-btn-row .btn { flex: 1; min-height: 58px; margin: 0; padding: 5px 10px; }
.fairy-btn-row b { color: var(--flower); }
.room-seat-tools { display: flex; flex-direction: column; align-items: stretch; gap: var(--s2); margin: 0 0 var(--s3); padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.room-seat-tool-actions { display: flex; flex: 0 0 auto; gap: var(--s2); }
.room-seat-tool-row { width: 100%; align-items: stretch; }
.room-seat-tool-row > .btn, .room-seat-tool-row > select, .room-seat-tool-row > .seat-tool-inspect { flex: 1 1 0; min-width: 0; }
.room-seat-tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); }
.room-seat-tool-grid > .btn, .room-seat-tool-grid > select { width: 100%; min-width: 0; margin: 0; }
.room-seat-tool-grid > .btn { min-height: 48px; padding: 6px 4px; flex-direction: column; gap: 1px; font-size: clamp(10px, 2.7vw, 13px); line-height: 1.25; white-space: normal; }
.room-seat-tool-grid > select { min-height: 48px; padding: 5px 3px; font-size: clamp(10px, 2.7vw, 12px); text-align: center; }
.room-seat-tool-row-secondary > .btn, .room-seat-tool-row-secondary > select { flex: 0 1 220px; }
.room-seat-tool-actions .btn { min-height: 48px; margin: 0; padding: 6px 4px; font-size: clamp(10px, 2.7vw, 13px); line-height: 1.25; white-space: normal; }
.room-seat-tool-actions select { min-width: 0; min-height: 48px; margin: 0; padding: 5px 3px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: #fff; font-size: clamp(10px, 2.7vw, 12px); text-align: center; }
.room-seat-tool-actions .fairy-next-select { min-width: 0; font-size: clamp(10px, 2.7vw, 12px); font-weight: 750; }
#btn-emergency-open { font-size: 0; }
#btn-emergency-open::after { content: '投票卡'; font-size: 13px; }
#btn-emergency-open { color: #7d3c98; border: 1px solid rgba(125, 60, 152, .24); background: rgba(166, 87, 190, .13); }
#btn-open-settle { color: #9b5a00; border: 1px solid rgba(155, 90, 0, .24); background: rgba(224, 168, 64, .16); }
.room-seat-tools > .seat-tool-inspect { width: 100%; margin-top: var(--s2); }
.room-seat-tools > .fairy-zone { flex: 0 0 auto; width: 100%; margin: 0; padding: 0; min-height: 0; border: 0; background: transparent; text-align: left; }
.room-seat-tools > .fairy-zone .fairy-admin { display: none; }
.room-seat-tools > .fairy-zone .fairy-inspect { margin: 0; padding: 0; border: 0; }
.room-seat-tools > .fairy-zone .fairy-inspect .form-label { display: none; }
.room-seat-tools > .fairy-zone .fairy-inspect .btn { min-height: 44px; width: 100%; margin: 0; }
.room-seat-tools > .fairy-zone .fairy-inspect .hint { display: none; }
.room-seat-tools > .fairy-zone .fairy-status, .room-seat-tools > .fairy-zone .fairy-result { margin: 0; }
.seat-tool-inspect { display: flex; margin: 0; padding: 0; border: 0; }
.seat-tool-inspect .form-label, .seat-tool-inspect .hint { display: none; }
.seat-tool-inspect .btn { width: 100%; min-height: 44px; margin: 0; }
.role-identity-text { display: grid; grid-template-columns: 40% 60%; align-items: center; width: min(100%, 700px); margin: 0 auto; padding: 22px 24px; border: 1px solid rgba(23, 105, 224, .24); border-radius: 14px; color: var(--text); background: linear-gradient(135deg, rgba(23, 105, 224, .14), rgba(255, 255, 255, .98) 72%); box-shadow: var(--shadow); text-align: center; }
.role-identity-heading { display: flex; align-items: center; justify-content: center; gap: 9px; }
.role-identity-heading h3 { margin: 0; color: var(--text); font-size: 30px; line-height: 1.2; }
.role-identity-copy { min-width: 0; padding-left: 20px; border-left: 1px solid var(--line); }
.role-identity-text .role-desc { margin: 0 auto; color: var(--muted); font-size: 14px; line-height: 1.65; }
.role-identity-text .role-visible-numbers { margin: 0; padding: 0; border-top: 0; }
.role-identity-text .role-visible-numbers > small,
.role-identity-text .role-view-waiting { display: none; }
.role-identity-text .role-identity-copy { padding-left: 20px; border-left: 0; }
.role-identity-text .clue-numbers { width: 100%; min-width: 0; flex-wrap: nowrap; gap: clamp(4px, 1.5vw, 10px); }
.role-identity-text .clue-numbers span { min-width: 0; flex: 1 1 0; padding: 10px 2px; border-color: rgba(23, 105, 224, .30); background: rgba(23, 105, 224, .12); color: var(--good-deep); font-size: clamp(20px, 4.5vw, 30px); line-height: 1.2; white-space: nowrap; }
.role-identity-text.faction-evil { border-color: rgba(213, 56, 47, .26); background: linear-gradient(135deg, rgba(213, 56, 47, .13), rgba(255, 255, 255, .98) 72%); }
.role-identity-text.faction-evil .clue-numbers span { border-color: rgba(213, 56, 47, .30); background: rgba(213, 56, 47, .12); color: var(--evil-deep); }
.mixed-master-status { margin: var(--s3) 0 0; padding: 8px 10px; border-radius: 10px; color: var(--accent-deep); background: var(--accent-soft); font-size: 13px; font-weight: 750; }
.mixed-master-help { margin: var(--s3) 0 var(--s2); color: var(--muted); font-size: 12px; line-height: 1.5; }
.mixed-master-controls { display: flex; align-items: stretch; gap: var(--s2); }
.mixed-master-controls select { min-width: 0; flex: 1 1 auto; min-height: 42px; margin: 0; padding: 6px 8px; border: 1px solid rgba(10, 108, 255, .20); border-radius: 9px; color: var(--text); background: #fff; font-size: 12px; }
.mixed-master-controls .btn { flex: 0 0 auto; width: auto; min-height: 42px; margin: 0; padding: 7px 10px; font-size: 12px; }
.fairy-dice {
  display: inline-flex;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
}
.d10-2d { display: block; width: 100%; height: 100%; transform-origin: 50% 50%; }
.d10-body { fill: #79a7f2; stroke: #245cae; stroke-width: 3; stroke-linejoin: round; }
.d10-lines { fill: none; stroke: rgba(255, 255, 255, .48); stroke-width: 1.25; }
.d10-center { fill: #1769e0; stroke: rgba(255, 255, 255, .65); stroke-width: 1.5; }
.d10-value {
  fill: #fff;
  font: 900 18px/1 -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  text-anchor: middle;
  dominant-baseline: middle;
}
#btn-fairy-random.rolling .ic {
  will-change: transform;
  animation: fairy-d10-roll .9s cubic-bezier(.22, .8, .28, 1) both;
}
@keyframes fairy-d10-roll {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(180deg) scale(.86); }
  65% { transform: rotate(540deg) scale(1.12); }
  100% { transform: rotate(720deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  #btn-fairy-random.rolling .ic { animation: none; }
}
.fairy-zone {
  width: min(100%, 460px);
  margin: 0 auto var(--s4);
  padding: var(--s3);
  min-height: 70px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(210, 106, 162, .22);
  border-radius: 14px;
  background: rgba(210, 106, 162, .055);
  text-align: center;
}
.fairy-admin .form-label, .fairy-inspect .form-label { margin: var(--s3) 0 var(--s2); }
.fairy-status { margin: var(--s3) 0 0; padding: 9px 10px; border-radius: 10px; color: #a33576; background: rgba(210, 106, 162, .10); font-size: 11px; }
.fairy-status.rejected { color: var(--muted); background: rgba(107, 110, 118, .08); }
.fairy-result { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-top: var(--s3); padding: 10px; border-radius: 11px; font-size: 12px; }
.fairy-result strong { padding: 4px 10px; border-radius: 8px; color: #fff; }
.fairy-result.good { background: var(--good-soft); }
.fairy-result.evil { background: var(--evil-soft); }
.fairy-result.good strong { background: var(--good); }
.fairy-result.evil strong { background: var(--evil); }
.fairy-inspect { margin-top: var(--s3); padding-top: var(--s2); border-top: 1px dashed rgba(210, 106, 162, .25); }
.fairy-inspect .btn { min-height: 46px; width: 100%; }
.fairy-inspect b { color: var(--flower); }
.fairy-next-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.fairy-next-row label { flex: 0 0 auto; color: #a33576; font-size: 11px; font-weight: 800; }
.fairy-next-row select { min-width: 0; flex: 1; min-height: 38px; margin: 0; padding: 5px 8px; border: 1px solid rgba(210, 106, 162, .32); border-radius: 8px; color: var(--text); background: #fff; font-size: 12px; }
.fairy-next-row .btn { flex: 0 0 auto; width: auto; min-height: 38px; padding: 6px 12px; }
/* ============ 身份仪式：仅占房间中间区域 ============ */
.draw-ritual {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 505px;
  margin: 14px 0;
  padding: 22px 10px 20px;
  border: 1px solid #6c593b;
  border-radius: 20px;
  color: #e8d6af;
  text-align: center;
  background: radial-gradient(ellipse at 50% 47%, #223044 0, #0d1627 44%, #070b16 83%);
  box-shadow: inset 0 0 0 3px #080e19, inset 0 0 0 4px #564a36, 0 16px 38px rgba(5, 10, 20, .19);
}
.draw-ritual::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .4;
  background: repeating-linear-gradient(103deg, transparent 0 48px, rgba(195, 158, 97, .035) 49px, transparent 50px 108px);
}
.draw-ritual::after {
  content: '';
  position: absolute;
  inset: auto 8% 0;
  height: 45px;
  border-radius: 50%;
  background: #030810;
  filter: blur(18px);
  z-index: -1;
}
.ritual-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .55;
  background-image: radial-gradient(circle, #cdb079 1px, transparent 2px), radial-gradient(circle, #cdb079 1px, transparent 2px);
  background-size: 137px 113px, 181px 149px;
  background-position: 12px 24px, 87px 72px;
}
.ritual-heading { position: relative; z-index: 2; display: grid; justify-items: center; gap: 2px; }
.ritual-heading span { color: #bc9d63; font: 700 13px Georgia, serif; letter-spacing: .42em; }
.ritual-heading strong { color: #f1e5c8; font: 500 clamp(23px, 5vw, 32px) Georgia, serif; letter-spacing: .08em; }
.ritual-heading i { display: block; width: 112px; height: 1px; margin-top: 8px; background: linear-gradient(90deg, transparent, #b99a62, transparent); }
.ritual-table { position: relative; width: 100%; height: 350px; max-width: 560px; margin: 2px auto 0; }
.ritual-card-orbit {
  position: absolute;
  inset: 0;
  z-index: 4;
}
.ritual-card-slot {
  position: absolute; left: 50%; top: 50%; width: 64px; height: 94px; padding: 0; border: 0; border-radius: 9px;
  background: none; cursor: pointer;
  transform: translate(-50%, -50%);
  transition: transform .27s ease, opacity .34s ease;
  pointer-events: none;
  touch-action: manipulation;
}
.ritual-card-slot .ritual-card-back { pointer-events: auto; }
.ritual-card-slot:disabled { cursor: default; }
.ritual-card-slot:focus-visible { outline: 2px solid #e0be80; outline-offset: 4px; }
.ritual-card-motion { display: block; width: 100%; height: 100%; animation: ritual-deal .72s cubic-bezier(.16,.85,.2,1) both; animation-delay: calc(var(--order) * 65ms); }
.ritual-card-depth, .ritual-card-facing { display: block; width: 100%; height: 100%; }
.ritual-card-back {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; height: 100%; overflow: hidden; border: 2px solid #a88a56; border-radius: 9px;
  color: #d4b679; background: radial-gradient(circle at 50% 35%, #202c3b, #080e19 67%);
  box-shadow: inset 0 0 0 3px #080d16, inset 0 0 0 4px rgba(194, 156, 91, .55), 0 7px 14px rgba(1, 4, 11, .55);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.ritual-card-border { position: absolute; inset: 7px; border: 1px solid rgba(185, 150, 87, .4); border-radius: 4px; }
.ritual-card-border::before, .ritual-card-border::after { content: '✦'; position: absolute; left: 50%; transform: translateX(-50%); color: #ae925c; font-size: 8px; }
.ritual-card-border::before { top: 2px; } .ritual-card-border::after { bottom: 2px; }
.ritual-card-crest { width: 43%; height: 51%; margin-top: -1px; }
.ritual-card-crest svg { width: 100%; height: 100%; }
.ritual-card-word { margin-top: 2px; font: 700 7px Georgia, serif; letter-spacing: .16em; }
.draw-ritual.selecting .ritual-card-slot:hover, .draw-ritual.selecting .ritual-card-slot:focus-visible, .draw-ritual.selecting .ritual-card-slot:active {
  transform: translate(-50%, -58%) scale(1.08);
  z-index: 40 !important;
}
.draw-ritual.selecting .ritual-card-slot:hover .ritual-card-back, .draw-ritual.selecting .ritual-card-slot:active .ritual-card-back { border-color: #eed39c; box-shadow: 0 0 19px rgba(218, 168, 82, .55), 0 12px 20px #02050b; }
.draw-ritual.is-committing .ritual-card-slot:not(.is-selected) { opacity: .15; transform: translate(-50%, -50%) scale(.65); }
.draw-ritual.is-committing .ritual-card-orbit { z-index: 8; }
.draw-ritual.is-committing .ritual-card-slot.is-selected {
  left: 50% !important; top: 50% !important; z-index: 55 !important;
  transform: translate(-50%, -50%) rotate(0) scale(1.65);
}
.draw-ritual.is-committing .ritual-card-slot.is-selected .ritual-card-depth { animation: none; transform: scale(1); opacity: 1; }
.ritual-center-message {
  position: absolute; z-index: 6; left: 50%; top: 18%; width: 135px; transform: translate(-50%, -50%);
  color: #f2db9f; pointer-events: none; text-shadow: 0 0 18px #c6903e;
}
.ritual-ready-word { font: 16px Georgia, serif; letter-spacing: .12em; }
.ritual-count-number { display: block; font: 76px Georgia, serif; line-height: 1; animation: ritual-count-in .65s ease-out both; }
.ritual-choose-word { display: block; font: 700 25px/1.3 system-ui, sans-serif; letter-spacing: .24em; padding-left: .24em; }
.ritual-held-wrap { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; }
.ritual-held-wrap { min-height: 400px; justify-content: center; }
.ritual-eyebrow { color: #bd9d68; font: 700 11px Georgia, serif; letter-spacing: .19em; }
.ritual-held-card { width: 130px; height: 190px; margin: 12px auto 18px; transform: rotate(-3deg); animation: ritual-held-float 3s ease-in-out infinite; }
.ritual-held-card .ritual-card-word { font-size: 13px; }
.ritual-held-message { max-width: 27rem; margin: 0 18px; color: #e2d6bd; font-size: 14px; line-height: 1.6; }
.ritual-flip-card { width: min(78vw, 272px); height: 400px; margin: 0 auto; perspective: 1000px; }
.ritual-flip-inner { position: relative; width: 100%; height: 100%; isolation: isolate; }
.ritual-flip-card.is-flipping .ritual-flip-inner { animation: ritual-flip-scale 1.05s cubic-bezier(.22,.6,.18,1) both; }
.ritual-flip-back, .ritual-card-front { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.ritual-flip-back { overflow: hidden; border-radius: 9px; visibility: visible; opacity: 1; }
.ritual-flip-back .ritual-card-back { position: absolute; inset: 0; }
.ritual-card-front {
  overflow: hidden;
  border: 2px solid #ccb27b; border-radius: 9px;
  background-color: #0d1622; background-image: url('./role-art/avalon-characters.png'); background-repeat: no-repeat;
  visibility: visible; opacity: 0; box-shadow: inset 0 0 0 5px #0b1727, inset 0 0 0 6px rgba(219, 181, 111, .5);
}
.ritual-flip-card.is-flipping .ritual-flip-back { animation: ritual-flip-back-face 1.05s steps(1, end) both; }
.ritual-flip-card.is-flipping .ritual-card-front { animation: ritual-flip-front-face 1.05s steps(1, end) both; }
.ritual-flip-card.is-flipped .ritual-flip-back { visibility: hidden; opacity: 0; }
.ritual-flip-card.is-flipped .ritual-card-front { visibility: visible; opacity: 1; }
.ritual-card-front::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 74%, rgba(8, 15, 25, .6)); }
.ritual-card-front-name {
  position: absolute; z-index: 1; right: 12px; bottom: 18px; left: 12px;
  color: #f8e8c2; font-size: 26px; line-height: 1.2; text-align: center;
  text-shadow: 0 2px 5px #050a11;
}
.ritual-flip-back .ritual-card-word { font-size: 13px; }
.role-art-merlin { background-size: 1905px 1270px; background-position: -31px -184px; }
.role-art-percival { background-size: 1905px 1270px; background-position: -345px -184px; }
.role-art-loyal { background-size: 1905px 1270px; background-position: -658px -184px; }
.role-art-mordred { background-size: 1597px 1065px; background-position: -162px -634px; }
.role-art-morgana { background-size: 1597px 1065px; background-position: -475px -634px; }
.role-art-assassin { background-size: 1597px 1065px; background-position: -801px -634px; }
.role-art-oberon { background-size: 1597px 1065px; background-position: -1145px -634px; }
.role-identity-reveal { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; width: 100%; margin: 14px auto 0; }
.role-identity-info {
  position: relative; z-index: 1; width: min(78vw, 272px); margin-top: -28px; padding: 44px 15px 18px;
  border: 1px solid rgba(204, 178, 123, .7); border-top: 0; border-radius: 0 0 10px 10px;
  color: #f4e5c6; background: linear-gradient(180deg, transparent, #132235 32px, #0b1727 100%);
  text-align: center;
}
.role-identity-info h3 { margin: 0; font-size: 25px; line-height: 1.2; }
.role-identity-info .role-desc { margin: 8px 0 0; color: #e1dbcf; font-size: 12px; line-height: 1.5; }
.role-identity-info .role-visible-numbers { display: block; margin-top: 12px; padding-top: 11px; border-color: rgba(221, 192, 140, .35); }
.role-identity-info .role-visible-numbers > small { color: #e1dbcf; font-size: 11px; line-height: 1.4; }
.role-identity-info .clue-numbers { gap: 6px; margin: 8px 0 0; }
.role-identity-info .clue-numbers span { min-width: 34px; padding: 5px 7px; border-color: #657c9a; background: #182a40; color: #e5edfc; font-size: 11px; }
.role-identity-info .role-view-waiting { margin: 12px 0 0; color: #d5c8b4; font-size: 11px; }
.faction-evil .ritual-card-front { border-color: #a96363; }
.faction-evil .role-identity-info { border-color: rgba(169, 99, 99, .7); background: linear-gradient(180deg, transparent, #35202a 32px, #170d1b 100%); }
.faction-evil .role-identity-info .clue-numbers span { border-color: #865961; background: #35202a; color: #f1d9dc; }
@media (min-width: 640px) {
  .role-identity-reveal { flex-direction: row; justify-content: center; align-items: stretch; }
  .role-identity-reveal .ritual-flip-card { flex: 0 0 272px; margin: 0; }
  .role-identity-info {
    display: flex; flex-direction: column; justify-content: center;
    width: 300px; min-height: 400px; margin: 0 0 0 -28px; padding: 25px 18px 25px 46px;
    border: 1px solid rgba(204, 178, 123, .7); border-left: 0; border-radius: 0 10px 10px 0;
    background: linear-gradient(90deg, transparent, #132235 32px, #0b1727 100%);
  }
  .faction-evil .role-identity-info { background: linear-gradient(90deg, transparent, #35202a 32px, #170d1b 100%); }
}
@keyframes ritual-deal { from { opacity: 0; transform: scale(.45) rotate(-22deg); } to { opacity: 1; transform: none; } }
@keyframes ritual-count-in { from { opacity: .4; transform: scale(1.35); } to { opacity: 1; transform: scale(1); } }
@keyframes ritual-held-float { 50% { transform: translateY(-7px) rotate(-1deg); } }
@keyframes ritual-flip-scale { 0%, 18% { transform: scaleX(1); } 50% { transform: scaleX(.04); } 82%, 100% { transform: scaleX(1); } }
@keyframes ritual-flip-back-face { 0%, 49% { visibility: visible; opacity: 1; } 50%, 100% { visibility: hidden; opacity: 0; } }
@keyframes ritual-flip-front-face { 0%, 49% { visibility: visible; opacity: 0; } 50%, 100% { visibility: visible; opacity: 1; } }
@media (max-width: 420px) {
  .draw-ritual { min-height: 515px; padding: 20px 5px 18px; }
  .ritual-table { height: 360px; }
  .ritual-card-slot { width: 61px; height: 90px; }
  .ritual-held-wrap { min-height: 380px; }
  .ritual-flip-card { width: min(78vw, 270px); height: 390px; }
  .room-seat-tools { align-items: stretch; }
  .room-seat-tool-actions { flex: 1; }
  .room-seat-tool-actions .btn { flex: 1; padding-left: 8px; padding-right: 8px; font-size: 12px; }
  .room-seat-tool-actions select { flex: 1; min-width: 0; }
  .room-seat-tool-row-secondary > .btn, .room-seat-tool-row-secondary > select { flex: 1 1 0; }
  .role-identity-text { grid-template-columns: 40% 60%; gap: 0; padding: 18px 10px; }
  .role-identity-heading { gap: 4px; }
  .role-identity-heading h3 { font-size: 23px; }
  .role-identity-copy { padding-left: 10px; }
  .role-identity-text .role-identity-copy { padding-left: 10px; border-left: 0; }
  .role-identity-text .role-desc { font-size: 12px; line-height: 1.5; }
}
@media (prefers-reduced-motion: reduce) {
  .ritual-card-motion, .ritual-count-number, .ritual-held-card, .ritual-flip-card.is-flipping .ritual-flip-inner { animation: none; }
  .ritual-card-slot { transition: none; }
  .ritual-flip-card.is-flipping .ritual-flip-back { visibility: hidden; }
  .ritual-flip-card.is-flipping .ritual-card-front { visibility: visible; opacity: 1; }
}
/* ============ 仙女查验确认弹框 ============ */
.fairy-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px; }
.fairy-modal[hidden] { display: none; }
.fairy-modal-mask { position: absolute; inset: 0; background: rgba(20, 24, 34, .55); }
.fairy-modal-box {
  position: relative;
  width: min(92vw, 340px);
  padding: 20px 18px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(20, 24, 34, .28);
  animation: modal-in .18s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.fairy-modal-box h3 { margin: 0 0 var(--s2); color: #a33576; font-size: 16px; }
.fairy-modal-box p { margin: 0 0 var(--s3); color: var(--muted); font-size: 13px; line-height: 1.6; }
.fairy-modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.fairy-modal-actions .btn { margin: 0; min-height: 46px; border-radius: 12px; }
/* 弹框尺寸小，去掉主按钮的蓝色发光与渐变叠加，避免糊成一团 */
.fairy-modal-actions .btn.primary { box-shadow: none; }
.fairy-modal-actions .btn.danger { background: var(--evil); box-shadow: none; }
.fairy-modal-actions .btn.danger:active:not(:disabled) { background: var(--evil-deep); }
/*
 * 次要按钮：原样式 background rgba(107,110,118,.08) 叠在白底上约等于 #F3F3F4，
 * 与弹框白底对比度仅 1.11:1，边界完全看不见。改为白底 + 描边，让它真的像个按钮。
 */
.fairy-modal-actions .btn.ghost {
  color: var(--text);
  background: #fff;
  border: 1px solid rgba(28, 28, 30, .14);
}
.fairy-modal-actions .btn.ghost:active:not(:disabled) { background: rgba(28, 28, 30, .05); }

/* 房主首次进入房间时的职责提醒：信息完整，但保持一屏内可读。 */
.host-guide-box { width: min(94vw, 390px); max-height: 88vh; overflow: auto; }
.host-guide-box h3 { color: var(--text); font-size: 17px; line-height: 1.45; }
.host-guide-list { margin: var(--s3) 0 var(--s4); padding-left: 24px; color: var(--text); }
.host-guide-list li { margin: 0 0 9px; padding-left: 2px; font-size: 13px; line-height: 1.55; }
.host-guide-list li:last-child { margin-bottom: 0; }
.host-guide-list li::marker { color: var(--accent-deep); font-weight: 850; }
.host-guide-actions { grid-template-columns: 1fr; }

/* 应急票卡设置：入口隐藏在房主/管理员「投票卡」中，只有发起后的临时卡片会进入房间正文。 */
.emergency-modal-box { width: min(94vw, 390px); max-height: 88vh; overflow: auto; }
.emergency-modal-box h3 { color: var(--text); }
.settle-modal-box { width: min(94vw, 420px); max-height: 88vh; overflow: auto; }
.settle-modal-box h3 { color: var(--text); }
.settle-modal-actions { margin-top: var(--s4); }
.emergency-type-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin: var(--s3) 0; }
.emergency-type-btn {
  min-height: 74px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: rgba(107, 110, 118, .05);
  text-align: left;
  cursor: pointer;
}
.emergency-type-btn strong, .emergency-type-btn small { display: block; }
.emergency-type-btn strong { font-size: 13px; }
.emergency-type-btn small { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.emergency-type-btn.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
#emergency-team-wrap .form-label { margin-top: var(--s2); }
#emergency-team-list { max-height: none; }

.emergency-card {
  border: 1px solid rgba(10, 108, 255, .20);
  background: linear-gradient(180deg, rgba(10, 108, 255, .055), #fff 45%);
}
.emergency-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.emergency-card-head small { display: block; margin-bottom: 2px; color: var(--muted); font-size: 10.5px; font-weight: 750; }
.emergency-status { flex: 0 0 auto; padding: 4px 9px; border-radius: 999px; color: var(--accent-deep); background: var(--accent-soft); font-size: 11px; font-weight: 800; }
.emergency-progress { margin: var(--s4) 0 var(--s3); color: var(--muted); text-align: center; }
.emergency-progress strong { color: var(--accent-deep); font-size: 20px; font-variant-numeric: tabular-nums; }
.emergency-participants { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--s3) 0; }
.emergency-participants span { padding: 5px 8px; border-radius: 999px; color: var(--text); background: rgba(107, 110, 118, .08); font-size: 11px; }
.emergency-choice-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin-top: var(--s3); }
.emergency-choice-actions.single { grid-template-columns: 1fr; }
.emergency-choice-btn {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}
.emergency-choice-btn.positive { color: var(--good-deep); border-color: rgba(23, 105, 224, .32); background: var(--good-soft); }
.emergency-choice-btn.negative { color: var(--evil-deep); border-color: rgba(213, 56, 47, .30); background: var(--evil-soft); }
.emergency-choice-btn:disabled { opacity: .45; cursor: not-allowed; }
.emergency-waiting, .emergency-secret-note { margin: var(--s3) 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.emergency-result { margin-top: var(--s4); padding: 16px; border-radius: 13px; text-align: center; background: var(--good-soft); color: var(--good-deep); }
.emergency-result.blocked { color: var(--evil-deep); background: var(--evil-soft); }
.emergency-result strong, .emergency-result span { display: block; }
.emergency-result strong { font-size: 20px; }
.emergency-result span { margin-top: 3px; font-size: 13px; font-weight: 750; }
.emergency-team-results { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: var(--s3); }
.emergency-team-results > span { display: grid; grid-template-columns: auto 1fr auto; gap: 5px; align-items: center; min-width: 0; padding: 8px; border-radius: 10px; font-size: 11px; background: rgba(107, 110, 118, .06); }
.emergency-team-results > span em { font-style: normal; font-weight: 800; }
.emergency-team-results > span.approve em { color: var(--good-deep); }
.emergency-team-results > span.reject em { color: var(--evil-deep); }
.emergency-close-btn { min-height: 42px; margin-top: var(--s3); font-size: 12px; }

/* 通用确认弹框：标题用中性色，不沿用仙女弹框的粉色 */
.confirm-modal-box h3 { color: var(--text); }
.confirm-modal-text { margin: 0 0 var(--s3); }
.confirm-modal-text p { margin: 0 0 var(--s2); color: var(--muted); font-size: 13px; line-height: 1.6; }
.confirm-modal-text p:last-child { margin-bottom: 0; }

/* 房间头部操作区：退出房间 / 踢出房间 */
.room-header-actions { display: flex; align-items: center; gap: var(--s2); flex: 0 0 auto; }

/* 座位图选人（刺客指定目标 / 踢出玩家）：复用房间座位按钮的视觉，只补选中态 */
.kick-seat-wrap { margin: 0 0 var(--s3); max-height: 46vh; overflow: auto; }
.pick-seat-grid { margin-top: var(--s2); }
/* 这两处座位图比房间页窄（弹框内每列仅约 54px），字号统一收一档，名字过长交给 ellipsis */
.pick-seat-grid .seat-button { min-height: 62px; padding: 6px 2px; gap: 2px; }
.pick-seat-grid .seat-button.occupied .seat-number { font-size: 15px; }
.pick-seat-grid .seat-button .seat-player-name > span { font-size: 11px; }
.pick-seat-grid .seat-button.selected {
  border: 2px solid var(--accent);
  background: rgba(10, 108, 255, .14);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.pick-seat-grid .seat-button:disabled { opacity: .35; cursor: not-allowed; }

/* ============ 管理员面板 / 重置 / 每日明细展开 ============ */
.btn.danger { color: #fff; background: var(--evil); }
.btn.danger:active { opacity: .85; }
.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: var(--s2) 0 var(--s3);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
}
.switch-row input {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  min-height: 26px;
  height: 26px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 999px;
  background: rgba(107, 110, 118, .28);
  cursor: pointer;
  transition: background .18s;
}
.switch-row input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(20, 24, 34, .28);
  transition: transform .18s;
}
.switch-row input:checked { background: var(--accent); }
.switch-row input:checked::after { transform: translateX(18px); }
.mixed-game-switch { margin: var(--s3) 0 0; }
.mixed-game-switch input:disabled { opacity: .45; cursor: not-allowed; }
.role-toggle-card .switch-row { margin: 0; }
.role-toggle-card .hint { margin-bottom: 0; }
[hidden] { display: none !important; }

/* 危险操作 / 管理员检查：同一卡片切换，开关固定在右上角 */
.danger-zone {
  margin-top: var(--s6) !important;
  border-color: rgba(213, 56, 47, .20);
  background: linear-gradient(180deg, rgba(213, 56, 47, .04), #fff 72%);
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.danger-zone h2 { color: var(--evil-deep); }
.danger-zone .btn { margin-top: var(--s4); }
.danger-zone.admin-active {
  border-color: rgba(10, 108, 255, .28);
  background: linear-gradient(180deg, rgba(10, 108, 255, .055), #fff 76%);
  box-shadow: 0 8px 24px rgba(10, 108, 255, .08);
}
.danger-zone.admin-active h2 { color: var(--accent-deep); }
.danger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
}
.admin-test-draw-tools {
  margin-top: var(--s4);
  padding-top: var(--s3);
  border-top: 1px solid rgba(10, 108, 255, .14);
}
.admin-test-draw-tools .hint { margin: 0 0 var(--s2); }
.admin-test-draw-tools .btn { width: 100%; margin-top: 0; }

/* 角色胜率：横向胶囊进度条（玩家详情二级页仍在用） */
.role-rate-list { display: flex; flex-direction: column; gap: 14px; }
.role-rate-row .role-rate-head {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px;
}
.role-rate-label { font-weight: 600; font-size: 14px; min-width: 52px; color: var(--text); }
.role-rate-meta { flex: 1; font-size: 11px; color: var(--muted); }
.role-rate-value { font-weight: 700; font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; }
.role-rate-bar {
  height: 14px; border-radius: 999px; background: rgba(107, 110, 118, .12); overflow: hidden;
}
.role-rate-bar > i {
  display: block; height: 100%; border-radius: 999px;
  background: var(--grad-brand); transition: width .5s cubic-bezier(.22, .8, .28, 1);
}
.role-rate-row.good .role-rate-bar > i { background: var(--grad-good); }
.role-rate-row.evil .role-rate-bar > i { background: var(--grad-evil); }

/* ===== 各身份胜率卡片：雷达/柱状切换 ===== */
.role-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.role-view-toggle {
  display: inline-flex; flex-shrink: 0; padding: 3px; border-radius: 999px;
  background: rgba(28, 28, 30, .06);
}
.role-view-toggle button {
  border: none; background: transparent; cursor: pointer;
  padding: 5px 12px; border-radius: 999px;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--muted);
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.role-view-toggle button.active {
  background: #fff; color: var(--text); font-weight: 700; box-shadow: var(--shadow-sm);
}
.role-view-toggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== 七角形雷达图：各身份胜率（实线=我，虚线=全服平均） ===== */
.radar-wrap { margin-top: 4px; }
.role-radar { display: block; width: 100%; max-width: 400px; margin: 0 auto; height: auto; }
.radar-grid {
  fill: none; stroke: rgba(28, 28, 30, .09); stroke-width: 1;
}
.radar-grid:last-of-type { stroke: rgba(28, 28, 30, .16); }
.radar-axis { stroke: rgba(28, 28, 30, .07); stroke-width: 1; }
.radar-axis[data-state="unplayed"] {
  stroke: rgba(107, 110, 118, .42); stroke-dasharray: 3 5;
}
.radar-me {
  fill: rgba(10, 108, 255, .15); stroke: var(--accent); stroke-width: 2; stroke-linejoin: round;
  transform-origin: 180px 162px;
  animation: radar-in .7s cubic-bezier(.16, 1, .3, 1) .12s backwards;
}
.radar-inner { fill: var(--card); stroke: rgba(28, 28, 30, .10); stroke-width: 1; }
.radar-dot { fill: var(--card); stroke: var(--accent); stroke-width: 1.8; opacity: 0; animation: radar-dot-in .35s ease-out .62s forwards; }
.radar-dot-zero { fill: var(--accent); stroke: var(--card); stroke-width: 1.2; }
.radar-label.radar-label-empty { opacity: .45; }
.radar-label.radar-label-zero .radar-label-value { fill: var(--text); font-weight: 700; }
.radar-avg {
  fill: none; stroke: rgba(107, 110, 118, .8); stroke-width: 1.6; stroke-dasharray: 6 4; stroke-linejoin: round;
  transform-origin: 180px 162px;
  animation: radar-in .7s cubic-bezier(.16, 1, .3, 1) .3s backwards;
}
.radar-label-name { font-size: 12px; font-weight: 700; }
.radar-label.good .radar-label-name { fill: var(--good-deep); }
.radar-label.evil .radar-label-name { fill: var(--evil-deep); }
.radar-label-value { font-size: 10.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.radar-legend { display: flex; justify-content: center; gap: 18px; margin-top: 10px; }
.radar-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.legend-me { width: 18px; height: 0; border-top: 2px solid var(--accent); }
.legend-avg { width: 18px; height: 0; border-top: 1.6px dashed rgba(107, 110, 118, .8); }
@keyframes radar-in {
  from { transform: scale(.15); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes radar-dot-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .radar-me, .radar-avg, .radar-dot { animation: none; }
  .radar-dot { opacity: 1; }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
  padding: 30px 18px;
  text-align: center;
  color: var(--muted);
}
.empty-state .empty-icon {
  display: inline-flex;
  width: 52px;
  height: 52px;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: rgba(107, 110, 118, .08);
}
.empty-state .empty-icon .ic { width: 26px; height: 26px; opacity: .4; }
.empty-state strong { display: block; color: var(--text); font-size: 15px; }
.empty-state p { margin: 0; font-size: 12.5px; line-height: 1.6; max-width: 24rem; }
.danger-head h2 { margin-bottom: 0; }
.danger-head + .admin-cover-body  { margin-top: var(--s3); }
.admin-cover-body { padding-top: 1px; }
.admin-cover-body .admin-seat-grid { margin-top: var(--s2); }
.reset-controls {
  margin-top: var(--s3);
  padding-top: var(--s3);
  border-top: 1px solid rgba(213, 56, 47, .14);
}
.admin-active .reset-controls { border-top-color: rgba(10, 108, 255, .14); }
.reset-help { margin: 0 0 var(--s3); color: var(--muted); font-size: 11.5px; line-height: 1.65; }
.reset-help strong:first-child { color: var(--accent-deep); }
.reset-help strong:last-child { color: var(--evil-deep); }
.reset-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.danger-zone .reset-actions .btn { min-height: 46px; margin: 0; padding: 9px 10px; }

/* 每日统计：手机优先的逐级卡片 */
.daily-list { display: grid; gap: var(--s2); margin-top: var(--s3); }
.daily-day-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 52px;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  color: var(--text);
  background: rgba(107, 110, 118, .035);
  text-align: left;
  cursor: pointer;
}
.daily-day-card.open { border-color: rgba(10, 108, 255, .28); background: var(--accent-soft); }
.daily-inline-summary { display: flex; min-width: 0; align-items: baseline; gap: 9px; overflow: hidden; white-space: nowrap; }
.daily-inline-summary strong { font-size: 13px; }
.daily-inline-summary small { color: var(--muted); font-size: 10px; }
.daily-inline-summary b { font-size: 10.5px; }
.row-chevron { width: 18px; text-align: right; }
.row-chevron .ic { transition: transform .18s; }
.day-row.open .row-chevron .ic, .player-row.open .row-chevron .ic { transform: rotate(90deg); }
.day-detail-section { margin: -2px 0 var(--s2); }
.nested-box { padding: 12px; border: 1px solid rgba(10, 108, 255, .14); border-radius: 14px; background: #fff; }
.day-detail-box { box-shadow: 0 8px 24px rgba(20, 24, 34, .06); }
.nested-heading, .player-detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s3);
}
.nested-heading > div, .player-detail-heading > div { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.nested-heading > small, .player-detail-heading small { color: var(--muted); font-size: 11px; }
.level-badge {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--accent-deep);
  background: var(--accent-soft);
  font-size: 10px;
  font-weight: 800;
}
.level-badge.third { color: #73510c; background: rgba(224, 180, 75, .18); }
.player-summary-list { display: grid; gap: 7px; }
.player-summary-card {
  display: grid;
  grid-template-columns: 30px minmax(86px, 1fr) 58px 58px 66px 18px;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 58px;
  padding: 8px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  color: var(--text);
  background: rgba(107, 110, 118, .035);
  text-align: left;
  cursor: pointer;
}
.player-summary-card:hover, .player-summary-card.open { border-color: rgba(10, 108, 255, .24); background: var(--accent-soft); }
.daily-rank {
  display: inline-flex;
  width: 25px;
  height: 25px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(107, 110, 118, .10);
  font-size: 11px;
  font-weight: 800;
}
.daily-rank.top { color: #805b0b; background: rgba(224, 180, 75, .24); }
.daily-player-name, .daily-team-rate, .daily-win-rate { min-width: 0; }
.daily-player-name strong, .daily-player-name small, .daily-team-rate small, .daily-team-rate strong, .daily-win-rate small, .daily-win-rate strong { display: block; }
.daily-player-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.daily-player-name small, .daily-team-rate small, .daily-win-rate small { color: var(--muted); font-size: 9.5px; font-weight: 650; }
.daily-team-rate strong, .daily-win-rate strong { margin-top: 1px; font-size: 12px; }
.daily-team-rate.evil strong { color: var(--evil-deep); }
.daily-team-rate.good strong { color: var(--good-deep); }
.daily-win-rate strong { color: var(--accent-deep); font-size: 14px; }
.player-data-section { overflow: hidden; }
.player-sort-label { display: flex; margin: 0; align-items: center; justify-content: space-between; gap: var(--s3); color: var(--text); }
.player-sort-label select { width: min(58%, 220px); min-height: 40px; }

/* 玩家数据前 10 柱状图 */
.top5-chart { padding: var(--s3); background: var(--line-soft); border-radius: 12px; }
.top5-head { display: flex; align-items: center; justify-content: flex-end; margin-bottom: var(--s2); }
.top5-head .player-sort-label { margin: 0; }
.top5-head .player-sort-label select { min-height: 32px; font-size: 12px; width: auto; min-width: 120px; }
/* 第三列使用内容宽度，保证「12胜 60%」始终一行显示；中间柱状条自适应缩短 */
.top5-row { display: grid; grid-template-columns: minmax(0, 112px) minmax(36px, 1fr) max-content; gap: var(--s2); align-items: center; padding: 6px 8px; font-size: 13px; cursor: pointer; border-radius: 8px; }
.top5-row:hover { background: rgba(0,0,0,.04); }
.top5-row.is-me { background: rgba(59,111,212,.1); }
.top5-row.is-me .top5-name { color: #3b6fd4; font-weight: 800; }
.top5-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.top5-name small { font-size: 10px; color: #3b6fd4; font-weight: 600; margin-left: 2px; }
.top5-bar { height: 14px; background: rgba(0,0,0,.06); border-radius: 7px; overflow: hidden; }
.top5-bar i { display: block; height: 100%; background: linear-gradient(90deg, #3b6fd4, #5b8def); border-radius: 7px; }
.top5-val { min-width: 78px; text-align: right; white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) {
  .top5-row { grid-template-columns: minmax(0, 84px) minmax(30px, 1fr) max-content; font-size: 12px; padding: 5px 6px; }
  .top5-val { min-width: 82px; font-size: 11.5px; }
  .top5-head { flex-direction: column; align-items: stretch; }
  .top5-head .player-sort-label select { width: 100%; }
}
.player-detail {
  margin: 3px 4px 9px 38px;
  padding: 12px;
  border-left: 3px solid rgba(224, 180, 75, .75);
  border-radius: 4px 12px 12px 4px;
  background: #fffdf8;
  box-shadow: 0 4px 14px rgba(20, 24, 34, .05);
}
.player-detail-heading > div { flex-wrap: wrap; }
.player-detail-heading > div > small { width: 100%; padding-left: 45px; }
.overall-rate { flex: 0 0 auto; color: var(--muted); font-size: 11px; }
.overall-rate b { margin-left: 3px; color: var(--accent-deep); font-size: 15px; }
.role-stat-list { display: grid; gap: 6px; }
.role-stat-card {
  display: grid;
  grid-template-columns: 22px minmax(82px, 1fr) 42px 42px 58px;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(107, 110, 118, .055);
}
.role-stat-rank { color: var(--muted); font-size: 10px; font-weight: 800; text-align: center; }
.role-stat-name { display: flex; align-items: center; gap: 5px; min-width: 0; }
.role-stat-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.role-stat-name .tag { flex: 0 0 auto; padding: 2px 5px; font-size: 9px; }
.role-stat-card > span:not(.role-stat-name):not(.role-stat-rank) { text-align: center; }
.role-stat-card small, .role-stat-card > span > strong { display: block; }
.role-stat-card small { color: var(--muted); font-size: 9px; }
.role-stat-card > span > strong { font-size: 12px; }
.role-stat-rate strong { color: var(--accent-deep); font-size: 13px !important; }
.daily-empty { margin: var(--s3) 0; text-align: center; }

@media (max-width: 420px) {
  .page { padding: 12px 12px calc(var(--nav-h) + 36px + env(safe-area-inset-bottom)); }
  .room-header { flex-wrap: nowrap; gap: 6px; }
  .room-header > div:first-child { flex: 1 1 auto; min-width: 0; }
  .room-header-actions { width: auto; flex: 0 0 auto; flex-wrap: nowrap; justify-content: flex-end; gap: 4px; }
  .room-header-actions .room-more-btn,
  .room-header-actions .room-exit-btn { min-height: 32px; padding: 6px 8px; font-size: 11px; }
  .room-code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hero { padding: 20px 2px var(--s4); }
  .card, .role-card { padding: 14px; }
  .nav a { padding: 0 2px; font-size: 11px; white-space: nowrap; }
  .history-menu, .game-accordion { padding: 0; }
  .history-menu > summary { min-height: 62px; padding: 12px; }
  .game-summary {
    grid-template-columns: minmax(0, 1fr) auto 16px;
    grid-template-areas: "gmain gvotes gchev" "gmeta gmeta gchev";
    gap: 5px 7px;
    min-height: 74px;
    padding: 10px;
  }
  .game-summary-main { grid-area: gmain; }
  .game-summary-meta { grid-area: gmeta; }
  .game-summary-votes { grid-area: gvotes; }
  .game-summary > .accordion-chevron { grid-area: gchev; }
  .game-summary-meta strong, .game-summary-meta small { display: inline; text-align: left; }
  .game-summary-meta small { margin-left: 5px; }
  .game-accordion-body { padding: 9px 7px; }
  .history-player-list { gap: 4px; }
  .history-player-row { min-height: 86px; padding: 5px 2px; }
  .history-player-name { font-size: 10px; }
  .history-player-role { font-size: 8.5px; }
  .daily-day-card { padding: 8px 7px; }
  .daily-inline-summary { gap: 6px; }
  .daily-inline-summary strong { font-size: 11px; }
  .daily-inline-summary b { font-size: 9px; }
  .nested-box { padding: 9px 7px; }
  .nested-heading, .player-detail-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .player-summary-card {
    grid-template-columns: 22px minmax(58px, 1fr) 35px 35px 44px 14px;
    gap: 3px;
    padding: 7px 5px;
  }
  .daily-rank { width: 22px; height: 22px; }
  .daily-team-rate, .daily-win-rate { text-align: center; }
  .daily-team-rate strong, .daily-player-name strong { font-size: 10px; }
  .daily-win-rate strong { font-size: 11px; }
  .player-detail { margin-left: 18px; padding: 9px 6px; }
  .player-detail-heading > div > small { padding-left: 0; }
  .role-stat-card {
    grid-template-columns: 18px minmax(68px, 1fr) 34px 38px 46px;
    gap: 4px;
    padding: 7px 4px;
  }
  .role-stat-name .tag { display: none; }
}

/* ===== 一行 banner ===== */
.hero-one-line { display: flex; flex-direction: row; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 24px; }
.hero-one-line .hero-user { flex-shrink: 0; min-width: 0; }
.hero-one-line .hero-user h1 { margin: 0; font-size: 22px; font-weight: 800; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-one-line .hero-games { margin: 4px 0 0; font-size: 11px; color: rgba(255,255,255,.75); }
.hero-stats-line { display: flex; align-items: center; gap: 0; flex-shrink: 0; }
.hsl-item { text-align: center; padding: 0 22px; min-width: 64px; }
.hsl-item:first-child { padding-left: 0; }
.hsl-item:last-child { padding-right: 0; }
.hsl-value { font-size: 22px; font-weight: 800; color: #fff; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hsl-value span { font-size: 12px; font-weight: 700; }
.hsl-label { font-size: 11px; color: rgba(255,255,255,.78); margin-top: 3px; font-weight: 600; }
.hsl-label small { font-size: 10px; color: rgba(255,255,255,.6); margin-left: 1px; }
.hsl-divider { width: 1px; height: 32px; background: rgba(255,255,255,.25); }
@media (max-width: 480px) {
  .hero-one-line { flex-direction: column; gap: 14px; padding: 18px 20px; }
  .hero-one-line .hero-user { text-align: center; }
  .hero-stats-line { width: 100%; justify-content: center; }
  .hsl-item { padding: 0 10px; min-width: 48px; }
  .hsl-value { font-size: 20px; }
}

/* ===== 趣味数据 v5：极简一行4列 ===== */
.fun-stats-grid { display: flex; gap: 0; margin: 14px 0 0; }
.fun-stat { flex: 1; display: block; text-align: center; padding: 18px 8px 16px; position: relative; background: transparent; border: none; box-shadow: none; }
.fun-stat:not(:last-child)::after { content: ''; position: absolute; right: 0; top: 22%; bottom: 22%; width: 1px; background: rgba(0,0,0,.08); }
.fun-stat::before { display: none; }
.fun-stat-value { font-size: 30px; font-weight: 800; color: #1a1b1c; font-variant-numeric: tabular-nums; line-height: 1.1; }
.fun-stat.kill .fun-stat-value, .fun-stat.block .fun-stat-value, .fun-stat.flower .fun-stat-value, .fun-stat.egg .fun-stat-value { color: #1a1b1c; }
.fun-stat-label { font-size: 12px; color: #8a8f98; margin-top: 6px; font-weight: 600; }
.fun-stat:hover { background: rgba(0,0,0,.02); }
.fun-stat:active { transform: none; }
@media (max-width: 480px) {
  .fun-stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; }
  .fun-stat { padding: 16px 8px; }
  .fun-stat:not(:last-child)::after { display: none; }
  .fun-stat:nth-child(odd)::after { content: ''; display: block; position: absolute; right: 0; top: 22%; bottom: 22%; width: 1px; background: rgba(0,0,0,.08); }
  .fun-stat-value { font-size: 26px; }
}

/* ===== 趣味数据 v5 修正：去背景色+竖线 ===== */
.fun-stat.kill, .fun-stat.block, .fun-stat.flower, .fun-stat.egg { background: transparent; }
.fun-stat.kill:hover, .fun-stat.block:hover, .fun-stat.flower:hover, .fun-stat.egg:hover { background: rgba(0,0,0,.03); }
.fun-stat:not(:last-child)::after { content: ''; position: absolute; right: 0; top: 22%; bottom: 22%; width: 1px; background: rgba(0,0,0,.1); display: block; }

/* 房间入口自定义图片图标 */
.room-entry-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

/* 趣味数据强制1x4 */
.fun-stats-grid { display: flex !important; flex-wrap: nowrap !important; }
.fun-stat { flex: 1 !important; width: auto !important; }
@media (max-width: 480px) {
  .fun-stats-grid { display: flex !important; flex-wrap: nowrap !important; }
  .fun-stat { flex: 1 !important; padding: 12px 4px !important; }
  .fun-stat-value { font-size: 18px !important; }
  .fun-stat-label { font-size: 10px !important; }
}

/* 挡刀明细展开 */
.fun-stat.expandable { cursor: pointer; }
/* 展开标识：label 后的内联小箭头，展开时翻转成 ▴ */
.fun-stat .expand-arrow { display: inline-block; margin-left: 3px; font-size: 9px; color: #a0a5ae; transition: transform .2s; }
.fun-stat.expandable:hover .expand-arrow, .fun-stat.open .expand-arrow { color: #3b6fd4; }
.fun-stat.open .expand-arrow { transform: rotate(180deg); }
.fun-stat-detail { border-top: 1px dashed rgba(0,0,0,.12); margin: 2px 2px 4px; padding: var(--s3) 2px 2px; }
.block-game-list { display: grid; gap: 6px; }
.block-game-item {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: var(--s2);
  align-items: center; padding: 7px 10px; border-radius: 8px;
  background: rgba(0,0,0,.035); font-size: 12.5px;
}
.block-game-item b { color: #3b6fd4; }
.block-game-time { color: var(--muted); }
.block-game-role { color: #1a1b1c; font-weight: 600; }
.block-game-result { font-size: 11px; font-weight: 700; }
.block-game-result.good { color: #1a7f37; }
.block-game-result.evil { color: var(--evil-deep); }

/* 红蓝阵营历史胜率 */
.faction-pk-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.faction-pk-head h2 { margin: 0; font-size: 20px; font-weight: 900; color: #1a1b1c; letter-spacing: 1px; }
.pk-total { font-size: 12px; font-weight: 700; color: #6b7280; background: rgba(0,0,0,.04); padding: 4px 10px; border-radius: 20px; }
@media (max-width: 480px) {
  .faction-pk-head h2 { font-size: 17px; }
}
.pk-score-row { display: flex; justify-content: space-between; align-items: center; margin: 0 0 8px; padding: 0 4px; }
.pk-score { display: flex; align-items: baseline; gap: 6px; }
.pk-score-pct { font-size: 24px; font-weight: 800; line-height: 1; }
.pk-score-wins { font-size: 12px; font-weight: 600; opacity: .7; }
.pk-score-blue { color: #2b5cb8; }
.pk-score-red { color: #b82b2b; text-align: right; flex-direction: row-reverse; }

.pk-blood-bar {
  position: relative;
  width: 100%;
  height: 90px;
  overflow: hidden;
  border-radius: 14px;
  background: transparent;
}
.pk-block {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pk-block-blue { left: 0; background: linear-gradient(135deg, #2b5cb8, #1a3d8a); border-radius: 14px 0 0 14px; }
.pk-block-red { right: 0; background: linear-gradient(225deg, #b82b2b, #8a1a1a); border-radius: 0 14px 14px 0; }

/* 光从两侧扫向阵营交界处。 */
.pk-block-blue::after { content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 60%; background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.15) 40%, rgba(255,255,255,.4) 50%, rgba(255,255,255,.15) 60%, transparent 100%); animation: pk-light-slam-right 2.5s ease-in-out infinite; z-index: 1; }
.pk-block-red::after { content: ''; position: absolute; top: 0; bottom: 0; right: -60%; width: 60%; background: linear-gradient(270deg, transparent 0%, rgba(255,255,255,.15) 40%, rgba(255,255,255,.4) 50%, rgba(255,255,255,.15) 60%, transparent 100%); animation: pk-light-slam-left 2.5s ease-in-out infinite; z-index: 1; }
@keyframes pk-light-slam-right {
  0% { left: -60%; opacity: 0; }
  15% { opacity: 1; }
  70% { left: 100%; opacity: .8; }
  100% { left: 100%; opacity: 0; }
}
@keyframes pk-light-slam-left {
  0% { right: -60%; opacity: 0; }
  15% { opacity: 1; }
  70% { right: 100%; opacity: .8; }
  100% { right: 100%; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .pk-block-blue::after,  .pk-block-red::after { animation: none; }
}

/* 玩家名字在各自轨道内飞到阵营交界处后消失。 */
@keyframes fly-to-right {
  0% { left: -30%; opacity: 0; transform: scale(.8); }
  8% { opacity: var(--fo, 1); transform: scale(1); }
  82% { opacity: var(--fo, 1); transform: scale(1); }
  94% { left: 96%; opacity: 0; transform: scale(.85); }
  100% { left: 96%; opacity: 0; }
}
@keyframes fly-to-left {
  0% { right: -30%; opacity: 0; transform: scale(.8); }
  8% { opacity: var(--fo, 1); transform: scale(1); }
  82% { opacity: var(--fo, 1); transform: scale(1); }
  94% { right: 96%; opacity: 0; transform: scale(.85); }
  100% { right: 96%; opacity: 0; }
}

/* 我的战绩顶部：框架渐变背景 */
.profile-hero {
  background: linear-gradient(135deg, #2b5cb8 0%, #5b3fa0 50%, #8a3d7a 100%);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(43,92,184,.25);
  overflow: hidden;
  position: relative;
}
.profile-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(255,255,255,.12) 0%, transparent 70%);
  pointer-events: none;
}
@media (max-width: 480px) {
  .profile-hero { border-radius: 14px; }
}

@media (max-width: 480px) {
  .pk-blood-bar { height: 76px; }
  .pk-score-pct { font-size: 20px; }
}

/* 每条轨道同时只显示一个名字。 */
.pk-row {
  position: absolute;
  left: 0;
  right: 0;
  /* 用 translateY(-50%) 定中心，不再用固定 height + 负 margin：字号常量变了也不会错位。
     line-height 必须锁死为 1 —— 继承 body 的 1.55 会把 13px 的字撑成 20px 行高，
     直接盖住上下相邻轨道（这正是之前名字重叠、最上方溢出框体的根因）。 */
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  line-height: 1;
  pointer-events: none;
}
.pk-row-blue { justify-content: flex-start; }
.pk-row-red { justify-content: flex-end; }
.pk-row .flyer {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  left: auto;
  right: auto;
  animation: none;
  opacity: 0;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.5);
  z-index: 1;
}
/* 单条简写自包含：name/duration/timing/iteration/fill 全在这，避免层叠问题 */
.pk-row .flyer.flyer-run {
  animation: fly-to-right var(--pk-dur, 4s) linear 1 forwards;
}
.pk-row-red .flyer.flyer-run {
  animation-name: fly-to-left;
}

/* ============ 轻提示（错误 / 成功反馈） ============ */
.toast-box {
  position: fixed;
  z-index: 300;
  top: calc(14px + env(safe-area-inset-top));
  left: 50%;
  max-width: min(88vw, 420px);
  padding: 10px 16px;
  border-radius: 999px;
  color: #fff;
  background: rgba(28, 28, 30, .90);
  box-shadow: 0 8px 24px rgba(20, 24, 34, .22);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, -12px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.toast-box.show { opacity: 1; transform: translate(-50%, 0); }
.toast-box.error { background: rgba(176, 35, 28, .94); }
@media (prefers-reduced-motion: reduce) {
  .toast-box { transition: none; }
}

/* 跨页面反馈，不拦截页面操作。 */
.feedback-stack { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(92vw, 520px); z-index: 400; pointer-events: none; }
.feedback-stack > div { padding: 12px 16px; margin-bottom: 8px; border-radius: 10px; font-size: 14px; color: white; box-shadow: 0 4px 16px #0002; }
#error-notice { background: #a82922; }
#connection-notice { background: #75510b; }
.room-header-actions button:disabled { opacity: .45; cursor: not-allowed; }

#room-admin-panel .danger-zone { animation: none; }

.player-merge summary { cursor: pointer; font-weight: 700; }
.player-merge > label { display: block; margin: 16px 0 8px; font-weight: 600; }
.merge-candidates { max-height: 280px; overflow-y: auto; margin-top: 12px; }
.merge-candidate { display: flex; align-items: center; gap: 10px; padding: 12px 4px; border-bottom: 1px solid #e8eaf0; }
.merge-candidate[hidden] { display: none; }
.merge-candidate input { width: 20px; min-height: 20px; margin: 0; flex: 0 0 20px; }
.merge-candidate span { flex: 1; overflow-wrap: anywhere; }
.merge-candidate small { color: var(--muted); }


/* ============ 物理骰子舞台（迁移自旧版，遮罩配 1.0 浅色主题） ============ */
.dice-stage {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  background: transparent;
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s ease, visibility 0s linear .22s;
}
.dice-stage.is-rolling {
  opacity: 1;
  visibility: visible;
  transition: opacity .22s ease, visibility 0s;
}
/* 物理边界充满整个手机屏幕；背景透明，骰子悬浮在页面之上滚动。
   Dice Box 按 canvas.clientWidth 同步物理世界并靠 ResizeObserver 触发，
   所以 canvas 必须用 CSS 铺满容器，否则停在默认 300×150（骰子挤在左上角） */
.dice-stage-box {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
}
.dice-stage-box canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}
@media (prefers-reduced-motion: reduce) {
  .dice-stage { display: none; }
}

/* 按钮内线宽图标统一尺寸（骰子/盾牌等） */
.btn .ic { width: 18px; height: 18px; vertical-align: -4px; }
#btn-fairy-random .ic { width: 20px; height: 20px; vertical-align: -5px; }
