/* 小棋苗的界面。手机优先：家长拿着手机坐在孩子旁边，念给孩子听，孩子在棋盘上点。
   三种声音分开：念给孩子听的（.say，大字）、给家长看的（.note，小字）、系统状态（.muted）。 */

:root {
  --bg: #f6f3ea; --surface: #fff; --ink: #1f2a24; --muted: #66736b; --line: #e7e2d4; --line-strong: #d4cdb9;
  --green: #2e7d57; --green-dark: #22603f; --green-soft: #e2f1e7;
  --sun: #e9a51f; --sun-soft: #fff3cf; --sun-ink: #7a5300;
  --coral: #cf5536; --coral-soft: #fde8e1;
  --sky: #2f6f9f; --sky-soft: #e6f0f7;
  --sq-light: #f1ecd9; --sq-dark: #8bae7f; --pc-dark: #333d36; --pc-light: #fffdf6;
  --radius: 18px; --radius-s: 12px;
  --shadow: 0 1px 2px rgba(31, 42, 36, .05), 0 8px 24px rgba(31, 42, 36, .06);
  --round: ui-rounded, "SF Pro Rounded", "Nunito", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --tabbar: 64px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Noto Sans SC", sans-serif;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--round); line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 800; } h2 { font-size: 1.15rem; font-weight: 700; } h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0; } a { color: var(--green); }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: .92rem; }
.small { font-size: .85rem; }
:focus-visible { outline: 3px solid rgba(46, 125, 87, .45); outline-offset: 2px; border-radius: 8px; }
svg.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.22em; }

/* ---------- 外壳 ---------- */
#bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 14px;
  padding-top: env(safe-area-inset-top); box-sizing: content-box; background: rgba(246, 243, 234, .92); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); }
#bar.scrolled { box-shadow: 0 1px 0 var(--line); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font: 800 1.15rem var(--round); }
.brand svg { width: 30px; height: 30px; }
#bar .back { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-left: -8px; border-radius: 50%; color: var(--ink); text-decoration: none; }
#bar .back:active { background: rgba(31, 42, 36, .08); }
#bar .title { font: 700 1.05rem var(--round); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#bar .spacer { flex: 1; }
#bar .toplinks { display: none; gap: 4px; margin-left: 18px; }
#bar .toplinks a { padding: 8px 14px; border-radius: 99px; text-decoration: none; color: var(--muted); font-weight: 600; }
#bar .toplinks a.on { background: var(--green-soft); color: var(--green-dark); }
.kid { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); background: var(--surface); border-radius: 99px;
  font: 600 .95rem var(--round); color: var(--ink); cursor: pointer; position: relative; }
