/* ══════════════════════════════════════════════════════════
   风体经营模拟器 · 样式
   设计取向：浅色商务控制台。信息密度优先，克制装饰。
   涨=红 / 跌=绿（国内习惯）。
   ══════════════════════════════════════════════════════════ */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --border: #e2e6ee;
  --border-strong: #cdd4e0;
  --text: #171a21;
  --text-2: #4d5566;
  --muted: #8b93a3;

  --primary: #2f5fe0;
  --primary-dark: #2249b8;
  --primary-soft: #eaf0ff;

  --up: #d93a3a;      /* 涨 · 红 */
  --up-soft: #fdecec;
  --down: #16a34a;    /* 跌 · 绿 */
  --down-soft: #e9f7ee;
  --warn: #d97706;
  --warn-soft: #fff5e6;
  --gold: #b8860b;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 28, 48, .05), 0 6px 20px rgba(20, 28, 48, .06);
  --shadow-sm: 0 1px 2px rgba(20, 28, 48, .06);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 34px; line-height: 1.25; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; font-family: var(--mono); }
[hidden] { display: none !important; }

/* ── 通用组件 ─────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.card-head h3 { display: flex; align-items: center; gap: 8px; }

.btn {
  appearance: none; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 550; font-family: inherit;
  cursor: pointer; transition: .14s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost { background: var(--surface); }
.btn-warn { background: var(--warn-soft); border-color: #f0d3a0; color: #92500a; }
.btn-warn:hover { background: #ffeccd; }
.btn-text { border-color: transparent; background: transparent; color: var(--text-2); padding: 6px 8px; }
.btn-text:hover { background: rgba(0,0,0,.04); border-color: transparent; }
.btn-block { width: 100%; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-small { padding: 5px 11px; font-size: 12.5px; }
.btn-danger { color: var(--up); border-color: #f2c9c9; }
.btn-danger:hover { background: var(--up-soft); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums;
}
.pill-alt { background: var(--primary-soft); border-color: #cddcff; color: var(--primary-dark); }
.pill-ok { background: var(--down-soft); border-color: #bfe6cd; color: #0f7a37; }
.pill-warn { background: var(--warn-soft); border-color: #f3dcb2; color: #96570b; }

.tag { font-size: 11px; padding: 1px 7px; border-radius: 5px; font-weight: 600; }
.tag-super { background: #ecf1ff; color: #2749b0; }
.tag-mimic { background: #f2eefb; color: #6b41b8; }
.tag-human { background: var(--down-soft); color: #0f7a37; }
.tag-host  { background: #fff3d6; color: #8a6100; }
.tag-ready { background: var(--down-soft); color: #0f7a37; }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; padding: 10px 12px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); outline: none;
}
.field input:focus, .field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.code-input { text-transform: uppercase; letter-spacing: .22em; font-family: var(--mono); font-size: 17px; }

.check { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 9px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--primary); }

/* ── 网络状态条 ───────────────────────────────────────── */
.netbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 7px 14px; font-size: 13px; font-weight: 550;
  background: var(--warn-soft); color: #8a5208;
  border-bottom: 1px solid #f0dcb4;
}
.netbar.bad { background: var(--up-soft); color: #9c2626; border-bottom-color: #f2c9c9; }
.netbar.good { background: var(--down-soft); color: #0f7a37; border-bottom-color: #bfe6cd; }
.netbar-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
.netbar.good .netbar-dot { animation: none; }
.netbar-btn {
  border: 1px solid currentColor; background: transparent; color: inherit;
  padding: 2px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; font-family: inherit;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .3 } }

/* ── 首页 ─────────────────────────────────────────────── */
.home-wrap { max-width: 940px; margin: 0 auto; padding: 56px 20px 60px; }
.home-hero { text-align: center; margin-bottom: 38px; }
.hero-badge {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-dark);
  font-size: 12px; font-weight: 650; letter-spacing: .06em; margin-bottom: 14px;
}
.hero-sub { max-width: 620px; margin: 12px auto 0; color: var(--text-2); font-size: 15px; }
.hero-facts { display: flex; justify-content: center; gap: 34px; margin-top: 26px; flex-wrap: wrap; }
.hero-facts div { display: flex; flex-direction: column; }
.hero-facts b { font-size: 22px; font-variant-numeric: tabular-nums; }
.hero-facts span { font-size: 12px; color: var(--muted); }

