:root {
  --bg: #f4efe6;
  --card: #fffdf8;
  --card-2: #f7f1e6;
  --text: #2a211b;
  --text-2: #75665a;
  --line: #e4d9c8;
  --accent: #b3261e;
  --accent-soft: rgba(179, 38, 30, 0.08);
  --good: #2f7d4f;
  --shadow: 0 1px 2px rgba(70, 45, 20, 0.06), 0 6px 20px rgba(70, 45, 20, 0.07);

  --wood-line: #5e3b1c;
  --red-piece: #b3261e;
  --black-piece: #1f1a16;
  --mark: rgba(25, 104, 196, 0.9);

  --font-ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --font-kai: "Kaiti SC", "STKaiti", "KaiTi", "楷体", "BiauKai", "Songti SC", "STSong", "SimSun", serif;

  --board-w: min(100%, 660px, calc((100vh - 300px) * 0.9));
}
@supports (height: 100dvh) {
  :root { --board-w: min(100%, 660px, calc((100dvh - 300px) * 0.9)); }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16120e;
    --card: #211b16;
    --card-2: #2a221c;
    --text: #efe6d9;
    --text-2: #a8998a;
    --line: #3a3029;
    --accent: #e0574b;
    --accent-soft: rgba(224, 87, 75, 0.12);
    --good: #5cc28a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }

.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: 0.08em; }
.brand-name { font-family: var(--font-kai); font-size: 21px; }
.seal {
  width: 30px; height: 30px; border-radius: 7px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff8ee;
  font-family: var(--font-kai); font-size: 19px; letter-spacing: 0;
  box-shadow: inset 0 0 0 2px rgba(255, 248, 238, 0.35);
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rating-badge {
  display: flex; align-items: baseline; gap: 6px;
  height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card);
  font-size: 13px; color: var(--text-2);
}
.rating-badge b { font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- 布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}
.play { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; }
.play > * { width: var(--board-w); max-width: 100%; }
.side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 16px; }

@media (max-width: 880px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .side { position: static; width: var(--board-w); max-width: 100%; margin: 0 auto; }
  :root { --board-w: min(100%, 560px, calc((100vh - 290px) * 0.9)); }
  @supports (height: 100dvh) {
    :root { --board-w: min(100%, 560px, calc((100dvh - 290px) * 0.9)); }
  }
}
@media (max-width: 880px) and (max-height: 640px) {
  :root { --board-w: 100%; }
}

/* ---------- 对局双方信息条 ---------- */
.strip {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  min-height: 50px; padding: 7px 12px;
  background: var(--card); border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.strip.turn::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-kai); font-weight: 700; font-size: 19px;
  background: radial-gradient(circle at 35% 30%, #fffaf0, #f1dcb0 55%, #ddb97f);
  box-shadow: inset 0 0 0 2px #c4955a, 0 1px 2px rgba(0, 0, 0, 0.2);
}
.avatar.red { color: var(--red-piece); }
.avatar.black { color: var(--black-piece); }
.who { min-width: 0; flex: 1; }
.who .name { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.who .sub {
  margin-top: 2px; font-size: 12.5px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.who .sub.alert { color: var(--accent); font-weight: 600; }
.level-pill {
  font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent);
}
.level-pill.muted { background: var(--card-2); color: var(--text-2); }
.thinking-dots::after {
  content: "";
  display: inline-block; width: 1.2em; text-align: left;
  animation: dots 1.2s steps(4) infinite;
}
@keyframes dots { 0% { content: ""; } 25% { content: "·"; } 50% { content: "··"; } 75% { content: "···"; } }

.captured { display: flex; flex-wrap: wrap-reverse; justify-content: flex-end; gap: 2px; max-width: 46%; }
.mini {
  width: 19px; height: 19px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-kai); font-weight: 700; font-size: 12px;
  background: radial-gradient(circle at 35% 30%, #fffaf0, #ecd4a5);
  box-shadow: inset 0 0 0 1px #c4955a;
  opacity: 0.9;
}
.mini.red { color: var(--red-piece); }
.mini.black { color: var(--black-piece); }
/* AI 思考指示：来回扫动，不暗示固定时长 */
.think-bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  overflow: hidden; opacity: 0; transition: opacity 0.2s;
}
.think-bar.active { opacity: 1; }
.think-bar::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -35%; width: 35%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: think-sweep 1.1s ease-in-out infinite;
}
@keyframes think-sweep { from { left: -35%; } to { left: 100%; } }

