/* ============================================================
   中国象棋 · 界面样式
   配色与棋子/棋盘共用同一套木色，保证风格统一。
   ============================================================ */

:root {
  --wood-light: #fffaea;
  --wood-mid: #f8e9c8;
  --wood-dark: #ecd6a8;
  --wood-edge: #d9bd8b;
  --wood-rim: #a87b41;
  --wood-deep: #6d4a20;

  --red: #b4242b;
  --red-soft: #d8504f;
  --black-piece: #26221e;

  --paper: #f5eddd;
  --paper-2: #fbf6ec;
  --surface: #fffdf8;
  --ink: #2b2118;
  --muted: #7d6c56;
  --line: rgba(122, 84, 38, 0.18);
  --line-strong: rgba(122, 84, 38, 0.34);
  --accent: #b4242b;
  --accent-2: #a1642a;
  --ok: #3f7d52;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-1: 0 1px 2px rgba(63, 40, 16, .08), 0 4px 14px rgba(63, 40, 16, .08);
  --shadow-2: 0 6px 28px rgba(48, 30, 10, .22);
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "KaiTi", "STKaiti", "Kaiti SC", "Songti SC", "SimSun", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1c1815;
    --paper-2: #221d19;
    --surface: #262019;
    --ink: #f0e6d8;
    --muted: #a6957e;
    --line: rgba(216, 186, 140, .14);
    --line-strong: rgba(216, 186, 140, .28);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .3);
    --shadow-2: 0 6px 28px rgba(0, 0, 0, .55);
  }
}

* { box-sizing: border-box; }

/* 作者样式中给 .modal 设了 display:grid，会盖掉 UA 的 [hidden]{display:none}，这里统一兜底 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255, 240, 210, .55), transparent 60%),
    linear-gradient(160deg, var(--paper) 0%, var(--paper-2) 55%, var(--paper) 100%);
  background-attachment: fixed;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ───────────────────────────── 顶栏 ───────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px clamp(12px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fffaea, #f3dfb4 62%, #ddb87f);
  border: 2px solid var(--red);
  color: var(--red);
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(90, 60, 20, .28);
  padding-bottom: 2px;
}

.brand-text { font-size: 17px; font-weight: 600; letter-spacing: .06em; }

.modes {
  display: flex; gap: 4px; margin-left: auto;
  padding: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--wood-dark) 30%, transparent);
  border: 1px solid var(--line);
}

.mode-btn {
  border: 0; background: transparent;
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 13.5px; color: var(--muted);
  transition: background .16s, color .16s;
  white-space: nowrap;
}
.mode-btn:hover { color: var(--ink); }
.mode-btn.is-active {
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-1);
}

.topbar-actions { display: flex; gap: 6px; }

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 15px;
  transition: color .16s, border-color .16s, transform .16s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--line-strong); transform: translateY(-1px); }

/* ───────────────────────────── 布局 ───────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: clamp(16px, 2.4vw, 32px);
  align-items: start;
  padding: clamp(14px, 2.4vw, 30px);
  max-width: 1240px;
  margin: 0 auto;
}

.board-column { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.board-frame {
  width: min(100%, calc(100vh - 190px) * 0.9025);
  perspective: 1400px;
}

.board {
  position: relative;
  width: 100%;
  aspect-ratio: 9.26 / 10.26;
  border-radius: 12px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .5) inset,
    0 10px 26px rgba(60, 36, 10, .28),
    0 2px 6px rgba(60, 36, 10, .18);
}

.board-wood {
  position: absolute; inset: 0;
  border-radius: 12px;
  background-image: url("/assets/board/wood.png");
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.board-wood::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 12px;
  box-shadow:
    inset 0 0 0 2px rgba(109, 74, 32, .55),
    inset 0 0 0 7px rgba(255, 250, 235, .18),
    inset 0 0 0 8px rgba(109, 74, 32, .35),
    inset 0 0 60px rgba(70, 40, 8, .28);
  pointer-events: none;
}

.board-grid, .board-marks {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.board-marks { z-index: 3; }

.board-pieces { position: absolute; inset: 0; z-index: 2; }

.board-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  min-height: 18px;
}

/* ───────────────────────────── 棋盘元素 ───────────────────────────── */

