@font-face{font-family:Studio Thai;src:url(thai-regular.woff) format("woff");font-weight:400 599;unicode-range:U+0E00-0E7F;font-display:swap}
@font-face{font-family:Studio Thai;src:url(thai-bold.woff) format("woff");font-weight:600 900;unicode-range:U+0E00-0E7F;font-display:swap}
@font-face{font-family:Studio Hanzi;src:url(hanzi.woff) format("woff");font-display:swap}
:root{
  color-scheme:light;
  --ink:#132330;--muted:#526572;--faint:#687985;--mint:#a9f2d5;
  --teal:#006b59;--teal-dark:#004d41;--line:#d8e3e7;--base:#edf3f5;
  --navy:#101a24;--white:#fff;--amber:#a45516;--radius:16px;
  --chinese:"Studio Hanzi","Songti SC","Noto Serif CJK SC",serif;
  font-family:"Studio Thai",system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  font-size:16px;line-height:1.48;color:var(--ink);background:var(--base)
}
*,*::before,*::after{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;overflow:hidden;overscroll-behavior:none}
body{height:100dvh;display:grid;grid-template-rows:auto minmax(0,1fr);touch-action:manipulation;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
img{-webkit-user-drag:none}
button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
button:disabled{cursor:default;opacity:.49}
button:focus-visible{outline:3px solid #008c73;outline-offset:3px}
button:hover:not(:disabled){border-color:#78ae9f}
svg{display:block}
.symbols{position:absolute;width:0;height:0;overflow:hidden}
.icon{width:19px;height:19px;flex:none;stroke:currentColor;stroke-width:1.7;fill:none;stroke-linecap:round;stroke-linejoin:round}
[hidden]{display:none!important}
h1,h2,h3,p{margin:0}
.topbar{background:var(--navy);color:var(--white);padding:env(safe-area-inset-top) max(20px,env(safe-area-inset-right)) 0 max(20px,env(safe-area-inset-left))}
.topbar-inner{height:clamp(54px,8dvh,70px);max-width:1392px;margin:auto;display:flex;justify-content:space-between;align-items:center;gap:12px}
.identity,.settings{display:flex;align-items:center;gap:12px}
.identity{display:grid;justify-items:start;gap:2px}
.brand{display:block;object-fit:contain;object-position:left center;width:auto;height:clamp(30px,4.8dvh,43px)}
.brand-sub{display:block;font-size:12px;line-height:1.38;color:#bec8cb;white-space:nowrap}
.top-button{min-height:44px;padding:0 13px;border:1px solid #3a4c59;border-radius:9px;background:#192733;color:#e6f1f2;display:flex;align-items:center;justify-content:center;gap:8px;font-size:14px;font-weight:650;white-space:nowrap}
.top-button[aria-pressed=true]{background:var(--mint);color:var(--teal-dark);border-color:var(--mint)}
.workspace{
  width:100%;min-height:0;max-width:1456px;margin:0 auto;
  padding:clamp(8px,1.8dvh,20px) max(20px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left));
  display:grid;grid-template-columns:202px minmax(0,1fr) 248px;
  grid-template-areas:"lessons practice tools";gap:16px;align-items:stretch;
}
.workspace.left-tools{grid-template-columns:248px minmax(0,1fr) 202px;grid-template-areas:"tools practice lessons"}
.lessons{grid-area:lessons;align-self:start;min-width:0}
.control-rail{grid-area:tools;min-width:0;display:flex;flex-direction:column;gap:9px;align-self:start}
#guide-toggle,#close-guide{display:none}
#close-guide{margin-left:auto}
.lessons,.coach{background:var(--white);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden}
.lesson-heading,.coach-head{padding:19px 17px;display:flex;justify-content:space-between;align-items:center;gap:9px;border-bottom:1px solid var(--line)}
.lesson-heading h2,.coach h2{font-size:15px;font-weight:750}
.lesson-heading>span{font-family:var(--chinese);color:var(--faint);font-size:15px;white-space:nowrap}
.character-list{display:grid;gap:8px;padding:12px}
.character-button{border:1px solid transparent;border-radius:11px;min-width:0;min-height:66px;display:flex;align-items:center;gap:11px;text-align:left;padding:8px;background:#f5f8f9}
.character-button[aria-current=true]{background:#e2f8ef;border-color:#9bd8c3;color:#10473a}
.character-glyph{min-width:45px;height:45px;background:white;border:1px solid #dbe6e9;border-radius:9px;display:grid;place-items:center;font:26px/1 var(--chinese);flex:none}
.character-button strong,.character-button small{display:block;overflow-wrap:anywhere}
.character-button strong{font-size:15px}
.character-button small{font-size:13px;color:var(--muted)}
.character-check{color:var(--teal);margin-left:auto}
.course-progress{padding:15px 17px 19px;border-top:1px solid var(--line)}
.course-progress>div{display:flex;justify-content:space-between;align-items:center;gap:6px;color:var(--muted);font-size:13px;margin-bottom:9px}
.course-progress strong{color:var(--teal);white-space:nowrap;font-variant-numeric:tabular-nums}
progress{appearance:none;display:block;width:100%;height:5px;border:0;border-radius:100px;overflow:hidden;background:#e5eef0;color:#007a64}
progress::-webkit-progress-bar{background:#e5eef0}
progress::-webkit-progress-value{background:#007a64;border-radius:100px}
progress::-moz-progress-bar{background:#007a64;border-radius:100px}
.practice{grid-area:practice;min-width:0;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr) auto;justify-items:center;gap:7px}
.practice-heading{width:100%;display:flex;justify-content:space-between;gap:12px;align-items:center}
.lesson-title{display:flex;align-items:center;gap:12px;min-width:0}
.current-glyph{height:54px;width:54px;flex:none;display:grid;place-items:center;border:1px solid #c9d7dc;border-radius:13px;background:#f9fbfc;font:34px/1 var(--chinese)}
.lesson-title h1{font-weight:760;font-size:clamp(23px,2.3vw,34px);line-height:1.12;letter-spacing:-.035em}
.lesson-title p{font-size:14px;color:var(--muted);margin-top:3px}
.round-list{display:flex;gap:4px;min-width:0;padding:4px;background:#dfe9ed;border-radius:11px}
.round-button{white-space:nowrap;min-height:42px;padding:0 11px;display:flex;align-items:center;justify-content:center;gap:7px;border:1px solid transparent;background:transparent;border-radius:8px;font-size:14px;color:#425867;font-weight:650}
.round-button[aria-current=true]{background:white;border-color:#bed1d6;color:var(--teal-dark)}
.round-number{display:grid;place-items:center;width:22px;height:22px;line-height:1;border-radius:50%;background:#edf2f4;font-size:12px;font-variant-numeric:tabular-nums}
.round-button[aria-current=true] .round-number{background:var(--mint);color:#003b32}
.board-space{min-height:0;width:100%;min-width:0;display:grid;place-items:center;container-type:size}
.paper-frame{width:min(100%,760px,max(0px,calc(100dvh - 265px)));padding:clamp(4px,1.1dvh,9px);border:1px solid #c7d7de;border-radius:17px;background:#dde8ed;box-shadow:0 2px 5px #18303e0b, 0 12px 30px #18303e0b}
@supports (width:1cqh){.paper-frame{width:min(100%,760px,100cqh)}}
.paper,#result-board{background:#f8f3e9 url(xuan-paper.webp) center / cover no-repeat}
.paper{position:relative;border:1px solid #cddbe1;border-radius:9px;overflow:hidden;aspect-ratio:1;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
#board{width:100%;height:100%;touch-action:none;user-select:none;-webkit-user-select:none;cursor:crosshair}
.board-axis{stroke:#c5d4db;stroke-width:1.3;stroke-dasharray:5 6;fill:none}
.board-diagonal{stroke:#dbe5e9;stroke-width:1.1;stroke-dasharray:4 7;fill:none}
.guide,.demo-path,.review-guide{fill:none;stroke-linecap:round;stroke-linejoin:round}
.guide{stroke:#bdcbd1;stroke-width:4;stroke-dasharray:4 8}
.guide.dim{opacity:.32}
.guide.next{stroke:#258772;stroke-width:4.8}
.entry{color:#152939;pointer-events:none}
.ink-body{fill:currentColor}
.ink-core{fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.demo-path{stroke:#09745e;stroke-width:7.2}
.start-halo{fill:#d9faed;stroke:#7fcbb2;stroke-width:1.2}
.start-core{fill:#1a846d}
.marker-text{font:650 13px system-ui,sans-serif;fill:#0b594a}
.tip-marker{fill:#ffebd7;stroke:#b76222;stroke-width:2}
.corner{position:absolute;width:14px;height:14px;border:0 solid #708b9a;pointer-events:none}
.corner.top-left{top:8px;left:8px;border-top-width:2px;border-left-width:2px;border-top-left-radius:3px}
.corner.top-right{top:8px;right:8px;border-top-width:2px;border-right-width:2px;border-top-right-radius:3px}
.corner.bottom-left{bottom:8px;left:8px;border-bottom-width:2px;border-left-width:2px;border-bottom-left-radius:3px}
.corner.bottom-right{bottom:8px;right:8px;border-bottom-width:2px;border-right-width:2px;border-bottom-right-radius:3px}
.board-status{min-height:1.5em;text-align:center;font-size:14px;color:var(--muted);max-width:100%;line-height:1.5}
.board-status[data-tone=tip]{color:var(--amber)}
.toolbar{display:flex;align-items:center;justify-content:center;gap:6px;min-width:0}
.control{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:46px;padding:0 12px;border:1px solid #cbdadf;border-radius:9px;background:white;font-size:14px;font-weight:650;white-space:nowrap}
.icon-control{width:46px;padding:0;flex:none}
.primary{border-color:var(--teal);background:var(--teal);color:white}
.primary:hover:not(:disabled){background:var(--teal-dark)}
.coach-head{justify-content:flex-start}
.coach-icon{width:36px;height:36px;border-radius:10px;display:grid;place-items:center;color:var(--teal);background:#e3f7ef;flex:none}
.coach-head p{font-size:13px;color:var(--muted);margin-top:2px}
.coach-body{padding:17px}
.coach-body h3{font-size:16px;margin-bottom:7px}
.coach-body>p{font-size:14px;color:var(--muted)}
.legend{display:grid;gap:8px;font-size:13px;color:var(--muted);margin-top:14px}
.legend span{display:flex;align-items:center;gap:9px}
.legend-start{width:11px;height:11px;border-radius:50%;background:#16765e;box-shadow:0 0 0 3px #d7f6ea;margin-left:4px;margin-right:3px}
.legend-line{width:18px;border-top:2px dashed #75929f}
.component-section{margin-top:16px;padding-top:13px;border-top:1px solid var(--line)}
.component-label{font-weight:700;font-size:14px;margin-bottom:7px}
.component-list{display:flex;flex-wrap:wrap;gap:5px}
.component-button,.component-next{min-height:44px;border-radius:8px;padding:0 7px;background:#f5f9f9;border:1px solid var(--line);font-size:13px}
.component-button[aria-current=step]{background:#e1f7ee;border-color:#85c9b4;color:var(--teal-dark);font-weight:700}
.component-next{width:100%;margin-top:8px;font-weight:700;color:var(--teal-dark)}
.coach-foot{border-top:1px solid var(--line);padding:14px 17px 17px}
.coach-foot p{color:var(--muted);font-size:13px;margin-bottom:7px}
.side-control{display:flex;width:100%;min-height:44px;border:1px solid var(--line);border-radius:9px;background:#f8fbfb;font-size:13px;align-items:center;justify-content:center;gap:7px;padding:5px 8px}
dialog{border:1px solid var(--line);border-radius:18px;padding:0;color:var(--ink);background:#fbfdfd;max-width:min(700px,calc(100% - 24px));width:100%;max-height:calc(100% - 24px);overflow:hidden;box-shadow:0 20px 80px #101a2445}
dialog::backdrop{background:#101a2477}
.result-head,.result-actions{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:15px 20px;border-bottom:1px solid var(--line)}
.result-head p{font-size:14px;color:var(--teal);font-weight:700}
.result-head h2{font-size:25px;line-height:1.2}
.result-body{display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);gap:16px;padding:16px 20px}
.result-figure{display:grid;align-content:start;justify-items:center;gap:8px}
#result-board{border:1px solid var(--line);border-radius:9px;width:100%;aspect-ratio:1}
.review-guide{stroke:#258772;stroke-width:4;stroke-dasharray:5 8;opacity:.72}
.review-guide.issue{stroke:#b76222}
.entry.issue{color:#b76222}
.scores{display:grid;grid-template-columns:1fr 1fr;gap:7px}
.score{border:1px solid var(--line);border-radius:10px;background:white;padding:10px;min-width:0}
.score strong{display:block;font-size:31px;font-weight:760;color:var(--teal-dark);line-height:1.15;font-variant-numeric:tabular-nums}
.score strong small{font-size:13px;color:var(--muted);font-weight:600}
.score span{display:block;font-size:14px;font-weight:700;margin-top:5px}
.score>small{display:block;color:var(--muted);font-size:12px}
.tip{margin-top:12px;background:#fff5e9;border:1px solid #f0dbc1;border-radius:10px;padding:11px 12px}
.tip h3{font-size:14px;color:#753e16;margin-bottom:4px}
.tip p{font-size:14px}
.result-actions{border-top:1px solid var(--line);border-bottom:0;justify-content:flex-end}
.component-label-chip{display:inline-flex;align-items:center;min-height:28px}
.coach-head,.coach-body{padding:13px 14px}
.coach-foot{padding:10px 14px 13px}
.toolbar .control:not(.primary){flex:none;width:44px;padding:0}
.toolbar .control:not(.primary) span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.toolbar .primary{flex:1;min-width:0;padding:0 10px}

@media(max-width:1190px), (orientation:portrait), (max-height:550px){
  .workspace,.workspace.left-tools{
    grid-template-columns:minmax(0,1fr) 225px;grid-template-rows:auto minmax(0,1fr);
    grid-template-areas:"lessons lessons" "practice tools";gap:10px 13px
  }
  .workspace.left-tools{grid-template-columns:225px minmax(0,1fr);grid-template-areas:"lessons lessons" "tools practice"}
  .lessons{display:flex;align-items:center;justify-content:space-between;padding:0 6px}
  .lesson-heading{border:0;padding:8px;white-space:nowrap}
  .lesson-heading>span{display:none}
  .character-list{display:flex;gap:5px;padding:5px}
  .character-button{min-height:44px;padding:3px 8px 3px 3px;gap:6px}
  .character-glyph{height:36px;min-width:36px;font-size:22px}
  .course-progress{border:0;width:154px;flex:none;padding:6px 8px}
  .toolbar .primary .icon{display:none}
}

@media(orientation:portrait){
  .workspace,.workspace.left-tools{
    grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;
    grid-template-areas:"lessons" "practice" "tools";gap:8px
  }
  .control-rail{justify-self:center;width:min(100%,760px)}
  .toolbar .primary{flex:0 1 auto;padding:0 13px}
  .toolbar .primary .icon{display:block}
  .side-control{display:none}
}

@media(orientation:portrait), (max-height:690px){
  #guide-toggle,#close-guide{display:inline-flex}
  .coach{display:none}
  .guide-open .coach{
    display:block;position:fixed;z-index:5;
    inset:auto max(12px,env(safe-area-inset-right)) max(68px,calc(env(safe-area-inset-bottom) + 60px)) auto;
    width:min(350px,calc(100vw - 24px));box-shadow:0 10px 36px #101a2433
  }
  .coach-head,.coach-body{padding:9px 12px}
  .coach-foot{padding:8px 12px 10px}
  .legend{display:flex;gap:12px;margin-top:8px}
  .component-section{margin-top:8px;padding-top:8px}
  .component-next{width:auto;margin-top:6px}
}
@media(orientation:landscape) and (max-height:690px){
  .guide-open .coach{inset:max(9px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) auto auto}
  .left-tools .guide-open .coach{right:auto;left:max(12px,env(safe-area-inset-left))}
  .toolbar{flex-wrap:wrap;justify-content:flex-start}
  .toolbar .primary{flex:1 0 100%}
}
@media(max-width:730px){
  .topbar,.workspace{padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right))}
  .course-progress,.lesson-heading{display:none}
  .lessons{padding:0}
  .character-list{width:100%;display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}
  .character-button strong{font-size:14px}
  .character-check{display:none}
}
@media(max-width:570px), (orientation:landscape) and (max-height:530px){
  .round-text,.top-button span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
  .top-button{width:44px;padding:0}
  .settings{gap:6px}
  .character-button{padding:3px;gap:4px}
  .character-glyph{min-width:30px;height:32px}
  .character-button small{font-size:12px}
  .lesson-title{gap:7px}
  .current-glyph{width:39px;height:39px;font-size:24px;border-radius:9px}
  .lesson-title h1{font-size:20px}
  .lesson-title p{font-size:12px;margin-top:1px}
  .round-button{padding:0 5px;min-width:31px;min-height:32px}
  .round-list{gap:3px}
  .control{padding:0 8px;gap:5px}
  .control.icon-control{padding:0}
}
@media(max-width:380px){
  .toolbar{gap:4px}
  .toolbar .control:not(.primary){width:40px}
  .toolbar .primary{padding-inline:9px}
}
@media(orientation:landscape) and (max-height:530px){
  .workspace{padding-top:6px}
  .workspace{grid-template-columns:minmax(0,1fr) 192px}
  .workspace.left-tools{grid-template-columns:192px minmax(0,1fr)}
  .practice{gap:4px}
  .control-rail{gap:6px}
  .side-control{padding:3px 6px}
  .coach-icon,.legend,.coach-foot{display:none}
}

body.focused .topbar-inner{height:56px}
body.focused .brand{height:34px}
body.focused .topbar .input-button,body.focused .lessons,body.focused .coach,body.focused .practice-heading,
body.focused #guide-toggle,body.focused .demo-control,body.focused #clear,body.focused .side-control{display:none}
body.focused .workspace{grid-template-columns:minmax(0,1fr) 122px;grid-template-rows:minmax(0,1fr);grid-template-areas:"practice tools"}
body.focused .left-tools{grid-template-columns:122px minmax(0,1fr);grid-template-areas:"tools practice"}
body.focused .practice{grid-template-rows:minmax(0,1fr) auto}
body.focused .control-rail{align-self:center}
body.focused .toolbar{display:grid;gap:7px}
body.focused .toolbar .control:not(.primary){width:100%;padding:0 9px}
body.focused .toolbar .control:not(.primary) span{position:static;width:auto;height:auto;overflow:visible;clip-path:none}
@media(orientation:portrait){
  body.focused .workspace,body.focused .left-tools{
    grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;grid-template-areas:"practice" "tools"
  }
  body.focused .toolbar{display:flex}
  body.focused .toolbar .control:not(.primary){width:auto}
}

@media(max-width:530px) and (orientation:portrait){
  .result-head,.result-body,.result-actions{padding:10px 12px}
  .result-body{grid-template-columns:1fr;gap:9px}
  #result-board{width:min(185px,max(62px,calc(100dvh - 430px)))}
  .tip{margin-top:7px}
  .result-head h2{font-size:21px}
  .score{padding:7px}
  .score strong{font-size:27px}
  .score>small{line-height:1.25}
  #overlay{min-height:40px}
}
@media(orientation:landscape) and (max-height:470px){
  .result-head,.result-body,.result-actions{padding:8px 12px}
  .result-body{gap:9px}
  #result-board{width:min(100%,max(58px,calc(100dvh - 228px)))}
  .result-head h2{font-size:21px}
  .score,.tip{padding:6px 8px}
  .tip{margin-top:7px}
  #overlay{min-height:36px}
}
