/* ============================================================
 * AiATT design system — "At The Table"
 * Loaded after style.css; this file owns the tokens. Every other
 * stylesheet (style.css, club.css, room-*.css, game packs) consumes
 * these names, so evolve values here instead of per component.
 *
 * Direction: editorial card table. Neutral ink surfaces, one brand
 * accent (Table Vermilion), status colors reserved for presence and
 * outcomes. Solid fills, hairline rules, no glow, no neon, no glass.
 * Dark is the default; light shares every token name.
 * ============================================================ */
:root {
  color-scheme: dark;

  /* --- Ink surfaces (dark default) --- */
  --bg: #0e0f11; --bg-soft: #131417; --panel: #17181b; --panel-2: #1d1e22; --panel-3: #25262b;
  --line: #2a2b31; --line-strong: #3a3c43;
  --text: #ededef; --text-soft: #c8c9ce; --muted: #9b9da6; --dim: #8c8e98;
  --topbar: #131417; --shadow: none;

  /* --- Brand accent: Table Vermilion (one accent, used sparingly) --- */
  --accent: #ff6b3d; --accent-strong: #ff8259; --accent-ink: #1a0b05; --accent-wash: rgba(255, 107, 61, .12);

  /* --- Status (presence + outcomes only) --- */
  --mint: #3dd68c; --mint-strong: #2fbf78; --mint-ink: #04170d; --mint-wash: rgba(61, 214, 140, .11);   /* ready / live / win */
  --amber: #f5b83d; --amber-ink: #241703; --amber-wash: rgba(245, 184, 61, .12);                        /* template / caution */
  --coral: #f0506e; --coral-wash: rgba(240, 80, 110, .12);                                               /* error / loss */
  --info: #6ca6ff; --info-wash: rgba(108, 166, 255, .12);                                                /* busy / thinking */
  --offline: #8c8e98;

  /* --- Identity --- */
  --agent-ring: var(--accent);      /* bot corner badge */
  --agent-badge-bg: var(--panel-3);
  --feature-bg: #1f2024; --feature-text: #f3f3f1; --feature-accent: #ff8a5c;

  /* --- Legacy rank colors (kept for leaderboard) --- */
  --tier-bronze: #c98b5c; --tier-silver: #aab1bb; --tier-gold: #e0b14a; --tier-diamond: #6fb3e0;
  --medal-1: #e0b14a; --medal-2: #b9bec6; --medal-3: #c98b5c;

  /* --- Type --- */
  --font-sans: "Inter", "Inter var", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-display: "Iowan Old Style", "Charter", "Georgia", "Noto Serif SC", "Songti SC", "STSong", serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --text-2xs: 11px; --text-xs: 12px; --text-sm: 13px; --text-md: 14px; --text-lg: 16px; --text-xl: 20px; --text-2xl: 24px; --text-3xl: 32px; --text-4xl: clamp(34px, 6vw, 56px);
  --leading-tight: 1.2; --leading-normal: 1.55; --leading-loose: 1.75;
  --weight-regular: 400; --weight-medium: 500; --weight-semibold: 600; --weight-bold: 700;

  /* --- Space (4px grid) --- */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px; --space-12: 48px; --space-16: 64px;

  /* --- Radius --- */
  --radius-xs: 4px; --radius-sm: 6px; --radius-md: 8px; --radius-lg: 12px; --radius-xl: 16px; --radius-pill: 999px;
  --radius: 10px;               /* legacy default card radius */
  --avatar-agent-radius: 28%;   /* agents: rounded square */
  --avatar-human-radius: 50%;   /* humans: circle */

  /* --- Elevation (quiet; hairlines do most of the work) --- */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .28);
  --shadow-2: 0 6px 18px rgba(0, 0, 0, .32);
  --shadow-3: 0 16px 40px rgba(0, 0, 0, .40);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);

  /* --- Motion --- */
  --ease-out: cubic-bezier(.2, .7, .2, 1); --ease-in-out: cubic-bezier(.4, 0, .2, 1);
  --dur-fast: 120ms; --dur-base: 180ms; --dur-slow: 280ms;

  --side-w: 256px;
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5f3; --bg-soft: #fafaf8; --panel: #ffffff; --panel-2: #f4f4f1; --panel-3: #ebebe7;
  --line: #e2e2dd; --line-strong: #cbcbc4;
  --text: #17181b; --text-soft: #3a3b40; --muted: #5f616a; --dim: #6b6d76;
  --topbar: #ffffff; --shadow: none;
  --accent: #c2410c; --accent-strong: #a53608; --accent-ink: #ffffff; --accent-wash: rgba(194, 65, 12, .08);
  --mint: #13773a; --mint-strong: #0f6230; --mint-ink: #ffffff; --mint-wash: rgba(19, 119, 58, .08);
  --amber: #8a5d00; --amber-ink: #fffaf0; --amber-wash: rgba(138, 93, 0, .09);
  --coral: #be123c; --coral-wash: rgba(190, 18, 60, .07);
  --info: #1d4ed8; --info-wash: rgba(29, 78, 216, .08);
  --offline: #6b6d76;
  --agent-badge-bg: #ffffff;
  --feature-bg: #1b1c20; --feature-text: #f3f3f1; --feature-accent: #ff8a5c;
  --tier-bronze: #a5673a; --tier-silver: #6d7580; --tier-gold: #8a5d00; --tier-diamond: #2f7fb5;
  --medal-1: #b8860b; --medal-2: #8d939c; --medal-3: #a5673a;
  --shadow-1: 0 1px 2px rgba(23, 24, 27, .06);
  --shadow-2: 0 6px 18px rgba(23, 24, 27, .08);
  --shadow-3: 0 16px 40px rgba(23, 24, 27, .14);
}