.kid select { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; margin: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; font: 800 .9rem var(--round); flex: none; }
.avatar.big { width: 44px; height: 44px; font-size: 1.2rem; }
.avatar.c1 { background: #c9772b; } .avatar.c2 { background: #2f6f9f; } .avatar.c3 { background: #8a5aa8; }

main { max-width: 720px; margin: 0 auto; padding: 8px 16px calc(28px + env(safe-area-inset-bottom)); }
body.tabs main { padding-bottom: calc(var(--tabbar) + 28px + env(safe-area-inset-bottom)); }
.page { display: flex; flex-direction: column; gap: 16px; animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: none; height: var(--tabbar); padding-bottom: env(safe-area-inset-bottom); box-sizing: content-box;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
body.tabs #tabs { display: flex; }
#tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font: 600 .72rem var(--round); }
#tabs a svg.icon { width: 24px; height: 24px; }
#tabs a.on { color: var(--green); }
@media (min-width: 860px) {
  #bar { padding-left: max(14px, calc((100vw - 1000px) / 2)); padding-right: max(14px, calc((100vw - 1000px) / 2)); }
  #bar .toplinks { display: flex; }
  body.tabs #tabs { display: none; }
  body.tabs main { padding-bottom: 40px; }
  main { padding-top: 16px; }
  main.wide { max-width: 1000px; }
}

/* ---------- 基本组件 ---------- */
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.card.narrow { max-width: 460px; width: 100%; margin: 0 auto; }
.card.center { text-align: center; align-items: center; }
.section-title { display: flex; align-items: baseline; gap: 8px; margin: 6px 4px -6px; }
.section-title h2 { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; } .row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.split { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 860px) { .split { grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 24px; } }
/* 首页：窄的时候一列；大屏上左边今天做什么，右边下过的棋和拍过的题 */
.homecols, .homecol { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (min-width: 1100px) {
  main.home { max-width: 1000px; }
  .homecols { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .homecol > .section-title:first-child { margin-top: 0; }
}

button, .btn { font: 700 1rem var(--round); min-height: 48px; padding: 0 20px; border-radius: 14px; border: 0; background: var(--green); color: #fff; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .08s, background .15s; -webkit-appearance: none; appearance: none; }
button:active, .btn:active { transform: scale(.97); }
button:hover, .btn:hover { background: var(--green-dark); }
button.soft, .btn.soft { background: var(--green-soft); color: var(--green-dark); }
button.soft:hover, .btn.soft:hover { background: #d3e9db; }
button.plain, .btn.plain { background: transparent; color: var(--green); padding: 0 10px; min-height: 40px; }
button.plain:hover, .btn.plain:hover { background: rgba(46, 125, 87, .08); }
button.danger { background: transparent; color: var(--coral); }
button.danger:hover { background: var(--coral-soft); }
button.danger.busy::after { border-color: rgba(207, 85, 54, .3); border-top-color: var(--coral); }
button.block, .btn.block { width: 100%; }
button.small, .btn.small { min-height: 38px; padding: 0 14px; font-size: .92rem; border-radius: 11px; }
button:disabled { opacity: .45; cursor: default; transform: none; }
button.busy { color: transparent !important; position: relative; pointer-events: none; }
button.busy::after { content: ""; position: absolute; width: 18px; height: 18px; border: 3px solid rgba(255, 255, 255, .5); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
button.soft.busy::after, button.plain.busy::after { border-color: rgba(46, 125, 87, .3); border-top-color: var(--green); }

label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .95rem; }
label.field small { font-weight: 400; color: var(--muted); font-size: .85rem; }
label.field small.bad { color: var(--coral); font-weight: 600; }
label.field .opt { font-weight: 400; color: var(--muted); }
input, select, textarea { width: 100%; font: inherit; font-weight: 400; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface); color: var(--ink); -webkit-appearance: none; appearance: none; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2366736b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 38px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--green); box-shadow: 0 0 0 3px rgba(46, 125, 87, .18); }
textarea { font-family: ui-monospace, Menlo, monospace; font-size: .88rem; line-height: 1.5; resize: vertical; }
input.code { font: 700 1.6rem var(--round); letter-spacing: .35em; text-align: center; padding-left: .35em; }
input.invite { font: 700 1.2rem ui-monospace, Menlo, Consolas, monospace; letter-spacing: .14em; text-transform: uppercase; text-align: center; }
input.invite::placeholder { font-weight: 400; color: var(--line-strong); }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; margin: 2px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
button.apple { background: #000; color: #fff; } button.apple:hover { background: #1c1c1e; }
input[type=range] { -webkit-appearance: auto; appearance: auto; padding: 0; min-height: 32px; border: 0; background: transparent; accent-color: var(--green); }
input[type=range]:focus { box-shadow: none; }

.seg { display: flex; padding: 4px; gap: 4px; background: rgba(31, 42, 36, .07); border-radius: 14px; }
.seg button { flex: 1; min-height: 40px; padding: 0 10px; background: transparent; color: var(--muted); border-radius: 11px; font-size: .92rem; }
.seg button:hover { background: rgba(255, 255, 255, .5); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(31, 42, 36, .15); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { min-height: 42px; padding: 0 16px; border-radius: 99px; background: var(--surface); color: var(--ink); border: 1.5px solid var(--line-strong); font-weight: 600; }
.chips button:hover { background: var(--green-soft); }
.chips button.on { background: var(--green-soft); border-color: var(--green); color: var(--green-dark); }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; min-height: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: var(--line-strong); border-radius: 99px; transition: .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: .2s; }
.switch input:checked + i { background: var(--green); } .switch input:checked + i::after { transform: translateX(20px); }

.tag { display: inline-flex; align-items: center; gap: 4px; font: 700 .78rem var(--round); padding: 3px 10px; border-radius: 99px; background: var(--green-soft); color: var(--green-dark); white-space: nowrap; }
.tag.bad, .tag.weak { background: var(--coral-soft); color: var(--coral); }
.tag.warn, .tag.ok { background: var(--sun-soft); color: var(--sun-ink); }
.tag.info { background: var(--sky-soft); color: var(--sky); }
.tag.unknown, .tag.plainish { background: rgba(31, 42, 36, .07); color: var(--muted); }
.tag svg.icon { width: 1em; height: 1em; stroke-width: 2.6; }
button.tag.link { min-height: 0; border: 0; cursor: pointer; padding: 5px 10px; white-space: normal; text-align: left; }
button.tag.link:hover { background: #ffe9a8; }
.moverow { display: flex; gap: 8px; align-items: flex-start; font-size: .95rem; }
.moverow.bad svg.icon { color: var(--coral); margin-top: 3px; stroke-width: 2.6; } .moverow.good svg.icon { color: var(--green); margin-top: 3px; stroke-width: 2.6; }
.empty h2 { color: var(--ink); }

/* 列表行：整行可点 */
.rows { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.rowlink { display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-decoration: none; color: var(--ink); min-height: 64px; background: none; border: 0; border-radius: 0; width: 100%; text-align: left; font: inherit; justify-content: flex-start; }
.rowlink + .rowlink, .rows > * + * { border-top: 1px solid var(--line); }
.rowlink:hover { background: rgba(31, 42, 36, .03); } .rowlink:active { background: rgba(31, 42, 36, .06); transform: none; }
.rowlink .t { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rowlink .chev { color: var(--line-strong); }
.rowlink.plainrow { cursor: default; } .rowlink.plainrow:hover { background: none; }
.badge { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; background: var(--green-soft); color: var(--green-dark); font: 800 .95rem var(--round); }
.badge.loss { background: var(--coral-soft); color: var(--coral); } .badge.draw, .badge.wait { background: rgba(31, 42, 36, .07); color: var(--muted); }
.badge.sun { background: var(--sun-soft); color: var(--sun-ink); } .badge.sky { background: var(--sky-soft); color: var(--sky); }
.empty { text-align: center; padding: 26px 18px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty svg.icon { width: 34px; height: 34px; color: var(--line-strong); }

/* 三种声音 */
.say { position: relative; background: var(--green-soft); border-radius: 6px var(--radius) var(--radius) var(--radius); padding: 14px 16px; font-size: 1.12rem; line-height: 1.5; font-weight: 500; }
.say .who { display: flex; align-items: center; gap: 6px; font: 700 .78rem var(--round); color: var(--green-dark); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.say.plain { background: var(--surface); border: 1.5px solid var(--line); }
.lesson { display: flex; gap: 10px; align-items: flex-start; background: var(--sun-soft); color: var(--sun-ink); border-radius: var(--radius-s); padding: 12px 14px; font-weight: 600; }
.lesson svg.icon { color: var(--sun); fill: var(--sun); margin-top: 2px; }
.note { background: var(--sky-soft); border-radius: var(--radius-s); padding: 12px 14px; font-size: .95rem; display: flex; flex-direction: column; gap: 8px; }
.note .who { display: flex; align-items: center; gap: 6px; font: 700 .78rem var(--round); color: var(--sky); text-transform: uppercase; letter-spacing: .04em; }
.note ul, .card ul.plain { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; }
.praise { display: flex; gap: 10px; align-items: flex-start; }
.praise svg.icon { color: var(--sun); fill: var(--sun); margin-top: 3px; }
details.fold { border-top: 1px solid var(--line); padding-top: 4px; }
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 44px; font: 700 .95rem var(--round); color: var(--green-dark); }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: ""; margin-left: auto; width: 9px; height: 9px; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s; opacity: .6; }
details.fold[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
details.fold > .inner { padding: 4px 0 10px; display: flex; flex-direction: column; gap: 10px; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; }
.checks li svg.icon { color: var(--green); margin-top: 3px; stroke-width: 2.6; }
.banner { display: flex; gap: 10px; align-items: flex-start; background: var(--sun-soft); color: var(--sun-ink); border-radius: var(--radius-s); padding: 12px 14px; font-size: .95rem; }
.banner.bad { background: var(--coral-soft); color: var(--coral); }
.banner ul { margin: 0; padding-left: 1.1em; }

/* ---------- 首页 ---------- */
.hello { margin: 4px 4px 0; display: flex; flex-direction: column; gap: 2px; }
.today { background: linear-gradient(145deg, #2e7d57, #245f44); color: #fff; border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 10px 28px rgba(36, 95, 68, .28); position: relative; overflow: hidden; }
.today::after { content: ""; position: absolute; right: -40px; top: -40px; width: 170px; height: 170px; border-radius: 50%; background: rgba(255, 255, 255, .07); pointer-events: none; }
.today .label { font: 700 .78rem var(--round); text-transform: uppercase; letter-spacing: .06em; opacity: .8; }
.today h2 { font-size: 1.35rem; font-weight: 800; }
.today p { opacity: .9; }
.today .btn { background: #fff; color: var(--green-dark); position: relative; z-index: 1; }
.today .btn:not(.block) { align-self: flex-start; }
.today .btn:hover { background: #f1f7f3; }
.ring { --p: 0; width: 76px; height: 76px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font: 800 1.15rem var(--round);
  background: radial-gradient(closest-side, #2a7350 79%, transparent 80% 100%), conic-gradient(#ffd666 calc(var(--p) * 1%), rgba(255, 255, 255, .22) 0); }
.ring small { font-size: .75rem; opacity: .75; font-weight: 600; }
.week { display: flex; gap: 6px; }
.week span { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; font: 600 .7rem var(--round); opacity: .75; }
.week i { width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 255, 255, .16); display: flex; align-items: center; justify-content: center; }
.week .done i { background: #ffd666; color: #5b4300; } .week .done i svg.icon { width: 14px; height: 14px; stroke-width: 3.2; }
.week .now { opacity: 1; } .week .now i { box-shadow: 0 0 0 2px #fff; }
.week .rest i { background: transparent; border: 1.5px dashed rgba(255, 255, 255, .3); }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.tile .tag { white-space: normal; text-align: left; }
.tile { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; text-align: left;
  border: 0; font: inherit; min-height: 0; justify-content: flex-start; cursor: pointer; }
.tile:hover { background: var(--surface); box-shadow: 0 2px 4px rgba(31, 42, 36, .06), 0 12px 28px rgba(31, 42, 36, .1); }
.tile b { font: 700 1.02rem var(--round); } .tile span.muted { font-size: .85rem; line-height: 1.4; }
.tile .badge { width: 46px; height: 46px; border-radius: 14px; } .tile .badge svg.icon { width: 24px; height: 24px; }

/* ---------- 登录 ---------- */
.hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 8px 6px; }
.hero svg.logo { width: 76px; height: 76px; }
.hero h1 { font-size: 1.9rem; }
.hero p { color: var(--muted); max-width: 30em; font-size: 1.05rem; }
.points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; max-width: 460px; width: 100%; margin: 0 auto; }
.points li { display: flex; gap: 12px; align-items: center; font-weight: 500; }

/* ---------- 棋盘 ---------- */
.boardwrap { width: 100%; max-width: 460px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
/* 三层：格子（收点击）、棋子（一直留着，换格子的时候滑过去）、箭头和圈。升变的选子盖在最上面 */
/* 只有格子那一层裁成圆角。棋子不裁：手指拖着的那枚画在手指上方，拖到最上面一排时要能伸到棋盘外面去 */
.board { position: relative; aspect-ratio: 1; width: 100%; border-radius: 12px; user-select: none; -webkit-user-select: none;
  box-shadow: 0 0 0 3px #5f8456, 0 6px 18px rgba(31, 42, 36, .16); }
.squares { position: relative; display: grid; grid-template-columns: repeat(8, 1fr); width: 100%; height: 100%; border-radius: inherit; overflow: hidden; }
.halo { position: absolute; left: 0; top: 0; width: 25%; height: 25%; border-radius: 50%; background: rgba(31, 42, 36, .17); pointer-events: none; }
.halo[hidden] { display: none; }
.pieces, .shapes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pieces { z-index: 1; } .shapes { z-index: 3; }
.pcbox { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; display: flex; align-items: center; justify-content: center;
  transition: transform .2s cubic-bezier(.2, .75, .3, 1), opacity .2s; will-change: transform; }
.pcbox svg.pc { width: 92%; height: 92%; }
.pcbox.still { transition: none; } .pcbox.fresh, .pcbox.gone { opacity: 0; }
.pcbox.drag { transition: none; z-index: 100000 !important; filter: drop-shadow(0 5px 5px rgba(31, 42, 36, .35)); }
/* 能走的子：鼠标是“可以抓”的样子；手指按在上面拖的是棋子，不是页面 */
.board.live .sq.own { cursor: grab; touch-action: none; }
/* 被将的王：格子中间一团红（和 lichess 一样）。选中它的时候让给选中的颜色 */
.sq.check::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, rgba(226, 62, 40, .95) 0%, rgba(226, 62, 40, .75) 28%, rgba(226, 62, 40, 0) 72%); }
.promo { position: absolute; inset: 0; z-index: 6; background: rgba(31, 42, 36, .45); border-radius: inherit; overflow: hidden; }
.promocol { position: absolute; top: 0; width: 12.5%; display: flex; flex-direction: column; }
.promocol.up { top: auto; bottom: 0; flex-direction: column-reverse; }
.promocol button { aspect-ratio: 1; width: 100%; min-height: 0; padding: 0; border-radius: 50%; background: var(--surface); display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 2px var(--line-strong), 0 2px 6px rgba(0, 0, 0, .28); }
.promocol button:hover { background: var(--green-soft); } .promocol button svg.pc { width: 84%; height: 84%; }
.flipbtn { grid-column: 1; grid-row: 2; align-self: center; width: 26px; height: 26px; min-height: 0; padding: 0; margin-left: -8px; border-radius: 50%; background: none; color: var(--muted);
  display: flex; align-items: center; justify-content: center; }
.flipbtn:hover { background: rgba(31, 42, 36, .08); color: var(--ink); } .flipbtn svg { width: 16px; height: 16px; }
.board.ok { animation: okglow .7s ease-out; } .board.no { animation: shake .4s; }
@keyframes okglow { 30% { box-shadow: 0 0 0 5px #38b36f, 0 0 26px rgba(56, 179, 111, .7); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.sq { position: relative; border: 0; border-radius: 0; margin: 0; padding: 0; min-height: 0; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; cursor: default; transition: none; }
.sq:active { transform: none; }
.board.live .sq { cursor: pointer; }
.sq.light, .sq.light:hover { background: var(--sq-light); } .sq.dark, .sq.dark:hover { background: var(--sq-dark); }
.sq.last::before { content: ""; position: absolute; inset: 0; background: rgba(255, 207, 64, .5); }
.sq.sel::before { content: ""; position: absolute; inset: 0; background: rgba(46, 125, 87, .55); }
.sq.target::after { content: ""; position: absolute; width: 30%; height: 30%; border-radius: 50%; background: rgba(31, 42, 36, .28); }
.sq.target.cap::after { width: 86%; height: 86%; background: none; border: 5px solid rgba(31, 42, 36, .28); box-sizing: border-box; }
.sq svg.pc { position: relative; width: 92%; height: 92%; pointer-events: none; }
.pc .f { stroke-width: 4.5; stroke-linejoin: round; stroke-linecap: round; }
.pc .d { fill: none; stroke-width: 4; stroke-linecap: round; }
.pc.w .f { fill: var(--pc-light); stroke: #2a332d; } .pc.w .d { stroke: #2a332d; } .pc.w .e { fill: #2a332d; }
.pc.b .f { fill: var(--pc-dark); stroke: #1c231f; } .pc.b .d { stroke: #e9e4d2; } .pc.b .e { fill: #e9e4d2; }
.boardbox { display: grid; grid-template-columns: 14px minmax(0, 1fr); grid-template-rows: auto minmax(16px, auto); gap: 4px 5px; width: 100%; padding-right: 6px; }
.ranks { display: grid; grid-template-rows: repeat(8, 1fr); } .files { grid-column: 2; align-self: center; display: grid; grid-template-columns: repeat(8, 1fr); }
.ranks span, .files span { display: flex; align-items: center; justify-content: center; font: 700 .72rem/1 var(--round); color: #9aa39b; }
.palette { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; background: var(--surface); border-radius: var(--radius-s); padding: 10px; box-shadow: var(--shadow); }
.palette.few { grid-template-columns: repeat(4, 1fr); max-width: 260px; margin: 0 auto; }
.palette button { aspect-ratio: 1; min-height: 0; padding: 0; background: var(--sq-dark); border-radius: 10px; }
.palette button:hover { background: #7da070; }
.palette button svg.pc { width: 84%; height: 84%; }
.palette button.empty { background: var(--bg); color: var(--ink); border: 1.5px solid var(--line-strong); font-size: .72rem; }
.palette p { grid-column: 1 / -1; font-size: .85rem; color: var(--muted); text-align: center; }
.verdict { min-height: 1.6em; font: 700 1rem var(--round); text-align: center; display: flex; align-items: center; justify-content: center; gap: 6px; }
.verdict.good { color: var(--green); } .verdict.bad { color: var(--coral); } .verdict.idle { color: var(--muted); font-weight: 500; font-size: .9rem; font-family: inherit; }
.line { display: flex; flex-direction: column; gap: 10px; }
.line .caption { min-height: 3.1em; text-align: center; font-weight: 500; }
.line .ctl { display: flex; gap: 10px; align-items: center; justify-content: center; }
.line .ctl span { min-width: 4em; text-align: center; font: 700 .9rem var(--round); color: var(--muted); }

/* ---------- 复盘 ---------- */
.result { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.moment { gap: 14px; scroll-margin-top: 70px; }
.moment .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.moment .num { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; font: 800 .85rem var(--round); display: flex; align-items: center; justify-content: center; }
.moment.good .num { background: var(--green); }
.steps3 { display: flex; gap: 6px; font: 600 .78rem var(--round); color: var(--muted); align-items: center; flex-wrap: wrap; }
.steps3 b { color: var(--green-dark); font-weight: 700; }
.chat { display: flex; flex-direction: column; gap: 10px; }
.chat .q { align-self: flex-end; background: var(--green); color: #fff; border-radius: var(--radius) var(--radius) 6px var(--radius); padding: 10px 14px; max-width: 88%; font-weight: 500; }
.chat .a { align-self: flex-start; background: var(--bg); border-radius: var(--radius) var(--radius) var(--radius) 6px; padding: 10px 14px; max-width: 94%; white-space: pre-wrap; }
.askbar { display: flex; gap: 8px; }
.askbar button { width: 48px; padding: 0; flex: none; }

/* ---------- 校对记录纸、确认棋图 ---------- */
img.sheet, img.preview { width: 100%; border-radius: var(--radius-s); display: block; background: var(--line); box-shadow: var(--shadow); }
.zoom { overflow: auto; border-radius: var(--radius-s); cursor: zoom-in; max-height: 78vh; box-shadow: var(--shadow); -webkit-overflow-scrolling: touch; }
.zoom img.sheet { box-shadow: none; border-radius: 0; } .zoom.in { cursor: zoom-out; } .zoom.in img.sheet { width: 280%; max-width: none; }
/* 手机上照片压矮一点，让照片和棋盘能同时看到，不用来回滚 */
@media (max-width: 859px) { .compare img.sheet { max-height: 34vh; object-fit: contain; background: #2b302c; } }
.cropbox { position: relative; border-radius: var(--radius-s); overflow: hidden; }
.cropbox .shade { position: absolute; top: 0; left: 0; right: 0; height: 0; background: repeating-linear-gradient(135deg, rgba(31, 42, 36, .86) 0 10px, rgba(31, 42, 36, .78) 10px 20px); border-bottom: 3px solid #ffcf40; }
.drop { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 30px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; background: var(--surface); color: var(--ink); cursor: pointer; width: 100%; min-height: 0; font: inherit; }
.drop:hover { background: var(--green-soft); border-color: var(--green); }
.drop b { font: 700 1.05rem var(--round); }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.options button { min-height: 60px; font: 800 1.35rem ui-monospace, Menlo, monospace; background: var(--surface); color: var(--ink); border: 2px solid var(--line-strong); }
.options button:hover { background: var(--green-soft); border-color: var(--green); }
.moves { margin: 0; padding-left: 0; list-style: none; columns: 2; column-gap: 18px; font: .9rem ui-monospace, Menlo, monospace; counter-reset: mv; }
.moves li { counter-increment: mv; display: flex; gap: 6px; padding: 2px 0; break-inside: avoid; }
.moves li::before { content: counter(mv) "."; color: var(--muted); min-width: 2.2em; text-align: right; }
.mv { flex: 1; } .mv.asked { background: var(--sun-soft); color: var(--sun-ink); border-radius: 4px; padding: 0 4px; }
.mv.inserted { background: var(--coral-soft); color: var(--coral); border-radius: 4px; padding: 0 4px; } .mv.settled { font-weight: 700; }
.bar { height: 8px; border-radius: 99px; background: rgba(31, 42, 36, .09); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: 99px; transition: width .3s; }
.sticky { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 4; box-shadow: 0 8px 24px rgba(31, 42, 36, .22); }

/* ---------- 拍题、练习 ---------- */
.hints { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; counter-reset: hint; }
.hints li { counter-increment: hint; display: flex; gap: 12px; align-items: flex-start; background: var(--green-soft); border-radius: var(--radius-s); padding: 12px 14px; font-size: 1.05rem; font-weight: 500; animation: rise .25s ease-out; }
.hints li::before { content: counter(hint); width: 24px; height: 24px; border-radius: 50%; background: var(--green); color: #fff; font: 800 .8rem var(--round); display: flex; align-items: center; justify-content: center; flex: none; margin-top: 2px; }
.hints li.answer { background: var(--sun-soft); color: var(--sun-ink); } .hints li.answer::before { content: "✓"; background: var(--sun); }
.cheer { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 6px 0; animation: pop .45s cubic-bezier(.2, 1.6, .4, 1); }
.cheer svg.icon { width: 44px; height: 44px; color: var(--sun); fill: var(--sun); }
.cheer b { font: 800 1.25rem var(--round); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

/* ---------- 水平 ---------- */
.stagehero { background: linear-gradient(145deg, #2e7d57, #245f44); color: #fff; border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 10px 28px rgba(36, 95, 68, .28); }
.stagehero .label { font: 700 .78rem var(--round); text-transform: uppercase; letter-spacing: .06em; opacity: .8; }
.stagehero h1 { font-size: 1.5rem; }
.stagehero p { opacity: .85; font-size: .92rem; }
.segbar { display: flex; gap: 5px; } .segbar i { flex: 1; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .22); }
.segbar i.passed { background: #ffd666; } .segbar i.current { background: #fff; }
.ladder { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ladder li { position: relative; padding: 0 0 18px 44px; }
.ladder li:last-child { padding-bottom: 0; }
.ladder li::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--line); }
.ladder li:last-child::before { display: none; }
.ladder li .dot { position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); color: var(--muted); display: flex; align-items: center; justify-content: center; font: 800 .82rem var(--round); }
.ladder li.passed .dot { background: var(--green); border-color: var(--green); color: #fff; } .ladder li.passed .dot svg.icon { width: 15px; height: 15px; stroke-width: 3.2; }
.ladder li.passed::before { background: var(--green); }
.ladder li.current .dot { border-color: var(--green); color: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.ladder li b { display: block; font: 700 1rem var(--round); padding-top: 2px; } .ladder li.ahead b { color: var(--muted); font-weight: 600; }
.ladder li small { display: block; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.skill { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; }
.skill .meter { display: flex; gap: 4px; } .skill .meter i { flex: 1; height: 6px; border-radius: 99px; background: rgba(31, 42, 36, .09); }
.skill.weak .meter i:nth-child(-n+1) { background: var(--coral); } .skill.ok .meter i:nth-child(-n+2) { background: var(--sun); } .skill.strong .meter i { background: var(--green); }
.skill a { margin-right: 10px; font-weight: 600; }

/* ---------- 等待、提示、对话框 ---------- */
.waitbox { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 44px 16px; }
.waitbox svg.logo { width: 84px; height: 84px; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }
.dots::after { content: ""; animation: dots 1.4s steps(4, end) infinite; display: inline-block; width: 1.2em; text-align: left; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.spinner { width: 30px; height: 30px; border: 4px solid var(--green-soft); border-top-color: var(--green); border-radius: 50%; margin: 30px auto; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skel { border-radius: var(--radius); background: linear-gradient(90deg, #ece8db 25%, #f4f1e6 37%, #ece8db 63%); background-size: 400% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + 20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; opacity: 0; pointer-events: none; transition: .22s; max-width: min(92vw, 420px); z-index: 40; font-weight: 500; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); } .toast.bad { background: var(--coral); }
.veil { position: fixed; inset: 0; z-index: 50; background: rgba(31, 42, 36, .45); display: flex; align-items: flex-end; justify-content: center; padding: 16px; animation: fade .18s; }
.veil .dialog { background: var(--surface); border-radius: 22px; padding: 22px; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 12px; animation: up .22s ease-out; margin-bottom: env(safe-area-inset-bottom); }
.veil .dialog button.danger { background: var(--coral); color: #fff; }
@media (min-width: 600px) { .veil { align-items: center; } }
@keyframes fade { from { opacity: 0; } } @keyframes up { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ---------- 整盘棋的回放、错题本 ---------- */
.chart { position: relative; height: 84px; border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.chart svg.curve { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.curve .up { fill: #eef6f0; } .curve .down { fill: #f4f1e8; }
.curve .area { fill: rgba(46, 125, 87, .22); } .curve .stroke { fill: none; stroke: var(--green); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.curve .mid { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.curve .cursor { stroke: var(--ink); stroke-width: 2; vector-effect: non-scaling-stroke; }
.marks { position: absolute; inset: 0; pointer-events: none; }
.marks .mark { position: absolute; pointer-events: auto; width: 18px; height: 18px; min-height: 0; padding: 0; border-radius: 50%; transform: translate(-50%, -50%); border: 3px solid #fff; background: var(--coral); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.marks .mark.good { background: var(--green); } .marks .mark:hover { transform: translate(-50%, -50%) scale(1.25); }
#replay .caption { min-height: 3.1em; } #replay input[type=range] { width: 100%; }
.todaylink { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font: 600 .9rem var(--round); opacity: .92; position: relative; z-index: 1; }
.todaylink svg.icon:last-child { margin-left: auto; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--bg); border-radius: var(--radius-s); padding: 12px 8px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.stat b { font: 800 1.5rem var(--round); } .stat span { font-size: .78rem; color: var(--muted); }
.stat.ready b { color: var(--sun-ink); } .stat.fixed b { color: var(--green); }
.boardbox.mini { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; gap: 0; padding: 0; pointer-events: none; }
.boardbox.mini .ranks, .boardbox.mini .files { display: none; }
.boardbox.mini .board { border-radius: 6px; box-shadow: 0 0 0 2px #5f8456; }
.miniboard { width: 76px; flex: none; }
.mrow { display: flex; flex-direction: column; } .mrow + .mrow { border-top: 1px solid var(--line); }
.mrow .sourcelink { align-self: flex-start; margin: -6px 0 12px 104px; font-weight: 600; }
a.tag { text-decoration: none; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--coral); margin: 0 4px 0 2px; vertical-align: -1px; } .dot.good { background: var(--green); }
.curve .up { height: 20px; }

/* ---------- 是不是在变好、拖放 ---------- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 96px; padding-top: 16px; }
.bars .bar { flex: 1; max-width: 46px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; text-decoration: none; color: var(--muted); font: 700 .78rem var(--round); }
.bars .bar i { width: 100%; border-radius: 6px 6px 2px 2px; background: var(--coral); opacity: .85; }
.bars .bar:hover i { opacity: 1; }
.weeksrow { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.wk { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dots7 { display: grid; grid-template-columns: repeat(4, 7px); gap: 3px; }
.dots7 i { width: 7px; height: 7px; border-radius: 50%; background: rgba(31, 42, 36, .12); } .dots7 i.on { background: var(--green); }
.wk.now .small { color: var(--ink); font-weight: 700; }
.page.dropping .drop, .page.dropping textarea { border-color: var(--green); background: var(--green-soft); }