.home-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.card-action { padding: 22px 22px 20px; }
.card-action h2 { margin-bottom: 6px; }
.card-action .muted { font-size: 13px; min-height: 40px; }

.card-rules { padding: 0; overflow: hidden; }
.rules-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px; background: transparent; border: none; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--text);
}
.rules-toggle:hover { background: var(--surface-2); }
.chev { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: .2s; }
.rules-toggle[aria-expanded="true"] .chev { transform: rotate(-135deg); }
.rules-body { padding: 4px 20px 20px; border-top: 1px solid var(--border); }
.rules-sec { margin-top: 16px; }
.rules-sec h4 { margin: 0 0 6px; font-size: 13.5px; color: var(--primary-dark); }
.rules-sec ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13px; }
.rules-sec li { margin-bottom: 3px; }
.rules-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 6px; }
.rules-table th, .rules-table td { padding: 5px 8px; border: 1px solid var(--border); text-align: right; }
.rules-table th:first-child, .rules-table td:first-child { text-align: left; }
.rules-table thead th { background: var(--surface-2); font-weight: 600; color: var(--text-2); }

.home-foot { text-align: center; margin-top: 24px; font-size: 12.5px; }
.home-mlink { display: inline-block; margin-top: 10px; color: var(--primary); font-weight: 600; text-decoration: none; border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; transition: .14s ease; }
.home-mlink:active { background: var(--primary-soft); }

/* ── 大厅 ─────────────────────────────────────────────── */
.lobby-wrap { max-width: 1060px; margin: 0 auto; padding: 28px 20px 50px; display: flex; flex-direction: column; gap: 16px; }
.lobby-head { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.room-code-box .label, .invite .label { display: block; font-size: 11.5px; color: var(--muted); letter-spacing: .04em; }
.room-code { font-family: var(--mono); font-size: 32px; font-weight: 700; letter-spacing: .18em; color: var(--primary-dark); }
.invite { flex: 1; min-width: 280px; }
.invite-row { display: flex; gap: 8px; margin-top: 3px; }
.invite-row input {
  flex: 1; padding: 7px 10px; font-size: 12.5px; font-family: var(--mono);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-2);
}
.hint { font-size: 12px; color: var(--down); }