/* ---------- 棋盘 ---------- */
.board-frame {
  padding: 2px 10px;
  border-radius: 14px;
  background: linear-gradient(170deg, #c38f55, #a8733d);
  box-shadow: 0 2px 0 #8a5a2b, 0 14px 34px rgba(70, 40, 10, 0.28);
}
.file-labels {
  display: grid; grid-template-columns: repeat(9, 1fr);
  height: 20px; line-height: 20px; text-align: center;
  font-family: var(--font-kai); font-size: 12.5px; color: rgba(40, 18, 4, 0.72);
  user-select: none;
}
.board {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 10;
  container-type: inline-size;
  border-radius: 4px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  background:
    repeating-linear-gradient(93deg, rgba(110, 60, 15, 0.035) 0 2px, transparent 2px 11px),
    repeating-linear-gradient(88deg, rgba(255, 235, 200, 0.06) 0 1px, transparent 1px 7px),
    radial-gradient(ellipse at 25% 15%, rgba(255, 238, 200, 0.55), transparent 60%),
    linear-gradient(165deg, #efcf98, #ddb06d 60%, #d4a462);
  box-shadow: inset 0 0 0 1px rgba(80, 45, 10, 0.25);
}
.grid { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.grid .lines line { stroke: var(--wood-line); stroke-width: 2.4; stroke-linecap: square; }
.grid .frame { fill: none; stroke: var(--wood-line); stroke-width: 6; }
.grid .pts { fill: none; stroke: var(--wood-line); stroke-width: 2.4; }
.grid .river {
  font-family: var(--font-kai); font-size: 54px; fill: rgba(70, 38, 10, 0.62);
  text-anchor: middle; dominant-baseline: central; letter-spacing: 12px;
}
.layer { position: absolute; inset: 0; pointer-events: none; }

.piece {
  position: absolute;
  width: 10.5%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 34% 28%, #fffbf2 0%, #f6e6c4 42%, #e6c891 100%);
  box-shadow:
    0 0.55cqw 0 #b88a4c,
    0 1cqw 1.6cqw rgba(50, 25, 5, 0.32),
    inset 0 0 0 0.3cqw #c9995b;
  font-family: var(--font-kai);
  font-weight: 700;
  font-size: min(5.6vw, 34px); /* 不支持容器单位的老浏览器 */
  font-size: 6.3cqw;
  line-height: 1;
  transition: left 0.24s cubic-bezier(0.25, 0.8, 0.3, 1), top 0.24s cubic-bezier(0.25, 0.8, 0.3, 1), transform 0.14s ease, box-shadow 0.14s ease;
}
.piece::before {
  content: ""; position: absolute; inset: 8.5%;
  border-radius: 50%;
  border: 0.32cqw solid currentColor;
  opacity: 0.5;
}
.piece span { position: relative; top: -0.04em; }
.piece.red { color: var(--red-piece); }
.piece.black { color: var(--black-piece); }
.piece.moving { z-index: 5; }
.piece.selected {
  z-index: 4;
  transform: translate(-50%, -57%) scale(1.07);
  box-shadow:
    0 0.55cqw 0 #b88a4c,
    0 2.4cqw 2.6cqw rgba(50, 25, 5, 0.35),
    inset 0 0 0 0.3cqw #c9995b,
    0 0 0 0.55cqw rgba(255, 190, 40, 0.9);
}
.piece.in-check { animation: check-glow 0.9s ease-in-out infinite alternate; }
@keyframes check-glow {
  from { box-shadow: 0 0.55cqw 0 #b88a4c, 0 0 0 0.4cqw rgba(220, 30, 20, 0.5), inset 0 0 0 0.3cqw #c9995b; }
  to { box-shadow: 0 0.55cqw 0 #b88a4c, 0 0 0 1.2cqw rgba(220, 30, 20, 0.85), 0 0 3cqw rgba(220, 30, 20, 0.6), inset 0 0 0 0.3cqw #c9995b; }
}
.piece.captured { animation: captured-out 0.4s ease forwards; z-index: 1; }
@keyframes captured-out {
  from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
}

.mark { position: absolute; transform: translate(-50%, -50%); }
.mark.dot {
  width: 3.1%; aspect-ratio: 1; border-radius: 50%;
  background: rgba(32, 118, 68, 0.85);
  box-shadow: 0 0 0 0.45cqw rgba(255, 252, 240, 0.55);
}
.mark.capture {
  width: 11.6%; aspect-ratio: 1; border-radius: 50%;
  box-shadow: 0 0 0 max(2.5px, 0.6cqw) rgba(32, 118, 68, 0.85);
}
.mark.last-from {
  width: 2.8%; aspect-ratio: 1; border-radius: 50%;
  border: max(2px, 0.45cqw) solid var(--mark);
}
.mark.last-to {
  --c: var(--mark);
  --w: max(2px, 0.5cqw);
  --l: 26%;
  width: 12%; aspect-ratio: 1;
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) top left / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) top right / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) top right / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) bottom left / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) bottom left / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) bottom right / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) bottom right / var(--w) var(--l);
  background-repeat: no-repeat;
}
.mark.hint {
  width: 12%; aspect-ratio: 1; border-radius: 50%;
  border: max(2.5px, 0.75cqw) solid rgba(236, 150, 0, 0.95);
  box-shadow: 0 0 0 max(2px, 0.5cqw) rgba(255, 214, 90, 0.4), 0 0 3cqw rgba(255, 170, 0, 0.55);
  animation: hint-pulse 0.9s ease-in-out infinite alternate;
}
@keyframes hint-pulse { to { transform: translate(-50%, -50%) scale(1.09); } }

