:root {
  --bg: #fff;
  --paper: #fff;
  --ink: #203634;
  --sub: #4f6660;
  --muted: #506963;
  --line: #dce9e4;
  --green: #166451;
  --darkgreen: #147863;
  --mint: #dcf7ec;
  --mint-strong: #a6e9d8;
  --purple: #efe7ff;
  --orange: #fff0d0;
  --blue: #e7efff;
  --trail-plum: #574087;
  --accent-mint: #70dfc3;
  --accent-purple: #d9c6fc;
  --accent-blue: #a6c1fc;
  --accent-gold: #ffd781;
  --edge-purple: #9278ba;
  --edge-gold: #be8947;
  --edge-neutral: #adc3ba;
  --radius: 20px;
  --radius-small: 12px;
  --radius-large: 28px;
  --shadow: 0 4px 0 #e9f1ee;
  --press-depth: 5px;
  --press-time: 160ms;
  --success-time: 650ms;
  --node-size: 56px;
  --node-row: 112px;
  --game-top-height: 65px;
}
.trail-art { display:inline-block; width:24px; height:24px; flex:none; vertical-align:middle; }
.trail-mascot { width:min(100%,150px); height:110px; align-self:center; justify-self:center; }
.rail { background:#fff; }
.brand { padding-inline:0; }
.brand-mark { background:var(--mint); box-shadow:0 3px 0 #9fd6c7; color:var(--green); display:grid; place-items:center; }
.brand-mark .trail-art { width:33px; height:33px; }
.rail nav button { color:var(--sub); }
.rail nav button:hover,.rail nav button.active { background:var(--mint); color:var(--green); }
.rail-profile { display:flex; gap:7px; align-items:center; color:var(--green); }
.top { position:sticky; top:0; z-index:10; background:#fff; height:auto; min-height:65px; padding-block:8px; max-width:1210px; }
#screen { max-width:1210px; }
.course-switcher { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.course-switcher label { display:flex; align-items:center; gap:6px; color:var(--sub); }
.course-switcher select { min-height:42px; padding:4px 8px; border:2px solid var(--line); border-radius:var(--radius-small); background:#fff; color:var(--ink); font-weight:750; }
.top-stats { display:flex; flex-wrap:wrap; gap:5px; }
.stat-pill { display:inline-flex; align-items:center; gap:5px; padding:5px 8px; min-height:42px; border:0; color:var(--ink); font-variant-numeric:tabular-nums; }
.stat-pill .trail-art { width:26px; height:26px; }
.stat-pill span { color:var(--sub); font-size:.78rem; }
.stat-gain strong { animation:stat-grow var(--success-time) ease-out; color:var(--green); }
@keyframes stat-grow { 32% { transform:scale(1.3); } }
.button,.choice,.menu-entry { --press-edge:var(--edge-neutral); transition:transform var(--press-time) cubic-bezier(.2,.9,.33,1.35),box-shadow var(--press-time); }
.button { min-height:44px; border-radius:var(--radius-small); font-weight:820; }
.button.primary { --press-edge:var(--darkgreen); color:#16463a; background:var(--accent-mint); box-shadow:0 var(--press-depth) var(--press-edge); }
.button.secondary { --press-edge:var(--edge-purple); color:var(--trail-plum); background:var(--accent-purple); box-shadow:0 var(--press-depth) var(--press-edge); }
.button.outline { color:var(--green); background:#f4faf7; border:1px solid var(--line); box-shadow:0 3px var(--edge-neutral); }
.button:not(.quiet):enabled:active,.choice:enabled:active,.menu-entry:enabled:active,.trail-node:enabled:active { transform:translateY(3px); box-shadow:0 2px var(--press-edge); }
.button:disabled,.trail-node:disabled { cursor:default; }
.button:focus-visible,.trail-node:focus-visible,.menu-entry:focus-visible,summary:focus-visible { outline:3px solid #5285d6; outline-offset:4px; }
.panel { border-radius:var(--radius); border-color:var(--line); box-shadow:none; }
.page-head { align-items:center; }
.page-head h1 { font-weight:850; }
.trail-secondary-links { margin-bottom:16px; }
.future-service { display:flex; align-items:flex-start; gap:12px; }
.future-service .actions { margin-top:12px; }
.trail-layout { display:grid; grid-template-columns:minmax(0,1fr) minmax(205px,.42fr); gap:clamp(20px,4vw,48px); align-items:start; }
.trail-main,.trail-side { display:grid; gap:20px; min-width:0; }
.trail-route-head { display:flex; gap:10px; flex-wrap:wrap; align-items:center; justify-content:space-between; margin-bottom:18px; }
.route-brand { display:none; }
.trail-route-head h1 { font-size:clamp(1.5rem,3vw,2rem); }
.trail-route-head p { color:var(--sub); font-size:.85rem; }
.trail-route-head .segmented { margin:0; }
.segmented button { min-height:40px; }
.segmented button.chosen { background:var(--mint); color:var(--green); border-color:#b4e2d5; }
.map-chapter {
  --chapter-bg:var(--mint); --chapter-color:#166451; --chapter-path:#d4ebe2;
  position:relative; scroll-margin-top:calc(var(--game-top-height) + 10px);
}
.map-chapter[data-tone=blue] { --chapter-bg:var(--blue); --chapter-color:#304d85; --chapter-path:#dfeaff; }
.map-chapter[data-tone=violet] { --chapter-bg:var(--purple); --chapter-color:var(--trail-plum); --chapter-path:#ebdff8; }
.map-chapter[data-tone=gold] { --chapter-bg:var(--orange); --chapter-color:#745022; --chapter-path:#f8ead3; }
.chapter-banner {
  display:flex; align-items:center; gap:12px; min-height:67px; padding:9px 14px; border-radius:var(--radius);
  color:var(--chapter-color); background:var(--chapter-bg); position:sticky; top:calc(var(--game-top-height) + 4px); z-index:6;
  box-shadow:0 4px var(--chapter-path);
}
.chapter-banner .trail-art { width:39px; height:39px; }
.chapter-banner small { color:inherit; font-weight:700; }
.chapter-banner h3 { margin:0; font-size:clamp(1.05rem,2vw,1.35rem); font-weight:850; }
.trail-stops { list-style:none; margin:8px 0 0; padding:0; }
.trail-stop { min-height:var(--node-row); position:relative; }
.map-link { position:absolute; top:50%; width:100%; height:100%; overflow:visible; pointer-events:none; }
.map-link path { fill:none; stroke:var(--chapter-path); stroke-width:14px; vector-effect:non-scaling-stroke; stroke-linecap:round; }
.trail-node {
  --press-edge:#9eb4ab; display:grid; place-items:center; width:var(--node-size); height:var(--node-size);
  position:absolute; z-index:1; top:calc(50% - var(--node-size) / 2); left:calc(var(--node-x) - var(--node-size) / 2);
  background:#edf2ef; color:#536b61; border:0; border-radius:19px; box-shadow:0 var(--press-depth) var(--press-edge);
  font-size:1.25rem; font-weight:850; transition:transform var(--press-time),box-shadow var(--press-time);
}
.trail-node .trail-art { width:30px; height:30px; }
.trail-stop.complete .trail-node,.trail-stop.available .trail-node { background:var(--chapter-bg); color:var(--chapter-color); --press-edge:#87bcae; }
.trail-stop.current .trail-node { background:var(--accent-mint); color:#145847; --press-edge:var(--darkgreen); }
.trail-stop.current .trail-node::after {
  content:""; position:absolute; inset:-7px; border:2px solid #48bfa2; border-radius:24px; pointer-events:none;
  animation:node-breathe 2.1s ease-in-out infinite;
}
.trail-stop.reward .trail-node { background:var(--orange); --press-edge:var(--edge-gold); }
.trail-stop.challenge .trail-node { background:var(--blue); --press-edge:#93aedd; }
.trail-stop.locked .trail-node { --press-edge:#d3dfd9; }
.trail-stop-copy { position:absolute; top:50%; transform:translateY(-50%); left:calc(var(--node-x) + var(--node-size) / 2 + 13px); right:4px; min-width:0; }
.trail-stop[data-side=left] .trail-stop-copy { left:4px; right:calc(100% - var(--node-x) + var(--node-size) / 2 + 13px); text-align:right; }
.trail-stop-copy strong,.trail-stop-copy small { display:block; }
.trail-stop-copy strong { font-weight:830; line-height:1.25; overflow-wrap:anywhere; }
.trail-stop-copy small { color:var(--sub); line-height:1.3; margin-top:5px; }
.locked .trail-stop-copy strong { color:var(--sub); }
.trail-stop.node-arrives .trail-node { animation:node-enter 440ms cubic-bezier(.19,.76,.34,1.14) both; }
@keyframes node-breathe { 0%,100% { transform:scale(1); opacity:.82; } 50% { transform:scale(1.09); opacity:.42; } }
@keyframes node-enter { from { opacity:.4; transform:translateY(14px) scale(.88); } to { opacity:1; transform:translateY(0) scale(1); } }
.chapter-gate { display:grid; gap:4px; justify-items:center; padding:18px 8px 25px; margin:0 0 14px; border-block:1px solid var(--line); text-align:center; }
.chapter-gate small { color:var(--sub); font-weight:750; }
.chapter-gate strong { font-size:1.13rem; margin-bottom:6px; }
.chapter-gate .button { width:min(100%,285px); }
.trail-story { display:grid; gap:12px; padding:16px; background:#eff7df; border-radius:var(--radius-large); }
.trail-story h2,.trail-side h2 { font-size:1.05rem; }
.trail-story .button { justify-self:start; }
.trail-side p { color:var(--sub); font-size:.88rem; }
.trail-focus { display:grid; grid-template-columns:auto 1fr; gap:9px 12px; align-items:center; }
.trail-focus-icon { width:36px; height:36px; }
.trail-meter { grid-column:1/-1; height:9px; overflow:hidden; border-radius:20px; background:var(--mint); }
.trail-meter > span { display:block; height:100%; border-radius:inherit; background:#39b599; }
.trail-focus > strong { grid-column:1/-1; font-size:.86rem; color:var(--green); }
.trail-links .button { margin-top:10px; }
.in-lesson .run-header,.in-lesson .progress-track { max-width:1060px; margin-inline:auto; }
.in-lesson .run-header h1 { font-weight:850; font-size:clamp(1.16rem,3vw,1.65rem); }
.in-lesson .progress-track { height:12px; background:#e6f0eb; }
.in-lesson .progress-track span { background:#28ae91; min-width:0; transition:width 240ms ease-out; }
.in-lesson .run-grid { max-width:1060px; margin-inline:auto; }
.in-lesson .run-grid.no-figure { justify-content:center; }
.in-lesson .question { padding:clamp(15px,3vw,28px); border:2px solid var(--line); }
.in-lesson .stem { font-weight:780; }
.in-lesson .choice { min-height:46px; background:#f6faf8; border:1px solid var(--line); border-radius:var(--radius-small); box-shadow:0 3px var(--edge-neutral); }
.in-lesson .choice.chosen { background:var(--mint); border-color:#93ceb9; color:var(--green); }
.in-lesson :is(.answer-input,.unit-select) { min-height:46px; }
.in-lesson .submit-row .primary { min-height:46px; }
.answer-feedback { position:relative; }
.answer-spark { position:absolute; top:17px; right:28px; pointer-events:none; }
.answer-spark i {
  position:absolute; width:6px; height:6px; border-radius:50%; background:#3dc4a4;
  animation:spark-fade var(--success-time) ease-out both;
}
.answer-spark i:nth-child(1) { --dx:12px; --dy:20px; }
.answer-spark i:nth-child(2) { --dx:-14px; --dy:-13px; background:#ffc86b; }
.answer-spark i:nth-child(3) { --dx:-26px; --dy:13px; }
.answer-spark i:nth-child(4) { --dx:12px; --dy:-11px; background:#c2a3ee; }
@keyframes spark-fade { from { opacity:.95; transform:scale(.5); } to { transform:translate(var(--dx),var(--dy)) scale(1.3); opacity:0; } }
.online-figure .figure { position:static; }
.online-figure :is(button,.geometry-notes,.segmented) { display:none; }
.round-result .result-mark { background:var(--orange); color:#80521c; font-weight:900; }
.menu-list { display:grid; gap:14px; width:min(100%,620px); }
.menu-entry { display:flex; align-items:center; text-align:left; gap:16px; min-height:62px; padding:12px 15px; background:var(--mint); border-radius:var(--radius); color:var(--ink); box-shadow:0 4px #a8cabe; }
.menu-entry:nth-child(2) { background:var(--orange); --press-edge:var(--edge-gold); box-shadow:0 4px var(--edge-gold); }
.menu-entry:nth-child(3) { background:var(--blue); --press-edge:#a4b8df; box-shadow:0 4px #a4b8df; }
.menu-entry .trail-art,.account-panel > .trail-art { width:34px; height:34px; }
.menu-entry strong { font-size:1.07rem; }
.menu-entry small,.rank-row small { display:block; color:var(--sub); }
.profile-hero { display:grid; grid-template-columns:85px minmax(0,1fr); gap:16px; align-items:center; border-radius:var(--radius-large); background:var(--orange); padding:14px; margin-bottom:15px; }
.profile-hero .trail-mascot { height:78px; }
.account-view { width:min(100%,480px); margin-inline:auto; }
.account-view .profile-hero { background:var(--mint); }
.account-form { display:grid; gap:12px; margin-top:16px; }
.account-form > .button { justify-self:start; }
.account-form input,.account-form select { font-size:1rem; min-height:44px; }
.form-error { color:#a33b33; font-weight:700; }
.form-error:empty { display:none; }
.account-panel { display:grid; grid-template-columns:auto minmax(0,1fr); align-items:start; gap:12px; background:var(--mint); }
.account-panel .actions,.collection-list + .actions { margin-top:12px; }
.account-assets { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 12px; margin:10px 0; }
.account-assets dt { font-size:.81rem; color:var(--sub); }
.account-assets dd { margin:0; font-weight:830; }
.collection-list { margin-top:8px; }
.settings-panel { display:flex; justify-content:space-between; align-items:center; gap:15px; }
.settings-panel input { width:22px; height:22px; accent-color:var(--green); }
.settings-panel label { min-width:44px; min-height:44px; display:grid; place-items:center; }
[data-sync][hidden] { display:none; }
.rank-hero { padding:16px; border-radius:var(--radius-large); background:var(--blue); margin:12px 0 17px; }
.rank-hero .side-head { justify-content:start; gap:12px; }
.rank-hero .trail-art { width:38px; height:38px; }
.rank-row { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--line); }
.rank-row:last-child { border-bottom:0; }
.rank-list h2 { margin-bottom:8px; }
.rank-row b { font-size:.88rem; }
.info-tip { position:relative; display:inline-block; vertical-align:middle; }
.info-tip summary { cursor:pointer; list-style:none; width:40px; height:40px; display:grid; place-items:center; color:var(--green); }
.info-tip summary::-webkit-details-marker { display:none; }
.info-tip p { translate:var(--tip-shift,0px) 0; position:absolute; top:calc(100% + 4px); right:0; width:min(245px,68vw); z-index:12; padding:10px 12px; border-radius:var(--radius-small); background:#24443c; color:#fff; font-size:.85rem; font-weight:550; box-shadow:0 3px 10px #273a3642; }
.page-head:has(.info-tip) { justify-content:space-between; }
.empty-action { display:grid; justify-items:start; gap:12px; padding:16px; }
.game-footer { max-width:1210px; margin:auto; padding:18px 15px; border-top:1px solid var(--line); text-align:center; color:var(--sub); font-size:.78rem; }
[hidden] { display:none!important; }
@media(max-width:850px){
  .trail-layout { grid-template-columns:minmax(0,1fr) minmax(165px,.38fr); }
}
@media(max-width:680px){
  :root { --node-size:49px; --node-row:93px; }
  .top { padding:8px 12px; gap:4px 8px; min-height:57px; flex-wrap:wrap; }
  .top.course-top .top-title { overflow:visible; white-space:normal; }
  .course-switcher { gap:5px; }
  .course-switcher label { gap:4px; }
  .course-switcher select { padding-inline:5px; min-height:38px; }
  .top-stats .stat-pill span { display:none; }
  .stat-pill { min-height:38px; padding:4px 6px; }
  .stat-pill .trail-art { width:21px; height:21px; }
  .shell { padding-bottom:calc(65px + env(safe-area-inset-bottom,0px)); }
  .rail { position:fixed; inset:auto 0 0; padding:5px 8px calc(5px + env(safe-area-inset-bottom,0px)); border-top:1px solid var(--line); border-bottom:0; }
  .rail :is(.brand,.rail-bottom) { display:none; }
  .rail nav button { flex-direction:column; gap:2px; padding:4px; min-height:50px; font-weight:750; }
  .rail nav button span { display:block; font-size:.75rem; }
  .trail-layout,.trail-main,.trail-side { display:flex; flex-direction:column; gap:14px; align-items:stretch; }
  .trail-main,.trail-side { display:contents; }
  .route-brand { display:inline; }
  .route-title { display:none; }
  .trail-focus { order:0; }
  .trail-route { order:1; }
  .trail-story { order:2; }
  .trail-links { order:3; }
  .chapter-banner { min-height:56px; }
  .chapter-banner .trail-art { width:31px; height:31px; }
  .trail-node .trail-art { width:27px; height:27px; }
  .trail-stop-copy { left:calc(var(--node-x) + var(--node-size) / 2 + 9px); }
  .trail-stop[data-side=left] .trail-stop-copy { right:calc(100% - var(--node-x) + var(--node-size) / 2 + 9px); }
  .trail-stop-copy strong { font-size:.86rem; }
  .trail-stop-copy small { font-size:.75rem; }
  .in-lesson .shell { padding-bottom:0; }
  .in-lesson .rail { display:none; }
  .in-lesson .figure { position:static; }
  .in-lesson .toast { bottom:16px; }
  .toast { bottom:calc(68px + env(safe-area-inset-bottom,0px)); }
}
@media(max-width:365px){
  .course-switcher label span { position:absolute; clip-path:inset(50%); }
  .top-stats { gap:1px; }
  .stat-pill { padding-inline:3px; }
}
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after { animation:none!important; transition:none!important; scroll-behavior:auto!important; }
}
:root[data-reduced-motion=true] *, :root[data-reduced-motion=true] *::before,:root[data-reduced-motion=true] *::after {
  animation:none!important; transition:none!important; scroll-behavior:auto!important;
}