.grid-line { stroke: #4a2f13; stroke-width: 0.024; fill: none; opacity: .82; }
.grid-line-outer { stroke: #4a2f13; stroke-width: 0.038; fill: none; opacity: .78; }
.deco-line { stroke: #6d4a20; stroke-width: 0.02; fill: none; opacity: .5; }
.river-text {
  fill: #4a2f13; opacity: .62;
  font-family: var(--font-display);
  font-size: 0.72px;
  letter-spacing: 0.18px;
  text-anchor: middle;
  dominant-baseline: central;
}
.coord-text {
  fill: #4a2f13; opacity: .42;
  font-family: var(--font); font-size: 0.26px;
  text-anchor: middle; dominant-baseline: central;
}

.mark-last { fill: rgba(180, 36, 43, .16); stroke: rgba(180, 36, 43, .5); stroke-width: 0.02; }
.mark-from { fill: rgba(180, 36, 43, .2); stroke: rgba(180, 36, 43, .62); stroke-width: 0.028; }
.mark-select {
  fill: rgba(180, 36, 43, .16);
  stroke: rgba(180, 36, 43, .85);
  stroke-width: 0.045;
  animation: pulse-ring 1.3s ease-in-out infinite;
}
@keyframes pulse-ring {
  0%, 100% { stroke-opacity: .85; }
  50% { stroke-opacity: .35; }
}
.mark-check {
  fill: rgba(200, 30, 30, .16);
  stroke: rgba(200, 30, 30, .95);
  stroke-width: 0.05;
  animation: check-flash .8s ease-in-out infinite;
}
@keyframes check-flash {
  0%, 100% { stroke-opacity: 1; }
  50% { stroke-opacity: .25; }
}
.dot-move { fill: rgba(63, 125, 82, .72); }
.dot-capture {
  fill: none;
  stroke: rgba(63, 125, 82, .85);
  stroke-width: 0.045;
  stroke-dasharray: 0.14 0.1;
}
.premove-hint { fill: rgba(90, 100, 200, .55); }

/* 棋子 */
.piece {
  position: absolute;
  width: 11.3%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  transition: left .26s cubic-bezier(.34, 1.16, .5, 1), top .26s cubic-bezier(.34, 1.16, .5, 1),
              opacity .22s ease, filter .2s ease;
  will-change: left, top;
  cursor: pointer;
  z-index: 2;
}
.piece svg { display: block; width: 100%; height: 100%; pointer-events: none; }
.piece.is-mine { cursor: grab; }
.piece.is-dragging { z-index: 20; transition: none; cursor: grabbing; filter: drop-shadow(0 8px 12px rgba(50, 30, 5, .45)); }
.piece.is-selected { z-index: 6; filter: drop-shadow(0 0 6px rgba(180, 36, 43, .85)); }
.piece.is-captured { opacity: 0; transform: translate(-50%, -50%) scale(.55) rotate(18deg); }
.piece.is-new { animation: piece-drop .28s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes piece-drop {
  from { opacity: 0; transform: translate(-50%, -78%) scale(1.14); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.piece.is-moved { animation: piece-settle .32s ease; }
@keyframes piece-settle {
  0% { }
  45% { transform: translate(-50%, -50%) scale(1.06); }
  100% { transform: translate(-50%, -50%) scale(1); }
}
.piece.is-last .piece-disc { }

.board-banner {
  position: absolute; inset: auto 0 50% 0;
  z-index: 12;
  display: grid; place-items: center;
  pointer-events: none;
}
.board-banner span {
  font-family: var(--font-display);
  font-size: clamp(30px, 6vw, 58px);
  font-weight: 700;
  color: #fff;
  padding: 6px 30px;
  border-radius: 10px;
  background: rgba(140, 20, 24, .88);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .4);
  animation: banner-in .4s cubic-bezier(.2, 1.4, .4, 1);
  letter-spacing: .1em;
}
@keyframes banner-in {
  from { transform: scale(.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ───────────────────────────── 侧栏 ───────────────────────────── */

.sidebar { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 78px; }

.player-card {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.player-card.is-turn {
  border-color: color-mix(in srgb, var(--red) 45%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 12%, transparent), var(--shadow-1);
}
.player-card.is-check { animation: card-shake .45s ease; }
@keyframes card-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.player-avatar {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 21px;
  padding-bottom: 2px;
  background: radial-gradient(circle at 34% 28%, #fffaea, #f3dfb4 62%, #ddb87f);
  border: 2px solid currentColor;
  box-shadow: 0 1px 3px rgba(90, 60, 20, .25);
}
[data-side="red"] .player-avatar { color: var(--red); }
[data-side="black"] .player-avatar { color: var(--black-piece); }

.player-meta { min-width: 0; flex: 1; }
.player-name {
  font-size: 14.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.player-sub.is-thinking { color: var(--accent-2); }

.player-timer {
  font-variant-numeric: tabular-nums;
  font-size: 14px; color: var(--muted);
  padding: 3px 8px; border-radius: 7px;
  background: color-mix(in srgb, var(--wood-dark) 34%, transparent);
}
.player-timer.is-low { color: var(--red); font-weight: 700; }

.status-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--wood-mid) 42%, transparent);
  border: 1px solid var(--line);
  font-size: 13.5px;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok); flex: none;
}
.status-dot.is-red { background: var(--red); }
.status-dot.is-black { background: var(--black-piece); }
.status-dot.is-warn { background: #d9922c; }
.status-dot.is-over { background: var(--muted); }

.panel {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 13px;
  font-size: 13px; font-weight: 600;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--wood-mid) 30%, transparent);
}
.panel-head-right { font-weight: 400; font-size: 12px; color: var(--muted); }

.moves-panel { flex: 1; min-height: 120px; display: flex; flex-direction: column; }

.chat-panel { display: flex; flex-direction: column; }
.chat-panel .chat-log { height: 148px; }
.room-code-row { flex-wrap: wrap; }
#sidebar-room .room-code-row { border: 0; background: transparent; padding: 10px 12px 4px; }
.moves-list {
  list-style: none; margin: 0; padding: 4px 6px;
  overflow-y: auto;
  max-height: 232px;
  font-size: 13.5px;
  scrollbar-width: thin;
}
.moves-list li {
  display: grid;
  grid-template-columns: 30px 1fr 1fr;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 6px;
  align-items: baseline;
}
.moves-list li:nth-child(odd) { background: color-mix(in srgb, var(--wood-dark) 16%, transparent); }
.moves-list .mv-no { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.moves-list .mv-red { color: var(--red); font-family: var(--font-display); font-size: 14.5px; }
.moves-list .mv-black { color: var(--black-piece); font-family: var(--font-display); font-size: 14.5px; }
.moves-list li.is-current { outline: 1.5px solid color-mix(in srgb, var(--red) 40%, transparent); }
.moves-list:empty::after {
  content: "尚未落子";
  display: block; padding: 14px; text-align: center;
  color: var(--muted); font-size: 12.5px;
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.act {
  padding: 9px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  color: var(--ink);
  transition: border-color .16s, color .16s, transform .12s, background .16s;
}
.act:hover:not(:disabled) { border-color: var(--line-strong); color: var(--accent); transform: translateY(-1px); }
.act:active:not(:disabled) { transform: translateY(0); }
.act:disabled { opacity: .42; cursor: not-allowed; }
.act-primary {
  grid-column: span 3;
  background: linear-gradient(180deg, #c62c33, #a81f26);
  color: #fff; border-color: transparent; font-weight: 600;
}
.act-primary:hover:not(:disabled) { color: #fff; border-color: transparent; filter: brightness(1.06); }

/* ───────────────────────────── 弹层 ───────────────────────────── */

.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 18px;
  background: rgba(28, 18, 8, .5);
  backdrop-filter: blur(3px);
  animation: fade-in .18s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  width: min(560px, 100%);
  max-height: min(88vh, 780px);
  display: flex; flex-direction: column;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  animation: pop-in .22s cubic-bezier(.2, 1.2, .4, 1);
  overflow: hidden;
}
.modal-wide { width: min(680px, 100%); }
.modal-narrow { width: min(400px, 100%); }
@keyframes pop-in {
  from { transform: scale(.94) translateY(8px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 16px 18px 20px; overflow-y: auto; }

.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.field input[type="text"], .field input:not([type]) {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--paper-2);
  font-size: 14px;
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
.field input:focus {
  border-color: color-mix(in srgb, var(--red) 55%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 12%, transparent);
}

.muted { color: var(--muted); font-size: 12.5px; line-height: 1.65; margin: 7px 0 0; }

.segmented { display: flex; gap: 5px; flex-wrap: wrap; }
.segmented button {
  flex: 1 1 auto;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--paper-2);
  font-size: 13px; color: var(--muted);
  transition: all .16s;
  white-space: nowrap;
}
.segmented button:hover { border-color: var(--line-strong); }
.segmented button.is-active {
  background: color-mix(in srgb, var(--red) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--red) 45%, transparent);
  color: var(--accent); font-weight: 600;
}

.level-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.level-btn {
  padding: 11px 6px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--paper-2);
  text-align: center;
  transition: all .16s;
}
.level-btn strong { display: block; font-size: 14px; margin-bottom: 2px; }
.level-btn small { display: block; font-size: 10.5px; color: var(--muted); line-height: 1.4; }
.level-btn:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.level-btn.is-active {
  background: color-mix(in srgb, var(--red) 9%, var(--surface));
  border-color: color-mix(in srgb, var(--red) 48%, transparent);
  color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 9%, transparent);
}
.level-btn.is-active small { color: color-mix(in srgb, var(--red) 70%, var(--muted)); }

.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 14px; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.toggle input { width: 17px; height: 17px; accent-color: var(--red); cursor: pointer; }

.audio-check { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.audio-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.audio-state {
  font-size: 12.5px;
  padding: 4px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--wood-dark) 34%, transparent);
  color: var(--muted);
}
.audio-state.is-ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); font-weight: 600; }
.audio-state.is-warn { background: color-mix(in srgb, #d9922c 20%, transparent); color: #a5670f; }
.audio-check .muted b { color: var(--accent); }

.lan-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.lan-box {
  padding: 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper-2);
}
.lan-box h3 { margin: 0 0 6px; font-size: 14px; }
.lan-box .field:last-of-type { margin-bottom: 10px; }

.btn {
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 13.5px;
  transition: all .16s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary {
  background: linear-gradient(180deg, #c62c33, #a81f26);
  color: #fff; border-color: transparent; font-weight: 600;
}
.btn-primary:hover { color: #fff; filter: brightness(1.07); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.room-code-row {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--wood-mid) 46%, transparent);
  border: 1px solid var(--line);
  font-size: 13px;
}
.room-code-row strong {
  font-size: 22px; letter-spacing: .16em;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--accent);
  margin-right: auto;
}

.chat-log {
  height: 132px; overflow-y: auto;
  padding: 9px 12px;
  font-size: 13px; line-height: 1.65;
  background: var(--paper-2);
}
.chat-log .chat-row { margin-bottom: 3px; }
.chat-log .chat-who { font-weight: 600; margin-right: 5px; }
.chat-log .chat-row.is-red .chat-who { color: var(--red); }
.chat-log .chat-row.is-black .chat-who { color: var(--black-piece); }
.chat-log .chat-row.is-sys { color: var(--muted); font-size: 12px; font-style: italic; }
.chat-input { display: flex; gap: 7px; padding: 8px; border-top: 1px solid var(--line); }
.chat-input input {
  flex: 1; padding: 7px 11px; font-size: 13px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--paper-2); outline: none;
}

.help-body h3 {
  font-size: 14px; margin: 18px 0 7px; color: var(--accent-2);
}
.help-body h3:first-child { margin-top: 0; }
.help-body ul { margin: 0; padding-left: 20px; font-size: 13.5px; line-height: 1.95; }
.help-body b { color: var(--accent); }
kbd {
  display: inline-block;
  padding: 1px 6px; margin: 0 1px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  background: var(--paper-2);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11.5px;
}

.result-body { text-align: center; padding: 26px 22px 22px; }
.result-icon { font-size: 42px; line-height: 1; margin-bottom: 10px; }
.result-body h2 { margin: 0 0 6px; font-size: 22px; }
.result-actions { display: flex; gap: 9px; margin-top: 20px; justify-content: center; }
.result-actions .btn { flex: 1; }

/* ───────────────────────────── 提示条 ───────────────────────────── */

.toast-wrap {
  position: fixed; left: 50%; bottom: 26px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(43, 33, 24, .92);
  color: #fdf6e8;
  font-size: 13.5px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .3);
  animation: toast-in .24s cubic-bezier(.2, 1.3, .4, 1);
  white-space: nowrap;
  max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
}
.toast.is-warn { background: rgba(168, 31, 38, .94); }
.toast.is-ok { background: rgba(52, 110, 70, .94); }
@keyframes toast-in {
  from { transform: translateY(14px) scale(.94); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.toast.is-out { animation: toast-out .22s ease forwards; }
@keyframes toast-out { to { transform: translateY(8px); opacity: 0; } }

/* ───────────────────────────── 响应式 ───────────────────────────── */

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .board-frame { width: min(100%, 560px); }
  .moves-list { max-height: 150px; }
}

@media (max-width: 620px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 12px; }
  .brand-text { font-size: 15px; }
  .modes { order: 3; width: 100%; margin-left: 0; justify-content: space-between; }
  .mode-btn { flex: 1; padding: 7px 6px; font-size: 12.5px; }
  .topbar-actions { margin-left: auto; }
  .layout { padding: 10px; gap: 12px; }
  .board-frame { width: 100%; }
  .actions { grid-template-columns: repeat(3, 1fr); }
  .lan-split { grid-template-columns: 1fr; }
  .level-list { grid-template-columns: repeat(2, 1fr); }
  .toggles { grid-template-columns: 1fr; }
  .moves-list { max-height: 118px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
