/* ============================================================
   狼人杀助手 · 设计系统（浅色玻璃拟态 + 紫蓝渐变 Indigo→Violet）
   ============================================================ */
:root {
  --grad: linear-gradient(135deg, #6366f1, #8b5cf6);
  --grad-soft: linear-gradient(135deg, #eef0ff, #f3ecff);
  --glass: rgba(255, 255, 255, .62);
  --glass-2: rgba(255, 255, 255, .8);
  --rule: rgba(120, 124, 208, .16);
  --ink: #232a4d;
  --muted: #7a82a6;
  --ok: #22c55e; --warn: #f59e0b; --err: #e5484d;
  --r-lg: 20px; --r-md: 14px;
  --shadow: 0 24px 60px rgba(70, 78, 160, .16);
  --shadow-sm: 0 14px 34px rgba(70, 78, 160, .1);
}

* { box-sizing: border-box; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: #232a4d;
  background:
    radial-gradient(1100px 640px at 8% -8%, #c7ccff 0%, transparent 55%),
    radial-gradient(820px 560px at 106% 12%, #e3d7ff 0%, transparent 50%),
    linear-gradient(160deg, #eef0fb, #e6e8ff);
  background-attachment: fixed;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(139, 92, 246, .22); }

/* 滚动条 */
* { scrollbar-width: thin; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(120, 124, 208, .32); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120, 124, 208, .5); }

/* ---------------- 布局骨架 ---------------- */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶部玻璃导航（永远置顶） */
.nav {
  position: sticky; top: 0; z-index: 9999;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  margin: 0;
  background: rgba(255, 255, 255, .62);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--rule);
}
.nav .brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 800; letter-spacing: .3px;
}
.nav .brand .logo {
  width: 30px; height: 30px; border-radius: 10px;
  background: var(--grad); color: #fff;
  display: grid; place-items: center; font-size: 15px;
  box-shadow: 0 8px 18px rgba(99, 102, 241, .34);
}
.nav .tabs { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.tabbtn {
  border: 1px solid var(--rule); background: rgba(255, 255, 255, .6);
  color: var(--muted); font-size: 13px; font-weight: 700;
  padding: 9px 18px; border-radius: 999px; cursor: pointer;
  transition: .18s; text-decoration: none;
}
.tabbtn:hover { color: var(--ink); background: rgba(255, 255, 255, .85); transform: translateY(-1px); }
.tabbtn.active {
  background: var(--grad); color: #fff; border-color: transparent;
  box-shadow: 0 10px 22px rgba(99, 102, 241, .34);
}
.nav .me-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 14px 5px 5px; border-radius: 999px;
  background: rgba(255, 255, 255, .6); border: 1px solid var(--rule);
  font-size: 12.5px; font-weight: 700; color: var(--ink);
}
.nav .me-chip img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: #dfe3ff; }

.wrap { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 22px 18px 40px; }
.wrap.narrow { max-width: 760px; }

/* ---------------- 页头 ---------------- */
.page-head { margin-bottom: 18px; }
.page-head h1 {
  font-size: 21px; font-weight: 800; margin: 0 0 6px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.page-head .sub { font-size: 12.5px; color: var(--muted); }
.pill-tag {
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: var(--grad-soft); color: #6d28d9;
  border: 1px solid rgba(139, 92, 246, .22);
}
.head-row { display: flex; align-items: flex-start; gap: 12px; }
.head-row .page-head { margin-bottom: 18px; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--glass);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 20px;
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}
.card h2 {
  font-size: 15px; font-weight: 800; margin: 0 0 14px;
  display: flex; align-items: center; gap: 9px;
}
.card h2 .sub, .card .card-sub { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.card.tight { padding: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

/* ---------------- 折叠卡片（低频内容收起来，手机一屏放得下） ---------------- */
details.card { padding: 14px 16px; }
details.card > summary {
  cursor: pointer; list-style: none; font-size: 14px; font-weight: 800; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: '展开 ▾'; margin-left: auto; font-size: 11.5px; font-weight: 700; color: #6d28d9; }
details.card[open] > summary::after { content: '收起 ▴'; }
details.card[open] > summary { margin-bottom: 12px; }
details.card .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { details.card .two-col { grid-template-columns: 1fr; } }

/* ---------------- 首页 Hero ---------------- */
.hero {
  text-align: center; padding: 54px 20px 40px;
}
.hero h1 {
  font-size: clamp(38px, 8vw, 66px); font-weight: 800; margin: 0 0 10px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: 2px;
}
.hero .slogan { font-size: 13.5px; color: var(--muted); margin-bottom: 34px; }
.hero .actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.hero .actions .btn { min-width: 190px; padding: 16px 30px; font-size: 15.5px; }

/* ---------------- 按钮 ---------------- */
.btn {
  border: 1px solid transparent;
  border-radius: 999px; padding: 11px 22px;
  font-weight: 700; font-size: 13.5px; font-family: inherit;
  cursor: pointer; transition: .18s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary {
  background: var(--grad); color: #fff;
  box-shadow: 0 10px 24px rgba(99, 102, 241, .34);
}
.btn.ghost {
  background: rgba(255, 255, 255, .6); color: var(--ink);
  border-color: var(--rule);
}
.btn.ghost:hover { background: rgba(255, 255, 255, .9); }
.btn.danger { background: rgba(229, 72, 77, .1); color: var(--err); border-color: rgba(229, 72, 77, .3); }
.btn.sm { padding: 10px 16px; font-size: 12.5px; }
.btn.xs { padding: 7px 13px; font-size: 12px; }
.btn.block { width: 100%; }

/* ---------------- 表单 ---------------- */
label.fld { display: block; margin-bottom: 14px; }
label.fld > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; font-family: inherit; font-size: 13.5px; color: var(--ink);
  border-radius: 999px; padding: 11px 16px;
  border: 1px solid var(--rule); background: rgba(255, 255, 255, .8);
  outline: none; transition: .18s;
}
textarea.input { border-radius: var(--r-md); resize: vertical; }
.input:focus, select.input:focus {
  border-color: #8b5cf6; box-shadow: 0 0 0 3px rgba(139, 92, 246, .15);
}
.input[readonly] { color: var(--muted); background: rgba(255, 255, 255, .5); }
.hint { font-size: 11px; color: var(--muted); margin-top: 6px; }
.hint.err { color: var(--err); font-weight: 600; }

.switchrow {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, .5); border: 1px solid var(--rule);
  margin-bottom: 10px;
}
.switchrow .t { font-size: 13px; font-weight: 700; }
.switchrow .d { font-size: 11px; color: var(--muted); margin-top: 3px; }
.switchrow .spacer { flex: 1; }

/* 开关 */
.sw { position: relative; width: 44px; height: 24px; flex: none; }
.sw input { display: none; }
.sw i {
  display: block; width: 100%; height: 100%; border-radius: 999px;
  background: #cbd0e0; transition: .2s; cursor: pointer;
}
.sw i::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18); transition: .2s;
}
.sw input:checked + i { background: var(--grad); }
.sw input:checked + i::after { left: 23px; }

/* 分段选择 */
.seg { display: inline-flex; padding: 4px; gap: 4px; background: rgba(255, 255, 255, .55); border: 1px solid var(--rule); border-radius: 999px; }
.seg button {
  border: none; background: transparent; cursor: pointer; font-family: inherit;
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  padding: 8px 16px; border-radius: 999px; transition: .18s;
}
.seg button.on { background: var(--grad); color: #fff; box-shadow: 0 8px 18px rgba(99, 102, 241, .3); }

/* 角色配置行 */
.roleline {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, .5); border: 1px solid var(--rule);
  margin-bottom: 9px;
}
.roleline .ric {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: rgba(99, 102, 241, .1); display: grid; place-items: center; font-size: 18px;
}
.roleline .rn { font-size: 13px; font-weight: 700; }
.roleline .rd { font-size: 10.5px; color: var(--muted); opacity: .85; }
.stepper { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.stepper button {
  width: 30px; height: 30px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule); background: rgba(255, 255, 255, .8);
  color: var(--ink); font-size: 15px; font-weight: 700; line-height: 1;
}
.stepper button:hover { background: var(--grad); color: #fff; border-color: transparent; }
.stepper .val {
  min-width: 30px; text-align: center; font-size: 15px; font-weight: 800;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* 统计卡 */
.stats { display: flex; gap: 14px; flex-wrap: wrap; }
.stat {
  flex: 1; min-width: 130px; padding: 16px 18px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, .55); border: 1px solid var(--rule);
}
.stat .v {
  font-size: 26px; font-weight: 800; line-height: 1.15;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat .k { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* 状态点 */
.dot { width: 10px; height: 10px; border-radius: 50%; background: #cbd0e0; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px rgba(34, 197, 94, .18); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px rgba(245, 158, 11, .18); }
.dot.err { background: var(--err); box-shadow: 0 0 0 4px rgba(229, 72, 77, .18); }
.dottext { font-size: 12.5px; font-weight: 600; margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* 日志区 */
.log {
  height: 270px; overflow: auto; padding: 14px; border-radius: var(--r-md);
  background: rgba(20, 24, 48, .92); color: #dfe5ff;
  font-family: Consolas, 'Courier New', monospace; font-size: 12px; line-height: 1.6;
}
.log.small { height: 140px; }
.log .empty { text-align: center; color: #6b7396; padding-top: 90px; }
.log.small .empty { padding-top: 40px; }
.log .line { white-space: pre-wrap; word-break: break-all; }
.log .line .t { color: #7f8bb8; }

/* ---------------- 座位区 ---------------- */
.seat-area {
  position: relative; width: 100%; min-height: min(46vh, 380px);
  border-radius: var(--r-lg); padding: 14px;
  background: rgba(255, 255, 255, .34);
  border: 1px solid var(--rule);
  overflow: hidden;
  /* 手机上手指在座位区滑动时，允许页面正常纵向滚动 */
  touch-action: pan-y;
  overscroll-behavior: contain;
}
.seat-area.round { min-height: min(50vh, 430px); }
/* 自定义排布：座位区内部拖动时不允许页面跟着滑（解决“拖动时页面也滑动”） */
.seat-area.custom { touch-action: none; }
.seat-area.custom .seat, .seat-area.custom .seat .ava { touch-action: none; }
.seat-area.grid-mode { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px; align-content: start; }
.seat-area .table {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 46%; height: 46%; min-width: 190px; min-height: 190px;
  border-radius: 50%;
  background: var(--grad-soft); border: 1px solid rgba(139, 92, 246, .2);
  box-shadow: inset 0 0 40px rgba(139, 92, 246, .12);
  display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 12px;
  pointer-events: none;
}
.seat-area .table b { display: block; font-size: 13px; color: #6d28d9; margin-bottom: 4px; }
/* 方形排布：中央是「正方形桌子」（大圆角的方形，与方形座位环呼应） */
.seat-area .table.sq { border-radius: 26px; }

.seat {
  position: relative; width: 88px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  cursor: pointer; user-select: none;
}
.seat .ava {
  width: 62px; height: 62px; border-radius: 50%;
  background: #dfe3ff center/cover no-repeat; overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .9);
  box-shadow: 0 10px 22px rgba(70, 78, 160, .18);
  display: grid; place-items: center; font-size: 24px; color: #9aa2c6;
  transition: .18s;
}
.seat.shape-square .ava { border-radius: 14px; }
.seat:hover .ava { transform: translateY(-2px); box-shadow: 0 14px 26px rgba(99, 102, 241, .3); }
.seat .no {
  position: absolute; top: -4px; left: 2px; z-index: 3;
  min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px;
  background: var(--grad); color: #fff; font-size: 11.5px; font-weight: 800;
  display: grid; place-items: center; box-shadow: 0 6px 14px rgba(99, 102, 241, .35);
}
.seat .nm { font-size: 11.5px; font-weight: 700; color: var(--ink); max-width: 86px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.seat .tg {
  font-size: 9.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: rgba(99, 102, 241, .12); color: #4f46e5;
}
.seat .tg.wolf { background: rgba(229, 72, 77, .14); color: #b42326; }
.seat .tg.good { background: rgba(34, 197, 94, .16); color: #15803d; }
.seat .tg.sheriff { background: var(--grad); color: #fff; }
.seat .tg.dead { background: rgba(122, 130, 166, .2); color: #5b6488; }
.seat.speaking .ava { border-color: #8b5cf6; box-shadow: 0 0 0 4px rgba(139, 92, 246, .22), 0 12px 26px rgba(99, 102, 241, .3); }
.seat.dead { opacity: .5; }
.seat.dead .ava { filter: grayscale(1); }
.seat.me .ava { border-color: #6366f1; }
.seat.selectable .ava { border-color: rgba(139, 92, 246, .55); }
.seat.selectable:hover .ava { border-color: #8b5cf6; }
.seat.picked .ava { border-color: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, .2); }
.seat.empty .ava { border-style: dashed; border-color: rgba(120, 124, 208, .5); }
.seat .badge-crown { position: absolute; top: -6px; right: -2px; font-size: 16px; }

/* 观战台 */
.stand {
  margin-top: 14px; padding: 12px 14px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, .45); border: 1px dashed rgba(120, 124, 208, .45);
}
.stand .st-title { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.stand .st-list { display: flex; gap: 10px; flex-wrap: wrap; }
.stand .st-item {
  display: flex; align-items: center; gap: 7px; padding: 5px 13px 5px 5px;
  border-radius: 999px; background: rgba(255, 255, 255, .8); border: 1px solid var(--rule);
  font-size: 12px; font-weight: 700; cursor: pointer; transition: .18s;
}
.stand .st-item:hover { border-color: rgba(99, 102, 241, .55); box-shadow: 0 0 0 3px rgba(139, 92, 246, .12); }
.stand .st-item img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; background: #dfe3ff; }
.stand .st-item .go { font-size: 11px; color: #4f46e5; }

/* 房号 */
.roomno {
  font-size: 34px; font-weight: 800; letter-spacing: 6px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.codebox {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 16px; border-radius: 999px; background: rgba(255, 255, 255, .6); border: 1px solid var(--rule);
}

/* ---------------- 弹窗 ---------------- */
.mask {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(6, 10, 20, .55);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
}
.modal {
  width: 100%; max-width: 420px; border-radius: 18px; padding: 24px;
  background: rgba(255, 255, 255, .95); border: 1px solid var(--rule);
  box-shadow: 0 30px 70px rgba(30, 34, 70, .3);
  max-height: 88vh; overflow: auto;
}
.modal.wide { max-width: 620px; }
.modal h3 { margin: 0 0 6px; font-size: 18px; font-weight: 800; text-align: center; }
.modal .msub { font-size: 12px; color: var(--muted); text-align: center; margin-bottom: 18px; }
.modal .mfoot { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }

/* 身份卡 */
.rolecard {
  width: 250px; margin: 0 auto; border-radius: var(--r-lg); padding: 22px 18px; text-align: center;
  background: var(--grad); color: #fff; box-shadow: 0 24px 50px rgba(99, 102, 241, .45);
}
.rolecard .ic { font-size: 52px; line-height: 1; }
.rolecard .nm { font-size: 23px; font-weight: 800; margin: 10px 0 6px; letter-spacing: 1px; }
.rolecard .camp { font-size: 12px; opacity: .9; }
.rolecard .ds { font-size: 12px; line-height: 1.7; margin-top: 14px; text-align: left; opacity: .95; }

/* 计时器 */
.timer {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; border-radius: 999px;
  background: rgba(255, 255, 255, .7); border: 1px solid var(--rule);
}
.timer .n {
  font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.timer.urgent .n { background: linear-gradient(135deg, #f59e0b, #e5484d); -webkit-background-clip: text; background-clip: text; }
.timer .lbl { font-size: 12px; color: var(--muted); }

/* 提示条 */
.banner {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; border-radius: 999px; margin-bottom: 16px;
  background: var(--grad-soft); border: 1px solid rgba(139, 92, 246, .22);
  font-size: 13px; font-weight: 700; color: #5b21b6;
}
.banner.dark {
  background: rgba(20, 24, 48, .92); color: #dfe5ff; border-color: transparent;
  font-weight: 600; font-size: 12.5px;
}
.banner .spacer { flex: 1; }

/* 时间线（结算/回顾） */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: rgba(120, 124, 208, .25); }
.tl-item { position: relative; margin-bottom: 14px; }
.tl-item::before {
  content: ''; position: absolute; left: -20px; top: 5px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--grad); box-shadow: 0 0 0 3px rgba(139, 92, 246, .16);
}
.tl-item .tl-t { font-size: 12px; font-weight: 800; color: #4f46e5; margin-bottom: 4px; }
.tl-item .tl-d { font-size: 12.5px; color: var(--ink); line-height: 1.7; }
.tl-item .tl-d em { font-style: normal; color: var(--muted); }

/* 列表项 */
.li {
  display: flex; align-items: center; gap: 12px; padding: 13px 15px;
  border-radius: var(--r-md); background: rgba(255, 255, 255, .55);
  border: 1px solid var(--rule); margin-bottom: 10px;
}
.li .lic { width: 38px; height: 38px; border-radius: 11px; background: rgba(99, 102, 241, .1); display: grid; place-items: center; font-size: 18px; flex: none; }
.li .ln { font-size: 13.5px; font-weight: 700; }
.li .ld { font-size: 11px; color: var(--muted); margin-top: 3px; }
.li .spacer { flex: 1; }

/* 空态 */
.empty-state { text-align: center; padding: 44px 16px; color: var(--muted); }
.empty-state .ic { font-size: 40px; margin-bottom: 10px; opacity: .8; }
.empty-state .t { font-size: 13.5px; font-weight: 700; color: var(--ink); margin-bottom: 5px; }
.empty-state .d { font-size: 12px; }

/* 头像上传 */
.avatar-pick { display: flex; align-items: center; gap: 14px; }
.avatar-pick .pv {
  width: 70px; height: 70px; border-radius: 50%; flex: none; overflow: hidden;
  background: #dfe3ff center/cover no-repeat; border: 2px solid rgba(255, 255, 255, .9);
  box-shadow: 0 10px 22px rgba(70, 78, 160, .18);
  display: grid; place-items: center; font-size: 26px; color: #9aa2c6;
}
.avatar-pick .pv img { width: 100%; height: 100%; object-fit: cover; }

/* 九宫格身份一览（结算） */
.reveal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.reveal {
  padding: 12px 10px; border-radius: var(--r-md); text-align: center;
  background: rgba(255, 255, 255, .6); border: 1px solid var(--rule);
}
.reveal.wolf { background: rgba(229, 72, 77, .1); border-color: rgba(229, 72, 77, .28); }
.reveal.god { background: rgba(139, 92, 246, .1); border-color: rgba(139, 92, 246, .28); }
.reveal .rno { font-size: 11px; font-weight: 800; color: var(--muted); }
.reveal .ric { font-size: 26px; margin: 4px 0 2px; }
.reveal .rnm { font-size: 12.5px; font-weight: 800; }
.reveal .ruser { font-size: 10.5px; color: var(--muted); margin-top: 3px; }

/* 胜利横幅 */
.win-banner {
  text-align: center; padding: 26px; border-radius: var(--r-lg);
  background: var(--grad); color: #fff; box-shadow: 0 24px 50px rgba(99, 102, 241, .4);
  margin-bottom: 18px;
}
.win-banner .big { font-size: 30px; font-weight: 800; letter-spacing: 1px; }
.win-banner .sml { font-size: 13px; opacity: .92; margin-top: 6px; }
.win-banner.lose { background: linear-gradient(135deg, #64748b, #475569); box-shadow: 0 24px 50px rgba(71, 85, 105, .35); }

/* 操作区 */
.actionbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.tipbox {
  padding: 12px 16px; border-radius: var(--r-md); font-size: 12.5px; line-height: 1.7;
  background: rgba(255, 255, 255, .55); border: 1px solid var(--rule); color: var(--ink);
}
.tipbox b { color: #4f46e5; }

.hide { display: none !important; }
.center { text-align: center; }
.muted { color: var(--muted); }
.mono { font-family: Consolas, 'Courier New', monospace; }
.nowrap { white-space: nowrap; }

/* ---------------- 对局页：座位当背景，控件浮在上面 ---------------- */
.game-wrap { padding-top: 10px; }
.stage {
  position: relative;
  height: calc(100vh - 118px);
  min-height: 430px;
  border-radius: var(--r-lg);
  overflow: hidden;
}
.stage-seats {
  position: absolute; inset: 0;
  min-height: 0;
  border-radius: var(--r-lg);
}
.stage-seats .table { top: 39%; width: 40%; height: 40%; min-width: 160px; min-height: 160px; }

.float-top, .float-bottom {
  position: absolute; left: 8px; right: 8px;
  display: flex; flex-direction: column; gap: 6px;
  pointer-events: none;                       /* 只有控件本身接收点击，其它位置能点到座位 */
}
.float-top { top: 8px; }
.float-bottom { bottom: 8px; }
.float-top > *, .float-bottom > * { pointer-events: auto; }

.pillbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .74);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid var(--rule);
  box-shadow: 0 8px 20px rgba(70, 78, 160, .12);
  font-size: 12.5px; color: var(--ink);
}
.pillbar.night { background: rgba(22, 26, 50, .74); color: #e6ebff; }
.pillbar.night .muted { color: #9aa4c8; }
.pillbar .timer .lbl { color: inherit; opacity: .7; }

.float-card {
  padding: 10px 12px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, .8);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--rule);
  box-shadow: 0 10px 26px rgba(70, 78, 160, .14);
  max-height: 40vh; overflow: auto;
}
.float-card .fh { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12.5px; }

.float-strip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .66);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--rule);
}

.mini {
  border-radius: var(--r-md); padding: 8px 12px;
  background: rgba(255, 255, 255, .66);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--rule);
}
.mini > summary {
  list-style: none; cursor: pointer;
  font-size: 12px; font-weight: 700; color: #6d28d9;
  display: flex; align-items: center; gap: 6px;
}
.mini > summary::-webkit-details-marker { display: none; }
.mini > summary::after { content: '展开 ▾'; margin-left: auto; }
.mini[open] > summary::after { content: '收起 ▴'; }
.mini .mini-body {
  margin-top: 8px; display: flex; flex-direction: column; gap: 8px;
  max-height: 46vh; overflow: auto;
}

/* ---------------- 夜晚：整页切到暗紫色系 ---------------- */
body.night {
  background:
    radial-gradient(1100px 640px at 8% -8%, #3b2a72 0%, transparent 55%),
    radial-gradient(820px 560px at 106% 12%, #2a1b52 0%, transparent 50%),
    linear-gradient(160deg, #16112f, #0d0a1f);
  color: #ded9ff;
}
body.night .nav { background: rgba(24, 19, 48, .76); border-bottom-color: rgba(150, 130, 230, .22); }
body.night .nav .brand span { color: #e9e5ff; }
body.night .nav .tabbtn { color: #b3acdb; }
body.night .nav .tabbtn.active { color: #fff; }
body.night .stage-seats {
  background: rgba(32, 24, 66, .6);
  border-color: rgba(150, 130, 230, .24);
}
body.night .stage-seats .table {
  background: linear-gradient(135deg, #2c2158, #3b2a72);
  border-color: rgba(160, 130, 240, .32);
  color: #b8b2e0;
  box-shadow: inset 0 0 46px rgba(120, 80, 220, .3);
}
body.night .stage-seats .table b { color: #d3c8ff; }
body.night .seat .nm { color: #d2cbf3; }
body.night .seat .ava { border-color: rgba(160, 140, 240, .38); background: rgba(42, 33, 78, .78); }
body.night .seat.empty .ava { color: #8d86b8; }
body.night .float-card, body.night .float-strip, body.night .mini {
  background: rgba(26, 20, 54, .84);
  border-color: rgba(155, 135, 235, .26);
  color: #e2ddff;
}
body.night .float-card .muted, body.night .float-strip .muted, body.night .mini .muted { color: #a29bcc; }
body.night .mini > summary { color: #cbb9ff; }
body.night .log { background: rgba(10, 7, 24, .88); color: #dcd7ff; }
body.night .hint { color: #a29bcc; }
body.night .btn.ghost { background: rgba(255, 255, 255, .1); color: #e9e5ff; border-color: rgba(155, 135, 235, .32); }

/* 对局页沉浸式：顶部导航收起（放在媒体查询外，横屏变宽时也不会跳回来） */
body.no-nav .nav { display: none; }

@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
  .hero { padding: 34px 14px 24px; }
  .hero .actions .btn { min-width: 150px; }
  .seat-area.round { min-height: min(46vh, 400px); }
  .seat { width: 76px; }
  .seat .ava { width: 54px; height: 54px; }
  .wrap { padding: 12px 10px 26px; }
  .nav { padding: 8px 12px; }
  .nav .brand { display: none; }
  /* 手机紧凑排版：卡片内边距与间距收紧，尽量一屏放下 */
  .card { padding: 14px; margin-bottom: 12px; }
  .card h2 { font-size: 15px; }
  .page-head { margin-bottom: 12px; }
  .page-head h1 { font-size: 18px; }
  .page-head .sub { font-size: 12px; }
  .switchrow { padding: 8px 10px; }
  .seat-area { min-height: min(40vh, 330px); }
  .seat-area.round { min-height: min(42vh, 350px); }
}

@media (max-width: 420px) {
  .seat { width: 66px; }
  .seat .ava { width: 46px; height: 46px; }
  .seat .nm { font-size: 10.5px; }
  .seat-area { min-height: min(38vh, 300px); }
  .seat-area.round { min-height: min(40vh, 320px); }
}

/* ============================================================
   移动端（手机优先）：刘海安全区 / dvh 高度 / 拇指可达控件 / 底部抽屉
   ============================================================ */
:root { --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); }

body { overscroll-behavior-y: none; }
body.sheet-open { overflow: hidden; }
* { -webkit-tap-highlight-color: transparent; }

.nav { padding-top: calc(9px + var(--safe-t)); }

/* 对局页：用 dvh，手机地址栏出现/隐藏都不会把底部行动区顶出去 */
.stage { height: calc(100dvh - 100px - var(--safe-t)); }
.stage .seat-area.stage-seats { min-height: 0; height: 100%; }

/* 圆形工具按钮（身份卡 / 声音 / 日志 / 更多） */
.pillbar .timer { padding: 3px 12px; gap: 6px; border: none; background: transparent; }
.pillbar .timer .n { font-size: 22px; }
.pillbar.night .timer .n { background: linear-gradient(135deg, #c4b5fd, #a78bfa); -webkit-background-clip: text; background-clip: text; color: transparent; }

.toolbar { display: flex; align-items: center; gap: 8px; }
.tool-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 26px; }
.tool-tags .tg { font-size: 10.5px; font-weight: 700; padding: 4px 9px; border-radius: 999px; }
.ibtn {
  width: 42px; height: 42px; flex: none; border-radius: 999px;
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 8px 20px rgba(70, 78, 160, .14);
  font-family: inherit; font-size: 19px; line-height: 1;
  cursor: pointer; display: grid; place-items: center;
  transition: transform .15s, box-shadow .15s;
}
.ibtn:active { transform: scale(.93); }
.ibtn.off { opacity: .5; }
.ibtn.locked { border-color: rgba(245, 158, 11, .6); box-shadow: 0 0 0 3px rgba(245, 158, 11, .2); }

/* 「点一下开启声音」提示条（手机必须由用户手势解锁） */
.hint-audio {
  justify-content: center; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #f59e0b, #e5484d);
  border: none; cursor: pointer;
  box-shadow: 0 10px 24px rgba(229, 72, 77, .3);
  animation: hintPulse 1.8s ease-in-out infinite;
}
@keyframes hintPulse { 0%, 100% { transform: none; } 50% { transform: translateY(-2px); } }

/* 底部抽屉：低频内容（说明/私有信息/声音/日志/操作）平时不占屏幕 */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 99998;
  max-height: min(82dvh, 640px); overflow: auto;
  padding: 14px 14px calc(22px + var(--safe-b));
  border-radius: 22px 22px 0 0;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-top: 1px solid var(--rule);
  box-shadow: 0 -20px 52px rgba(30, 34, 70, .3);
  animation: sheetUp .22s cubic-bezier(.2, .8, .2, 1);
}
@keyframes sheetUp { from { transform: translateY(28px); opacity: .25; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; margin-bottom: 10px; }
.sheet-head b { font-size: 15px; }
.sheet-head .ibtn { margin-left: auto; width: 34px; height: 34px; font-size: 15px; }
.sheet .row { margin-bottom: 10px; }
.sheet .log.small { height: 150px; }
.sheet .btn { flex: 1; }
body.night .sheet { background: rgba(20, 16, 42, .97); color: #e2ddff; border-top-color: rgba(155, 135, 235, .26); }
body.night .sheet .hint { color: #a29bcc; }
body.night .sheet .ibtn, body.night .sheet .btn.ghost {
  background: rgba(255, 255, 255, .1); color: #e9e5ff; border-color: rgba(155, 135, 235, .3);
}

@media (max-width: 760px) {
  .hide-xs { display: none !important; }
  .wrap, .wrap.game-wrap { padding: 8px 8px calc(12px + var(--safe-b)); }
  .stage { height: calc(100dvh - 86px - var(--safe-t)); min-height: 320px; border-radius: 16px; }
  .stage-seats .table { top: 38%; width: 34%; height: 34%; min-width: 116px; min-height: 116px; }
  .float-top, .float-bottom { left: 6px; right: 6px; gap: 6px; }
  .float-top { top: 6px; }
  .float-bottom { bottom: calc(6px + var(--safe-b)); }
  .pillbar { padding: 6px 10px; font-size: 12px; gap: 6px; }
  .timer { padding: 2px 10px; gap: 4px; }
  .timer .n { font-size: 20px; }
  .float-card { padding: 10px 10px 12px; max-height: 44dvh; border-radius: 16px; }
  .float-card .fh { font-size: 12px; margin-bottom: 8px; }
  .float-strip { padding: 4px 10px; font-size: 11px; }
  /* 手指够得到：主要按钮一律 ≥44px 高 */
  .btn { padding: 12px 20px; font-size: 14px; }
  .btn.sm, .btn.xs { padding: 11px 16px; font-size: 13px; }
  .float-card .btn, .float-card .seg button { min-height: 44px; }
  .seat { width: 66px; }
  .seat .ava { width: 46px; height: 46px; font-size: 20px; }
  .seat .no { min-width: 20px; height: 20px; font-size: 11px; }
  .seat .nm { font-size: 10.5px; max-width: 66px; }
  .reveal-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
  .modal { padding: 20px 16px; border-radius: 18px; }
  .rolecard { width: min(250px, 72vw); }
  .sheet { padding: 12px 12px calc(24px + var(--safe-b)); }
}

/* ============================================================
   移动端深度适配 v2：底部标签栏 / iOS 输入框 / 底部抽屉弹窗 / 小屏 / 横屏
   ============================================================ */
/* 底部标签栏（桌面端隐藏，手机端由下方媒体查询打开） */
.tabbar { display: none; }
.tabbar .tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 700;
  padding-bottom: 4px;
}
.tabbar .tab b { font-size: 19px; line-height: 1; filter: grayscale(.4); }
.tabbar .tab i { font-style: normal; }
.tabbar .tab.on { color: #4f46e5; }
.tabbar .tab.on b { filter: none; }
body.night .tabbar { background: rgba(20, 16, 42, .94); border-top-color: rgba(155, 135, 235, .24); }
body.night .tabbar .tab { color: #9c95c6; }
body.night .tabbar .tab.on { color: #c4b5fd; }

/* 手机上手感细节：去掉 300ms 点击延迟；正文不吃系统长按菜单，输入/日志可选中 */
button, .btn, .tabbtn, .ibtn, .seg button, .stepper button, .tabbar .tab, .seat, summary { touch-action: manipulation; }
body { -webkit-user-select: none; user-select: none; }
input, textarea, .log, .tl-item .tl-d, .tipbox, .reveal .ruser { -webkit-user-select: text; user-select: text; }

@media (max-width: 760px) {
  /* 顶部只留品牌与头像，导航交给底部标签栏（拇指可达） */
  .nav .tabs .tabbtn { display: none; }
  body:not(.no-tabbar) .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 9990;
    height: calc(58px + var(--safe-b)); padding-bottom: var(--safe-b);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border-top: 1px solid var(--rule);
    box-shadow: 0 -8px 24px rgba(70, 78, 160, .08);
  }
  body:not(.no-tabbar) .wrap { padding-bottom: calc(76px + var(--safe-b)); }
  body:not(.no-tabbar) .toast { bottom: calc(74px + var(--safe-b)); }
  body.no-tabbar .toast { bottom: calc(22px + var(--safe-b)); }

  /* iOS 输入框必须 ≥16px，否则聚焦时整页被强行放大 */
  .input, select.input, textarea.input { font-size: 16px; padding: 12px 16px; }

  /* 弹窗改成「底部抽屉」：单手好点，按钮全宽、主按钮更靠下 */
  .mask { align-items: flex-end; justify-items: center; padding: 0; }
  .modal {
    max-width: 100%; border-radius: 20px 20px 0 0;
    padding: 18px 16px calc(18px + var(--safe-b));
    max-height: 90dvh;
    animation: sheetUp .2s cubic-bezier(.2, .8, .2, 1);
  }
  .modal h3 { font-size: 17px; }
  .modal .mfoot { flex-direction: column-reverse; gap: 8px; margin-top: 14px; }
  .modal .mfoot .btn { width: 100%; min-height: 48px; font-size: 14.5px; }

  /* 所有可点元素 ≥44px */
  .seg button { min-height: 40px; padding: 9px 16px; }
  .stepper button { width: 38px; height: 38px; }
  .sw { width: 50px; height: 28px; }
  .sw i::after { width: 22px; height: 22px; }
  .sw input:checked + i::after { left: 25px; }
  .stand .st-item { padding: 7px 15px 7px 6px; }
  .codebox { width: 100%; justify-content: center; }
  .roomno { font-size: 30px; letter-spacing: 4px; }
  .log { font-size: 12.5px; }
  .log, .sheet, .float-card, .modal { -webkit-overflow-scrolling: touch; }
  .reveal { padding: 10px 8px; }
  .reveal .ric { font-size: 22px; }
  .empty-state { padding: 30px 12px; }

  /* 页面主按钮吸底：滚动时也够得到（创建房间 / 开始游戏） */
  .actionbar-dock {
    position: sticky; bottom: calc(70px + var(--safe-b)); z-index: 40;
    margin: 4px -4px 0; padding: 10px 4px;
    border-radius: 14px;
    background: linear-gradient(to top, rgba(255, 255, 255, .97) 62%, rgba(255, 255, 255, 0));
  }
  .actionbar-dock .btn { flex: 1; min-height: 48px; font-size: 14.5px; white-space: nowrap; padding-left: 12px; padding-right: 12px; }
  .actionbar-dock .btn.ghost { flex: 0 0 auto; }
  body.night .actionbar-dock { background: linear-gradient(to top, rgba(20, 16, 42, .97) 62%, rgba(20, 16, 42, 0)); }

  /* 对局页：沉浸式全屏（顶部导航收起，空间全给牌局） */
  body.playing.no-nav .app { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  body.playing.no-nav .game-wrap { display: flex; flex-direction: column; padding: 6px 6px calc(6px + var(--safe-b)); }
  body.playing.no-nav .stage { flex: 1 1 auto; height: auto; min-height: 0; border-radius: 14px; }
  body.playing.no-nav .float-top { top: calc(6px + var(--safe-t)); }
  body.no-nav .float-top { top: calc(6px + var(--safe-t)); }
  body:not(.playing).no-nav .stage { height: auto; min-height: 46dvh; border-radius: 14px; }
}

/* 小屏（iPhone SE / 小屏安卓） */
@media (max-width: 380px) {
  .pillbar { font-size: 11.5px; padding: 5px 9px; }
  .ibtn { width: 40px; height: 40px; font-size: 18px; }
  .seat { width: 58px; }
  .seat .ava { width: 42px; height: 42px; font-size: 18px; }
  .seat .nm { font-size: 10px; max-width: 58px; }
  .timer .n { font-size: 18px; }
  .wrap, .wrap.game-wrap { padding-left: 6px; padding-right: 6px; }
  .card { padding: 12px; }
  .modal { padding: 16px 12px calc(16px + var(--safe-b)); }
  .nav .me-chip span { display: none; }
}

/* 矮屏 / 横屏：座位改成自动换行的流式排布，整页可滚动，控制条固定（由 JS 加 body.flow-seats） */
body.flow-seats.playing.no-nav .app { height: auto; min-height: 0; overflow: visible; }
body.flow-seats .game-wrap { padding: 6px; }
body.flow-seats .stage { display: block; height: auto; min-height: 0; border-radius: 14px; }
body.flow-seats .seat-area.stage-seats {
  position: static; height: auto; min-height: 0;
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  padding: 74px 8px calc(210px + var(--safe-b));
}
body.flow-seats .stage-seats .table { display: none; }
body.flow-seats .stage-seats .seat {
  position: static !important; left: auto !important; top: auto !important; transform: none !important; width: 62px;
}
body.flow-seats .stage-seats .seat .ava { width: 44px; height: 44px; font-size: 19px; }
body.flow-seats .stage-seats .seat .nm { max-width: 60px; }
body.flow-seats .float-top { position: fixed; left: 6px; right: 6px; top: calc(6px + var(--safe-t)); }
body.flow-seats .float-bottom { position: fixed; left: 6px; right: 6px; bottom: calc(6px + var(--safe-b)); }
body.flow-seats .float-card { max-height: 40dvh; }

/* 矮屏（小屏手机竖屏）：把座位与控件都缩一点，给座位环留出空间 */
@media (max-height: 660px) {
  .seat { width: 58px; }
  .seat .ava { width: 42px; height: 42px; font-size: 18px; }
  .seat .nm { font-size: 10px; max-width: 58px; }
  .float-card { max-height: 36dvh; }
}

/* 横屏弹窗回到居中（横屏时上下留白少，底部抽屉反而不好点） */
@media (orientation: landscape) and (max-height: 560px) {
  .mask { align-items: center; justify-items: center; padding: 10px; }
  .modal { max-width: 560px; border-radius: 18px; max-height: 92dvh; }
  .modal .mfoot { flex-direction: row; }
  .modal .mfoot .btn { width: auto; min-height: 42px; }
}

/* ============================================================
   单页应用（SPA）：首页/创建/大厅/对局/我的 都在 index.html 里，切换只显隐不刷新
   ============================================================ */
#viewRoot { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.view[hidden] { display: none !important; }

/* 座位按 --sc 整体缩放：由 UI.layout 按座位区可用空间算出（人多 / 屏矮 / 上下控件占位多时自动变小），
   保证相邻座位之间永远留得下，不会挤成一团（大厅和对局用的是同一套算法） */
.seat { width: calc(88px * var(--sc, 1)); gap: calc(5px * var(--sc, 1)); }
.seat .ava { width: calc(62px * var(--sc, 1)); height: calc(62px * var(--sc, 1)); }
.seat .nm { font-size: calc(11.5px * var(--sc, 1)); max-width: calc(86px * var(--sc, 1)); }
.seat .no {
  min-width: calc(22px * var(--sc, 1)); height: calc(22px * var(--sc, 1));
  font-size: calc(11.5px * var(--sc, 1)); padding: 0 calc(5px * var(--sc, 1));
}
.seat .badge-crown { font-size: calc(16px * var(--sc, 1)); }
.seat .tg { font-size: calc(9.5px * var(--sc, 1)); padding: calc(2px * var(--sc, 1)) calc(7px * var(--sc, 1)); }
.seat-area.round .seat .tags { max-width: calc(110px * var(--sc, 1)); }