.lobby-grid { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.lobby-side { display: flex; flex-direction: column; gap: 14px; }

.seat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.seat {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.seat-avatar {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center; font-size: 15px; font-weight: 700; color: #fff;
}
.seat-main { flex: 1; min-width: 0; }
.seat-name { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.seat-desc { font-size: 12px; color: var(--muted); }
.seat-empty { border-style: dashed; background: transparent; color: var(--muted); justify-content: center; padding: 14px; }

.bot-group { padding: 12px 0; border-top: 1px solid var(--border); }
.bot-group:first-of-type { border-top: none; padding-top: 4px; }
.bot-group-title { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.bot-btns { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.bot-batch {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 11px; margin-bottom: 4px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px;
}
.bot-batch .num-box { padding: 2px 8px; }
.bot-batch .num-box input { width: 46px; text-align: center; }
.bot-btn {
  border: 1px solid var(--border-strong); background: var(--surface);
  padding: 6px 11px; border-radius: 7px; cursor: pointer;
  font-size: 12.5px; font-family: inherit; text-align: left; color: var(--text);
}
.bot-btn:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.bot-btn b { display: block; font-weight: 600; }
.bot-btn span { display: block; font-size: 11px; color: var(--muted); max-width: 250px; }
.bot-btn:hover span { color: var(--primary-dark); opacity: .8; }

.est { margin-top: 10px; padding: 9px 11px; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary-dark); font-size: 12.5px; }

/* 大厅顶部的当前赛道提示（对所有人可见） */
.lobby-industry {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; margin-top: 4px;
  border: 1px solid var(--border); border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm); background: var(--surface-2);
}
.lobby-industry .li-icon { font-size: 22px; line-height: 1; }
.lobby-industry b { color: var(--text); }
.lobby-industry .muted { font-size: 12.5px; }

/* 房主设置面板里的赛道画像 */
.industry-info { margin: 10px 0 4px; padding: 12px 13px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.industry-info .ii-tag { font-size: 12.5px; color: var(--text-2); margin-bottom: 9px; }
.industry-info .ii-tag b { color: var(--text); }
.ii-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 16px; }
.ii-grid > div { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; }
.ii-grid > div span { color: var(--muted); }
.ii-grid > div b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

.chat-card { display: flex; flex-direction: column; }
.chat-log { max-height: 170px; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; font-size: 13px; }
.chat-line b { color: var(--primary-dark); }
.chat-form { display: flex; gap: 8px; }
.chat-form input {
  flex: 1; padding: 8px 11px; font-size: 13px; font-family: inherit;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); outline: none; background: var(--surface);
}
.chat-form input:focus { border-color: var(--primary); }

/* ── 对局：顶栏 ───────────────────────────────────────── */
.view-game { display: flex; flex-direction: column; height: 100vh; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 9px 18px; background: var(--surface); border-bottom: 1px solid var(--border);
  flex: none; box-shadow: var(--shadow-sm); z-index: 20;
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 12px; flex: 1; }
.tb-right { justify-content: flex-end; }
/* 顶部左上角 ✕：对局中点击 → 提示彻底退出本局 */
.btn-close-game { font-size: 18px; line-height: 1; width: 34px; height: 34px; border-radius: 9px; color: var(--text-2); }
.btn-close-game:hover { color: var(--danger, #c0392b); background: rgba(0,0,0,.05); }
.tb-center { display: flex; align-items: center; gap: 14px; }
.tb-code { font-family: var(--mono); font-weight: 700; letter-spacing: .12em; color: var(--primary-dark); }
.tb-round { font-weight: 650; }
.tb-phase { font-size: 12.5px; padding: 2px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); }
.tb-phase.settling { background: var(--warn-soft); color: #96570b; }
.tb-phase.review { background: var(--down-soft); color: #0f7a37; }

.timer { position: relative; width: 46px; height: 46px; display: grid; place-items: center; }
.timer-ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 4; }
.ring-fg { fill: none; stroke: var(--primary); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .5s linear, stroke .3s; }
.timer.urgent .ring-fg { stroke: var(--up); }
.timer-text { position: relative; font-family: var(--mono); font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.timer.urgent .timer-text { color: var(--up); }

.submit-progress { display: flex; gap: 4px; align-items: center; }
.sp-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); transition: .25s; }
.sp-dot.done { background: var(--down); }
.sp-dot.off { background: var(--border-strong); opacity: .4; box-shadow: inset 0 0 0 1px var(--muted); }
.sp-dot.me { box-shadow: 0 0 0 2px var(--primary-soft); }

.ready-count { font-size: 12px; color: var(--text-2); min-width: 64px; align-self: center; }
.ready-count.all-ready { color: #0f7a37; font-weight: 700; }
#btn-ready.ready-on { background: var(--down); border-color: var(--down); color: #fff; }
#btn-ready-lobby.ready-on { background: var(--down); border-color: var(--down); color: #fff; }

.net-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.net-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--down); }
.net-chip.warn i { background: var(--warn); animation: pulse 1.2s infinite; }
.net-chip.bad i { background: var(--up); animation: pulse .8s infinite; }

/* ── 对局：三栏 ───────────────────────────────────────── */
.game-grid {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 290px minmax(0, 1fr) 320px;
  gap: 14px; padding: 14px 16px; overflow: hidden;
}
.col-narrator { display: flex; flex-direction: column; min-height: 0; }
.col-main { overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding-right: 2px; }
.col-side { overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }

/* 主持人 */
.narr-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 4px; margin-bottom: 10px; }
.narr {
  padding: 8px 11px; border-radius: 9px; font-size: 13px; line-height: 1.55;
  background: var(--surface-2); border-left: 3px solid var(--border-strong);
  animation: slideIn .3s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.narr.rule { border-left-color: var(--primary); background: var(--primary-soft); color: #23366f; }
.narr.warn { border-left-color: var(--warn); background: var(--warn-soft); color: #8a5208; }
.narr.event { border-left-color: #7c3aed; background: #f4efff; color: #4c2a95; }
.narr.highlight { border-left-color: var(--up); background: var(--up-soft); color: #932c2c; font-weight: 550; }
.narr.result { border-left-color: var(--down); background: var(--down-soft); color: #0f6b33; }
.narr.chat { border-left-color: var(--muted); }
.narr.chat b { color: var(--primary-dark); }

/* 私人教练（一对一，仅本人可见，不广播；入门档渲染进左栏「私人教练」面板） */
.coach-line {
  padding: 8px 11px; border-radius: 9px; font-size: 13px; line-height: 1.55;
  background: #eaf3ff; border-left: 3px solid #2563eb; color: #1f3a6b;
  animation: slideIn .3s ease;
}
.coach-line .coach-stage { display: inline-block; font-size: 11px; font-weight: 700; color: #2563eb; margin-bottom: 3px; letter-spacing: .3px; }
.coach-line.s1 { background: #eaf3ff; border-left-color: #2563eb; color: #1f3a6b; }
.coach-line.s2 { background: #eafff3; border-left-color: #0f9d58; color: #14532d; }
.coach-line.s3 { background: #fff4e6; border-left-color: #ea8c00; color: #7a4a06; }
.pill-coach { background: #2563eb; color: #fff; font-size: 11px; padding: 1px 8px; }

/* 开局说明 */
.briefing h2 { margin-bottom: 10px; }
.briefing-block { margin-bottom: 14px; }
.briefing-block h4 { margin: 0 0 5px; font-size: 13.5px; color: var(--primary-dark); }
.briefing-block ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13px; }

/* 事件卡 */
.event-card { display: flex; gap: 14px; align-items: flex-start; border-left: 4px solid #7c3aed; }
.event-icon { font-size: 26px; line-height: 1; }
.event-body h3 { margin-bottom: 3px; }
.event-desc { color: var(--text-2); font-size: 13px; margin: 0 0 5px; }
.event-advice { font-size: 12.5px; color: #6b21a8; background: #f7f2ff; padding: 5px 9px; border-radius: 6px; display: inline-block; }
.event-card.calm { border-left-color: var(--muted); }

/* 决策面板 */
.dec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.dec-block { padding-bottom: 4px; }
.dec-title { display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px; flex-wrap: wrap; }
.dec-title b { font-size: 13.5px; }
.slide-row { display: flex; align-items: center; gap: 11px; }
.slide-row input[type=range] { flex: 1; accent-color: var(--primary); height: 4px; }
.num-box {
  display: flex; align-items: center; gap: 3px; flex: none;
  border: 1px solid var(--border-strong); border-radius: 7px; padding: 4px 8px; background: var(--surface);
}
.num-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.num-box span { font-size: 11.5px; color: var(--muted); }
.num-box input {
  width: 78px; border: none; outline: none; background: transparent;
  font-family: var(--mono); font-size: 13.5px; font-variant-numeric: tabular-nums;
  color: var(--text); text-align: right; padding: 0;
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-inline > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.quick-row { display: flex; gap: 6px; margin-top: 7px; }
.quick-btn {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  border-radius: 6px; padding: 2px 9px; font-size: 11.5px; cursor: pointer; font-family: inherit;
}
.quick-btn:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-soft); }

.mini-bars { display: flex; gap: 3px; align-items: flex-end; height: 22px; margin-top: 7px; }
.mini-bar { flex: 1; background: var(--border); border-radius: 2px 2px 0 0; position: relative; }
.mini-bar.me { background: var(--primary); }

.rnd-progress { position: relative; height: 20px; margin-top: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.rnd-fill { height: 100%; background: linear-gradient(90deg, #a5b8f5, var(--primary)); transition: width .3s; }
.rnd-progress span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* 预算测算 */
.budget { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 13px; }
.budget-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.bchip {
  display: flex; flex-direction: column; padding: 6px 11px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border); min-width: 92px;
}
.bchip .k { font-size: 11px; color: var(--muted); }
.bchip .v { font-family: var(--mono); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bchip.ok { background: var(--down-soft); border-color: #bfe6cd; }
.bchip.ok .v { color: #0f7a37; }
.bchip.bad { background: var(--up-soft); border-color: #f2c9c9; }
.bchip.bad .v { color: var(--up); }
.bchip.hl { background: var(--primary-soft); border-color: #cddcff; }
.bchip.hl .v { color: var(--primary-dark); }

.flowbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.flowbar div { height: 100%; }
.flowlegend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 7px; font-size: 11.5px; color: var(--text-2); }
.flowlegend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }

.dec-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--border); }
.dec-quit { text-align: right; margin-top: 6px; }
.dec-quit .btn-danger { font-size: 12.5px; padding: 4px 10px; opacity: .8; }
.dec-quit .btn-danger:hover { opacity: 1; }

.quit-confirm-box { max-width: 440px; }
.quit-confirm-box h3 { margin: 0 0 10px; font-size: 19px; }
.quit-confirm-box .muted { margin: 0 0 16px; font-size: 14px; line-height: 1.6; }
.quit-confirm-box .muted b { color: var(--up); }

.locked { opacity: .55; pointer-events: none; }

/* 结算 */
.settle-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.settle-head h2 { margin: 0; }
.settle-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.stat { padding: 8px 13px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.stat .k { font-size: 11px; color: var(--muted); display: block; }
.stat .v { font-family: var(--mono); font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }

table.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.grid th, table.grid td { padding: 7px 9px; border-bottom: 1px solid var(--border); text-align: right; font-variant-numeric: tabular-nums; }
table.grid th { color: var(--muted); font-weight: 600; font-size: 11.5px; white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
table.grid td:first-child, table.grid th:first-child { text-align: left; }
table.grid tr.me { background: var(--primary-soft); }
table.grid tr.me td { font-weight: 600; }
table.grid tbody tr:hover { background: var(--surface-2); }
table.grid tr.me:hover { background: #dfe9ff; }
.up { color: var(--up); }
.down { color: var(--down); }
.rank-badge { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 11.5px; font-weight: 700; margin-right: 6px; }
.rank-1 { background: #fff4d1; border-color: #f0dda0; color: #8a6100; }
.rank-2 { background: #eef1f5; border-color: #d8dee7; color: #4b5563; }
.rank-3 { background: #fbeee0; border-color: #eed7bd; color: #92400e; }
.delta { font-size: 11px; margin-left: 4px; }

.notes { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; }
.note { font-size: 12.5px; padding: 6px 10px; border-radius: 7px; background: var(--warn-soft); color: #8a5208; border-left: 3px solid var(--warn); }

/* 复盘 */
.podium { display: flex; gap: 12px; align-items: flex-end; justify-content: center; margin: 6px 0 22px; }
.podium-item { flex: 1; max-width: 190px; text-align: center; }
.podium-bar { border-radius: 10px 10px 0 0; display: grid; place-items: end center; padding-bottom: 8px; color: #fff; font-weight: 700; }
.podium-name { font-weight: 650; margin-top: 8px; }
.podium-score { font-family: var(--mono); font-size: 13px; color: var(--text-2); }

/* 右栏 */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi { padding: 8px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.kpi .k { font-size: 11px; color: var(--muted); display: block; }
.kpi .v { font-family: var(--mono); font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.kpi.wide { grid-column: span 2; }
.kpi.alert { background: var(--up-soft); border-color: #f2c9c9; }
.kpi.alert .v { color: var(--up); }

.spark { margin-top: 12px; }
.spark svg { width: 100%; height: 54px; display: block; }
.spark-cap { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 2px; }

.rivals { display: flex; flex-direction: column; gap: 7px; }
.rival { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.rival.me { background: var(--primary-soft); border-color: #cddcff; }
.rival.dim { opacity: .5; }
.rival-av { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.rival-main { flex: 1; min-width: 0; }
.rival-name { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.rival-name .dotstate { width: 6px; height: 6px; border-radius: 50%; background: var(--down); flex: none; }
.rival-name .dotstate.off { background: var(--muted); }
.rival-sub { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rival-val { text-align: right; font-family: var(--mono); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rival-val small { display: block; font-weight: 400; font-size: 10.5px; color: var(--muted); }

.trend-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.trend-row:last-child { border-bottom: none; }
.trend-r { width: 26px; color: var(--muted); }
.trend-bar { flex: 1; height: 7px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.trend-bar i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.trend-v { width: 62px; text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── 遮罩 / toast ─────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(18, 22, 32, .45); backdrop-filter: blur(3px);
  display: grid; place-items: center;
}
.overlay-box {
  background: var(--surface); border-radius: 14px; padding: 30px 36px;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.2); max-width: 380px;
}
.overlay-box h3 { margin: 14px 0 6px; font-size: 17px; }
.spinner {
  width: 34px; height: 34px; margin: 0 auto; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 9px 18px; border-radius: 999px; font-size: 13px; font-weight: 550;
  background: #232935; color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.2);
  animation: toastIn .25s ease;
}

/* ── 进房选择弹窗（游戏进行中：观察者 / 游戏者） ── */
.join-choose-box { max-width: 420px; }
.join-choose-box h3 { margin: 0 0 8px; font-size: 19px; }
.join-choose-box .muted { margin: 0 0 6px; font-size: 14px; }
.jc-hint { color: #d9534f; font-size: 13px; margin: 0 0 14px; line-height: 1.5; }
.choice-btns { display: flex; flex-direction: column; gap: 10px; }
.choice-btns .btn { width: 100%; }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; }
.btn-link { background: none; border: none; color: var(--muted, #8a93a6); margin-top: 12px; cursor: pointer; font-size: 13px; text-decoration: underline; }
.toast.err { background: #b3261e; }
.toast.ok { background: #146c39; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── 终局出口 ─────────────────────────────────────────── */
.endgame-actions {
  margin-top: 12px; display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.endgame-hint { color: var(--text-2); font-size: 13.5px; }
.endgame-btns { display: flex; gap: 10px; }

/* ── 响应式 ───────────────────────────────────────────── */
@media (max-width: 1180px) {
  .game-grid { grid-template-columns: 250px minmax(0,1fr) 280px; gap: 10px; padding: 10px; }
  .dec-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .home-cards { grid-template-columns: 1fr; }
  .lobby-grid { grid-template-columns: 1fr; }
  .view-game { height: auto; min-height: 100vh; }
  .game-grid { grid-template-columns: 1fr; overflow: visible; }
  .col-narrator { order: 3; max-height: 320px; }
  .col-side { order: 2; }
  .col-main { order: 1; overflow: visible; }
  .topbar { flex-wrap: wrap; gap: 8px; }
  .tb-left, .tb-right { flex: none; }
  h1 { font-size: 27px; }
  .home-wrap { padding-top: 34px; }
}

/* ════════════════ 首页游戏类型选择 ════════════════ */
.game-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.game-opt {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 12px; border: 1.5px solid var(--bd, #e3e6ec); border-radius: 12px;
  background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .05s;
}
.game-opt:hover { border-color: #c4cad6; }
.game-opt:active { transform: scale(.99); }
.game-opt.sel { border-color: #2f6df6; box-shadow: 0 0 0 3px rgba(47,109,246,.15); background: #f5f8ff; }
/* 难度选择：进阶/精英待开发，禁用态 */
.game-opt.diff-opt.locked { opacity: .55; cursor: not-allowed; filter: grayscale(.4); }
.game-opt.diff-opt.locked:hover { border-color: var(--bd, #e3e6ec); }
.game-opt.diff-opt.locked .diff-locked { color: #c0392b; font-weight: 600; font-size: .85em; margin-left: 2px; }
.go-icon { font-size: 26px; line-height: 1; }
.go-main { display: flex; flex-direction: column; gap: 2px; }
.go-main b { font-size: 14px; }
.go-main .muted { font-size: 11.5px; line-height: 1.3; }
@media (max-width: 560px) { .game-picker { grid-template-columns: 1fr; } }

/* ══ 加入方式切换（参赛 / 旁观）══ */
.mode-toggle { display: flex; gap: 6px; }
.mode-opt {
  flex: 1; padding: 9px 10px; border: 1px solid var(--line, #d8dde6);
  background: #fff; color: #445; border-radius: 9px; cursor: pointer;
  font-size: 13px; transition: all .15s;
}
.mode-opt.sel { background: var(--brand, #2f5fe0); color: #fff; border-color: var(--brand, #2f5fe0); }
.mode-opt:hover { border-color: var(--brand, #2f5fe0); }

/* 旁观者标签 */
.tag-spectator { background: #eef0f5; color: #6b7280; }

/* 旁观模式卡片 */
.spectator-card { padding: 22px; text-align: center; }
.spectator-card p { color: #556; margin: 8px 0; }
.spectator-card .btn { margin-top: 10px; }
.kpi-empty { padding: 18px; text-align: center; color: #667; font-size: 14px; line-height: 1.7; }
.kpi-empty .muted { font-size: 12px; }

/* ══ 账号条（常驻右上角）══ */
.account-bar {
  position: fixed; top: 10px; right: 12px; z-index: 60;
  display: flex; align-items: center; gap: 8px;
}
.account-bar .acc-name { font-size: 13px; color: #445; background: #fff; padding: 5px 10px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
/* 进入对局后，账号条被移入顶栏 .tb-right 内，必须解除 fixed 定位，否则仍会浮在右上角挡住「准备就绪」按钮（见 #154） */
.account-bar.in-game {
  position: static; top: auto; right: auto; z-index: auto;
  gap: 6px;
}
.account-bar.in-game .acc-name { box-shadow: none; background: rgba(255,255,255,.16); color: #fff; }

/* ══ 弹窗通用 ══ */
.modal-box {
  position: relative; width: min(460px, 92vw); max-height: 88vh; overflow-y: auto;
  background: #fff; border-radius: 14px; padding: 22px 22px 18px;
  box-shadow: 0 18px 60px rgba(20,30,60,.28);
}
.modal-box h2 { margin: 0 0 14px; font-size: 19px; }
.modal-close {
  position: absolute; top: 10px; right: 12px; width: 30px; height: 30px;
  border: none; background: #f1f3f7; border-radius: 8px; font-size: 18px; line-height: 1;
  color: #667; cursor: pointer;
}
.modal-close:hover { background: #e6e9f0; }
.auth-form .field { margin-bottom: 12px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.auth-tab {
  flex: 1; padding: 9px; border: 1px solid var(--line, #d8dde6); background: #fff;
  border-radius: 9px; cursor: pointer; font-size: 14px; color: #556;
}
.auth-tab.sel { background: var(--brand, #2f5fe0); color: #fff; border-color: var(--brand, #2f5fe0); }
.auth-error { color: #c0392b; font-size: 13px; min-height: 18px; margin: 4px 0 10px; }

/* ══ 战绩 ══ */
.history-box { width: min(720px, 94vw); }
.history-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.history-item {
  border: 1px solid #e4e8f0; border-radius: 11px; padding: 12px 14px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.history-item:hover { border-color: var(--brand, #2f5fe0); box-shadow: 0 3px 14px rgba(47,95,224,.12); }
.hi-top { display: flex; justify-content: space-between; align-items: center; }
.hi-top b { font-size: 15px; }
.hi-rank { color: var(--brand, #2f5fe0); font-weight: 600; font-size: 14px; }
.hi-sub { color: #556; font-size: 13px; margin-top: 3px; }
.hi-meta { color: #8a93a3; font-size: 12px; margin-top: 4px; }
.history-detail { margin-top: 8px; }
.hi-detail-head { margin-bottom: 12px; }
.hi-detail-head b { font-size: 15px; }
.hi-detail-head .muted { margin-top: 4px; }
.table-scroll { overflow-x: auto; }
.season-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
.season-table th, .season-table td { padding: 8px 10px; text-align: right; border-bottom: 1px solid #eef1f6; white-space: nowrap; }
.season-table th:first-child, .season-table td:first-child { text-align: center; }
.season-table thead th { background: #f6f8fc; color: #455; font-weight: 600; }
.season-table .hi-ev { text-align: left; color: #6b7280; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.season-table .up { color: #c0392b; }
.season-table .down { color: #1a8f4f; }

/* ════════════════════════════════════════
   新机制 UI：设备购置 / 政策 / 旁观 / 信息迷雾
   ════════════════════════════════════════ */
/* 设备购置档位卡片 */
.equip-tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.equip-tier {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  padding: 9px 10px; border: 1.5px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); cursor: pointer; text-align: left; transition: all .15s;
}
.equip-tier b { font-size: 13.5px; }
.equip-tier .et-price { font-size: 12px; color: var(--primary-dark); font-weight: 600; font-family: var(--mono); }
.equip-tier .et-cap, .equip-tier .et-mul { font-size: 11.5px; color: var(--muted); }
.equip-tier:hover { border-color: var(--primary); }
.equip-tier.sel { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px rgba(47,95,224,.18) inset; }
.equip-count-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.equip-total { font-size: 12.5px; }
.equip-total b { color: var(--primary-dark); }

/* 投产线面板 */
.line-summary {
  background: var(--surface-2, #f6f8fb); border: 1px solid var(--border-soft, #e6e9ef);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px;
}
.ls-row { display: flex; justify-content: space-between; align-items: center; padding: 2px 0; color: var(--muted); }
.ls-row b { color: var(--text, #1f2430); font-family: var(--mono); }
.ls-lines { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.line-chip {
  font-size: 12px; padding: 2px 9px; border-radius: 20px;
  background: var(--primary-soft, #eaf0ff); color: var(--primary-dark, #2249b8);
  border: 1px solid rgba(47,95,224,.18);
}
.tag-pending { font-size: 10.5px; padding: 0 6px; border-radius: 10px; background: #fff3e0; color: #b26a00; margin-left: 4px; }
.line-ops { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.line-op { min-width: 0; }
.dec-sub { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text, #1f2430); }
.dec-sub .muted { font-weight: 400; margin-left: 4px; }
.line-op + .line-op { border-left: 1px solid var(--border-soft, #e6e9ef); padding-left: 16px; }
@media (max-width: 720px) {
  .line-ops { grid-template-columns: 1fr; gap: 14px; }
  .line-op + .line-op { border-left: none; padding-left: 0; border-top: 1px solid var(--border-soft, #e6e9ef); padding-top: 12px; }
}

/* 旁观计数 */
.spec-count {
  font-size: 12.5px; color: #6b7280; background: #eef0f5;
  border: 1px solid #e0e3ea; padding: 3px 9px; border-radius: 20px;
}
.pill-spec { background: #eef0f5; border-color: #e0e3ea; color: #6b7280; }

/* 政策与风向标 */
.policy-card .policy-active { display: flex; flex-direction: column; gap: 8px; }
.policy-item { display: flex; gap: 10px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.policy-item.strong { border-color: #f2c9c9; background: var(--up-soft); }
.policy-icon { font-size: 22px; line-height: 1.2; }
.policy-main { flex: 1; min-width: 0; }
.policy-name { font-size: 13.5px; font-weight: 650; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.policy-prof { font-size: 11px; font-weight: 600; color: #92500a; background: var(--warn-soft); border: 1px solid #f0d3a0; padding: 1px 6px; border-radius: 5px; }
.policy-desc { font-size: 12px; color: #556; margin: 2px 0; line-height: 1.5; }
.policy-meta { font-size: 11.5px; color: var(--muted); }
.policy-forecast { margin-top: 10px; padding: 10px; border: 1px dashed var(--primary); border-radius: 10px; background: var(--primary-soft); }
.pf-head { font-size: 12.5px; font-weight: 650; color: var(--primary-dark); display: flex; align-items: center; gap: 8px; }
.pf-certain { font-size: 11px; padding: 1px 7px; border-radius: 5px; font-weight: 600; }
.pf-certain.yes { background: var(--down-soft); color: #0f7a37; }
.pf-certain.no { background: var(--warn-soft); color: #96570b; }
.pf-name { font-size: 13.5px; font-weight: 600; margin-top: 5px; }
.pf-desc { font-size: 12px; margin-top: 2px; line-height: 1.5; }

/* 信息迷雾 */
.fog-note { font-size: 12px; color: #6b7280; background: #f1f3f7; border: 1px solid #e3e7ee; border-radius: 8px; padding: 6px 9px; margin-bottom: 8px; }
.tag-fog { background: #eef0f5; color: #6b7280; }
.rival.fogged .rival-val { opacity: .82; }
.rival.fogged .rival-val::after { content: ' 🌫️'; }
.more-note { font-size: 12px; color: var(--muted); text-align: center; padding: 8px; }

/* 复盘/战绩：逐季回看 —— 季导航 + 分组表头 */
.review-seasons { margin-top: 22px; border-top: 1px dashed var(--border); padding-top: 16px; }
.review-seasons .settle-head h3 { margin: 0; font-size: 16px; }

.season-nav { display: flex; align-items: center; gap: 8px; margin: 10px 0 12px; flex-wrap: wrap; }
.season-nav .sn-arrow {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 5px 10px; font-size: 12.5px; cursor: pointer;
}
.season-nav .sn-arrow:disabled { opacity: .4; cursor: not-allowed; }
.sn-strip { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; }
.sn-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  border-radius: 8px; padding: 5px 11px; font-size: 12.5px; cursor: pointer; min-width: 38px;
  font-variant-numeric: tabular-nums;
}
.sn-btn:hover { border-color: var(--primary); }
.sn-btn.sel { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }

.season-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.season-meta b { color: var(--text); }

table.grid.season-detail { font-size: 12px; }
table.grid.season-detail th, table.grid.season-detail td { padding: 6px 8px; }
.season-detail .grp { background: var(--surface-2); text-align: center; font-size: 11.5px; letter-spacing: .5px; }
.season-detail .grp-decision { color: #2563eb; border-bottom: 2px solid #2563eb33; }
.season-detail .grp-result { color: #0f9d58; border-bottom: 2px solid #0f9d5833; }
.season-detail .pl-name { text-align: left; white-space: nowrap; }
.season-detail .mono { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 11.5px; }
.season-detail .up { color: var(--up); }
.season-detail .down { color: var(--down); }

/* 手机端复用季导航（沿用 .season-nav 全局样式，此处仅补详情头部间距） */
.mhi-detail-head { margin-bottom: 8px; }

/* 应收账款 KPI 强调 */
.kpi.info { background: #eef6fb; border-color: #cfe6f3; }
.kpi.info .v { color: #0b6fa4; }