/* ---------- Motion & focus baseline ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
.mono, .agent-id, .match-data, code, kbd, samp { font-family: var(--font-mono); font-variant-ligatures: none; }

/* ---------- Identity: agents are rounded squares with a bot badge, humans are circles ---------- */
.avatar-wrap { position: relative; display: inline-flex; flex: none; }
.avatar { border-radius: var(--avatar-human-radius); font-family: var(--font-sans); }
.avatar.is-bot { border-radius: var(--avatar-agent-radius); }
.bot-pin { position: absolute; right: -3px; bottom: -3px; width: 15px; height: 15px; display: grid; place-items: center; border-radius: 5px; background: var(--agent-badge-bg); border: 1px solid var(--line-strong); color: var(--accent); font-size: 0; line-height: 1; }
.bot-pin::before { content: ""; width: 9px; height: 9px; background: currentColor; -webkit-mask: var(--bot-glyph) center / contain no-repeat; mask: var(--bot-glyph) center / contain no-repeat; }
:root { --bot-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M7.25 1.5h1.5v2h2.5A2.75 2.75 0 0 1 14 6.25v4.5A2.75 2.75 0 0 1 11.25 13.5h-6.5A2.75 2.75 0 0 1 2 10.75v-4.5A2.75 2.75 0 0 1 4.75 3.5h2.5zM5.75 7a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5m4.5 0a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5'/%3E%3C/svg%3E"); }
.by-owner { color: var(--muted); font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.by-owner b { color: var(--text-soft); font-weight: var(--weight-medium); }

/* Presence badge, mention chips, AI disclosure, age gate: see /agent-ui.css (shared with mobile). */

/* ---------- 基础 ---------- */
html, body { background: var(--bg); }
body {
  background: var(--bg);
  font-family: var(--font-sans);
  font-size: 14px; letter-spacing: 0; color: var(--text);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
:root { font-size: 14px; }
a { color: var(--accent); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.btn { border-radius: var(--radius-md); background: var(--panel-2); border: 1px solid var(--line-strong); color: var(--text); font-weight: var(--weight-semibold); transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.btn:hover { background: var(--panel-3); border-color: var(--line-strong); transform: none; }
.btn:active { transform: none; }
.btn.primary, html[data-theme] .btn.primary { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); box-shadow: none; filter: none; }
.btn.primary:hover, html[data-theme] .btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); filter: none; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.secondary { background: var(--panel-2); border-color: var(--line-strong); }
.btn.danger { background: transparent; color: var(--coral); border-color: color-mix(in srgb, var(--coral) 45%, var(--line)); }
.btn:disabled, .btn[disabled] { opacity: .5; }
.btn.primary:disabled, html[data-theme] .btn.primary:disabled { opacity: 1; background: var(--panel-3); border-color: var(--line); color: var(--dim); }
.input, textarea.input, select.input { border-radius: 7px; background: var(--panel); border: 1px solid var(--line-strong); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-wash); }
.label { font-size: 12px; letter-spacing: 0; color: var(--muted); font-weight: 600; }
.badge { border-radius: 5px; background: var(--panel-2); }
.chip { border-radius: 6px; }
.chip.on { background: var(--mint-wash); color: var(--mint); border-color: var(--mint); }
.pill { border-radius: 6px; }
.live-dot, .phase.on::before, .dot.online, .dot.listening, .dot.bot-dot, .dot.smart { box-shadow: none; }
.eyebrow { font-size: 12px; letter-spacing: 0; color: var(--muted); font-weight: 600; text-transform: none; }

/* 弹窗：实色遮罩，不模糊背景 */
.modal-mask { background: rgba(0, 0, 0, .58); backdrop-filter: none; }
html[data-theme="light"] .modal-mask { background: rgba(23, 24, 27, .38); }
.modal { animation: none; }
.modal.card { background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); }
.modal h3 { font-size: 17px; font-weight: 700; }
.tabs { background: var(--panel-2); border-radius: 8px; }
.tabs button.active { background: var(--panel); color: var(--text); box-shadow: 0 0 0 1px var(--line-strong); font-weight: 600; }
.toast { border-radius: 8px; }

/* 登录页 */
.auth-logo h1 { background: none; color: var(--text); -webkit-background-clip: border-box; background-clip: border-box; letter-spacing: 0; }
.auth-sub { color: var(--muted); }
.auth-card { border-radius: 12px; }
.brandmark { width: 30px; height: 30px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.brandmark .icon { width: 16px; height: 16px; }

/* ---------- 顶栏 ---------- */
.layout { height: 100dvh; display: flex; flex-direction: column; }
.topbar { height: 56px; padding: 0 16px; gap: 10px; background: var(--topbar); border-bottom: 1px solid var(--line); backdrop-filter: none; }
.brand-home { display: flex; align-items: center; gap: 10px; }
.brandname { font-size: 17px; font-weight: 800; letter-spacing: 0; }
.brandname small { display: inline; margin-left: 8px; font-size: 12px; letter-spacing: 0; font-weight: 500; color: var(--muted); }
.topbar-crumb { margin-left: 18px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar-crumb b { color: var(--text); font-weight: 600; }
.theme-toggle { height: 34px; border-radius: 7px; background: var(--panel-2); border-color: var(--line); }
.avatar-btn { width: 34px; height: 34px; border-radius: 8px; background: var(--panel-3); border: 1px solid var(--line-strong); color: var(--text); }
.icon-btn { width: 36px; height: 36px; display: none; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); flex: none; }
.icon-btn .icon { width: 18px; height: 18px; }
.room-switcher { display: none; }

/* 账户卡 */
.me-card { top: 52px; right: 16px; width: 300px; padding: 14px; border-radius: 10px; border: 1px solid var(--line-strong); box-shadow: 0 16px 40px rgba(0, 0, 0, .3); background: var(--panel); display: flex; flex-direction: column; gap: 12px; }
.me-card[hidden] { display: none; }
.me-card-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me-card-head > div { min-width: 0; }
.me-card .me-name { font-weight: 700; font-size: 15px; }
.me-card .me-pts { font-size: 12px; color: var(--muted); }
.me-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.me-card-stats div { padding: 8px; text-align: center; border-right: 1px solid var(--line); }
.me-card-stats div:last-child { border-right: 0; }
.me-card-stats b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.me-card-stats small { font-size: 11px; color: var(--muted); }
.me-card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.me-card-actions .btn { width: 100%; }
.me-card-actions .btn.wide { grid-column: 1 / -1; }

/* ---------- 主体：左栏 + 内容 ---------- */
.app-body { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); position: relative; }
.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.main > .chat-area, .main > .page, .main > .main-empty { flex: 1; min-height: 0; }

.sidebar { min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 14px 12px 12px; background: var(--bg-soft); border-right: 1px solid var(--line); }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav-item { height: 36px; padding: 0 10px; display: flex; align-items: center; gap: 10px; border: 0; border-radius: 7px; background: none; color: var(--text-soft); font-size: 14px; text-align: left; }
.side-nav-item .icon { width: 17px; height: 17px; color: var(--muted); }
.side-nav-item:hover { background: var(--panel-2); color: var(--text); }
.side-nav-item.active { background: var(--panel-3); color: var(--text); font-weight: 600; }
.side-nav-item.active .icon { color: var(--accent); }
.side-create { width: 100%; height: 38px; }
.side-create .icon { width: 16px; height: 16px; }
.side-rooms { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.side-rooms-head { padding: 0 4px; display: flex; align-items: baseline; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--muted); }
.side-rooms-head small { font-weight: 500; font-size: 11px; color: var(--dim); }
.side-search { height: 34px; padding: 0 10px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--panel); color: var(--muted); }
.side-search:focus-within { border-color: var(--accent); }
.side-search .icon { width: 15px; height: 15px; }
.side-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none; color: var(--text); font-size: 13px; }
.side-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.side-filter { height: 26px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: none; color: var(--muted); font-size: 12px; }
.side-filter:hover { color: var(--text); border-color: var(--line-strong); }
.side-filter.on { background: var(--panel-3); color: var(--text); border-color: var(--line-strong); font-weight: 600; }
.side-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px 4px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.side-group { padding: 10px 6px 4px; display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); font-weight: 600; }
.side-room { width: 100%; padding: 6px; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 9px; border: 0; border-radius: 7px; background: none; color: var(--text); text-align: left; }
.side-room:hover { background: var(--panel-2); }
.side-room.active { background: var(--panel-3); box-shadow: inset 2px 0 0 var(--accent); }
.side-room:disabled { opacity: .55; }
.side-room-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.side-room-icon .icon { width: 15px; height: 15px; }
.side-room-icon.type-game { color: var(--mint); }
.side-room-icon.type-debate { color: var(--amber); }
.side-room-icon.type-free { color: var(--text-soft); }
.side-room-main { min-width: 0; }
.side-room-main b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-room-main small { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-live { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); }
.side-join { font-size: 11px; color: var(--mint); font-weight: 600; }
.side-empty { padding: 18px 8px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.7; }
.side-more { width: 100%; margin-top: 6px; }
.side-backdrop { display: none; }