.stamp {
  position: absolute; left: 50%; top: 50%;
  width: 27%; aspect-ratio: 1;
  display: grid; place-items: center;
  border: 1.3cqw solid var(--red-piece);
  border-radius: 16%;
  color: var(--red-piece);
  background: rgba(255, 248, 236, 0.4);
  font-family: var(--font-kai); font-weight: 700; font-size: 16cqw;
  opacity: 0; pointer-events: none;
  transform: translate(-50%, -50%) rotate(-10deg);
}
.stamp.show { animation: stamp 1.15s cubic-bezier(0.2, 0.9, 0.3, 1) forwards; }
@keyframes stamp {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-10deg) scale(1.9); }
  14% { opacity: 0.92; transform: translate(-50%, -50%) rotate(-10deg) scale(1); }
  72% { opacity: 0.92; }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(-10deg) scale(1); }
}

/* ---------- 操作按钮 ---------- */
.actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.actions button {
  height: 54px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 12.5px; color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.1s ease, background 0.15s ease;
}
.actions button:active:not(:disabled) { transform: scale(0.96); background: var(--card-2); }
.actions button:disabled { opacity: 0.38; cursor: default; box-shadow: none; }
.actions svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#btnNew { background: var(--accent); color: #fff8ee; border-color: transparent; }
#btnNew:active { background: var(--accent); filter: brightness(0.92); }

/* ---------- 侧栏卡片 ---------- */
.card { background: var(--card); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.card h3 {
  margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--text-2);
  display: flex; justify-content: space-between; align-items: baseline;
}
.card h3 .count { font-weight: 400; font-size: 12px; }
.info { margin: 0; display: grid; gap: 8px; }
.info div { display: flex; justify-content: space-between; gap: 12px; }
.info dt { color: var(--text-2); }
.info dd { margin: 0; font-weight: 600; text-align: right; }
.info .warn { color: var(--accent); font-weight: 600; }
.info .ok { color: var(--good); }

