/* ============================================================
   弈境 · GO ATLAS — online rooms
   ============================================================ */

.online-body {
  min-height: 100vh;
}
.online-page {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 34px 46px;
}
.online-body .main-nav .nav-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.view { animation: onlineViewIn .28s ease both; }
@keyframes onlineViewIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- lobby ---------- */

.lobby-hero {
  max-width: 980px;
  margin: 18px auto 40px;
  text-align: center;
}
.lobby-kicker { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 17px; }
.lobby-kicker .eyebrow { margin: 0; }
.hero-rule { display: block; width: 46px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.lobby-hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(38px, 4.8vw, 62px);
  font-weight: 500;
  letter-spacing: .02em;
  line-height: 1.22;
  color: #f1eadf;
}
.lobby-hero h1 em { font-style: normal; color: var(--gold); }
.lobby-lead {
  max-width: 680px;
  margin: 18px auto 0;
  color: #9b9d92;
  font-size: 13px;
  line-height: 1.9;
}
.lobby-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 22px;
}
.lobby-tags span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #a9aa9e;
  font-size: 9px;
  letter-spacing: .04em;
  background: rgba(255,255,255,.025);
}
.lobby-tags i {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 8px rgba(120,184,161,.6);
}
.lobby-grid {
  display: grid;
  grid-template-columns: 1.12fr .88fr;
  gap: 14px;
  max-width: 1050px;
  margin: 0 auto;
}
.lobby-card {
  padding: 24px;
  min-height: 100%;
  position: relative;
  overflow: hidden;
}
.lobby-card::after {
  content: "";
  position: absolute;
  width: 180px; height: 180px;
  right: -80px; top: -80px;
  border-radius: 50%;
  border: 1px solid rgba(216,179,114,.07);
  pointer-events: none;
}
.lobby-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.lobby-card-head h2 { font-size: 25px; }
.lobby-step {
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(216,179,114,.52);
  border: 1px solid rgba(216,179,114,.16);
  border-radius: 4px;
  padding: 3px 5px;
}
.field-label {
  display: block;
  margin: 14px 0 6px;
  font-size: 9px;
  letter-spacing: .08em;
  color: #85897d;
}
.text-input {
  width: 100%;
  height: 43px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: rgba(255,255,255,.035);
  color: #eee7db;
  font-family: var(--font-ui);
  font-size: 13px;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.text-input::placeholder { color: #5f665c; }
.text-input:focus {
  border-color: rgba(216,179,114,.5);
  background: rgba(255,255,255,.055);
  box-shadow: 0 0 0 3px rgba(216,179,114,.06);
}
.code-input { font-family: var(--font-mono); letter-spacing: .28em; text-transform: uppercase; font-size: 16px; }
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255,255,255,.025);
}
.segmented button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #85897e;
  height: 33px;
  font-size: 10px;
  cursor: pointer;
}
.segmented button.active { background: rgba(255,255,255,.09); color: #f0e8dc; }
.preset-grid { display: flex; flex-direction: column; gap: 6px; }
.preset-option {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 9px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255,255,255,.018);
  padding: 10px 11px;
  cursor: pointer;
  color: #9da095;
}
.preset-option:hover { border-color: var(--line-strong); background: rgba(255,255,255,.035); }
.preset-option.active { border-color: rgba(216,179,114,.48); background: rgba(216,179,114,.065); color: var(--text); }
.preset-option .preset-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.2);
  margin-left: 3px;
}
.preset-option.active .preset-dot { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 9px rgba(216,179,114,.4); }
.preset-option b { display: block; font-size: 11px; font-weight: 600; color: inherit; }
.preset-option span { display: block; font-family: var(--font-mono); font-size: 8px; color: #747a6e; margin-top: 1px; }
.preset-option em { font-style: normal; font-family: var(--font-mono); font-size: 8px; color: #8d7a5a; }
.create-submit { width: 100%; margin-top: 16px; height: 44px; }
.join-submit { width: 100%; margin-top: 18px; height: 44px; }
.join-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 17px 0 10px;
  color: #61675d;
  font-size: 8px;
  letter-spacing: .1em;
}
.join-divider::before, .join-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.spectate-link { width: 100%; text-align: center; font-size: 10px; }
.tiny-note { margin: 10px 0 0; color: #62685e; font-size: 9px; line-height: 1.65; }

.lobby-features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  max-width: 1120px;
  margin: 30px auto 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.lobby-features article { padding: 16px 16px 15px; border-left: 1px solid var(--line); }
.lobby-features article:first-child { border-left: 0; padding-left: 0; }
.lobby-features span { font-family: var(--font-mono); font-size: 8px; color: rgba(216,179,114,.5); }
.lobby-features b { display: block; margin: 5px 0 3px; font-size: 11px; font-weight: 600; color: #d8d1c4; }
.lobby-features p { margin: 0; color: #73786e; font-size: 9px; line-height: 1.65; }

/* ---------- room bar ---------- */

.room-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 1420px;
  margin: 0 auto 14px;
  padding: 0 2px;
}
.room-bar .link-btn { flex: 0 0 auto; }
.room-code-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #777c72;
  font-size: 9px;
  letter-spacing: .06em;
}
.room-code-line b {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .16em;
  color: var(--gold);
}
.room-copy {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: #8b9084;
  border-radius: 4px;
  font-size: 8px;
  padding: 2px 5px;
  cursor: pointer;
}
.room-copy:hover { color: var(--gold); border-color: rgba(216,179,114,.3); }
.room-bar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.conn-state { display: inline-flex; align-items: center; gap: 5px; color: #757b70; font-size: 8px; }
.conn-state i { width: 5px; height: 5px; border-radius: 50%; background: var(--jade); box-shadow: 0 0 7px rgba(120,184,161,.5); }
.conn-state.offline i { background: var(--cinnabar); box-shadow: none; }
.danger-link { color: #8d6d64 !important; }
.danger-link:hover { color: #e28c77 !important; }

/* ---------- waiting ---------- */

.waiting-stage {
  max-width: 1020px;
  margin: 22px auto 0;
}
.waiting-head { text-align: center; margin-bottom: 24px; }
.waiting-head h1 { margin: 0 0 7px; font-family: var(--font-display); font-size: 36px; font-weight: 500; color: #efe7db; }
.waiting-head p { margin: 0; color: #8c9085; font-size: 11px; }
.seat-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: stretch;
}
.seat-vs {
  align-self: center;
  font-family: var(--font-display);
  color: #62685e;
  font-size: 13px;
  letter-spacing: .2em;
}
.seat-card {
  min-height: 168px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(140deg, rgba(255,255,255,.04), transparent 34%),
    rgba(16,22,18,.78);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.seat-card.empty { border-style: dashed; background: rgba(255,255,255,.012); }
.seat-card.you { border-color: rgba(216,179,114,.32); }
.seat-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.seat-stone {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.seat-stone.black {
  background: radial-gradient(circle at 34% 27%, #565952, #151815 50%, #060806);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
  color: #d8c6a8;
}
.seat-stone.white {
  background: radial-gradient(circle at 32% 26%, #fffdf6, #e6dac5 60%, #c3b49e);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.15);
  color: #453c2d;
}
.seat-stone span { font-family: var(--font-display); font-size: 14px; }
.seat-color { font-size: 9px; letter-spacing: .1em; color: #777c72; }
.seat-name { margin: 2px 0 0; font-family: var(--font-display); font-size: 23px; font-weight: 500; color: #eee6da; }
.seat-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 12px;
  color: #777c72;
  font-size: 9px;
}
.seat-status i { width: 5px; height: 5px; border-radius: 50%; background: #5d655b; }
.seat-status.ready { color: var(--jade); }
.seat-status.ready i { background: var(--jade); box-shadow: 0 0 8px rgba(120,184,161,.5); }
.seat-status.offline { color: #9a7468; }
.seat-status.offline i { background: var(--cinnabar); }
.seat-you-tag {
  position: absolute;
  top: 14px; right: 14px;
  font-size: 8px;
  color: var(--gold);
  border: 1px solid rgba(216,179,114,.25);
  border-radius: 3px;
  padding: 1px 4px;
}
.waiting-actions { display: flex; justify-content: center; gap: 8px; margin: 20px 0 24px; }
.waiting-actions .action-btn { min-width: 150px; height: 42px; }
.invite-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.015);
  padding: 16px;
}
.invite-block .field-label { margin-top: 0; }
.copy-row { display: flex; gap: 6px; }
.copy-row .text-input { height: 38px; font-family: var(--font-mono); font-size: 9px; color: #9da095; }
.copy-btn {
  flex: 0 0 auto;
  min-width: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
  color: #bdb6a8;
  font-size: 9px;
  cursor: pointer;
}
.copy-btn:hover { border-color: rgba(216,179,114,.35); color: var(--gold); }
.waiting-meta { text-align: center; margin-top: 16px; color: #6d7368; font-size: 9px; }

/* ---------- playing ---------- */

.play-stage { max-width: 1420px; margin: 0 auto; }
.online-game {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  align-items: start;
}
.board-area { min-width: 0; max-width: 800px; margin: 0 auto; width: min(100%, max(460px, calc(100vh - 420px)), 800px); }
.clock-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 9px;
}
.clock-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(17,23,19,.82);
  padding: 10px 12px 9px;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
  min-width: 0;
}
.clock-card.active {
  border-color: rgba(216,179,114,.45);
  background: linear-gradient(150deg, rgba(216,179,114,.075), rgba(17,23,19,.86));
  box-shadow: inset 0 0 0 1px rgba(216,179,114,.08);
}
.clock-player { display: flex; align-items: center; gap: 7px; min-width: 0; }
.clock-player > div { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.clock-name { font-size: 10px; font-weight: 600; color: #ded7ca; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clock-role { font-size: 8px; color: #747a6f; white-space: nowrap; }
.clock-turn { margin-left: auto; font-size: 8px; color: #666c62; white-space: nowrap; }
.clock-card.active .clock-turn { color: var(--gold); }
.stone-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.stone-dot.black { background: #111411; box-shadow: inset 0 0 0 1px rgba(255,255,255,.22); }
.stone-dot.white { background: #eae0cf; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.clock-main {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 25px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -.03em;
  color: #e9e2d6;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.clock-card.active .clock-main { color: #f1d19a; }
.clock-main.low { color: #e58b75 !important; }
.clock-byo { margin-top: 1px; color: #6c7268; font-family: var(--font-mono); font-size: 8px; letter-spacing: .02em; }

.online-board-frame { width: 100%; max-width: none; }
.online-board-frame .board-canvas-wrap { max-height: none; }
.board-frame-bottom .capture-pair { font-size: 8px; }
#onlineBoard, #reviewBoard { touch-action: manipulation; }

.confirm-bar {
  display: flex;
  background: rgba(11, 15, 12, .97);
  backdrop-filter: blur(14px);
  z-index: 60;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
  padding: 9px 10px;
  border: 1px solid rgba(216,179,114,.32);
  border-radius: 11px;
  background: linear-gradient(150deg, rgba(216,179,114,.11), rgba(17,23,19,.95));
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
}
.confirm-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px rgba(216,179,114,.5); flex: 0 0 auto; }
.confirm-copy { flex: 1; min-width: 0; color: #bdb5a6; font-size: 10px; }
.confirm-copy b { color: var(--gold); font-family: var(--font-mono); font-size: 11px; }
.confirm-copy span { display: block; color: #6f756a; font-size: 8px; margin-top: 1px; }
.confirm-bar .action-btn { height: 34px; font-size: 10px; }
.online-actions { display: flex; gap: 7px; align-items: center; margin-top: 10px; }
.online-actions .action-btn { height: 37px; }
.role-note { margin-left: auto; color: #6f756a; font-size: 9px; letter-spacing: .02em; text-align: right; }
.role-note strong { color: var(--jade); font-weight: 500; }

.online-side { display: flex; flex-direction: column; gap: 11px; min-width: 0; }
.side-status { padding: 16px; }
.side-players { display: flex; flex-direction: column; gap: 7px; }
.side-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.018);
}
.side-player.you { border-color: rgba(216,179,114,.26); }
.side-player .stone-dot { width: 8px; height: 8px; }
.side-player b { font-size: 10px; font-weight: 500; color: #ddd6c9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-player span { margin-left: auto; font-size: 8px; color: #72786d; white-space: nowrap; }
.side-player .online-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--jade); margin-left: 4px; }
.side-player .online-dot.off { background: #714f45; }
.side-meta { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; color: #71776c; font-size: 8px; line-height: 1.7; }

.hidden-winrate {
  text-align: center;
  padding: 22px 18px;
  background:
    radial-gradient(240px 160px at 50% 0%, rgba(216,179,114,.07), transparent 70%),
    linear-gradient(180deg, rgba(24,31,26,.96), rgba(16,21,17,.98));
}
.lock-icon {
  width: 36px; height: 36px;
  border: 1px solid rgba(216,179,114,.22);
  border-radius: 50%;
  display: grid; place-items: center;
  margin: 0 auto 11px;
  color: var(--gold);
  font-size: 19px;
}
.hidden-winrate h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: 17px; font-weight: 500; color: #e8e0d2; }
.hidden-winrate p { margin: 0 auto; max-width: 280px; color: #7e8478; font-size: 9px; line-height: 1.8; }

.live-panel { padding-bottom: 12px; }
.online-winrate-numbers { display: flex; justify-content: space-between; align-items: flex-end; margin: 2px 0 9px; }
.online-winrate-numbers div { display: flex; flex-direction: column; gap: 1px; }
.online-winrate-numbers div:last-child { text-align: right; }
.online-winrate-numbers span { color: #777c72; font-size: 8px; }
.online-winrate-numbers b { color: var(--jade); font-family: var(--font-ui); font-size: 33px; font-weight: 300; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.online-winrate-numbers div:last-child b { color: #d8cdbd; }
.online-winrate-numbers b small { font-size: .38em; color: #777c72; margin-left: 1px; }
.online-winrate-bar { position: relative; height: 5px; border-radius: 4px; background: rgba(255,255,255,.08); margin-bottom: 9px; }
.online-winrate-bar i { display: block; height: 100%; width: 50%; border-radius: 4px; background: linear-gradient(90deg, #4b9079, #86c4ad 70%, #d8b372); transition: width .35s ease; }
.online-winrate-bar span { position: absolute; left: 50%; top: -3px; width: 1px; height: 11px; background: rgba(255,255,255,.22); }
.online-chart-wrap { height: 145px; margin: 0 -3px; }
.online-chart-wrap svg { width: 100%; height: 100%; display: block; overflow: visible; }
.live-panel .chart-axis { margin-top: 0; }
.live-panel .analysis-stats { margin-top: 10px; padding-top: 9px; }

.moves-panel-online { padding: 15px 16px 12px; }
.move-count { font-family: var(--font-mono); font-size: 8px; color: #73786e; }
.online-move-list { max-height: 192px; grid-template-columns: 1fr 1fr; }
.online-move-list .move-item { height: 26px; }
.online-move-list .move-item.reviewable { cursor: pointer; }
.online-move-list .move-item.reviewable:hover { background: rgba(255,255,255,.045); }

/* ---------- review ---------- */

.review-stage { max-width: 1420px; margin: 0 auto; }
.review-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 6px 0 18px;
}
.review-head h1 { margin: 0 0 5px; font-family: var(--font-display); font-size: 32px; font-weight: 500; color: #eee6da; }
.review-head p { margin: 0; color: #777c72; font-size: 10px; }
.review-head-actions { display: flex; gap: 7px; }
.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 18px;
  align-items: start;
}
.review-board-column { min-width: 0; max-width: 800px; width: min(100%, max(460px, calc(100vh - 380px)), 780px); margin: 0 auto; }
.review-nav { display: flex; gap: 6px; margin-top: 10px; }
.review-nav .action-btn { flex: 1; height: 36px; font-size: 10px; }
.review-side { display: flex; flex-direction: column; gap: 11px; }
.review-values { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0; }
.review-values div { display: flex; flex-direction: column; gap: 1px; }
.review-values span { color: #73786d; font-size: 8px; }
.review-values b { color: #ded6c8; font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
.review-comment { margin: 12px 0 0; color: #9a9c90; font-size: 10px; line-height: 1.8; min-height: 54px; }
.review-chart-panel { padding-bottom: 12px; }
.review-chart-wrap { height: 160px; }
.review-performance { padding-bottom: 15px; }
.report-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.report-metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
  background: rgba(255,255,255,.018);
}
.report-metric span { display: block; color: #73786e; font-size: 8px; }
.report-metric b { display: block; color: #e4dbcc; font-family: var(--font-mono); font-size: 16px; font-weight: 500; line-height: 1.4; }
.report-metric small { color: #7d8277; font-size: 8px; }
.report-metric.overall { grid-column: 1 / -1; background: linear-gradient(120deg, rgba(216,179,114,.10), rgba(255,255,255,.018)); border-color: rgba(216,179,114,.22); }
.report-metric.overall b { color: var(--gold); font-size: 27px; }
.report-texts { margin-top: 11px; }
.report-texts p { margin: 0 0 7px; color: #8e9287; font-size: 9px; line-height: 1.75; }
.report-texts p:last-child { margin-bottom: 0; }
.report-texts b { color: #cfc5b5; font-weight: 500; }
.report-loading { grid-column: 1 / -1; color: #83887c; font-size: 9px; line-height: 1.7; padding: 8px 2px; }
.review-commentary { margin-top: 18px; padding: 18px 20px; }
.commentary-list { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 16px; max-height: 360px; overflow-y: auto; padding-right: 4px; }
.commentary-item {
  text-align: left;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  padding: 6px 9px;
  cursor: pointer;
  color: #888d81;
  font-size: 9px;
  line-height: 1.55;
  transition: background .16s ease, border-color .16s ease;
}
.commentary-item:hover { background: rgba(255,255,255,.035); }
.commentary-item.active { border-left-color: var(--gold); background: rgba(216,179,114,.055); }
.commentary-item b { color: #d8cfc0; font-family: var(--font-mono); font-size: 9px; margin-right: 5px; }
.commentary-item .c-loss { color: #d98a74; }
.commentary-item .c-good { color: var(--jade); }

/* ---------- modals ---------- */

.join-modal { max-width: 480px; }
.join-room-summary {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 13px;
  color: #9c9f93;
  font-size: 9px;
  line-height: 1.7;
}
.join-room-summary b { color: var(--gold); font-family: var(--font-mono); letter-spacing: .08em; }
.join-modal .modal-actions { justify-content: space-between; }
.join-modal .modal-actions .action-btn { flex: 1; }
.join-modal .tiny-note { color: #b06e5c; }

.score-modal { max-width: 580px; }
.score-proposal { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: rgba(255,255,255,.02); }
.score-proposal-grid { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; }
.score-proposal-grid > div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.score-proposal-grid span { color: #777c72; font-size: 8px; }
.score-proposal-grid b { font-family: var(--font-display); font-size: 30px; font-weight: 500; color: #e8dfd1; }
.score-proposal-grid .score-colon { color: #656b61; font-family: var(--font-display); font-size: 18px; }
.score-proposal-note { border-top: 1px solid var(--line); margin-top: 11px; padding-top: 8px; color: #777c72; font-size: 9px; line-height: 1.7; }
.score-confirm-state { margin-top: 10px; color: #8b9084; font-size: 9px; }
.score-confirm-state b { color: var(--jade); font-weight: 500; }
.score-modal .modal-actions { justify-content: space-between; }
.score-modal .modal-actions .action-btn { flex: 1; }
.online-result-modal { max-width: 500px; }
.online-result-modal .result-sub { max-width: 370px; }
.online-result-modal .modal-actions { justify-content: center; flex-wrap: wrap; }

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  .online-game { grid-template-columns: minmax(0, 1fr) 340px; }
  .live-panel .online-winrate-numbers b { font-size: 29px; }
  .review-grid { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 1020px) {
  .online-page { padding: 22px 22px 38px; }
  .lobby-grid { grid-template-columns: 1fr; max-width: 680px; }
  .lobby-hero { margin-top: 8px; }
  .lobby-features { grid-template-columns: 1fr 1fr; }
  .lobby-features article:nth-child(3) { border-left: 0; padding-left: 0; }
  .lobby-features article { border-bottom: 1px solid var(--line); }
  .lobby-features article:nth-child(3), .lobby-features article:nth-child(4) { border-bottom: 0; }
  .online-game { grid-template-columns: 1fr; }
  .board-area { width: 100%; max-width: 760px; }
  .online-side { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .moves-panel-online { grid-column: 1 / -1; }
  .review-grid { grid-template-columns: 1fr; }
  .review-side { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .review-chart-panel { grid-row: span 2; }
  .review-performance { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .online-page { padding: 14px 12px 30px; }
  .online-body .topbar { height: 64px; padding: 0 14px; gap: 10px; }
  .online-body .brand { min-width: 0; }
  .online-body .brand-seal { width: 32px; height: 32px; font-size: 20px; border-radius: 7px; }
  .online-body .brand-name { font-size: 18px; }
  .online-body .brand-name em { font-size: 7px; }
  .online-body .main-nav { overflow-x: auto; scrollbar-width: none; margin-right: 0; }
  .online-body .main-nav::-webkit-scrollbar { display: none; }
  .online-body .nav-btn { font-size: 11px; padding: 7px 9px; }
  .online-body .nav-btn.active::after { left: 9px; right: 9px; bottom: -13px; }
  .online-body .engine-pill { display: none; }
  .lobby-hero { margin: 3px auto 24px; text-align: left; }
  .lobby-kicker { justify-content: flex-start; }
  .lobby-hero h1 { font-size: 36px; }
  .lobby-lead { margin-left: 0; font-size: 11px; }
  .lobby-tags { justify-content: flex-start; }
  .lobby-card { padding: 18px; border-radius: 14px; }
  .lobby-card-head h2 { font-size: 22px; }
  .lobby-features { grid-template-columns: 1fr; }
  .lobby-features article, .lobby-features article:nth-child(3) { border-left: 0; padding-left: 0; border-bottom: 1px solid var(--line); }
  .lobby-features article:last-child { border-bottom: 0; }
  .room-bar { gap: 8px; flex-wrap: wrap; }
  .room-bar-right { width: 100%; justify-content: flex-end; }
  .waiting-stage { margin-top: 12px; }
  .waiting-head { text-align: left; }
  .waiting-head h1 { font-size: 29px; }
  .seat-grid { grid-template-columns: 1fr; gap: 8px; }
  .seat-vs { display: none; }
  .seat-card { min-height: 128px; padding: 15px; }
  .seat-card-head { margin-bottom: 12px; }
  .seat-name { font-size: 20px; }
  .waiting-actions { margin: 16px 0; }
  .waiting-actions .action-btn { flex: 1; min-width: 0; }
  .invite-panel { grid-template-columns: 1fr; padding: 13px; }
  .clock-row { gap: 5px; margin-bottom: 6px; }
  .clock-card { padding: 8px 8px 7px; border-radius: 9px; }
  .clock-main { font-size: 21px; }
  .clock-player > div { gap: 4px; }
  .clock-name { font-size: 9px; }
  .clock-turn { font-size: 7px; }
  .role-note { font-size: 8px; }
  .confirm-bar { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 80; margin: 0; padding: 10px; border-radius: 12px; box-shadow: 0 14px 40px rgba(0,0,0,.55); }
  .confirm-bar .confirm-copy span { display: none; }
  .confirm-bar .action-btn { height: 34px; padding: 0 9px; }
  .online-side { grid-template-columns: 1fr; }
  .moves-panel-online { grid-column: auto; }
  .online-chart-wrap { height: 132px; }
  .review-head { align-items: flex-start; flex-direction: column; gap: 9px; }
  .review-head h1 { font-size: 26px; }
  .review-head-actions { width: 100%; }
  .review-head-actions .action-btn { flex: 1; }
  .review-side { grid-template-columns: 1fr; }
  .review-chart-panel { grid-row: auto; }
  .review-performance { grid-column: auto; }
  .commentary-list { grid-template-columns: 1fr; max-height: 320px; }
  .review-commentary { padding: 15px 14px; }
  .join-modal { max-width: 100%; }
  .score-proposal-grid b { font-size: 25px; }
}
@media (max-width: 480px) {
  .online-body .main-nav .nav-btn { font-size: 10px; padding: 6px 7px; }
  .lobby-hero h1 { font-size: 32px; }
  .lobby-tags span { font-size: 8px; padding: 5px 8px; }
  .preset-option { grid-template-columns: 18px 1fr; }
  .preset-option em { display: none; }
  .clock-main { font-size: 18px; }
  .clock-byo { font-size: 7px; }
  .online-actions .action-btn { flex: 1; }
  .role-note { display: none; }
  .online-move-list { grid-template-columns: 1fr; }
  .review-nav .action-btn { font-size: 8px; padding: 0 5px; }
  .review-values b { font-size: 11px; }
  .score-modal .modal-actions { flex-direction: column-reverse; }
  .score-modal .modal-actions .action-btn { width: 100%; }
  .online-result-modal .modal-actions .action-btn { flex: 1; }
}

#onlineBoard, #reviewBoard { display: block; width: 100%; height: 100%; }

.player-report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.player-report { border: 1px solid var(--line); border-radius: 8px; padding: 8px 9px; background: rgba(255,255,255,.018); }
.player-report b { display: block; color: #d9cfbf; font-size: 10px; font-weight: 500; margin-bottom: 4px; }
.player-report span { display: block; color: #8a8f83; font-size: 8px; line-height: 1.6; }
.blunder-list { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
.blunder-list > b { display: block; color: #cfbfa5; font-size: 9px; font-weight: 500; margin-bottom: 4px; }
.blunder-list p { margin: 0 0 5px; color: #a79580; font-size: 8px; line-height: 1.6; }

/* ---------- nigiri (guess-first) ---------- */
.nigiri-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 15px;
  padding: 11px 12px;
  border: 1px solid rgba(216,179,114,.22);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(216,179,114,.08), rgba(255,255,255,.018));
}
.nigiri-note b { display: block; color: #dcd0ba; font-size: 10px; font-weight: 600; margin-bottom: 2px; }
.nigiri-note p { margin: 0; color: #858a7e; font-size: 9px; line-height: 1.65; }
.nigiri-seal {
  flex: 0 0 auto;
  width: 31px; height: 31px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--cinnabar);
  color: #fff8ec;
  font-family: var(--font-display);
  font-size: 18px;
  box-shadow: inset 0 0 0 1px rgba(255,240,220,.22);
  transform: rotate(-2deg);
}
.nigiri-card {
  max-width: 760px;
  margin: 18px auto 0;
  border: 1px solid rgba(216,179,114,.22);
  border-radius: 14px;
  background:
    radial-gradient(500px 200px at 50% 0%, rgba(216,179,114,.08), transparent 70%),
    linear-gradient(180deg, rgba(24,31,26,.9), rgba(15,20,16,.95));
  padding: 16px;
}
.nigiri-wait, .nigiri-live, .nigiri-result {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}
.nigiri-live-copy { flex: 1; min-width: 0; }
.nigiri-live h3, .nigiri-result h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: #ece4d7;
}
.nigiri-live p, .nigiri-result p {
  margin: 0;
  color: #858a7e;
  font-size: 10px;
  line-height: 1.7;
}
.nigiri-live p b, .nigiri-result p b { color: #d8c9b2; font-weight: 500; }
.nigiri-actions { display: flex; gap: 7px; margin-top: 11px; }
.nigiri-actions .action-btn { min-width: 88px; height: 36px; }
.nigiri-result-mark {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: rgba(120,184,161,.08);
  border: 1px solid rgba(120,184,161,.25);
  color: var(--jade);
  font-family: var(--font-display);
  font-size: 21px;
}
.nigiri-your {
  display: inline-block;
  margin-top: 7px;
  padding: 3px 7px;
  border: 1px solid rgba(216,179,114,.25);
  border-radius: 999px;
  color: var(--gold);
  font-size: 8px;
  letter-spacing: .06em;
}
.seat-stone.pending {
  background: radial-gradient(circle at 34% 27%, #4c4e48, #22251f 55%, #141712);
  border: 1px dashed rgba(216,179,114,.35);
  color: #a99577;
  box-shadow: none;
}
.seat-stone.pending span { font-family: var(--font-mono); font-size: 12px; }
.waiting-actions { min-height: 0; }
.waiting-actions .action-btn[hidden] { display: none !important; }
@media (max-width: 760px) {
  .nigiri-card { margin-top: 12px; padding: 13px; }
  .nigiri-live h3, .nigiri-result h3 { font-size: 18px; }
  .nigiri-actions .action-btn { flex: 1; }
  .nigiri-actions { width: 100%; }
}

/* ---------- invite loading / mobile form ---------- */
.invite-loading {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background: var(--bg);
  color: #bfb5a4;
  font-size: 11px;
  letter-spacing: .08em;
}
.invite-loading[hidden] { display: none; }
.loading-ring {
  width: 24px; height: 24px;
  border: 2px solid rgba(216,179,114,.18);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: inviteSpin .8s linear infinite;
}
@keyframes inviteSpin { to { transform: rotate(360deg); } }
@media (max-width: 760px) {
  .modal-backdrop { padding: 10px; }
  .modal { max-height: calc(100dvh - 20px); }
  .text-input,
  .copy-row .text-input,
  .code-input { font-size: 16px; }
  .copy-row .text-input { height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .loading-ring { animation-duration: 1.8s; }
}

html.invite-boot #lobbyView { display: none !important; }
html.invite-boot #inviteLoading { display: grid !important; }

.invite-loading p {
  max-width: 260px;
  margin: 0;
  color: #8f9488;
  font-size: 10px;
  line-height: 1.7;
  text-align: center;
}
.invite-loading .action-btn { min-width: 120px; height: 36px; margin-top: 2px; }

/* ---------- chat ---------- */
.online-actions { flex-wrap: wrap; }
.chat-panel { display: flex; flex-direction: column; }
.chat-messages {
  max-height: 168px;
  overflow-y: auto;
  padding: 2px 2px 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-empty { color: #676d63; font-size: 9px; line-height: 1.6; padding: 8px 0; }
.chat-msg { font-size: 9px; line-height: 1.55; color: #a8aa9e; overflow-wrap: anywhere; }
.chat-msg-head { display: flex; align-items: baseline; gap: 5px; margin-bottom: 1px; }
.chat-msg-name { color: #c9bda9; font-size: 9px; }
.chat-msg-time { color: #5f665c; font-size: 8px; }
.chat-msg-role { color: #5f665c; font-size: 8px; }
.chat-msg.self .chat-msg-name { color: var(--gold); }
.chat-msg.self .chat-msg-text { color: #d8d0c2; }
.chat-msg-text { color: #969b8f; }
.chat-compose { display: flex; gap: 6px; margin-top: 9px; }
.chat-compose .text-input { height: 34px; min-width: 0; }
.chat-compose .action-btn { flex: 0 0 auto; min-width: 54px; height: 34px; }
.review-traditional {
  margin: 10px 0 0;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: #b6a78f;
  font-family: var(--font-display);
  font-size: 11px;
  line-height: 1.8;
  min-height: 30px;
}
.review-traditional:empty { display: none; }
.traditional-report { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.traditional-report h4 {
  margin: 0 0 5px;
  color: #d9cdbb;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
}
.traditional-report p {
  margin: 0 0 7px;
  color: #9f9789;
  font-size: 9px;
  line-height: 1.75;
}
.traditional-report p b { color: #c9b79e; font-weight: 500; }

/* ---------- archive ---------- */
.archive-modal { max-width: 620px; }
.archive-list { display: flex; flex-direction: column; gap: 7px; max-height: 55vh; overflow-y: auto; padding: 2px; }
.archive-empty { color: #858a7e; font-size: 10px; line-height: 1.8; padding: 18px 2px; }
.archive-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255,255,255,.018); color: inherit; padding: 10px 12px; cursor: pointer;
  transition: border-color .18s ease, background .18s ease;
}
.archive-item:hover { border-color: rgba(216,179,114,.32); background: rgba(216,179,114,.045); }
.archive-item b { display: block; color: #d8cdbd; font-size: 11px; font-weight: 500; }
.archive-item span { display: block; color: #777d72; font-size: 8px; line-height: 1.6; }
.archive-item .archive-result { color: #c6aa7d; text-align: right; white-space: nowrap; }
.archive-item .archive-result b { color: var(--gold); font-size: 10px; }
@media (max-width: 760px) {
  .archive-item { padding: 9px 10px; }
  .archive-list { max-height: 58vh; }
}
