:root{
  --art-opacity:.45;
  --route-duration:280ms;
  --ink:#202f27;
  --green:#235541;
  --green-light:#eaf1e9;
  --forest:#162f26;
  --paper:#f4f5ef;
  --muted:#58665c;
  --line:#dce3d9;
  --red:#a04436;
  --gold:#a67a39;
  --white:#fff;
  --shadow:0 2px 4px #162f2606,0 12px 28px #162f2607;
  --radius:14px;
  --sidebar-width:218px;
  --sidebar-inset:10px;
  --nav-peek:42px;
  --gutter:clamp(22px,3vw,44px);
  --ui-font:"Inter","Microsoft YaHei UI","PingFang SC",system-ui,sans-serif;
  --heading-font:"STSong","SimSun","Songti SC",serif;
}
.learner-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:16px 0}
.learner-fields label{display:flex;flex-direction:column;gap:6px;font-size:13px}
.learner-fields select{width:100%;min-width:0;min-height:44px}
.coach-reflection{display:block;resize:vertical;width:100%;min-height:74px;max-height:240px;border:1px solid var(--line);border-radius:8px;padding:10px 12px;margin:8px 0 14px;color:var(--ink);background:#fafbf8;font-size:14px;line-height:1.6}
.coordinate-guide{padding:0 22px 4px;font-size:13px;line-height:1.8}
.coordinate-guide summary{cursor:pointer;color:var(--green);padding:10px 0}
.coordinate-guide p{margin:0 0 8px}
.walkthrough{margin:24px 0;max-width:100%;overflow-wrap:anywhere;font-size:16px;line-height:1.85}
.walkthrough-nav{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-bottom:20px}
.walkthrough-nav select{flex:1;min-width:0;max-width:100%;min-height:44px;border:1px solid var(--line);padding:8px;background:var(--white);color:var(--ink);border-radius:8px}
#position-grid-canvas{display:block;width:100%;height:auto;background:#fff;cursor:crosshair;touch-action:none}
#position-grid-panel summary,#position-review summary{min-height:44px;cursor:pointer;padding:12px 0}
.grid-controls{display:flex;gap:10px;flex-wrap:wrap;margin:12px 0}
.grid-controls label{display:flex;flex-direction:column;gap:6px;flex:1;min-width:80px}
.grid-controls input{width:100%;min-height:44px;border:1px solid var(--line);border-radius:6px;padding:8px}
#position-vision-mode{max-width:100%;min-height:44px}
.walkthrough-layout{display:grid;grid-template-columns:minmax(260px,390px) minmax(0,1fr);gap:28px;align-items:start}
.study-board-panel{background:#fbf7ed;border:1px solid #dfd4bc;border-radius:12px;padding:16px;min-width:0}
.study-board-panel>strong{display:block;font-size:14px;line-height:1.5;min-height:42px}
.reference-board-panel{width:100%;max-width:520px;margin:0 auto}
.reference-board-panel~.position-line{padding-left:28px}
.reference-board-panel~.position-line .button{min-height:44px;margin:3px 0;text-align:left;white-space:normal}
.reference-board-panel~.position-line [aria-current=step]>.button{background:var(--green-light);border-color:var(--green);color:var(--green);font-weight:600}
.study-board{display:block;width:100%;height:auto;max-height:65vh;touch-action:manipulation}
.study-coordinate{font-size:12px;fill:#6c654f}
.study-board [role=button]{cursor:pointer;outline:none}
.study-board [role=button]:focus-visible>rect{stroke:var(--green);stroke-width:3}
.study-controls,.study-sandbox-controls{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0}
.study-controls .button,.study-sandbox-controls .button,.walkthrough-nav .button{min-height:40px;padding:7px 13px;font-size:13px;white-space:normal}
.study-controls .button[aria-pressed="true"]{background:var(--green);border-color:var(--green);color:var(--white);font-weight:600}
.study-controls .button[aria-pressed="true"]:hover:not(:disabled){background:#183e30;border-color:#183e30}
.study-sandbox-controls>.import-check{width:100%;font-size:13px;line-height:1.6;color:var(--ink)}
.study-status{font-size:14px;line-height:1.65;margin:10px 0 0;color:var(--green)}
.study-status[data-state=error]{color:var(--red)}
.study-status[data-state=pending]{color:#785b25}
.study-history{max-height:130px;overflow:auto;margin:12px 0 0;color:#625e4d}
.study-analysis{margin-top:16px;font-size:15px;line-height:1.8;background:#fffdf6;border-radius:8px}
.study-analysis:not(:empty){padding:14px;border:1px solid #dfd4bc}
.study-analysis-detail summary{cursor:pointer;min-height:44px;padding:8px 0;font-weight:600}
.original-evidence{border-top:1px solid var(--line);margin:18px 0;padding-top:8px}
.original-evidence summary{cursor:pointer;min-height:44px;padding:8px 0;color:var(--green)}
.step-explanation{min-width:0}
.step-explanation h3{font-size:17px;margin:24px 0 8px}
.step-explanation .eyebrow+h3{margin-top:8px}
.step-explanation>p{max-width:68ch}
.variation-detail{border:1px solid var(--line);border-radius:8px;margin:12px 0;background:var(--paper);padding:0 14px;font-size:15px}
.variation-detail summary{padding:14px 0;min-height:48px;cursor:pointer;font-weight:600;line-height:1.7}
.variation-detail summary:focus-visible{outline:3px solid var(--gold);outline-offset:3px}
.branch-line{padding-left:24px;font-size:14px}
.branch-line .button{padding:6px 12px;min-height:44px;margin:3px 0}
.walkthrough-summary{margin-top:24px;padding:18px 20px;border:1px solid #c8dac9;background:var(--green-light);border-radius:var(--radius)}
.walkthrough-summary h3{font-size:18px}
.walkthrough-summary p{max-width:85ch;margin-bottom:0}
.walkthrough [hidden]{display:none!important}
@media(max-width:900px){.walkthrough-layout{grid-template-columns:minmax(0,1fr)}.study-board-panel{max-width:520px;width:100%;margin:auto}.walkthrough-nav select{flex-basis:100%;order:-1}.walkthrough-nav .button{flex:1}.walkthrough-summary{padding:16px}}
*{box-sizing:border-box}
::selection{background:#dce8dc;color:var(--forest)}
html,.sidebar-content,#game-analysis,#game-coach,.game-history ol,.study-history,dialog{scrollbar-color:#c6cfc2 transparent;scrollbar-width:thin}
::-webkit-scrollbar{width:8px;height:8px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:#c6cfc2;border-radius:999px;border:2px solid transparent;background-clip:content-box}
::-webkit-scrollbar-thumb:hover{background:#9eb0a2;border:2px solid transparent;background-clip:content-box}
body{margin:0;background:var(--paper);color:var(--ink);font-family:var(--ui-font);font-size:14px;line-height:1.65;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}
button,input,select,textarea{font:inherit}
input,textarea{caret-color:var(--green)}
button,a,input,select{touch-action:manipulation}
button{cursor:pointer}
button:disabled{cursor:not-allowed;opacity:.62}
:where(button,a,select,input,textarea,summary,[role=button],[tabindex]):focus-visible{outline:2px solid var(--gold);outline-offset:2px}
:where(select,input:not([type="checkbox"],[type="file"]),textarea){transition:border-color .16s ease,background-color .16s ease,box-shadow .16s ease}
:where(select,input:not([type="checkbox"],[type="file"]),textarea):hover:not(:disabled){border-color:#9bb2a1}
:where(select,input:not([type="checkbox"],[type="file"]),textarea):focus-visible{border-color:var(--green)}
a{color:var(--green);text-decoration:none;text-underline-offset:3px}
a:hover{text-decoration:underline}
h1,h2,h3,p{margin-top:0}
h1{font-family:var(--heading-font);font-size:clamp(29px,3vw,41px);font-weight:700;letter-spacing:.025em;line-height:1.25;margin-bottom:8px}
h1:focus{outline:none}
h2{font-size:18px;margin-bottom:10px}
h3{font-size:15px;margin-bottom:6px}
.sidebar{
  --sidebar-divider:rgb(90 101 83 / 24%);
  position:fixed;inset:var(--sidebar-inset) auto var(--sidebar-inset) var(--sidebar-inset);
  width:calc(var(--sidebar-width) - 2 * var(--sidebar-inset));
  display:flex;flex-direction:column;
  border:1px solid var(--sidebar-divider);border-radius:14px;
  background:rgb(250 247 236 / 88%);color:var(--ink);z-index:3;
  box-shadow:inset 0 1px 0 rgb(255 254 247 / 80%),inset 0 0 0 1px rgb(255 254 247 / 35%),0 6px 20px rgb(38 49 38 / 9%)
}
.sidebar-content{display:flex;flex:1;flex-direction:column;min-height:0;overflow:auto;padding:22px 14px 15px}
@supports ((backdrop-filter:blur(6px)) or (-webkit-backdrop-filter:blur(6px))){
  .sidebar{
    background:linear-gradient(145deg,rgb(255 253 244 / 44%),rgb(251 247 229 / 16%) 60%,rgb(255 253 244 / 25%));
    -webkit-backdrop-filter:blur(6px) saturate(.9);
    backdrop-filter:blur(6px) saturate(.9)
  }
}
.brand{display:flex;align-items:center;align-self:start;width:fit-content;max-width:100%;padding:3px 5px;border-radius:7px}
.brand img{display:block;width:126px;max-width:100%;height:auto}
.nav-label{font-size:11px;color:var(--muted);margin:37px 12px 10px;letter-spacing:.11em}
.nav-item,.settings-link,.landing-return-link{display:flex;align-items:center;gap:10px;width:100%;min-height:45px;border:1px solid transparent;border-radius:8px;background:none;color:var(--ink);text-align:left;white-space:nowrap;padding:8px 11px;transition:background-color .16s ease,color .16s ease,border-color .16s ease}
.nav-item{position:relative;margin-bottom:4px;font-size:13px}
.nav-item>span,.settings-link>span,.landing-return-link>span{width:20px;font-size:17px;line-height:1;text-align:center;color:var(--green)}
.category-nav .nav-item::after,.category-link::after{content:"";width:7px;height:7px;border-right:1.5px solid currentColor;border-top:1.5px solid currentColor;transform:rotate(45deg);margin-inline-start:auto;flex:none;opacity:.65}
.nav-item:hover{text-decoration:none}
.sidebar :is(.nav-item,.settings-link,.landing-return-link):is(:hover,[aria-expanded="true"]){background:rgb(255 254 246 / 54%)}
.sidebar .nav-item.active{background:rgb(36 81 62 / 14%);color:#183d2e;font-weight:600}
.nav-item.active::before{content:"";position:absolute;inset:9px auto 9px 0;width:3px;background:var(--green);border-radius:3px}
.sidebar-utilities{margin-top:auto}
.landing-return-link{font-size:13px}
.settings-link{margin-top:2px;font-size:13px}
.local-note{border-top:1px solid var(--sidebar-divider);font-size:11px;color:var(--muted);padding:14px 10px 0;margin-top:8px}
.dot{display:inline-block;width:6px;height:6px;background:#93b89f;border-radius:50%;margin-right:4px}
.workspace{margin-left:var(--sidebar-width)}
.topbar{min-height:64px;display:flex;align-items:center;justify-content:space-between;gap:16px;background:var(--white);border-bottom:1px solid var(--line);padding:10px var(--gutter);color:var(--muted);font-size:13px}
.breadcrumb,.service-status{display:flex;align-items:center;gap:9px}
.breadcrumb{white-space:nowrap}
.breadcrumb b{color:var(--ink);font-weight:600}
.service-status span,#engine-status{border:1px solid var(--line);border-radius:20px;padding:3px 9px;font-size:11px;white-space:nowrap}
.service-status .ready{color:var(--green);background:#edf5ed;border-color:#d8e7d8}
.service-status .offline{color:#635e51;background:#f6f5ef}
.service-status .warning{color:#805e1e;background:#fff7e3;border-color:#e5cd91}
.service-status [data-state="pending"]{color:#755625;background:#fbf7e9;border-color:#e4d7ad}
.service-status [data-state="error"]{color:#a24432;background:#fff1ec;border-color:#edc5b9}
.header-button{border:1px solid var(--line);border-radius:7px;background:var(--white);color:var(--ink);padding:5px 11px;min-height:36px;font-size:12px;white-space:nowrap}
.header-button:hover,#engine-status:hover{border-color:#91ab96}
main{max-width:1390px;padding:26px var(--gutter) 16px;margin:0 auto}
.page-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:20px}
.page-heading p{margin-bottom:0}
.eyebrow{font-size:11px;letter-spacing:.06em;color:var(--muted);margin-bottom:8px}
.muted,.caption{color:var(--muted)}
.small,.caption{font-size:12px}
.training-progress{flex:0 0 172px;padding:10px 14px;background:var(--white);border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow)}
.training-progress>div{display:flex;justify-content:space-between;align-items:baseline;gap:8px;white-space:nowrap;font-size:12px;color:var(--muted)}
.training-progress strong{font-size:19px;color:var(--green);font-variant-numeric:tabular-nums;line-height:1.2}
.training-progress strong span{font-size:13px;font-weight:500;color:var(--muted)}
select{background:var(--white);color:var(--ink);border:1px solid var(--line);border-radius:7px;padding:7px 9px;max-width:100%;min-height:39px}
.lesson-strip{display:flex;align-items:center;gap:10px;padding:10px 0}
.lesson-strip .label{font-size:12px;color:var(--muted);white-space:nowrap}
.lesson-strip select{flex:1;min-width:0;padding-left:11px;background:#fafbf8}
.lesson-strip .button{flex-shrink:0}
.curriculum-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:4px 0 12px}
.course-tabs{display:flex;gap:3px;border-radius:8px;background:#f0f3ed;padding:3px}
.course-tabs button{border:0;border-radius:6px;background:none;color:var(--muted);font-size:13px;padding:6px 11px;min-height:34px;white-space:nowrap}
.course-tabs button:hover:not(:disabled){background:#e3ebe2;color:var(--ink)}
.course-tabs button[aria-pressed="true"]{background:var(--green);color:var(--white);font-weight:600}
#theme-filter{font-size:13px;min-width:122px}
.variation-panel{padding:12px 22px;background:#f7f9f4;border-top:1px solid var(--line);font-size:12px}
.variation-heading{display:flex;justify-content:space-between;gap:10px;color:var(--green)}
.variation-panel ol{display:grid;grid-template-columns:1fr 1fr;gap:4px 18px;padding-left:19px;margin:8px 0 0;color:var(--muted)}
.text-button{border:0;background:none;color:var(--green);padding:5px;font-size:13px}
.text-button:hover:not(:disabled){text-decoration:underline;text-underline-offset:3px}
.training-layout{display:grid;grid-template-columns:minmax(0,1.62fr) minmax(300px,1fr);grid-template-rows:auto 1fr;gap:14px 20px;align-items:start}
.training-layout>.board-card{grid-column:1;grid-row:1/span 2}
.training-layout>.goal-card{grid-column:2;grid-row:1}
.training-layout>.coach-card{grid-column:2;grid-row:2}
.board-card,.coach-card{min-width:0;border:1px solid var(--line);border-radius:var(--radius);background:var(--white);box-shadow:var(--shadow)}
.board-card{overflow:hidden}
.board-toolbar{padding:11px 18px;min-height:56px;display:flex;gap:10px;align-items:center;border-bottom:1px solid var(--line);font-size:13px}
.board-heading{min-width:0;margin-right:auto;display:flex;align-items:baseline;gap:5px 12px;flex-wrap:wrap}
.board-heading strong{font-size:15px}
.board-heading span{font-size:12px}
.turn-badge{background:#faece6;color:#913f32;border-radius:20px;padding:4px 9px;font-size:12px;font-weight:600;white-space:nowrap}
.turn-badge::before{content:"";display:inline-block;width:6px;height:6px;background:currentColor;border-radius:50%;margin-right:6px;vertical-align:2px}
.turn-badge.complete{background:var(--green-light);color:var(--green)}
.icon-button{display:grid;place-items:center;min-width:36px;min-height:36px;border:1px solid var(--line);background:#fff;border-radius:7px;padding:0 5px;font-size:20px;color:var(--green);transition:background-color .16s ease,border-color .16s ease,transform .1s ease}
.icon-button:hover,.icon-button[aria-pressed="true"]{background:var(--green-light);border-color:#a6bfa9}
.board-wrap{padding:10px 16px;background:#faf4e8}
:is(.training-layout,.game-board-card) .board-wrap{
  padding:14px clamp(10px,2.1vw,26px);
  background:radial-gradient(ellipse at 50% 45%,#f9f3e7,#f1eadb);
}
:is(#chessboard,#game-board){
  display:block;
  width:min(100%, 465px);
  height:auto;
  margin:0 auto;
  border-radius:8px;
  background:linear-gradient(118deg,#fdf8e9,#f5e8ce);
  box-shadow:inset 0 0 0 1px #cfbc99,0 4px 9px #5f46111a;
  user-select:none;
  touch-action:manipulation;
}
.board-footer{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:5px 17px;color:var(--muted);font-size:12px;border-top:1px solid var(--line)}
.board-footer button{white-space:nowrap;min-height:36px}
.feedback{border-top:1px solid var(--line);padding:10px 22px;color:#4b6454;font-size:13px;background:#f5f8f2}
.feedback.success{background:#eaf4e9;color:#275c3c}
.feedback.error{background:#fdf0ea;color:#963f2d}
.training-layout>.goal-card{min-width:0;padding:14px 17px;border:1px solid #d4dfd0;border-inline-start:3px solid var(--green);border-radius:var(--radius);background:#edf2e9;color:var(--ink)}
.goal-card h2{margin:0 0 4px;font-size:13px;font-weight:600;color:var(--green)}
.goal-card #objective{margin:0;font-size:clamp(16px,1.35vw,20px);font-weight:700;line-height:1.5}
.training-layout>.coach-card{display:grid;gap:12px;padding:0;border:0;background:none;box-shadow:none}
.training-tool{min-width:0;padding:14px 16px;background:var(--white);border:1px solid var(--line);border-radius:var(--radius)}
.training-tool h2{margin:0 0 10px;font-size:16px;line-height:1.3}
.training-tool>p.caption{margin:7px 0 0}
.training-disclosure{margin-block:8px;color:var(--muted);font-size:13px}
.training-disclosure summary{color:var(--green);cursor:pointer;padding-block:4px}
.training-disclosure p{margin:6px 0 0}
.training-disclosure .coach-reflection{margin-block:5px 10px;min-height:56px}
.section-title{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:12px}
.section-title h2{font-size:16px;margin:0}
.source-pill{font-size:11px;color:var(--green);padding:3px 8px;background:var(--green-light);border-radius:5px}
.hint-list{list-style:none;margin:0;padding:0}
.hint-list li{font-size:13px;color:var(--ink);background:#f6f8f1;border:1px solid #d5e0d0;border-radius:8px;padding:10px 12px;margin:10px 0;animation:appear .2s ease-out}
.hint-list li small{display:block;color:var(--muted);font-size:11px;margin-bottom:3px}
.button{display:inline-flex;align-items:center;justify-content:center;gap:8px;border-radius:8px;padding:8px 13px;font-size:13px;font-weight:600;min-height:40px;border:1px solid transparent;transition:background-color .16s ease,border-color .16s ease,color .16s ease,box-shadow .16s ease,transform .1s ease}
.button:active:not(:disabled),.icon-button:active:not(:disabled),.puzzle-card:active:not(:disabled){transform:translateY(0.5px)}
.primary{background:var(--green);color:#fff}
.primary:hover:not(:disabled){background:#183e30}
.button.primary:disabled{opacity:1;background:#dde5dd;border-color:#cbd7cc;color:#516358}
.secondary{background:#fff;border-color:var(--line);color:var(--green)}
.secondary:hover:not(:disabled),#hint-button:hover:not(:disabled){background:#e4ede3;border-color:#a6bfa9}
.button.secondary:disabled{opacity:1;background:#f4f6f1;border-color:#e1e6dd;color:#6c7970}
#hint-button{background:var(--green-light);border-color:#c8dac9;color:var(--green)}
#hint-counter{font-variant-numeric:tabular-nums;font-size:12px;white-space:nowrap}
.wide{width:100%;justify-content:space-between}
.coach-actions{display:flex;gap:8px;flex-wrap:wrap}
.coach-actions>*{flex:1 1 120px}
.report-panel,.plain-card{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:22px;margin-top:18px;box-shadow:var(--shadow)}
.report-panel .section-title h2{font-size:18px}
.report-panel p{font-size:13px;color:#60715b;line-height:1.9}
.evidence-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:20px 0}
.evidence-item{background:#f7f8f3;border-radius:6px;padding:12px 14px;font-size:14px;color:var(--ink);overflow-wrap:anywhere}
.evidence-item b{color:#365b3c;font-size:12px;margin-right:8px}
.report-bottom{display:flex;gap:12px;align-items:center;flex-wrap:wrap}
.report-bottom .button{margin-left:auto}
.item-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}
.item-card{padding:20px;background:#fff;border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}
.item-card h2{font-size:19px;font-family:serif}
.item-card p{font-size:13px;color:var(--muted)}
.item-card .button{margin-top:10px}
.mistake-heading{display:flex;flex-direction:column}
.mistake-heading .mistake-status{order:-1}
.analysis-origin-perspective{display:none}
.empty-state{grid-column:1/-1;padding:65px 20px;text-align:center;background:#fff;border:1px dashed #d8dfce;border-radius:12px}
.empty-state .empty-icon{font-size:36px;color:#bcc7ad;display:block;margin-bottom:20px}
.empty-state p{color:#8c9880}
.empty-small{min-height:180px;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:13px}
footer{display:flex;align-items:center;gap:10px;font-size:11px;color:var(--muted);margin-top:22px;padding:12px 0;border-top:1px solid var(--line)}
footer a{margin-left:auto;color:var(--green)}
dialog{border:1px solid #d4d8ce;border-radius:14px;padding:28px;width:min(520px,92vw);max-height:90dvh;overflow-y:auto;color:var(--ink);background:var(--white);box-shadow:0 24px 72px #162f262e;animation:appear .16s ease-out}
dialog::backdrop{background:#142b224a;backdrop-filter:blur(4px)}
#category-card{width:min(460px,calc(100% - 28px));padding:18px 20px 20px}
#category-card[open]{animation:category-enter .22s ease-out both}
#category-card[open]::backdrop{animation:category-shade-in .22s ease-out both}
#category-card[data-closing="true"]{animation:category-leave .16s ease-in both;pointer-events:none}
#category-card[data-closing="true"]::backdrop{animation:category-shade-out .16s ease-in both}
.category-card-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.category-card-header h2{margin:0;font-family:var(--heading-font);font-size:23px}
#category-card-close{font-size:22px}
.category-links:not([hidden]){display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,10rem),1fr));gap:8px}
.category-link{display:flex;align-items:center;gap:8px;min-width:0;min-height:48px;padding:9px 12px;border:1px solid var(--line);border-radius:var(--radius);color:var(--green);background:var(--white);font-size:15px;font-weight:600;text-decoration:none}
.category-link:is(:hover,[aria-current="page"]){border-color:#a8bea6;background:var(--green-light);text-decoration:none}
.category-link small{font-size:11px;color:var(--muted);white-space:nowrap}
@keyframes category-enter{from{opacity:0;transform:translateY(12px) scale(.98)}to{opacity:1;transform:none}}
@keyframes category-leave{from{opacity:1;transform:none}to{opacity:0;transform:translateY(8px) scale(.98)}}

/* Keep the outgoing frame in place while the new page appears over it. */
::view-transition-group(root){animation-duration:var(--route-duration)}
::view-transition-old(root){animation:none;mix-blend-mode:normal}
::view-transition-new(root){animation:route-dissolve var(--route-duration) ease-out both;mix-blend-mode:normal}
@keyframes route-dissolve{from{opacity:0}to{opacity:1}}
@media(max-width:900px){:root{--route-duration:220ms}}
@keyframes category-shade-in{from{opacity:0}to{opacity:1}}
@keyframes category-shade-out{from{opacity:1}to{opacity:0}}
@media(max-width:480px){.category-links:not([hidden]){grid-template-columns:minmax(0,1fr)}}
@media(prefers-reduced-motion:reduce){#category-card[open],#category-card[open]::backdrop{animation:none}}
.field-label{display:block;font-size:12px;margin:18px 0 12px}
.field-label input{width:100%;margin-top:8px;border:1px solid var(--line);border-radius:6px;padding:10px}
hr{border:0;border-top:1px solid var(--line);margin:18px 0}
dialog a{font-size:12px}
.file-label{cursor:pointer}
#toast{position:fixed;bottom:25px;left:calc(50% + var(--nav-reveal-width)/2);transform:translateX(-50%);background:#22443a;color:#fff;border:1px solid #3c6455;box-shadow:0 8px 28px #173d3238;border-radius:8px;padding:11px 20px;font-size:13px;z-index:20;max-width:80vw;animation:appear .18s ease-out}
[hidden]{display:none!important}
.board-cell{cursor:pointer}
.board-cell:focus-visible rect{stroke:#b39457;stroke-width:2}
:is(#chessboard,#game-board) .board-cell:focus-visible{outline:none}
:is(#chessboard,#game-board) .board-cell:focus-visible>rect{stroke:#7b5722;stroke-width:3}
:is(#chessboard,#game-board)[aria-disabled="true"] .board-cell{cursor:default}
.piece{transition:transform .16s}
.selected-ring{fill:none;stroke:#5f8766;stroke-width:3}
.legal-dot{fill:#729767;opacity:.6}
.piece-text{font-family:"KaiTi","STKaiti","SimSun",serif;font-size:28px;dominant-baseline:central;text-anchor:middle;font-weight:700;pointer-events:none}
.coord-label{font-size:12px;fill:#766342;font-family:Georgia,serif}
.last-ring{fill:none;stroke:#af9d6a;stroke-width:2;stroke-dasharray:4 3}
.target-mark{fill:#e2cf9c55;stroke:#baa267;stroke-width:1.5;stroke-dasharray:4 3}
@keyframes appear{from{opacity:0;transform:translateY(5px)}
to{opacity:1;transform:translateY(0)}
}
.walkthrough.is-studying .walkthrough-layout{grid-template-columns:minmax(0,1fr)}
.walkthrough.is-studying .study-board-panel{width:100%;max-width:620px;margin:0 auto}
.walkthrough.is-studying .study-board{max-height:70vh}
.walkthrough .study-analysis{width:100%;padding:24px;font-size:16px;line-height:1.9}
.walkthrough .study-analysis:empty{padding:0;border:0}
.walkthrough .study-analysis p{font-size:16px;line-height:1.9;color:var(--ink)}
.study-explanation-card{margin:20px 0;padding:20px;background:#fff;border:1px solid var(--line);border-radius:10px}
.study-explanation-card h4{font-size:15px;margin:18px 0 6px;color:var(--green)}
#position-report.has-active-study>:not(#position-walkthrough),#report-content.has-active-study>:not(.walkthrough){display:none!important}
#report-panel:has(.has-active-study)>.section-title,#report-panel:has(.has-active-study)>.evidence-grid,#report-panel:has(.has-active-study)>.report-bottom{display:none}
@media(max-width:680px){.walkthrough .study-analysis{padding:16px}.study-explanation-card{padding:14px}}
@media(max-width:1100px){
  :root{--sidebar-width:184px}
  .sidebar-content{padding-inline:12px}
  .training-layout{gap:12px 16px;grid-template-columns:minmax(0,1.4fr) minmax(278px,1fr)}
  .goal-card,.coach-card{padding:16px}
}
@media(max-width:900px){
  .sidebar{position:relative;inset:auto;width:auto;display:grid;grid-template-columns:1fr auto;gap:8px 12px;margin:8px calc(var(--gutter) - 8px) 0;padding:8px;overflow:visible}
  .sidebar-content{display:contents}
  .brand img{width:112px}
  .sidebar .category-nav{
    grid-column:1/-1;grid-row:2;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));
    border:1px solid var(--sidebar-divider);border-radius:8px;overflow:hidden
  }
  .sidebar .category-nav .nav-item{
    justify-content:center;min-width:0;min-height:44px;margin:0;padding:6px 4px;
    border:0;border-radius:0;text-align:center;white-space:normal
  }
  .sidebar .category-nav .nav-item + .nav-item{border-inline-start:1px solid var(--sidebar-divider)}
  .category-nav .nav-item:focus-visible{outline-offset:-3px}
  .category-nav .nav-item::after{display:none}
  .nav-item.active::before{inset:auto 20% 3px;width:auto;height:2px}
  .sidebar-utilities{display:contents}
  .nav-label,.local-note,#nav-toggle,.landing-return-link{display:none}
  .settings-link{grid-column:2;grid-row:1;width:auto;margin:0;min-height:38px}
  .workspace{margin:0}
  .topbar{min-height:52px}
  #toast{left:50%}
}
@media(max-width:820px){
  .nav-item>span{display:none}
}
@media(max-width:680px){
  :root{--gutter:14px}
  .sidebar{gap:8px 12px}
  .settings-link{font-size:12px;padding:5px 8px}
  .nav-item{font-size:12px;gap:4px}
  .topbar{min-height:50px;padding-block:6px}
  .breadcrumb,#engine-status{display:none}
  .service-status{width:100%;gap:6px}
  .service-status span{flex:1;min-width:0;background:none!important;border:0;padding:0;font-size:11px;overflow:hidden;text-overflow:ellipsis}
  .header-button{min-height:36px;padding:5px 8px}
  main{padding-block:16px}
  .page-heading{gap:8px;margin-bottom:13px}
  .page-heading p{font-size:12px}
  h1{margin-bottom:4px}
  .training-progress{flex:0 0 auto;padding:7px 8px}
  .training-progress>div{gap:7px;font-size:11px}
  .training-progress strong{font-size:16px}
  .training-progress strong span{font-size:11px}
  .curriculum-heading{gap:6px}
  .course-tabs{min-width:0;gap:2px;flex:1}
  .course-tabs button{flex:1;padding:5px;font-size:12px;min-height:36px}
  #theme-filter{min-width:0;width:98px;font-size:12px}
  .lesson-strip{gap:7px;padding:8px 0}
  .lesson-strip .label{display:none}
  .lesson-strip .button{padding-inline:9px}
  .training-layout{display:flex;flex-direction:column;align-items:stretch;gap:12px}
  .board-toolbar{padding:7px 12px;min-height:54px}
  .board-heading{display:block}
  .board-heading span{display:block}
  :is(.training-layout,.game-board-card) .board-wrap{padding:10px}
  .board-footer,.coordinate-guide,.variation-panel,.feedback{padding-inline:12px}
  .board-footer button{min-height:40px}
  .variation-panel ol{grid-template-columns:1fr}
  .evidence-grid,.item-grid{grid-template-columns:minmax(0,1fr)}
  .report-panel,.plain-card,.item-card{padding:16px}
  .report-bottom .button{margin-left:0}
  footer{flex-wrap:wrap}
  footer a{margin-left:0;width:100%}
}
@media(max-width:370px){
  .sidebar{grid-template-columns:minmax(0,1fr)}
  .settings-link{grid-column:1;grid-row:3;justify-self:start}
  .nav-item{font-size:11px}
  .course-tabs button{padding-inline:3px;font-size:11px}
  #theme-filter{width:83px}
  .learner-fields{grid-template-columns:1fr}
}
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}
}
.import-options{display:flex;flex-wrap:wrap;align-items:end;gap:12px;margin:16px 0}
.import-options label{display:flex;flex-direction:column;gap:6px;font-size:12px}
.import-check{display:flex;gap:10px;align-items:flex-start;font-size:12px;margin:16px 0}
.import-check input{flex-shrink:0;margin-top:5px;accent-color:var(--green)}
.import-status{padding:12px 15px;border:1px solid var(--line);border-radius:7px;overflow-wrap:anywhere;font-size:12px;margin:18px 0 0}
.import-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:22px;align-items:start;margin-bottom:20px}
#position-board{display:block;width:100%;max-height:565px;user-select:none}
.position-palette{padding:12px 18px;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}
.position-palette button{border:1px solid var(--line);border-radius:6px;background:#fafbf7;color:var(--ink);font-size:12px;font-weight:500;min-height:36px;transition:background-color .15s ease,border-color .15s ease,color .15s ease,transform .1s ease}
.position-palette button:nth-child(-n+7){color:#9c3e30;background:#fdf6f3;border-color:#e6cdc5}
.position-palette button:nth-child(-n+7):hover:not(:disabled){background:#f8e8e2;border-color:#ce9c8e}
.position-palette button:nth-child(-n+7)[aria-pressed="true"]{background:#a04436;border-color:#8a372a;color:#fff;font-weight:600}
.position-palette button:nth-child(n+8):nth-child(-n+14){color:#25362e;background:#f3f6f3;border-color:#ccd6cf}
.position-palette button:nth-child(n+8):nth-child(-n+14):hover:not(:disabled){background:#e5ece6;border-color:#93aa9b}
.position-palette button:nth-child(n+8):nth-child(-n+14)[aria-pressed="true"]{background:#233c32;border-color:#182b23;color:#fff;font-weight:600}
.position-palette button:last-child{border-style:dashed;border-color:#c6cdc3;background:#f7f7f2;color:var(--muted)}
.position-palette button:last-child:hover:not(:disabled){background:#eeeee7;border-color:#98a296;color:var(--ink)}
.position-palette button:last-child[aria-pressed="true"]{border-style:solid;background:#59665c;border-color:#445047;color:#fff;font-weight:600}
.import-board-actions{display:flex;flex-wrap:wrap;gap:8px;padding:4px 18px 14px}
.import-board-actions .text-button,#position-vision-diagnostic{border:1px solid var(--line);border-radius:6px;background:#fafbf7;padding:5px 11px;min-height:34px;font-size:12px;text-decoration:none}
.import-board-actions .text-button:hover:not(:disabled),#position-vision-diagnostic:hover:not(:disabled){background:var(--green-light);border-color:#a6bfa9;text-decoration:none}
#position-vision-diagnostic{margin-top:6px}
#position-fen{display:block;width:100%;resize:vertical;border:1px solid var(--line);border-radius:6px;background:#fafcf7;padding:10px;overflow-wrap:anywhere;margin:8px 0 12px;font:12px/1.6 monospace;color:var(--ink)}
.import-controls summary{cursor:pointer;font-size:12px;color:var(--green)}
.short-mate-options{margin-top:16px;padding:12px;border:1px solid var(--line);border-radius:7px}
.short-mate-options label{display:flex;flex-wrap:wrap;align-items:center;gap:12px;margin-top:14px;font-size:12px}
.teaching-source{margin-bottom:18px}
.position-line{font-size:13px;line-height:2;margin:15px 0}
#position-conclusion{font-size:17px;line-height:1.8}
#position-playback{width:100%}
@media(max-width:900px){.import-layout{grid-template-columns:1fr}.import-options .button{flex:1 1 180px}}
@media(max-width:680px){
  .import-layout{gap:14px}
  .position-palette{padding:10px}
  .import-options label,.import-options select{width:100%}
  .import-options .button{flex:1 1 100%;white-space:normal}
}
.model-call-status{border:1px solid var(--line);border-radius:8px;background:#fff;padding:9px 13px;font-size:12px;color:var(--muted);margin-bottom:14px;overflow-wrap:anywhere}
.api-test-status{border:1px solid var(--line);border-radius:7px;background:#f6f8f1;padding:12px 14px;margin:17px 0;font-size:12px;overflow-wrap:anywhere}
[data-state="success"]{background:#edf6eb;border-color:#c9dfc4;color:#31643e}
[data-state="error"]{background:#fff1ec;border-color:#edc5b9;color:#a24432}
[data-state="pending"]{background:#fbf7e9;border-color:#e4d7ad;color:#8c7136}
[data-state="warning"]{background:#fff7e3;border-color:#e5cd91;color:#805e1e}
.coach-validation-notes{margin:0 0 16px;overflow-wrap:anywhere;font-size:13px}
.coach-validation-notes summary{cursor:pointer;color:#805e1e}
@media(max-width:680px){dialog{padding:22px 16px}}

.import-save{padding:12px 18px 16px;border-top:1px solid var(--line)}
.import-save .import-check{margin:0 0 12px}
.import-save .import-options{margin:8px 0 0}
.game-library{margin-bottom:16px}
.game-select-row{display:flex;align-items:center;flex-wrap:wrap;gap:8px}
.game-select-row :is(select,input){width:min(100%,32rem);min-width:0;flex:1 1 210px}
.game-select-row input{min-height:40px;border:1px solid var(--line);border-radius:8px;background:#fff;padding:8px 12px;color:var(--ink)}
.game-rename-form{margin:12px 0}
.game-rename-status[data-state="error"]{color:#963f2d}
.game-library .caption{margin-bottom:0}
#game-open-import{margin-top:12px}
.game-board-card{margin-bottom:var(--game-board-bottom-gap)}
.game-board-card .board-footer{flex-wrap:wrap}
.game-board-card .board-footer span{flex:1 1 190px}
.game-board-card .board-heading{min-width:0}
#game-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#game-feedback{margin:0}
.turn-badge.black{background:#e3eae5;color:#34483e}

.game-actions{display:flex;align-items:center;flex-wrap:wrap;gap:0 14px}
.game-history summary span{margin-left:7px}
.game-history ol{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 8px;max-height:14rem;overflow:auto;padding:2px 6px;margin:10px 0 3px;list-style:none;counter-reset:game-ply}
.game-history li{display:grid;grid-template-columns:4ch minmax(0,1fr);gap:6px;align-items:baseline;padding:5px 7px;border-radius:5px;overflow-wrap:anywhere;font-variant-numeric:tabular-nums;transition:background-color .14s ease;counter-increment:game-ply}
.game-history li::before{content:counter(game-ply) ".";text-align:end;color:var(--muted)}
.game-history li:hover{background:#f2f5ee}
.game-history li[aria-current="step"]{background:var(--green-light);font-weight:600}
.game-history li .caption{margin-left:6px;white-space:nowrap}
@media(max-width:480px){.game-history ol{grid-template-columns:1fr;padding-inline:2px}}
.game-board-stage{container-type:inline-size}
.game-mate-label{display:none}
@media (max-width:900px){
  .game-board-stage[data-mate]{
    --mate-upper:#21d3ff;
    --mate-lower:#5279ff;
    --mate-edge:#322079;
    --mate-accent:#9a45ff;
    display:grid;
    grid-template-columns:minmax(36px,1fr) minmax(0,465px) minmax(36px,1fr);
    align-items:center;
    gap:clamp(5px,1.8vw,24px);
  }
  .game-board-stage[data-mate="red"]{
    --mate-upper:#ff9627;
    --mate-lower:#ff387d;
    --mate-edge:#881947;
    --mate-accent:#ff5a9b;
  }
  .game-board-stage[data-mate] .game-mate-label{
    position:relative;
    isolation:isolate;
    justify-self:center;
    display:grid;
    justify-items:center;
    gap:.16em;
    padding:.18em .06em;
    font-family:KaiTi,"Kaiti SC",STKaiti,"Noto Serif CJK SC",SimSun,serif;
    font-size:clamp(20px,8cqw,68px);
    font-weight:900;
    line-height:1;
    transform:rotate(-6deg);
    animation:game-mate-reveal 340ms cubic-bezier(.19,.8,.25,1.25) both;
  }
  .game-mate-glyph{
    display:block;
    color:var(--mate-lower);
    -webkit-text-stroke:.012em currentColor;
    text-shadow:.014em .028em 0 var(--mate-edge),0 0 .095em var(--mate-accent);
  }
  .game-mate-glyph:first-child{color:var(--mate-upper)}
  .game-mate-label::before,.game-mate-label::after{
    content:"";
    position:absolute;
    z-index:-1;
    inset:-5% -23%;
    pointer-events:none;
  }
  .game-mate-label::before{
    background:radial-gradient(ellipse,color-mix(in srgb,var(--mate-accent) 36%,transparent) 0%,transparent 69%);
  }
  .game-mate-label::after{
    background:linear-gradient(150deg,var(--mate-accent),transparent 22% 76%,var(--mate-upper));
    clip-path:polygon(0 18%,77% 0,10% 21%,3% 29%,8% 21%,0 24%,100% 77%,100% 82%,18% 100%,92% 80%,96% 68%,94% 78%,100% 73%);
    opacity:.85;
  }
  @keyframes game-mate-reveal{
    from{opacity:0;transform:translateY(.24em) scale(.72) rotate(-12deg)}
    to{opacity:1;transform:rotate(-6deg)}
  }
  @container (width >= 800px){
    .game-board-stage[data-mate] .game-mate-label{font-size:clamp(76px,10.4cqw,114px)}
  }
  @container (width < 480px){
    .game-board-stage[data-mate] .game-mate-label{transform:none;animation:none}
  }
  @media (prefers-reduced-motion:reduce){
    .game-board-stage[data-mate] .game-mate-label{animation:none}
  }
}

/* Saved game workbench */
body{--nav-reveal-width:var(--sidebar-width)}
body.nav-collapsed{--nav-reveal-width:var(--nav-peek)}
.panel-handle{display:grid;place-items:center;width:22px;height:52px;padding:0;border:1px solid #cdd6ca;border-radius:6px;background:var(--white);color:var(--green);box-shadow:0 2px 6px #162f2612;cursor:col-resize;touch-action:none;transition:background-color .15s ease,border-color .15s ease}
.panel-handle::before{content:"";width:6px;height:6px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(-45deg)}
.panel-handle:hover,.panel-handle:focus-visible{background:var(--green-light)}
#nav-toggle{
  position:absolute;top:50%;inset-inline-end:2px;transform:translateY(-50%);
  width:26px;height:56px;border-color:rgb(90 101 83 / 32%);border-radius:9px;
  background:rgb(255 253 244 / 66%);box-shadow:inset 0 1px rgb(255 255 255 / 72%);cursor:grab
}
#nav-toggle:hover,#nav-toggle:focus-visible{background:#f9f7eb}
#nav-toggle:focus-visible{outline-offset:-3px}
body.nav-dragging #nav-toggle{cursor:grabbing}
#nav-toggle[aria-expanded="true"]::before,.game-panel-toggle[aria-expanded="false"]::before{transform:rotate(135deg)}
@media(min-width:901px){
  .sidebar{transform:translateX(calc(var(--nav-reveal-width) - var(--sidebar-width)));transition:transform .16s ease-out}
  .workspace{margin-left:var(--nav-reveal-width);transition:margin-left .16s ease-out}
  body.nav-collapsed:not(.nav-dragging) .sidebar-content{visibility:hidden}
  body.nav-dragging :is(.sidebar,.workspace){transition:none}
}
@media(prefers-reduced-motion:reduce){:is(.sidebar,.workspace){transition:none}}
body:has(#view-games:not([hidden])) main{max-width:none}
#game-content{--game-board-bottom-gap:20px;--game-panel-rail:32px;--game-analysis-width:0px;--game-coach-width:0px}
#game-content:is([data-layout="wide"],[data-layout="triple"]){position:relative;display:grid;align-items:start}
#game-content[data-layout="wide"]{grid-template-columns:minmax(0,1fr) var(--game-panel-rail) var(--game-analysis-width)}
#game-content[data-layout="triple"]{grid-template-columns:minmax(0,1fr) var(--game-panel-rail) var(--game-analysis-width) var(--game-panel-rail) var(--game-coach-width)}
.game-board-card,#game-analysis,#game-coach{min-width:0}
#game-content:is([data-layout="wide"],[data-layout="triple"]) #game-analysis,
#game-content[data-layout="triple"] #game-coach{position:absolute;inset:0 0 var(--game-board-bottom-gap);margin:0;overflow:auto;scrollbar-gutter:stable}
#game-content:is([data-layout="wide"],[data-layout="triple"]) #game-analysis{grid-area:1 / 3 / 2 / 4}
#game-content[data-layout="triple"] #game-coach{grid-area:1 / 5 / 2 / 6}
#game-analysis-rail{grid-area:1 / 2 / 2 / 3}
#game-coach-rail{grid-area:1 / 4 / 2 / 5}
#game-content[data-layout="wide"] #game-coach{grid-column:1/-1}
.game-stack-toggle{justify-self:start;margin:0 0 10px}
#game-coach{margin-top:0}
#game-coach-report{margin-top:12px;border-top:1px solid var(--line);padding-top:8px}
#game-coach :is(p,summary){overflow-wrap:anywhere}
#game-coach-status:empty,#learner-save-status:empty{display:none}
#game-coach-content{display:grid;gap:12px}
.game-coach-message{min-width:0;padding:10px 12px;border:1px solid var(--line);border-radius:10px}
.game-coach-message p{margin:4px 0;white-space:pre-wrap}
.game-coach-reply-label,.game-coach-reply-desktop{display:none}
#game-coach-question-form,#coach-style-form{display:grid;gap:8px;margin-top:14px}
:is(#game-coach-question-form,#coach-style-form) textarea{width:100%;resize:vertical}
#game-coach-question-form button{justify-self:start}
#game-analysis>details{border-top:1px solid var(--line);margin-top:12px;padding-top:8px}
:is(#game-analysis,#game-coach) details>summary{cursor:pointer;color:var(--green);padding:4px 0}
#game-analysis :is(p,button){overflow-wrap:anywhere}
#game-analysis .import-options{margin-top:8px}
#position-recommendation:empty,#position-action-status:empty,#position-fen-status:empty{display:none}
#position-report-origin{margin:12px 0 3px}
#position-reference{margin-top:10px}
.game-play-controls{display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:4px 17px 10px}
.game-play-controls label:not([hidden]){display:inline-flex;align-items:center;gap:6px;font-size:13px}
.game-play-controls select{padding:6px 8px;font:inherit}
.game-opponent-recovery .text-button{margin:0 17px 6px}
.game-perspective{display:flex;gap:8px;flex-wrap:wrap}
.game-play-controls [aria-pressed="true"]{background:var(--green-light);border-color:#80a689;color:var(--green);font-weight:700}
.game-reference-table{width:100%;border-collapse:collapse;text-align:left;font-size:13px;font-variant-numeric:tabular-nums}
.game-reference-table th{color:var(--muted);font-weight:600;font-size:12px}
.game-reference-table :is(th,td){padding:5px 6px;border-bottom:1px solid var(--line)}
.game-reference-table tbody tr:hover{background:#f4f7f0}
.game-reference-table button{width:100%;min-height:32px;text-align:left;padding:3px 6px;border-radius:4px;white-space:normal}
#position-origin[aria-current],.game-reference-table [aria-current]{background:var(--green-light);border-radius:5px;font-weight:700}
.game-explanation-step{padding:4px 0;border-bottom:1px solid var(--line)}
.game-explanation-step>details{margin-left:10px}
.game-analysis-rail{position:relative;align-self:stretch;margin-bottom:var(--game-board-bottom-gap);min-height:125px;touch-action:none}
.game-analysis-splitter{position:absolute;inset:0;cursor:col-resize;border-radius:6px}
.game-analysis-splitter::before{content:"";position:absolute;inset:0 calc(50% - 1px);background:#cdd6ca;border-radius:2px}
.game-analysis-splitter:hover::before,.game-analysis-splitter:focus-visible::before{background:var(--green)}
.game-panel-toggle{position:absolute;z-index:1;top:50%;left:50%;transform:translate(-50%,-50%)}
.game-picker-toggle{display:flex;align-items:center;gap:8px;min-height:32px;margin:0 auto 8px;padding:4px 14px;width:auto;height:auto;font-size:13px;cursor:ns-resize}
.game-picker-toggle::before{transform:rotate(45deg);margin-top:-3px}
.game-picker-toggle[aria-expanded="true"]::before{transform:rotate(225deg);margin-top:3px}
.game-picker{display:grid;grid-template-rows:0fr;opacity:0;visibility:hidden;transition:grid-template-rows .2s ease,opacity .16s ease,visibility 0s linear .2s}
.game-picker[data-expanded="true"]{grid-template-rows:1fr;opacity:1;visibility:visible;transition-delay:0s}
.game-picker-content{min-height:0;overflow:clip;overflow-clip-margin:8px}
@media(prefers-reduced-motion:reduce){.game-picker{transition:none}}
#game-editor{width:min(540px,calc(100% - 24px));max-height:calc(100dvh - 24px);padding:20px 24px;overflow:auto}
#game-editor h2{margin-bottom:8px}
#game-editor .field-label{margin:8px 0 4px}
#game-editor-board{display:block;width:min(100%,272px);height:auto;margin:auto;touch-action:manipulation}
#game-editor :is(input,textarea){width:100%;border:1px solid var(--line);border-radius:6px;padding:7px 10px;font:inherit}
#game-editor .board-wrap{margin-top:8px;padding:8px 12px;border-radius:8px}
#game-editor .position-palette{padding:10px 0 6px}
#game-editor .import-options{margin:10px 0}
.game-select-row select:disabled{background:#f5f6f1;color:var(--muted)}
#coach-preferences fieldset,#coach-preferences details{margin:14px 0;padding:10px 12px;border:1px solid var(--line);border-radius:8px;min-width:0}
#coach-preferences :is(legend,summary){color:var(--green);font-weight:650}
#coach-preferences .learner-fields{margin:8px 0}
#coach-preferences input{margin-top:6px}
#coach-style-form :is(input,select,textarea),#game-range input{box-sizing:border-box;width:100%;max-width:100%;padding:8px;border:1px solid var(--line);border-radius:6px;font:inherit}
#game-range{align-items:end;flex-wrap:wrap;margin:10px 0}
#game-range label{display:grid;gap:4px;font-size:13px}
#game-range input{width:6em}
#game-tabs{display:flex;padding:6px;gap:4px;border-top:1px solid var(--line)}
#game-tabs button{flex:1;min-height:42px;border:0;border-radius:6px;background:transparent;color:var(--green);font:inherit}
#game-tabs button[aria-pressed="true"]{background:var(--green-light);font-weight:700}
dialog{overscroll-behavior:contain}
@media(max-width:800px){
  #game-content[data-layout="stacked"] :is(#game-analysis,#game-coach){margin-bottom:12px}
  #view-coach input,#view-coach select,#view-coach textarea,#view-games textarea,dialog input,dialog select{font-size:16px}
  .view,input,select,textarea,.plain-card{min-width:0}
  .view p,dialog p,.game-coach-message,.item-grid,.board-heading{overflow-wrap:anywhere}
  #game-range button{flex:1 1 auto}
  #game-moves{max-height:none}
  .game-play-controls{padding-inline:12px}
  .game-play-controls select{min-height:36px;font-size:16px}
  #position-grid-editor .grid-controls label{min-width:72px}
  .board-footer,.board-toolbar,.game-actions{flex-wrap:wrap}
  .learner-fields{grid-template-columns:repeat(auto-fit,minmax(min(100%,205px),1fr))}
  dialog{max-width:calc(100% - 16px);max-height:calc(100dvh - 16px);overflow:auto}
}