.moves {
  list-style: none; margin: 0; padding: 0;
  max-height: 320px; overflow-y: auto;
  font-family: var(--font-kai); font-size: 16px;
  scrollbar-width: thin;
}
.moves li {
  display: grid; grid-template-columns: 2.2em 1fr 1fr; align-items: center;
  padding: 3px 4px; border-radius: 6px;
}
.moves li:nth-child(odd) { background: var(--card-2); }
.moves .no { font-family: var(--font-ui); font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.moves .r { color: var(--red-piece); }
.moves .last { text-decoration: underline; text-decoration-color: var(--mark); text-underline-offset: 4px; text-decoration-thickness: 2px; }
.moves li.moves-empty { display: block; background: none; color: var(--text-2); font-size: 13px; font-family: var(--font-ui); padding: 6px 0; }
@media (prefers-color-scheme: dark) {
  .moves .r { color: #f07a6e; }
}
@media (max-width: 880px) {
  .moves { max-height: 180px; }
}

.stats-mini { display: grid; gap: 6px; font-size: 13.5px; }
.stats-mini .row { display: grid; grid-template-columns: 3em 1fr auto; gap: 8px; align-items: center; }
.stats-mini .bar { height: 6px; border-radius: 3px; background: var(--card-2); overflow: hidden; display: flex; }
.stats-mini .bar i { display: block; height: 100%; }
.stats-mini .bar .w { background: var(--good); }
.stats-mini .bar .d { background: #c8a96b; }
.stats-mini .bar .l { background: var(--accent); }
.stats-mini .num { color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 12.5px; }

/* ---------- 对话框 ---------- */
dialog {
  border: none; padding: 22px;
  width: min(460px, calc(100vw - 32px));
  border-radius: 18px;
  background: var(--card); color: var(--text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}
dialog::backdrop { background: rgba(25, 14, 6, 0.45); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
dialog[open] { animation: pop 0.2s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
dialog h2 { margin: 0 0 14px; font-size: 19px; }
dialog p { color: var(--text-2); line-height: 1.6; margin: 0 0 6px; }
@media (max-width: 560px) {
  dialog.sheet {
    margin: auto 0 0; width: 100vw; max-width: 100vw;
    border-radius: 18px 18px 0 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }
  dialog.sheet[open] { animation: slide-up 0.24s ease; }
  @keyframes slide-up { from { transform: translateY(40px); opacity: 0; } }
}
.field-label { font-size: 13px; color: var(--text-2); margin: 14px 0 8px; font-weight: 600; }
.field-label:first-of-type { margin-top: 0; }
.level-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.level-card {
  position: relative; display: flex; flex-direction: column; gap: 3px;
  padding: 12px 12px 11px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--card);
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.level-card input { position: absolute; opacity: 0; pointer-events: none; }
.level-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.level-card .top { display: flex; justify-content: space-between; align-items: baseline; }
.level-card .lv { font-family: var(--font-kai); font-size: 21px; font-weight: 700; }
.level-card .elo { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.level-card .pips { display: flex; gap: 3px; margin: 2px 0; }
.level-card .pips i { width: 14px; height: 4px; border-radius: 2px; background: var(--line); }
.level-card .pips i.on { background: var(--accent); }
.level-card .desc { font-size: 12px; color: var(--text-2); line-height: 1.45; }
.level-card .rec { font-size: 11.5px; color: var(--text-2); margin-top: 2px; font-variant-numeric: tabular-nums; }
.level-card.remote { grid-column: 1 / -1; }
.level-card.remote .lv { letter-spacing: 0.04em; }
.level-card.disabled { cursor: not-allowed; }
.level-card.disabled > :not(.engine-state) { opacity: 0.5; }
.engine-state { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-2); margin-top: 2px; }
.engine-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-2); opacity: 0.5; }
.engine-state.on { color: var(--good); }
.engine-state.warn { color: #c2861a; }
.engine-state.warn::before { background: #e0a030; opacity: 1; }
.engine-state.on::before { background: var(--good); opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent); }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--card-2); padding: 4px; border-radius: 12px; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 9px 4px; border-radius: 9px; font-size: 13.5px; color: var(--text-2); }
.seg input:checked + span { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.dialog-actions button {
  min-width: 96px; height: 44px; padding: 0 18px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--card); font-weight: 600;
}
.dialog-actions .primary { background: var(--accent); color: #fff8ee; border-color: transparent; }
.dialog-actions .danger { color: var(--accent); margin-right: auto; }

.result { text-align: center; }
.result-seal {
  width: 76px; height: 76px; margin: 4px auto 12px;
  display: grid; place-items: center;
  border: 4px solid var(--accent); border-radius: 16px; color: var(--accent);
  font-family: var(--font-kai); font-weight: 700; font-size: 46px;
  transform: rotate(-8deg);
}
.result-seal.lose { border-color: var(--text-2); color: var(--text-2); }
.result-seal.draw { border-color: #b8913f; color: #b8913f; }
.result h2 { margin-bottom: 4px; font-size: 22px; }
.rating-change {
  display: inline-flex; align-items: baseline; gap: 8px;
  margin-top: 10px; padding: 8px 16px; border-radius: 10px; background: var(--card-2);
  font-size: 13px; color: var(--text-2);
}
.rating-change b { font-size: 20px; color: var(--text); font-variant-numeric: tabular-nums; }
.rating-change .up { color: var(--good); font-style: normal; font-weight: 700; }
.rating-change .down { color: var(--accent); font-style: normal; font-weight: 700; }
.result .dialog-actions { justify-content: center; }

.stats-head { display: flex; gap: 10px; margin-bottom: 14px; }
.stats-head > div { flex: 1; background: var(--card-2); border-radius: 12px; padding: 10px 12px; }
.stats-head small { display: block; color: var(--text-2); font-size: 12px; }
.stats-head b { font-size: 22px; font-variant-numeric: tabular-nums; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.stats-table th, .stats-table td { padding: 7px 4px; text-align: center; border-bottom: 1px solid var(--line); }
.stats-table th { color: var(--text-2); font-weight: 600; font-size: 12px; }
.stats-table td:first-child, .stats-table th:first-child { text-align: left; }
.recent { margin-top: 14px; max-height: 190px; overflow-y: auto; font-size: 13px; }
.recent div { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.recent .res-w { color: var(--good); font-weight: 600; }
.recent .res-l { color: var(--accent); font-weight: 600; }
.recent .muted { color: var(--text-2); }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  padding: 10px 18px; border-radius: 99px;
  background: rgba(30, 22, 16, 0.92); color: #fbf3e6;
  font-size: 14px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .piece, .mark.hint, .stamp.show, dialog[open] { transition: none; animation: none; }
  .stamp.show { opacity: 0; }
}
