:root {
  --ink: #17201c;
  --muted: #6f7772;
  --panel: rgba(255, 255, 255, .91);
  --line: #dfe2dc;
  --red: #c83c32;
  --red-dark: #9e251f;
  --black: #1c2724;
  --jade: #2f765e;
  --gold: #c99c51;
  --paper: #e9c991;
  --paper-deep: #c89a5a;
  --shadow: 0 20px 55px rgba(25, 35, 30, .12);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #edf0eb; }
body {
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background:
    radial-gradient(circle at 13% 12%, rgba(63, 122, 94, .11), transparent 28rem),
    radial-gradient(circle at 88% 88%, rgba(193, 142, 67, .12), transparent 32rem),
    #edf0eb;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.page-shell { min-height: 100vh; }
.topbar {
  height: 76px;
  padding: 0 max(28px, calc((100vw - 1440px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(29, 48, 39, .1);
  background: rgba(244, 246, 242, .86);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand-cluster { display:flex;align-items:center;gap:18px;min-width:0; }
.brand { display: flex; align-items: center; gap: 12px; flex:none;color: inherit; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border: 1px solid #2e604c;
  color: #fff;
  background: #244f3f;
  border-radius: 12px;
  font: 700 24px "KaiTi", serif;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .12);
}
.brand strong { display: block; font: 700 20px "STKaiti", "KaiTi", serif; letter-spacing: 4px; }
.brand small { display: block; margin-top: 2px; color: #718078; font-size: 8px; letter-spacing: 2.2px; }
.visitor-stats { padding-left:17px;display:flex;flex-direction:column;gap:4px;border-left:1px solid rgba(34,75,58,.15);color:#6a7770;font-size:10px;line-height:1.2;white-space:nowrap; }
.visitor-stats span { display:flex;align-items:center; }
.visitor-stats b { margin-left:2px;color:#244f3f;font-size:11px;font-variant-numeric:tabular-nums; }
.visitor-stats i { width:6px;height:6px;margin-right:5px;border-radius:50%;background:#35a26b;box-shadow:0 0 0 3px rgba(53,162,107,.11); }
.main-nav { display: flex; align-self: stretch; gap: 34px; }
.nav-item {
  position: relative;
  padding: 0 4px;
  border: 0;
  background: none;
  color: #737b76;
  font-weight: 600;
}
.nav-item.active { color: #1f4f3c; }
.nav-item.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: #2f765e;
}
.engine-state { display: flex; align-items: center; gap: 8px; color: #617068; font-size: 12px; }
.engine-state i { width: 8px; height: 8px; border-radius: 50%; background: #39a46f; box-shadow: 0 0 0 5px rgba(57, 164, 111, .12); }
.page { display: none; }
.page.active { display: block; animation: pageIn .25s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(5px); } }

.play-layout {
  width: min(1420px, calc(100% - 40px));
  margin: 30px auto 44px;
  display: grid;
  grid-template-columns: 270px minmax(520px, 650px) 290px;
  gap: 24px;
  justify-content: center;
  align-items: start;
}
.panel {
  border: 1px solid rgba(39, 57, 47, .1);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.left-panel, .right-panel { padding: 22px; }
.panel-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; font-weight: 700; }
.panel-title > span:last-child { color: #8a928d; font-size: 10px; letter-spacing: 1px; }
.status-dot { padding: 4px 7px; color: #287255 !important; background: #e2f3e9; border-radius: 6px; }
.mode-grid { display: grid; gap: 8px; }
.mode-card {
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid #e1e3de;
  border-radius: 12px;
  background: #fafbf9;
  color: #26302b;
  transition: .2s ease;
}
.mode-card:hover { border-color: #94b6a6; transform: translateY(-1px); }
.mode-card.active { color: #fff; border-color: #2c6750; background: linear-gradient(135deg, #285e49, #37765e); box-shadow: 0 10px 20px rgba(42, 102, 78, .18); }
.mode-card b { font-size: 14px; }
.mode-card small { margin-top: 3px; color: inherit; opacity: .7; font-size: 11px; }
.field-label { display: flex; justify-content: space-between; margin-top: 22px; font-size: 13px; font-weight: 700; }
.field-label output { color: var(--jade); }
.range { width: 100%; margin: 14px 0 20px; accent-color: var(--jade); }
.side-choice { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; font-size: 13px; font-weight: 700; }
.segmented { padding: 3px; display: flex; gap: 2px; border-radius: 9px; background: #edf0ec; }
.side-btn { padding: 6px 12px; border: 0; border-radius: 7px; background: transparent; color: #727974; font-size: 12px; }
.side-btn.active { background: #fff; color: var(--red); box-shadow: 0 2px 7px rgba(0,0,0,.08); }
.primary-btn, .ghost-btn {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 700;
  transition: .2s ease;
}
.primary-btn { color: #fff; border: 1px solid #28624a; background: #2f7258; box-shadow: 0 8px 18px rgba(47, 114, 88, .2); }
.primary-btn:hover:not(:disabled) { background: #245f48; transform: translateY(-1px); }
.primary-btn:disabled { opacity: .45; cursor: not-allowed; }
.ghost-btn { margin-top: 8px; color: #2f6852; border: 1px solid #b9cdc3; background: #f7faf8; }
.divider { height: 1px; margin: 22px 0 10px; background: #e5e7e3; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; }
.toggle-row b, .toggle-row small { display: block; }
.toggle-row b { font-size: 12px; }
.toggle-row small { margin-top: 2px; color: #909791; font-size: 10px; }
.switch input { display: none; }
.switch span { width: 38px; height: 21px; display: block; border-radius: 20px; background: #ccd1cd; position: relative; transition: .2s; }
.switch span::after { content:""; position:absolute; top:3px; left:3px; width:15px; height:15px; border-radius:50%; background:white; box-shadow:0 1px 4px rgba(0,0,0,.18); transition:.2s; }
.switch input:checked + span { background: var(--jade); }
.switch input:checked + span::after { transform: translateX(17px); }

.board-stage { min-width: 0; }
.turn-banner {
  height: 64px;
  padding: 0 14px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  color: #304039;
}
.turn-banner > div { display: flex; align-items: center; gap: 9px; }
.turn-banner small { display: block; color: #8b938e; font-size: 10px; }
.turn-banner b { font-size: 14px; }
.turn-banner p { margin: 0; color: #707873; font-size: 12px; }
.turn-banner > span:last-child { justify-self: end; color: #79817c; font-size: 11px; }
.turn-piece { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 2px solid; background: #f4dfb3; font: 700 20px "KaiTi", serif; }
.turn-piece.red { color: var(--red); border-color: var(--red); }
.turn-piece.black { color: #202825; border-color: #202825; }
.board-wrap {
  width: 100%;
  position: relative;
  border: 10px solid #704826;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(43, 31, 17, .23), inset 0 0 0 2px rgba(255,255,255,.14);
  background: var(--paper);
}
#board { width: 100%; height: auto; display: block; touch-action: manipulation; }
.board-busy {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  color: #315343;
  background: rgba(250, 252, 248, .88);
  border: 1px solid rgba(47, 118, 94, .2);
  border-radius: 999px;
  box-shadow: 0 5px 16px rgba(28, 48, 39, .13);
  backdrop-filter: blur(8px);
  font-size: 10px;
  pointer-events: none;
}
.thinking-orbit { width: 14px; height: 14px; border: 2px solid rgba(47,118,94,.2); border-top-color:#2f765e; border-radius:50%; animation:spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.board-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 15px; }
.board-actions button { padding: 11px; border: 1px solid #d5d9d4; border-radius: 11px; color: #5b6560; background: rgba(255,255,255,.85); font-weight: 700; }
.board-actions button:hover { border-color: #89a99a; color: #285f49; }
.board-actions .accent-action { color: #fff; border-color: #2f7258; background: #2f7258; }
.board-actions span { margin-right: 4px; font-size: 17px; }
.replay-bar { margin-top:12px;padding:14px;border:1px solid #c9d8d0;border-radius:13px;background:rgba(247,251,248,.94);box-shadow:0 10px 26px rgba(39,73,57,.09); }
.replay-progress { display:flex;justify-content:space-between;align-items:center;color:#2f5e4b;font-size:12px; }
.replay-progress span { color:#74837b;font-size:10px; }
.replay-controls,.replay-continue { display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:10px; }
.replay-bar button,.replay-bar select { padding:9px;border:1px solid #cad6cf;border-radius:8px;color:#476057;background:#fff;font-size:11px;font-weight:700; }
.replay-bar .replay-next,.replay-continue button { color:#fff;border-color:#2f7258;background:#2f7258; }
.replay-bar button:disabled { opacity:.42;cursor:not-allowed; }
.replay-bar > small { display:block;margin-top:9px;color:#87928c;font-size:9px;text-align:center; }
.sandbox-bar { margin-top:12px;padding:13px 14px;display:flex;align-items:center;justify-content:space-between;gap:14px;border:1px solid #d4b570;border-radius:13px;background:linear-gradient(135deg,#fff9e9,#f5ead0);box-shadow:0 10px 25px rgba(120,84,28,.09); }
.sandbox-bar > div { display:flex;align-items:center;gap:10px; }
.sandbox-mark { width:32px;height:32px;display:grid;place-items:center;border-radius:9px;color:#fff;background:#b58536;font-weight:800; }
.sandbox-bar b,.sandbox-bar small { display:block; }.sandbox-bar b{color:#6e501f;font-size:12px}.sandbox-bar small{margin-top:3px;color:#9a8155;font-size:9px}
.sandbox-bar button { padding:8px 10px;border:1px solid #c99c51;border-radius:8px;color:#7a5722;background:#fffaf0;font-size:10px;font-weight:700;white-space:nowrap; }
.board-wrap.sandbox { border-color:#8d672d;box-shadow:0 25px 60px rgba(76,52,18,.25),inset 0 0 0 2px rgba(255,255,255,.14); }

.win-labels { display: flex; justify-content: space-between; font-size: 12px; color: #777f7a; }
.win-labels span { display: flex; align-items: center; gap: 5px; }
.win-labels b { color: #28332e; font-size: 16px; }
.red-dot,.black-dot { width: 7px; height: 7px; border-radius:50%; }
.red-dot { background: var(--red); }.black-dot { background: #28332e; }
.win-track { height: 12px; margin: 12px 0 22px; position: relative; overflow: hidden; border-radius: 10px; background: #29342f; }
.red-bar { height: 100%; border-radius: 10px 0 0 10px; background: linear-gradient(90deg,#ac2823,#dc4d41); transition: width .55s cubic-bezier(.2,.75,.3,1); }
.win-track > i { position:absolute; top:0; bottom:0; left:50%; width:1px; background:rgba(255,255,255,.6); }
.evaluation-card { padding: 16px; border-radius: 13px; background: #f2f4f1; border: 1px solid #e2e5e0; }
.evaluation-card small { color: #8b938e; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; }
.evaluation-card strong { display:block; margin: 5px 0; color:#294d3e; font:700 25px Georgia,serif; }
.evaluation-card p { margin:0; color:#7e8781; font-size:10px; }
.line-title { display:flex; justify-content:space-between; margin:22px 0 10px; font-size:12px; font-weight:700; }
.line-title small { color:#9ca29e; font-size:9px; letter-spacing:1px; }
.pv-line { min-height: 66px; display:flex; flex-wrap:wrap; align-content:flex-start; gap:5px; }
.pv-line span { padding:5px 7px; color:#415048; background:#eef1ed; border-radius:6px; font:600 10px Consolas,monospace; }
.best-move-card { display:flex; align-items:center; gap:11px; padding:13px; border:1px solid #d9b978; border-radius:12px; background:linear-gradient(135deg,#fff8e7,#f6ead0); }
.best-icon { width:33px;height:33px;display:grid;place-items:center;border-radius:9px;color:#fff;background:#be8b38; }
.best-move-card small,.best-move-card b { display:block; }
.best-move-card small { color:#9b824e;font-size:9px; }.best-move-card b { margin-top:2px;color:#674918;font:700 15px "Microsoft YaHei",sans-serif;white-space:nowrap; }
.notation-toggle { margin-left:auto;padding:2px;display:flex;background:rgba(166,120,43,.1);border-radius:7px; }
.notation-toggle button { padding:4px 6px;border:0;border-radius:5px;color:#9a7c47;background:transparent;font-size:9px; }
.notation-toggle button.active { color:#fff;background:#bd8b38;box-shadow:0 2px 5px rgba(126,85,21,.18); }
.session-info { margin-top:20px;padding-top:12px;border-top:1px solid #e5e7e3; }
.session-info p { display:flex;justify-content:space-between;margin:10px 0;color:#929994;font-size:10px; }
.session-info b { color:#4c5852;font-weight:600; }
.record-download { margin-top:15px;padding-top:15px;display:grid;grid-template-columns:92px 1fr;gap:8px;border-top:1px solid #e5e7e3; }
.record-download select,.record-download button { min-width:0;padding:9px 8px;border:1px solid #d5dbd6;border-radius:9px;background:#f8faf8;color:#52615a;font-size:10px;font-weight:700; }
.record-download button { color:#fff;border-color:#2f7258;background:#2f7258; }
.record-download button:hover { background:#255f49; }
.record-download button span { margin-right:4px;font-size:14px; }

.upload-layout { width:min(1100px,calc(100% - 40px)); margin:65px auto; display:grid;grid-template-columns:1fr 520px;gap:70px;align-items:center; }
.eyebrow { color:#2f765e;font-size:10px;font-weight:800;letter-spacing:2.5px; }
.upload-copy h1 { margin:16px 0 20px;font:700 clamp(38px,5vw,62px)/1.12 "STKaiti","KaiTi",serif;letter-spacing:2px; }
.upload-copy > p { max-width:480px;color:#6f7973;line-height:1.85;font-size:14px; }
.upload-copy ul { margin:32px 0 0;padding:0;display:grid;gap:18px;list-style:none; }
.upload-copy li { display:flex;align-items:center;gap:14px; }
.upload-copy li i { width:36px;height:36px;display:grid;place-items:center;border:1px solid #b7c8bf;border-radius:10px;color:#2f765e;font:700 10px Georgia; }
.upload-copy li b,.upload-copy li small { display:block; }.upload-copy li b{font-size:13px}.upload-copy li small{margin-top:2px;color:#939b96;font-size:10px}
.upload-card { padding:22px; }
.drop-zone { min-height:310px;padding:20px;display:flex;flex-direction:column;align-items:center;justify-content:center;position:relative;overflow:hidden;border:1.5px dashed #aebdb5;border-radius:15px;background:#f7f9f6;text-align:center;transition:.2s;cursor:pointer; }
.drop-zone.drag { border-color:#2f765e;background:#edf6f1; }
.drop-zone input { display:none; }
.upload-symbol { width:54px;height:54px;display:grid;place-items:center;margin-bottom:15px;border-radius:50%;color:#fff;background:#37765e;font-size:28px;box-shadow:0 8px 22px rgba(55,118,94,.22); }
.drop-zone b { font-size:15px; }.drop-zone small{margin-top:7px;color:#8b948e;font-size:10px}
.drop-zone img { position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:#e9ece7; }
.upload-options { display:grid;grid-template-columns:repeat(3,1fr);gap:9px;margin:16px 0; }
.upload-options label { color:#747e78;font-size:10px;font-weight:700; }
.upload-options select { width:100%;margin-top:6px;padding:9px 7px;border:1px solid #d9ded9;border-radius:8px;color:#34423b;background:#fff;font-size:11px; }
.upload-result { margin-top:14px;padding:12px;border-radius:9px;background:#eef6f1;color:#34614f;font-size:11px;line-height:1.7; }
.record-import-layout { width:min(1050px,calc(100% - 40px));margin:85px auto;display:grid;grid-template-columns:1fr 460px;gap:80px;align-items:center; }
.record-import-copy h1 { margin:16px 0 20px;font:700 clamp(38px,5vw,60px)/1.12 "STKaiti","KaiTi",serif;letter-spacing:2px; }
.record-import-copy > p { max-width:500px;color:#6f7973;line-height:1.85;font-size:14px; }
.record-feature-grid { margin-top:30px;display:grid;grid-template-columns:repeat(3,1fr);gap:10px; }
.record-feature-grid span { padding:13px;border:1px solid #dce2dd;border-radius:11px;background:rgba(255,255,255,.65); }
.record-feature-grid b,.record-feature-grid small { display:block; }.record-feature-grid b{font-size:11px}.record-feature-grid small{margin-top:5px;color:#929a95;font-size:9px}
.record-import-card { padding:22px; }
.record-drop-zone { min-height:260px;padding:25px;display:flex;flex-direction:column;align-items:center;justify-content:center;border:1.5px dashed #adbbb3;border-radius:15px;background:#f7f9f6;text-align:center;cursor:pointer;transition:.2s; }
.record-drop-zone.drag { border-color:#2f765e;background:#edf6f1; }.record-drop-zone input{display:none}
.record-file-icon { width:58px;height:58px;display:grid;place-items:center;margin-bottom:15px;border-radius:14px;color:#fff;background:#2f7258;font:700 27px "KaiTi",serif;box-shadow:0 9px 22px rgba(47,114,88,.2); }
.record-drop-zone b { font-size:14px; }.record-drop-zone small{margin-top:7px;color:#8b948e;font-size:10px}
.record-import-card .primary-btn { margin-top:15px; }
.record-format-note { margin-top:16px;padding:12px;border-radius:9px;background:#f0f3ef;color:#65716a;font-size:10px; }
.record-format-note b{color:#3d5047}.record-format-note p{margin:5px 0 0;line-height:1.6}
.toast { position:fixed;left:50%;bottom:28px;z-index:50;max-width:min(420px,calc(100% - 30px));padding:11px 18px;transform:translate(-50%,30px);opacity:0;color:#fff;background:#202b26;border-radius:10px;box-shadow:0 12px 30px rgba(0,0,0,.2);font-size:12px;pointer-events:none;transition:.25s; }
.toast.show { transform:translate(-50%,0);opacity:1; }
.toast.error { background:#96342e; }
.visitor-welcome { position:fixed;top:90px;right:24px;z-index:55;min-width:220px;padding:13px 16px;display:flex;align-items:center;gap:11px;transform:translateX(28px);opacity:0;pointer-events:none;color:#edf7f1;background:rgba(25,45,37,.95);border:1px solid rgba(255,255,255,.11);border-radius:13px;box-shadow:0 16px 38px rgba(14,30,23,.22);transition:opacity .28s,transform .28s; }
.visitor-welcome.show { transform:translateX(0);opacity:1; }
.visitor-welcome > span { width:34px;height:34px;display:grid;place-items:center;flex:none;border-radius:10px;color:#254d3e;background:#e2c58c;font:700 18px "KaiTi",serif; }
.visitor-welcome b,.visitor-welcome small { display:block; }
.visitor-welcome b { font-size:13px;letter-spacing:1px; }
.visitor-welcome small { margin-top:3px;color:#aabbb3;font-size:10px;font-variant-numeric:tabular-nums; }

@media (max-width: 1180px) {
  .play-layout { grid-template-columns: 230px minmax(480px,610px); }
  .right-panel { grid-column:1/-1;display:grid;grid-template-columns:1fr 1fr;gap:14px 28px; }
  .right-panel .panel-title,.right-panel .session-info { grid-column:1/-1; }
}
@media (max-width: 800px) {
  .topbar { height:64px;padding:0 15px; }.engine-state{display:none}.main-nav{gap:14px}.brand small{display:none}
  .brand-cluster{gap:10px}.visitor-stats{padding-left:10px;font-size:9px}.visitor-stats b{font-size:10px}
  .visitor-welcome{top:76px;right:12px}
  .play-layout { width:min(650px,calc(100% - 20px));margin-top:12px;grid-template-columns:1fr; }
  .left-panel { order:2 }.board-stage{order:1}.right-panel{order:3;display:block}
  .turn-banner p { display:none; }.board-wrap{border-width:6px;border-radius:13px}
  .upload-layout { margin:30px auto;grid-template-columns:1fr;gap:30px; }.upload-copy h1{font-size:42px}
  .record-import-layout { margin:30px auto;grid-template-columns:1fr;gap:30px; }
}
@media (max-width: 480px) {
  .topbar{padding:0 9px}.brand-name{display:none}.brand{gap:0}.brand-mark{width:36px;height:36px}.brand-cluster{gap:7px}.visitor-stats{padding-left:7px}.main-nav{gap:7px}.nav-item{padding:0 2px;font-size:11px}
  .play-layout{width:100%;margin-top:0}.panel{border-radius:0}.board-actions{padding:0 10px}.turn-banner{padding:0 12px}
  .upload-layout{width:100%;margin-top:20px}.upload-copy{padding:0 20px}.upload-card{border-radius:0}
  .upload-options{grid-template-columns:1fr}.drop-zone{min-height:260px}
  .record-import-layout{width:100%;}.record-import-copy{padding:0 20px}.record-import-card{border-radius:0}.record-feature-grid{grid-template-columns:1fr}
}
