@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700&family=Zen+Maru+Gothic:wght@500;700&display=swap');
:root{--navy:#152341;--ink:#24304a;--muted:#657089;--gold:#ecd49a;--paper:#fffdf6;--line:#dce2eb;--red:#b82f4a;--blue:#215faf;--focus:#e2a936;font-family:'Noto Sans JP',sans-serif;color:var(--ink);font-synthesis:none}
*{box-sizing:border-box}body{margin:0;background:#101d38;color:var(--ink);min-height:100vh;background-image:radial-gradient(ellipse at 15% 10%,#29476a 0,transparent 50%),radial-gradient(ellipse at 95% 50%,#293456 0,transparent 40%);padding-bottom:140px}body::before{content:'';pointer-events:none;position:fixed;inset:0;opacity:.35;background-image:radial-gradient(1px 1px at 20% 17%,#f2daa1 95%,transparent),radial-gradient(1.5px 1.5px at 70% 27%,#fff 95%,transparent),radial-gradient(1px 1px at 85% 83%,#fff 95%,transparent);background-size:300px 270px;z-index:-1}button,input{font:inherit}button,a{-webkit-tap-highlight-color:transparent;touch-action:manipulation}button{cursor:pointer;line-height:1.4}button{border:0}button:disabled{cursor:default;opacity:.46}button:focus-visible,a:focus-visible,input:focus-visible,summary:focus-visible{outline:3px solid var(--focus);outline-offset:3px}a{color:inherit;text-decoration:none}button:hover:not(:disabled){filter:brightness(.96)}[hidden]{display:none!important}.sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}.skip{position:fixed;top:-100px;left:20px;z-index:100;background:white;padding:15px}.skip:focus{top:10px}
.topbar{max-width:1160px;margin:auto;display:flex;align-items:center;justify-content:space-between;padding:24px 30px;color:#fff7e2;border-bottom:1px solid #ffffff20;gap:10px}.brand{display:flex;align-items:center;gap:12px;font-family:'Zen Maru Gothic',sans-serif;font-size:23px;font-weight:700;letter-spacing:.08em}.brand small{display:block;font-family:'Noto Sans JP',sans-serif;font-size:10px;font-weight:500;letter-spacing:.13em;margin-bottom:3px;color:#c6d5e9}.brand-mark{font-size:37px;color:var(--gold)}.top-actions{display:flex;gap:8px;align-items:center}.quiet{min-height:44px;border:1px solid #a4b1c34d;border-radius:12px;background:transparent;color:inherit;padding:9px 13px;font-size:12px}.help-button{width:44px;font-size:18px}.topbar #sound[aria-pressed=true]{background:#ecd49a;color:#1b2943;border-color:transparent}
main{max-width:1160px;margin:auto;padding:26px 30px 0}.journey-bar{display:flex;align-items:center;justify-content:space-between;gap:8px;color:var(--paper)}.stage-switch{display:flex;align-items:center;gap:14px;text-align:left;background:none;color:inherit;min-height:44px;padding:0 8px 0 0}.stage-switch>span:first-child{font-size:10px;letter-spacing:.13em;color:var(--gold)}.stage-switch strong{font-family:'Zen Maru Gothic',sans-serif;font-size:23px}.star-counter{white-space:nowrap;color:var(--gold);font-size:22px}.star-counter small{font-size:12px;color:#abbcd4}.progress-row{display:flex;align-items:center;gap:12px;margin:8px 0 24px;color:#c1cde0;font-size:11px}.progress-track{height:3px;background:#ffffff20;flex:1;overflow:hidden;border-radius:4px}#progress-fill{height:100%;background:var(--gold);transition:width .3s}.workspace{display:grid;grid-template-columns:minmax(0,1fr) 270px;gap:24px;align-items:start}.game-column{grid-column:1;grid-row:1;min-width:0}.companion-column{grid-column:2;grid-row:1;position:sticky;top:18px;min-width:0}.companion-card{position:relative;border:1px solid #b7cbe940;border-radius:24px;background:linear-gradient(150deg,#f9f5e8,#e7ecf7);overflow:hidden;padding:20px}.companion-top{display:flex;justify-content:space-between;align-items:center}.eyebrow{font-size:9px;font-weight:700;letter-spacing:.16em;color:#63728a;margin:0 0 9px}.edition{font-size:10px;color:#66738a}.partner-art{height:230px;margin:14px 0 8px;display:flex;justify-content:center;isolation:isolate}.partner-art svg{width:100%;height:100%;mix-blend-mode:multiply}.partner-caption{text-align:center}.partner-caption h2{margin:5px 0;font-family:'Zen Maru Gothic',sans-serif;font-size:23px}.partner-caption>span{font-size:10px;color:var(--muted)}.speech{position:relative;margin-top:18px;background:#ffffffb8;border-radius:16px;padding:14px;font-size:13px;line-height:1.8}.speech p{margin:0}.companion-actions{display:flex;justify-content:space-between;gap:5px;margin-top:6px}.text-button{background:transparent;color:#506581;min-height:44px;padding:8px;font-size:12px}.world-note{font-family:'Zen Maru Gothic',sans-serif;text-align:center;line-height:2.2;color:#becee4;font-size:12px;margin:24px 0}
.play-card{border-radius:24px;background:var(--paper);padding:24px;box-shadow:0 12px 45px #070e221f}.play-toolbar{display:flex;justify-content:space-between;align-items:center;gap:8px}.section-kicker{font-size:11px;color:var(--muted)}.segmented{display:flex;background:#e9edf2;padding:4px;border-radius:12px;gap:2px}.segmented button{font-size:12px;padding:8px 12px;min-height:38px;border-radius:9px;background:none;color:#667084}.segmented button.selected{background:white;color:#21314e;box-shadow:0 2px 5px #12254412}.equation{display:flex;justify-content:center;align-items:center;gap:12px;padding:26px 0 12px;font-family:'Zen Maru Gothic',sans-serif;font-size:clamp(30px,3.5vw,44px);font-weight:700;scroll-margin-top:20px;white-space:nowrap}.positive{color:var(--red)}.negative{color:var(--blue)}.neutral{color:#556173}.operator{font-size:.8em;color:#506079}.unknown{color:#7d8798;border-bottom:2px dotted #bac0c8;min-width:36px;text-align:center}.equation-key{font-size:11px;color:var(--muted);text-align:center;margin:0 0 23px;line-height:1.7}.model-header{display:flex;justify-content:space-between;align-items:center;margin:10px 0 9px;gap:6px}.model-header h3{font-size:12px;margin:0}.model-header>span{font-size:10px;color:var(--muted)}.legend{display:flex;gap:12px;font-size:11px;font-weight:700}.stone-mat{border-radius:16px;background:#f2f3f4;border:1px solid #e2e5e8;padding:12px}.mat-caption{display:flex;justify-content:space-between;gap:6px;font-size:10px;color:var(--muted);margin-bottom:6px}#net-value b{font-size:13px}.stones{display:flex;justify-content:center;flex-wrap:wrap;gap:7px;align-items:center;min-height:62px;padding:4px 0 8px}.stone{flex:0 0 auto;width:44px;height:44px;border-radius:14px;color:white;font-family:'Zen Maru Gothic',sans-serif;font-weight:700;font-size:26px;display:inline-flex;align-items:center;justify-content:center;border:2px solid #ffffff94;box-shadow:inset 0 3px 4px #ffffff54,0 3px 0 #1935551a;opacity:1!important}.red{background:linear-gradient(145deg,#f17c86,#c73553)}.blue{background:linear-gradient(145deg,#70b0e6,#2b69b6)}.stone.clickable{outline:1px dashed #6e829a;outline-offset:2px}.stone.clickable:active{transform:scale(.93)}.source{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:7px;border-top:1px dashed #c9d1db;padding-top:10px;min-height:36px}.source-label{width:100%;font-size:10px;text-align:center;color:var(--muted)}.remaining{font-size:11px;color:#5c6b82;line-height:1.6;text-align:center}.empty-stones{display:flex;gap:10px;align-items:center;color:#7b8391;font-size:11px}.empty-stones strong{font-size:26px}.step-copy{display:flex;gap:8px;align-items:center;min-height:50px}.step-copy p{font-size:12px;line-height:1.7;margin:10px 0}.step-badge{display:grid;place-items:center;border-radius:50%;background:#e7ebf3;color:#3c5377;width:24px;height:24px;flex-shrink:0;font-size:11px}.step-actions{display:flex;gap:8px}.primary,.secondary{min-height:46px;padding:11px 16px;border-radius:12px;font-weight:600;font-size:13px}.primary{color:#fff;background:#294b70;box-shadow:0 3px 0 #12273e}.secondary{background:#edf0f4;border:1px solid #d5dce5;color:#3c536e}.step-actions .primary{flex:1}.step-actions .secondary{font-size:11px}.model-tools{display:flex;justify-content:flex-end;gap:6px}.model-tools button{font-size:11px}.zero-note{background:#fff2d3;color:#775b25;padding:10px 12px;font-size:12px;border-radius:10px;margin-top:10px;line-height:1.7}.line-header{border-top:1px solid var(--line);padding-top:14px;margin-top:0}.numberline-scroll{overflow:hidden;background:#f2f5f8;border-radius:12px}.numberline-scroll svg{display:block;width:100%;height:auto}.line-description{font-size:11px;color:#53647c;margin:8px 2px 0;line-height:1.65;min-height:36px}.hidden-model{text-align:center;padding:24px 8px 35px;color:#66748a}.hidden-model>span{font-size:60px;color:#b7a16e}.hidden-model p{font-size:13px}.gentle-note{font-size:11px;text-align:center;color:#b9c9de;margin:15px 0}footer{display:flex;justify-content:space-between;align-items:center;gap:10px;font-size:11px;color:#c4d2e6;margin:16px 0}footer a{padding:12px 0}footer button{color:inherit}
.answer-dock{position:fixed;bottom:0;left:0;right:0;z-index:20;background:#fbfaf6f5;backdrop-filter:blur(15px);border-top:1px solid #dbe0e8;padding:12px max(20px,env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom));box-shadow:0 -8px 30px #111b3026}.dock-inner{max-width:690px;margin:auto}.answer-controls{display:flex;gap:12px;align-items:stretch}.answer-picker{display:flex;align-items:center;justify-content:space-between;gap:10px;flex:1;min-width:0;border-radius:12px;border:1px solid #ccd6e3;background:white;color:#334761;padding:9px 12px;min-height:52px}#answer-label{font-size:12px}.answer-preview{font-size:25px;font-family:'Zen Maru Gothic',sans-serif;font-weight:700}.answer-controls>.primary{flex:1;min-height:52px;background:#213e61;font-size:14px}.feedback{font-size:12px;line-height:1.6;padding:0 2px 10px;color:#8d4b30}.feedback.success{color:#276b60}.answer-controls #next{background:#236a60}.answer-dialog{max-width:500px}.dialog-heading{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:15px}.dialog-heading h2{margin:0;font-family:'Zen Maru Gothic',sans-serif;font-size:23px}.dialog-heading .quiet{flex-shrink:0}.answer-equation{text-align:center;font-family:'Zen Maru Gothic',sans-serif;font-size:25px;font-weight:700;background:#eff2f6;border-radius:12px;padding:12px}.answer-dialog #input-help{font-size:11px;color:var(--muted);margin:12px 0}.answer-choices{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:7px}.answer-tab{border-radius:11px;font-size:18px;font-family:'Zen Maru Gothic',sans-serif;font-weight:700;min-height:46px;padding:5px 0;border:1px solid transparent}.answer-tab.negative{background:#e5effb;border-color:#c5d7ee}.answer-tab.positive{background:#fbe8eb;border-color:#ebcdd4}.answer-tab.neutral{background:#eaecef;border-color:#d7dbe2}.answer-tab[aria-pressed=true]{outline:3px solid #28476d;outline-offset:-3px;box-shadow:inset 0 0 0 5px white}.answer-tab:focus-visible{outline:3px solid #936309;outline-offset:1px}
dialog{border:1px solid #d7dfe8;border-radius:22px;background:#fffdf8;color:var(--ink);padding:24px;max-width:650px;width:calc(100% - 28px);max-height:calc(100dvh - 32px);overflow:auto;box-shadow:0 20px 90px #02071380}dialog::backdrop{background:#08152ecc;backdrop-filter:blur(4px)}dialog>h2{font-family:'Zen Maru Gothic',sans-serif}dialog p{font-size:13px;line-height:1.8}dialog h3{font-size:14px}.close-dialog{float:right}.sources{font-size:12px;line-height:1.8;padding-left:20px}.sources a{text-decoration:underline}.volume-label{display:flex;align-items:center;gap:12px;font-size:13px;min-height:44px}input[type=range]{min-height:44px;flex:1;min-width:0}.help-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}.small{font-size:11px!important;color:var(--muted)}.lesson-nav{display:grid;gap:10px}.lesson-tab{display:grid;grid-template-columns:44px 1fr auto;align-items:center;text-align:left;gap:10px;padding:15px 12px;background:#f0f3f7;color:#263c59;border:1px solid #dae1ea;border-radius:14px;min-height:74px}.lesson-tab[aria-current=step]{background:#e5edf7;border:2px solid #49678b}.lesson-tab .number{font-size:24px;font-family:'Zen Maru Gothic',sans-serif;color:#8c754b}.lesson-tab strong{display:block;font-size:14px}.lesson-tab small{display:block;font-size:11px;color:#62718a;margin-top:5px}.lesson-tab .stage-count{font-size:11px;white-space:nowrap}.crew{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-top:18px}.crew-member{background:#f1f3f7;border:1px solid #dce2ea;border-radius:14px;padding:12px 8px;color:#34455d;display:grid;justify-items:center;gap:7px}.crew-member.active{border:2px solid #bd9950;background:#fff5df}.avatar{display:block;width:64px;height:64px;border-radius:50%;overflow:hidden;background:#fff}.avatar svg{width:100%;height:100%;mix-blend-mode:multiply}.crew .name{font-size:12px}.complete-crew{display:flex;flex-wrap:wrap;justify-content:center;gap:10px;margin:18px 0}.complete-crew .avatar{width:50px;height:50px}#complete-dialog{text-align:center}.completion-stars{color:#bd9651;font-size:45px}#complete-dialog .primary{display:block;width:100%;margin-top:20px}#celebration{position:fixed;left:50%;top:45%;pointer-events:none;z-index:30;color:#e7c873}#celebration i{position:absolute;font-size:25px;animation:star-flight 1.2s ease-out forwards}@keyframes star-flight{from{transform:translate(0,0);opacity:1}to{transform:translate(var(--dx),var(--dy));opacity:0}}.vanish{animation:stone-pop .2s ease-out}@keyframes stone-pop{from{opacity:.7;transform:scale(.98)}to{opacity:1;transform:scale(1)}}
@media(max-width:760px){body{padding-bottom:145px}.topbar{padding:12px 16px}.brand{font-size:18px;gap:8px}.brand small{font-size:8px}.brand-mark{font-size:29px}.top-actions{gap:5px}.quiet{padding:8px 10px}.topbar #sound{font-size:11px}.help-button{width:36px}main{padding:12px 14px 0}.stage-switch{gap:8px}.stage-switch>span:first-child{font-size:9px;letter-spacing:0}.stage-switch strong{font-size:17px}.star-counter{font-size:19px}.progress-row{margin:3px 0 12px}.workspace{display:flex;flex-direction:column;gap:12px}.companion-column{position:static;width:100%}.companion-card{display:grid;grid-template-columns:76px 1fr;grid-template-rows:auto auto auto;padding:12px;column-gap:12px;border-radius:18px}.companion-top,.partner-caption>span,.world-note{display:none}.partner-art{grid-column:1;grid-row:1 / 4;height:96px;margin:0;align-self:center}.partner-caption{grid-column:2;text-align:left}.partner-caption h2{font-size:14px;margin:0 0 4px}.speech{grid-column:2;background:transparent;padding:0;margin:0;font-size:12px;line-height:1.65;min-height:40px}.companion-actions{grid-column:2;margin:0;justify-content:flex-start;gap:10px}.companion-actions button{min-height:32px;font-size:10px;padding:6px 0}.game-column{width:100%}.play-card{padding:14px;border-radius:18px}.play-toolbar{gap:4px}.section-kicker{font-size:10px}.segmented button{font-size:11px;padding:6px 8px;min-height:38px}.equation{font-size:32px;gap:8px;padding:17px 0 8px}.equation-key{font-size:9px;margin-bottom:15px}.model-header{margin:8px 0}.stone-mat{padding:9px}.stones{gap:6px;min-height:58px}.stone{width:42px;height:42px;border-radius:12px;font-size:25px}.stone.clickable{min-width:44px;min-height:44px}.source{gap:6px}.step-copy p{font-size:11px;margin:8px 0}.step-copy{min-height:46px}.step-actions{gap:7px}.step-actions .primary{font-size:12px;padding:10px}.step-actions .secondary{font-size:10px;padding:10px}.model-tools button{min-height:40px}.line-header{padding-top:10px}.line-description{font-size:10px;min-height:34px}.answer-dock{padding:10px 14px calc(10px + env(safe-area-inset-bottom))}.answer-controls{gap:8px}.answer-picker{padding:8px 11px;gap:6px}.answer-controls>.primary{font-size:13px}.feedback{font-size:11px;max-height:100px;overflow:auto}.gentle-note{font-size:10px}dialog{padding:18px;border-radius:20px}.answer-dialog{margin:auto auto 10px;max-height:calc(100dvh - 20px)}.dialog-heading{margin-bottom:12px}.dialog-heading h2{font-size:20px}.dialog-heading .eyebrow{font-size:8px}.dialog-heading .quiet{font-size:11px}.answer-equation{font-size:24px;padding:9px}.answer-choices{gap:6px}.answer-tab{font-size:18px;min-height:46px}.crew .avatar{width:62px;height:62px}.help-grid{grid-template-columns:1fr;gap:6px}footer{font-size:10px;margin:6px 0}footer .text-button{font-size:10px}}
@media(max-width:350px){.topbar{padding:10px}.brand{font-size:16px}.brand small{font-size:7px}.brand-mark{font-size:24px}.topbar #sound{font-size:10px;padding:7px}.stage-switch strong{font-size:15px}main{padding-left:10px;padding-right:10px}.play-card{padding:12px}.equation{font-size:28px;gap:7px}.answer-choices{grid-template-columns:repeat(5,minmax(0,1fr))}.answer-dialog{padding:14px}.answer-tab{min-height:44px}.dialog-heading h2{font-size:18px}.speech{font-size:11px}.companion-card{column-gap:9px;grid-template-columns:64px 1fr}.partner-art{height:84px}.star-counter small{font-size:10px}.step-actions .secondary{font-size:9px;padding:7px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

/* Keep touch targets usable and modal backgrounds still. */
body:has(dialog[open]){overflow:hidden}
@media(max-width:760px){.help-button{width:44px}.companion-actions button{min-height:44px}.companion-card{padding-top:8px;padding-bottom:8px}}