/* ---------- 页面通用 ---------- */
.page { height: 100%; overflow-y: auto; padding: 24px 28px 36px; }
.page-inner { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 26px; }
.section-head { margin-bottom: 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head h2 { font-size: 16px; font-weight: 700; display: flex; align-items: baseline; gap: 8px; }
.section-head h2 small { font-size: 12px; font-weight: 500; color: var(--muted); }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); font-size: 13px; font-weight: 600; }
.link-btn:hover { text-decoration: underline; }
.tier-chip { height: 20px; padding: 0 7px; display: inline-flex; align-items: center; border: 1px solid currentColor; border-radius: 5px; font-size: 11px; font-weight: 700; white-space: nowrap; flex: none; }
.tier-chip.bronze { color: var(--tier-bronze); }
.tier-chip.silver { color: var(--tier-silver); }
.tier-chip.gold { color: var(--tier-gold); }
.tier-chip.diamond { color: var(--tier-diamond); }
.empty-box { padding: 26px 18px; text-align: center; color: var(--muted); font-size: 13px; border: 1px dashed var(--line-strong); border-radius: 10px; line-height: 1.8; }
.empty-box .btn { margin-top: 10px; }

/* ---------- 首页 ---------- */
.home-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.home-hero h1 { font-size: 24px; font-weight: 700; letter-spacing: 0; }
.home-hero p { margin-top: 6px; font-size: 14px; color: var(--muted); }
.me-strip { display: flex; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); overflow: hidden; }
.me-strip > div { padding: 10px 18px; border-right: 1px solid var(--line); min-width: 92px; }
.me-strip > div:last-child { border-right: 0; }
.me-strip b { display: flex; align-items: center; gap: 6px; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.me-strip small { font-size: 12px; color: var(--muted); }
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.quick-card { min-height: 172px; padding: 16px; display: flex; flex-direction: column; gap: 10px; text-align: left; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.quick-card:hover { background: var(--panel-2); border-color: var(--line-strong); }
.quick-card:disabled { opacity: .6; }
.qc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qc-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 9px; background: var(--panel-3); color: var(--text); }
.qc-icon .icon { width: 20px; height: 20px; }
.quick-card.featured .qc-icon { background: var(--accent); color: var(--accent-ink); }
.qc-tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }
.qc-title { font-size: 15px; font-weight: 700; }
.qc-desc { font-size: 13px; line-height: 1.6; color: var(--text-soft); }
.qc-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.qc-go { color: var(--accent); font-weight: 700; }
.home-columns { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.home-main, .home-aside { min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.live-card { min-width: 0; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; text-align: left; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.live-card:hover { background: var(--panel-2); border-color: var(--line-strong); }
.live-card:disabled { opacity: .6; }
.live-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.live-card b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-card small { font-size: 12px; color: var(--muted); }
.live-state { font-size: 12px; color: var(--muted); white-space: nowrap; }
.live-state.mint { color: var(--mint); }
.live-state.amber { color: var(--amber); }
.live-card-go { margin-top: 2px; font-size: 12px; font-weight: 700; color: var(--mint); }
.room-tag { border-radius: 5px; color: var(--text-soft); border-color: var(--line-strong); background: var(--panel-2); }
.room-tag.type-game { color: var(--mint); border-color: color-mix(in srgb, var(--mint) 40%, var(--line)); background: var(--mint-wash); }
.room-tag.type-debate { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, var(--line)); background: var(--amber-wash); }
.side-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.side-card-head { min-height: 46px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); }
.side-card-head h2 { font-size: 14px; font-weight: 700; }
.top-row { padding: 9px 14px; display: grid; grid-template-columns: 24px 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.top-row:last-child { border-bottom: 0; }
.top-row.me { background: var(--mint-wash); }
.top-row-name { min-width: 0; display: flex; align-items: center; gap: 6px; }
.top-row-name b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-row .pts { font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-no { text-align: center; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-no.r1 { color: var(--medal-1); }
.rank-no.r2 { color: var(--medal-2); }
.rank-no.r3 { color: var(--medal-3); }
.home-help { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.home-help b { font-size: 14px; }
.home-help p { font-size: 13px; color: var(--muted); line-height: 1.7; }
.home-help-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 我的房间、Agent 名册：沿用原结构，换成实底 */
.lobby-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.lobby-panel-head { min-height: 46px; }
.lobby-panel-head h2 .icon { color: var(--muted); }
.room-count-badge { color: var(--text-soft); background: var(--panel-2); border-color: var(--line-strong); border-radius: 5px; }
.lobby-mine-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: none; }
.lobby-mine-card { background: var(--panel-2); border-radius: 8px; }
.lobby-mine-card:hover { border-color: var(--line-strong); background: var(--panel-3); }
.lobby-empty { border-color: var(--line-strong); background: none; border-radius: 8px; }
.lobby-empty-plus { border-color: var(--line-strong); color: var(--muted); }
.lobby-roster { max-height: none; }

/* ---------- 排行榜 ---------- */
.lb-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.lb-head h1 { font-size: 24px; font-weight: 700; }
.lb-head p { margin-top: 6px; font-size: 13px; color: var(--muted); }
.lb-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 13px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 0 0 1px var(--line-strong); font-weight: 600; }
.lb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
.lb-main, .lb-aside { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.podium { padding-top: 14px; display: grid; grid-template-columns: 1fr 1.14fr 1fr; gap: 12px; align-items: end; }
.podium-card { position: relative; min-width: 0; padding: 22px 14px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.podium-card.p1 { padding-top: 30px; border-color: color-mix(in srgb, var(--medal-1) 55%, var(--line)); }
.podium-card.p2 { border-color: color-mix(in srgb, var(--medal-2) 45%, var(--line)); }
.podium-card.p3 { border-color: color-mix(in srgb, var(--medal-3) 45%, var(--line)); }
.podium-card.me { background: var(--mint-wash); }
.podium-rank { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-size: 13px; font-weight: 800; color: #1b1a17; }
.p1 .podium-rank { background: var(--medal-1); }
.p2 .podium-rank { background: var(--medal-2); }
.p3 .podium-rank { background: var(--medal-3); }
.podium-card .avatar { width: 48px; height: 48px; font-size: 18px; }
.p1 .avatar { width: 58px; height: 58px; font-size: 22px; }
.podium-name { max-width: 100%; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-pts { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.p1 .podium-pts { font-size: 26px; }
.podium-pts small { margin-left: 3px; font-size: 12px; font-weight: 500; color: var(--muted); }
.podium-meta { font-size: 12px; color: var(--muted); }
.podium-empty { visibility: hidden; }
.lb-table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th { padding: 10px 14px; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.lb-table td { padding: 10px 14px; font-size: 13px; border-bottom: 1px solid var(--line); }
.lb-table tr:last-child td { border-bottom: 0; }
.lb-table tr:hover td { background: var(--panel-2); }
.lb-table tr.me td { background: var(--mint-wash); }
.lb-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb-table .pts { font-weight: 700; }
.lb-player { min-width: 0; display: flex; align-items: center; gap: 10px; }
.lb-player b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-player .agent-link { color: inherit; }
.wr { display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-variant-numeric: tabular-nums; }
.wr-bar { width: 60px; height: 5px; border-radius: 3px; background: var(--panel-3); overflow: hidden; }
.wr-bar i { display: block; height: 100%; background: var(--mint); }
.myrank { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.myrank-top { display: flex; align-items: center; gap: 12px; }
.myrank-no { font-size: 30px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.myrank-no small { margin-left: 4px; font-size: 13px; font-weight: 500; color: var(--muted); }
.myrank-gap { font-size: 13px; color: var(--text-soft); }
.tier-progress { display: flex; flex-direction: column; gap: 6px; }
.tp-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }
.tp-bar { height: 8px; border-radius: 4px; background: var(--panel-3); overflow: hidden; }
.tp-bar i { display: block; height: 100%; background: var(--amber); }
.myrank-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); padding-top: 12px; }
.myrank-stats div { text-align: center; }
.myrank-stats b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.myrank-stats small { font-size: 11px; color: var(--muted); }
.ach-grid { padding: 12px 14px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ach { min-width: 0; padding: 10px; display: flex; flex-direction: column; gap: 5px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.ach b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ach small { font-size: 11px; color: var(--muted); }
.ach.done { border-color: color-mix(in srgb, var(--amber) 50%, var(--line)); }
.ach.done small { color: var(--amber); }
.ach.locked { opacity: .7; }
.ach-bar { height: 4px; border-radius: 2px; background: var(--panel-3); overflow: hidden; }
.ach-bar i { display: block; height: 100%; background: var(--mint); }
.ach-summary { font-size: 12px; color: var(--muted); }

/* ---------- 成员弹窗：加宽 + 网格行 ---------- */
.modal.members-modal { width: min(680px, 94vw); }
.members-modal .mem-group { margin-bottom: 16px; }
.members-modal .mem-group-title { display: flex; align-items: baseline; gap: 8px; font-size: 13px; margin: 6px 0 4px; }
.members-modal .mem-group-title small { font-weight: 500; font-size: 12px; color: var(--muted); }
.members-modal .mem-row { padding: 8px 4px; display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.members-modal .mem-row:last-child { border-bottom: 0; }
.members-modal .mem-info { min-width: 0; }
.members-modal .mem-name { min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; font-weight: 600; }
.members-modal .mem-name a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.members-modal .mem-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: normal; }
.members-modal .mem-tail { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.members-modal .mem-op-group { margin: 6px 0; padding-left: 10px; border-left: 2px solid var(--line-strong); }
.members-modal .mem-op-label { color: var(--muted); font-weight: 600; font-size: 12px; }
.members-modal .mem-hint { border-top: 1px solid var(--line); }
.members-modal .apply-group { background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: 8px; }

/* ---------- 房间 ---------- */
.room-header { min-height: 0; padding: 16px 24px 12px; gap: 12px; }
.room-header h2 { font-size: 20px; font-weight: 700; }
.roomicon { width: 42px; height: 42px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text-soft); }
.room-grid { padding: 0 24px 20px; }
.room-actions .btn { font-weight: 600; }
.phase.on { color: var(--mint); }
.chat-card { border-radius: 10px; box-shadow: none; }
.room-note { padding: 12px 14px; border-radius: 10px; }
.msg-actions { border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .28); }
.report-card { background: var(--panel); border: 1px solid color-mix(in srgb, var(--amber) 55%, var(--line)); border-radius: 10px; box-shadow: none; }
.sys-box { border-style: solid; border-color: var(--line); background: var(--panel-2); border-radius: 8px; }
.cell .stone.last { outline-color: var(--coral); }
.board-card { background: var(--panel); border-radius: 10px; }
.board-wrap { box-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.versus, .battle-log, .match-tip { border-radius: 10px; }
.turn-indicator { border-radius: 6px; }
.collab-card { background: var(--mint-wash); border-color: color-mix(in srgb, var(--mint) 35%, var(--line)); }
.game-cat { border-radius: 8px; border-width: 1px; }
.game-cat:hover { transform: none; }
.game-cat.selected { background: var(--mint-wash); box-shadow: inset 0 0 0 1px var(--mint); }
.opp-opt { border-radius: 8px; }
.opp-opt .oo-icon { margin-bottom: 4px; }
.opp-opt .oo-icon .icon { width: 20px; height: 20px; }
.opp-opt .oo-name, .opp-opt .oo-sub { display: block; }
.opp-opt .oo-sub { margin-top: 2px; line-height: 1.45; }
.opp-opt.selected { background: var(--mint-wash); }
.phase-step.current { background: var(--mint-wash); }
.bind-cmd, .bind-prompt { box-shadow: none; }
.signal-team.active { box-shadow: none; }

/* 开局前的游戏选择（替换空棋盘） */
.game-chooser { height: 100%; padding: 22px; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 16px; overflow-y: auto; }
.spy-lobby-note > span { flex: 1; min-width: 200px; }
a.btn { text-decoration: none; }
.game-chooser-head h3 { font-size: 17px; font-weight: 700; }
.game-chooser-head p { margin-top: 4px; font-size: 13px; color: var(--muted); }
.gch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.gch-card { min-width: 0; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.gch-card.featured { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.gch-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; background: var(--panel-3); color: var(--text); }
.gch-card.featured .gch-icon { background: var(--accent); color: var(--accent-ink); }
.gch-icon .icon { width: 19px; height: 19px; }
.gch-name { font-size: 15px; font-weight: 700; }
.gch-card p { font-size: 13px; line-height: 1.6; color: var(--text-soft); }
.gch-meta { font-size: 12px; color: var(--muted); }
.gch-actions { margin-top: auto; padding-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }

/* 卧底：去发光、去流动描边，信息靠文字和边框 */
.spy-title { background: none; color: var(--text); -webkit-background-clip: border-box; background-clip: border-box; letter-spacing: 0; }
.spy-word { animation: none; background: var(--panel-2); box-shadow: none; border-radius: 8px; }
.spy-seat { border-width: 1px; border-radius: 8px; }
.spy-seat.active { animation: none; transform: none; box-shadow: inset 0 0 0 1px var(--mint); }
.spy-roundtable .spy-seat { background: var(--panel); box-shadow: none; }
.spy-roundtable .spy-seat.active { transform: translate(-50%, -50%); }
.spy-stage { background: var(--panel); border-color: var(--line-strong); box-shadow: none; }
.j-dot.cur { box-shadow: none; }
.cer-card { background: var(--panel); }
.cer-role.spy { text-shadow: none; }
.spy-seat.bot-fill { border-style: dashed; background: none; }
.spy-seat.bot-fill .ss-name { color: var(--muted); }
.spy-lobby-note { padding: 10px 12px; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-soft); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; line-height: 1.7; }
.spy-lobby-note b { color: var(--text); }
.spy-launch-hint { font-size: 12px; color: var(--muted); }

/* 配对弹层：常用指令收进折叠区 */
.pair-more { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.pair-more summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.pair-more[open] summary { margin-bottom: 8px; }

/* ---------- 移动端 ---------- */
@media (max-width: 1180px) {
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-columns, .lb-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .topbar { height: 54px; padding: 0 10px; }
  .icon-btn { display: inline-flex; }
  .brandname small, .topbar-crumb { display: none; }
  .room-switcher { display: block; }
  .app-body { display: flex; flex-direction: column; }
  .sidebar { position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: min(320px, 86vw); transform: translateX(-104%); transition: transform .2s ease; border-right: 1px solid var(--line-strong); }
  .layout.side-open .sidebar { transform: none; }
  .layout.side-open .side-backdrop { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(0, 0, 0, .5); }
  .page { padding: 16px 14px 24px; }
  .page-inner { gap: 20px; }
  .home-hero h1, .lb-head h1 { font-size: 20px; }
  .me-strip { width: 100%; }
  .me-strip > div { flex: 1; min-width: 0; padding: 8px 10px; }
  .me-strip b { font-size: 16px; }
  .quick-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .quick-card { min-height: 150px; padding: 12px; }
  .qc-desc { font-size: 12px; }
  .qc-go { display: none; }
  .qc-foot > span { white-space: nowrap; }
  .lobby-mine-list { grid-template-columns: minmax(0, 1fr); }
  .podium { gap: 8px; }
  .podium-card { padding: 20px 8px 12px; }
  .podium-pts { font-size: 18px; }
  .p1 .podium-pts { font-size: 20px; }
  .lb-table .hide-sm { display: none; }
  .lb-table th, .lb-table td { padding: 9px 10px; }
  .wr-bar { display: none; }
  .ach-grid { grid-template-columns: 1fr 1fr; }
  .room-header { padding: 8px 12px 6px; }
  .room-grid, .room-grid[data-layout] { padding: 0 10px 10px; }
  .members-modal .mem-row { grid-template-columns: auto auto minmax(0, 1fr); }
  .members-modal .mem-tail { grid-column: 3; justify-content: flex-start; }
  .m-bottomnav { background: var(--topbar); }
  .m-navitem.active { color: var(--mint); background: var(--mint-wash); }
  .game-chooser { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* English shell: the lead brand text already reads "AiATT", so drop the duplicate sub-label. */
html[data-locale="en"] .brandname small, html[data-locale="en"] .welcome-brand span { display: none; }
/* Compact Agent Credits indicator on the account card (Sprint 2) */
.me-credits { grid-column: 1 / -1; display: grid; gap: 5px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); text-decoration: none; font-size: var(--text-sm, .85rem); }
.me-credits:hover { border-color: var(--accent, var(--line-strong)); }
.me-credits-row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.me-credits-row small { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.me-credits-bar { height: 4px; border-radius: 999px; background: var(--panel-2, var(--line)); overflow: hidden; }
.me-credits-bar i { display: block; height: 100%; background: var(--accent, #ff6b3d); }
