/* ============ 弈境 · 中国象棋 ============ */
:root {
  --ink: #14100c;
  --ink-2: #1d1712;
  --ink-3: #262019;
  --line: rgba(214, 178, 122, 0.16);
  --gold: #d9b06a;
  --gold-2: #f0cf94;
  --red: #b8382e;
  --red-2: #e0564a;
  --text: #ece2d2;
  --muted: #a1907a;
  --ok: #57a86b;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  background:
    radial-gradient(1200px 700px at 78% -10%, rgba(184, 56, 46, 0.16), transparent 62%),
    radial-gradient(900px 600px at 8% 108%, rgba(217, 176, 106, 0.1), transparent 60%),
    linear-gradient(160deg, #17120e 0%, #100d0a 48%, #191410 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 22px 30px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 8px 4px 18px;
  flex-wrap: wrap;
}

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

.brand-seal {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(150deg, #c9453a, #8f2a22);
  color: #ffe9cf;
  font-size: 26px;
  font-weight: 700;
  font-family: "STKaiti", "KaiTi", "Kaiti SC", serif;
  box-shadow: 0 8px 22px rgba(184, 56, 46, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  letter-spacing: 0;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong {
  font-size: 21px;
  letter-spacing: 0.16em;
  font-family: "STKaiti", "KaiTi", "Kaiti SC", serif;
  color: var(--gold-2);
}
.brand-text small { font-size: 11px; color: var(--muted); letter-spacing: 0.22em; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-left: auto;
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 9px;
  cursor: pointer;
  transition: 0.18s;
  font-family: inherit;
  white-space: nowrap;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.tab.active {
  color: #23180d;
  background: linear-gradient(160deg, var(--gold-2), var(--gold));
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(217, 176, 106, 0.24);
}

.account { display: flex; align-items: center; }

.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #3a2f24, #241c15);
  border: 1px solid rgba(217, 176, 106, 0.4);
  color: var(--gold-2);
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.small { width: 40px; height: 40px; font-size: 15px; }
.avatar.red { border-color: rgba(224, 86, 74, 0.55); color: #ffb3a8; }

.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta span { font-size: 13px; }
.user-meta small { font-size: 11px; color: var(--gold); }

/* ---------------- 按钮 ---------------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: 0.18s;
  white-space: nowrap;
  font-weight: 500;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(160deg, var(--gold-2), #c99b52);
  color: #23180d;
  font-weight: 650;
  box-shadow: 0 8px 20px rgba(217, 176, 106, 0.22);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-1px); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
  color: var(--text);
}
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }
.btn-ghost.danger { color: #ff9c92; border-color: rgba(224, 86, 74, 0.32); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; }

.icon-btn {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: 0.16s;
}
.icon-btn:hover { color: var(--gold-2); background: rgba(255, 255, 255, 0.07); }

/* ---------------- 布局 ---------------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
  flex: 1;
}

/* ---------------- 棋盘 ---------------- */
.board-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.player-strip {
  width: min(100%, 620px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  transition: 0.2s;
}
.player-strip.active {
  border-color: rgba(217, 176, 106, 0.5);
  background: rgba(217, 176, 106, 0.09);
  box-shadow: 0 0 0 1px rgba(217, 176, 106, 0.18) inset;
}
.pinfo { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.pname { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pstate { font-size: 11.5px; color: var(--muted); }
.player-strip.active .pstate { color: var(--gold); }

.captured {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: flex-end;
  max-width: 55%;
}
.captured .cap {
  font-size: 13px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: "STKaiti", "KaiTi", serif;
}
.captured .cap.red { color: #ff9d92; background: rgba(184, 56, 46, 0.18); }
.captured .cap.black { color: #cbbda8; background: rgba(255, 255, 255, 0.08); }

.board-wrap {
  position: relative;
  width: min(100%, 620px);
  aspect-ratio: 900 / 1000;
  border-radius: 20px;
  padding: 10px;
  background: linear-gradient(160deg, rgba(217, 176, 106, 0.16), rgba(0, 0, 0, 0.24));
  border: 1px solid rgba(217, 176, 106, 0.24);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.board {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
  touch-action: manipulation;
}

.board-svg {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-select: none;
}

/* 棋子
   注意：外层 .piece 的 transform 属性由 board.js 通过 setAttribute('transform') 写入，
   用于把棋子定位到棋盘格点。SVG 中 transform 属性就是 CSS 属性的呈现属性，
   一旦 CSS 再对 .piece 设置 transform/animation，定位会被整体覆盖，棋子会跳到 SVG 原点。
   因此所有悬停位移与动画都必须作用在内层 .piece-skin 上。 */
.piece {
  cursor: pointer;
}
.piece-skin {
  transition: transform 0.12s ease;
}
.piece circle.disc {
  filter: url(#pieceShadow);
  transition: stroke 0.16s, filter 0.16s;
}
.piece text {
  font-family: "STKaiti", "KaiTi", "Kaiti SC", "Songti SC", serif;
  font-weight: 700;
  pointer-events: none;
  dominant-baseline: central;
  text-anchor: middle;
}
.piece.red text { fill: #a52d24; }
.piece.black text { fill: #23201c; }
.piece.red circle.disc { stroke: #a52d24; }
.piece.black circle.disc { stroke: #2a241d; }
.piece.selected circle.disc {
  stroke: #e0a63c;
  filter: url(#glow);
}
.piece.selected .piece-skin { transform: translateY(-3px); }
.piece.movable { cursor: pointer; }
.piece.movable:hover .piece-skin { transform: translateY(-2px); }
.piece.lastmove circle.disc { stroke: #c98a2e; stroke-width: 3; }
.piece.dim { opacity: 0.55; }

.board.hint-on .piece.movable circle.disc { stroke: #d38b2a; }

/* 提示点 */
.hint-dot { pointer-events: none; }
.hint-dot circle { fill: rgba(224, 86, 74, 0.55); }
.hint-dot.occupied circle { fill: none; stroke: #e0564a; stroke-width: 4; }

.arrow { pointer-events: none; }
.arrow path { fill: #d9b06a; opacity: 0.85; }

/* 覆盖层 */
.board-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(12, 9, 6, 0.68);
  backdrop-filter: blur(3px);
  border-radius: 20px;
  z-index: 5;
  animation: fadeIn 0.22s ease;
}
.overlay-card {
  background: linear-gradient(165deg, #241d15, #17120e);
  border: 1px solid rgba(217, 176, 106, 0.34);
  border-radius: 18px;
  padding: 26px 30px;
  text-align: center;
  box-shadow: var(--shadow);
  max-width: 340px;
}
.overlay-card h3 {
  margin: 0 0 8px;
  font-size: 22px;
  color: var(--gold-2);
  font-family: "STKaiti", "KaiTi", serif;
  letter-spacing: 0.08em;
}
.overlay-card p { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }
.overlay-actions { display: flex; gap: 10px; justify-content: center; }

.status-bar {
  width: min(100%, 620px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13.5px;
  color: var(--muted);
}
.turn-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red-2);
  box-shadow: 0 0 10px rgba(224, 86, 74, 0.8);
  flex: none;
}
.turn-dot.black { background: #ddd0bb; box-shadow: 0 0 10px rgba(221, 208, 187, 0.7); }
.spacer { flex: 1; }
.eval-badge {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(217, 176, 106, 0.13);
  color: var(--gold-2);
  border: 1px solid rgba(217, 176, 106, 0.24);
  font-variant-numeric: tabular-nums;
}

/* ---------------- 侧栏 ---------------- */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}
.side-panel::-webkit-scrollbar { width: 6px; }
.side-panel::-webkit-scrollbar-thumb { background: rgba(217, 176, 106, 0.24); border-radius: 3px; }

.view { display: none; flex-direction: column; gap: 16px; }
.view.active { display: flex; }

.card {
  background: linear-gradient(168deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.022));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(8px);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.card-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--gold-2);
  letter-spacing: 0.06em;
}
.card-head .card-title { margin: 0; }
.card-desc { margin: 0 0 14px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }

.levels { display: grid; gap: 8px; margin-bottom: 16px; }
.level-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.16);
  cursor: pointer;
  transition: 0.16s;
  text-align: left;
  font-family: inherit;
  color: inherit;
  width: 100%;
}
.level-item:hover { border-color: rgba(217, 176, 106, 0.4); background: rgba(217, 176, 106, 0.07); }
.level-item.active {
  border-color: var(--gold);
  background: linear-gradient(100deg, rgba(217, 176, 106, 0.2), rgba(217, 176, 106, 0.05));
  box-shadow: 0 0 0 1px rgba(217, 176, 106, 0.28) inset;
}
.level-icon { font-size: 19px; width: 26px; text-align: center; flex: none; }
.level-info { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.level-info strong { font-size: 13.5px; font-weight: 600; }
.level-info small { font-size: 11.5px; color: var(--muted); }

.field-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.field-row > label { font-size: 12.5px; color: var(--muted); width: 62px; flex: none; }
.field-row input, .field-row select {
  flex: 1;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  padding: 9px 11px;
  font-size: 13px;
  font-family: inherit;
  min-width: 0;
}
.field-row input:focus, .field-row select:focus {
  outline: none;
  border-color: rgba(217, 176, 106, 0.6);
  box-shadow: 0 0 0 3px rgba(217, 176, 106, 0.12);
}
.field-row select option { background: #1d1712; }

.segmented {
  flex: 1;
  display: flex;
  gap: 3px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.26);
  border-radius: 9px;
  border: 1px solid var(--line);
}
.segmented button {
  flex: 1;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 7px 4px;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  transition: 0.15s;
  white-space: nowrap;
}
.segmented button.active { background: rgba(217, 176, 106, 0.22); color: var(--gold-2); font-weight: 600; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.btn-row .btn { flex: 1; min-width: 96px; }

.hint-text {
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-height: 16px;
}

/* 房间列表 */
.room-list, .record-list, .rank-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.room-item, .record-item, .rank-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.045);
  font-size: 13px;
  transition: 0.15s;
}
.room-item:hover, .record-item:hover { border-color: rgba(217, 176, 106, 0.34); background: rgba(217, 176, 106, 0.06); }
.room-item .rmeta, .record-item .rmeta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; flex: 1; }
.rmeta strong { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rmeta small { font-size: 11px; color: var(--muted); }
.room-item .btn, .record-item .btn { padding: 6px 12px; font-size: 12px; }
.badge {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(87, 168, 107, 0.16);
  color: #8ed6a0;
  border: 1px solid rgba(87, 168, 107, 0.3);
  white-space: nowrap;
}
.badge.waiting { background: rgba(217, 176, 106, 0.14); color: var(--gold-2); border-color: rgba(217, 176, 106, 0.3); }
.badge.finished { background: rgba(255, 255, 255, 0.07); color: var(--muted); border-color: var(--line); }

.empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 18px 0; margin: 0; }

.rank-item { gap: 12px; }
.rank-no {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  flex: none;
}
.rank-item:nth-child(1) .rank-no { background: linear-gradient(150deg, #f2d18c, #c99b52); color: #241a0d; }
.rank-item:nth-child(2) .rank-no { background: linear-gradient(150deg, #d7d7d7, #9d9d9d); color: #1c1c1c; }
.rank-item:nth-child(3) .rank-no { background: linear-gradient(150deg, #d8a97a, #a9764a); color: #241a0d; }
.rank-item .rating { margin-left: auto; color: var(--gold-2); font-weight: 600; font-variant-numeric: tabular-nums; }

/* 棋谱列表 */
.move-card { padding: 14px 16px; }
.replay-controls { display: flex; gap: 2px; }
.move-list {
  display: grid;
  grid-template-columns: 34px 1fr 1fr;
  gap: 2px 6px;
  max-height: 220px;
  overflow-y: auto;
  font-size: 12.5px;
  scrollbar-width: thin;
}
.move-list::-webkit-scrollbar { width: 5px; }
.move-list::-webkit-scrollbar-thumb { background: rgba(217, 176, 106, 0.24); border-radius: 3px; }
.move-list .empty { grid-column: 1 / -1; }
.move-no { color: var(--muted); font-size: 11px; text-align: right; padding: 4px 2px; font-variant-numeric: tabular-nums; }
.move-cell {
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  transition: 0.13s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.move-cell:hover { background: rgba(255, 255, 255, 0.07); }
.move-cell.current { background: rgba(217, 176, 106, 0.24); color: var(--gold-2); font-weight: 600; }
.move-cell.empty-cell { cursor: default; }

/* ---------------- 弹窗 ---------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 6, 4, 0.76);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.18s ease;
}
.modal-card {
  position: relative;
  width: min(100%, 420px);
  background: linear-gradient(168deg, #251e16, #17120e);
  border: 1px solid rgba(217, 176, 106, 0.26);
  border-radius: 20px;
  padding: 26px 26px 22px;
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow-y: auto;
  animation: popIn 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.modal-card.narrow { width: min(100%, 340px); }
.modal-card.wide { width: min(100%, 560px); }
.modal-card h3 { margin: 0 0 16px; font-size: 18px; color: var(--gold-2); font-family: "STKaiti", "KaiTi", serif; }
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}
.modal-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }

.modal-tabs { display: flex; gap: 6px; margin-bottom: 20px; }
.modal-tabs button {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: 0.16s;
}
.modal-tabs button.active { background: rgba(217, 176, 106, 0.18); color: var(--gold-2); border-color: rgba(217, 176, 106, 0.34); font-weight: 600; }

.input-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}
.input-label input {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.input-label input:focus {
  outline: none;
  border-color: rgba(217, 176, 106, 0.6);
  box-shadow: 0 0 0 3px rgba(217, 176, 106, 0.12);
}
.form-error { color: #ff9187; font-size: 12px; margin: 0 0 12px; min-height: 16px; }

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 14px;
  color: var(--muted);
  font-size: 11.5px;
}
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

.oauth-row { display: flex; gap: 10px; }
.oauth-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: 0.16s;
}
.oauth-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2); }
.oauth-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.oauth-note, .guest-note { font-size: 11px; color: var(--muted); text-align: center; margin: 12px 0 0; line-height: 1.6; }
.guest-note { margin-top: 6px; }

.code-input {
  width: 100%;
  text-align: center;
  letter-spacing: 0.32em;
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  color: var(--gold-2);
  font-family: inherit;
  margin-bottom: 8px;
}
.code-input:focus { outline: none; border-color: rgba(217, 176, 106, 0.6); }

.record-detail { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.record-detail dl { display: grid; grid-template-columns: 84px 1fr; gap: 8px 12px; margin: 0; }
.record-detail dt { color: var(--muted); }
.record-detail dd { margin: 0; color: var(--text); }
.record-detail .moves-preview {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.24);
  max-height: 150px;
  overflow-y: auto;
  line-height: 1.9;
  font-size: 12.5px;
  color: var(--text);
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 20px);
  background: rgba(34, 26, 18, 0.96);
  border: 1px solid rgba(217, 176, 106, 0.36);
  color: var(--text);
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: 0.26s;
  z-index: 200;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  max-width: 86vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.footer {
  margin-top: 22px;
  text-align: center;
  font-size: 11.5px;
  color: rgba(161, 144, 122, 0.6);
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.footer a { color: rgba(217, 176, 106, 0.72); text-decoration: none; }
.footer a:hover { color: var(--gold-2); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
@keyframes pieceIn { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.shake { animation: shake 0.3s ease; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; }
}

@media (max-width: 900px) {
  .app { padding: 12px 14px 24px; }
  .layout { grid-template-columns: 1fr; }
  .side-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .topbar { gap: 12px; }
  .tabs { order: 3; width: 100%; margin-left: 0; overflow-x: auto; }
  .tab { flex: 1; padding: 8px 10px; font-size: 13px; }
  .account { margin-left: auto; }
  .board-wrap, .player-strip, .status-bar { width: 100%; }
  .move-list { max-height: 160px; }
}

@media (max-width: 520px) {
  .brand-text small { display: none; }
  .brand-seal { width: 38px; height: 38px; font-size: 21px; }
  .brand-text strong { font-size: 17px; }
  .btn { padding: 9px 14px; font-size: 13px; }
  .card { padding: 14px; }
  .player-strip { padding: 7px 10px; gap: 8px; }
  .avatar.small { width: 32px; height: 32px; font-size: 13px; }
  .captured { max-width: 46%; }
  .captured .cap { width: 18px; height: 18px; font-size: 11px; }
  .modal-card { padding: 22px 18px 18px; }
  .user-meta { display: none; }
  .footer { font-size: 10.5px; }
}

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