@charset "UTF-8";
:root{--paper:#f2ecd9;--light:#faf6e9;--ink:#414b3c;--muted:#83826b;--red:#9b4035;--gold:#ae8b47;--line:#d1c6aa;--green:#6d8061;--serif:'STKaiti','KaiTi','楷体','Noto Serif SC','SimSun',serif}*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font:17px/1.65 var(--serif)}button,input,select{font:inherit}button,a{-webkit-tap-highlight-color:transparent}button{cursor:pointer;color:inherit;border:1px solid var(--line);border-radius:5px;background:transparent;min-height:44px;padding:8px 16px}button:hover{background:#e7dbc24d;border-color:var(--gold)}button:focus-visible,a:focus-visible{outline:3px solid #aa764b;outline-offset:4px}button:disabled{opacity:.5;cursor:default}a{color:inherit;text-decoration:none}.paper-grain{position:fixed;inset:0;pointer-events:none;z-index:-1;background:radial-gradient(ellipse at 15% 30%,#ddbc7820,transparent 60%),radial-gradient(ellipse at 85% 85%,#7f897515,transparent 65%)}#top{height:90px;max-width:1240px;margin:auto;display:flex;align-items:center;gap:20px;padding:0 35px;border-bottom:1px solid var(--line)}.brand{display:flex;gap:12px;align-items:center;margin-right:auto;font-size:20px;line-height:1.2;letter-spacing:3px}.brand-sub{display:block;font-size:12px;letter-spacing:2px;margin-top:7px;color:var(--muted)}.brand-seal{color:var(--red);border:1px solid var(--red);font-size:25px;display:grid;place-items:center;width:42px;height:42px;transform:rotate(-4deg)}.quiet{border:0;background:transparent;font-size:14px;padding:8px}.close{position:absolute;right:15px;top:10px;border:0;font-size:28px}#back{font-size:32px}main{max-width:1180px;margin:auto;padding:25px 35px 45px}h1,h2,h3,p{margin:0}h1,h2,h3{font-weight:400}h1{font-size:clamp(30px,4.6vw,56px);line-height:1.5;letter-spacing:6px}h2{font-size:29px;letter-spacing:3px}h3{font-size:22px}.eyebrow{color:var(--gold);font:12px/1.5 system-ui,sans-serif;letter-spacing:4px;margin-bottom:16px}.muted{color:var(--muted);font-size:14px}.hero{display:grid;grid-template-columns:1.4fr 1fr;gap:30px;align-items:center;min-height:330px}.hero h1 span{display:block}.hero-description{max-width:420px;color:var(--muted);margin:20px 0;font-size:17px;line-height:1.9}.hero-art{position:relative;height:320px;display:grid;place-items:center}.hero-art:before{content:'';width:250px;height:250px;border:1px solid var(--line);border-radius:50%;position:absolute;transform:translateY(-5px)}.hero-art:after{content:'山川有形 · 数自有意';position:absolute;right:0;top:20px;writing-mode:vertical-rl;color:var(--gold);letter-spacing:6px;font-size:12px}.hero-art img{height:290px;max-width:90%;z-index:1}.mountain{height:26px;overflow:hidden;margin:8px 0 20px;color:#c8c7ad}.mountain svg{height:50px;width:100%}.section-head{display:flex;justify-content:space-between;gap:20px;align-items:end;margin:12px 0 20px}.stage-entries{display:grid;grid-template-columns:repeat(3,1fr);gap:20px}.stage-card{display:block;position:relative;text-align:left;padding:23px 25px;background:#fff9e72e;min-height:165px;transition:transform .2s}.stage-card:hover{transform:translateY(-3px)}.stage-card:after{content:'入卷 →';position:absolute;right:20px;bottom:17px;font-size:14px;color:var(--red)}.stage-card .num{color:var(--gold);font:12px system-ui;letter-spacing:4px}.stage-card h2{font-size:29px;margin:9px 0 3px}.stage-card p{font-size:14px;color:var(--muted)}.stage-card small{display:block;font-size:12px;color:var(--muted);margin-top:14px}.bottom-note{display:flex;gap:25px;justify-content:space-between;color:var(--muted);font-size:12px;margin-top:28px;padding-top:14px;border-top:1px solid var(--line)}.stage-intro{padding:25px 0 20px;display:flex;align-items:center;gap:24px}.stage-intro img{height:110px}.stage-intro h1{font-size:38px}.space-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.space-card{padding:18px 20px;text-align:left;min-height:140px;background:#fff9e71a}.space-card .space-index{color:var(--gold);font-size:12px;letter-spacing:2px}.space-card h2{font-size:25px;display:flex;align-items:center;gap:15px;margin:6px 0}.space-card .era{font-size:11px;color:var(--muted);border-left:1px solid var(--line);padding-left:12px}.space-card p{font-size:14px;color:var(--muted)}.space-card small{display:block;font:11px system-ui;color:var(--muted);margin-top:12px}.space-card meter{display:block;width:100%;height:3px;margin-top:10px;accent-color:var(--green)}.journey-head{display:grid;grid-template-columns:1fr 130px;align-items:center;gap:20px;padding:20px 0 28px;border-bottom:1px solid var(--line)}.journey-head img{max-height:160px;max-width:100%}.journey-head h1{font-size:36px}.journey-head p{max-width:700px;color:var(--muted);margin-top:12px;font-size:16px}.topic-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:16px;margin-top:25px}.topic-card{padding:20px;display:flex;gap:16px;align-items:center;text-align:left;background:#fff9e724}.topic-card img{width:54px;height:54px;object-fit:contain}.topic-card h3{font-size:21px}.topic-card p{font-size:13px;color:var(--muted);margin-top:5px}.topic-card small{font-size:11px;color:var(--gold)}.topic-mark{width:54px;height:54px;border:1px solid var(--line);border-radius:50%;display:grid;place-items:center;font-size:26px;color:var(--red);flex-shrink:0}.topic-cover{display:grid;grid-template-columns:1fr 220px;gap:25px;align-items:center;padding:20px 0}.topic-cover img{height:220px;max-width:100%}.topic-cover h1{font-size:37px}.task-description{padding:20px;border-top:1px solid var(--line);border-bottom:1px solid var(--line);font-size:18px;line-height:1.9}.phase-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-top:22px}.phase-btn{text-align:left;padding:18px;min-height:130px}.phase-btn b{display:block;color:var(--red);font-weight:400;font-size:20px;margin-bottom:8px}.phase-btn span{font-size:13px;color:var(--muted)}.phase-btn.active{background:#a97a3920;border-color:var(--gold)}.actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:18px}.primary{background:var(--red);border-color:var(--red);color:var(--light)}.primary:hover{background:#83382e}.notice{font-size:13px;color:var(--muted);padding:12px 15px;border-left:2px solid var(--gold);background:#e4d4af25;margin:17px 0}.play-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.play-head h2{font-size:22px}.play-meta{font:12px system-ui;color:var(--muted)}.play-tools{display:flex;gap:8px;align-items:center}.play-tools button{font-size:12px;min-height:36px;padding:5px 10px}.phase-tabs{display:flex;gap:8px;margin:12px 0}.phase-tabs button{font-size:13px;min-height:35px;padding:5px 15px}.phase-tabs .active{border-color:var(--red);color:var(--red);background:#a84b3a0c}.goal-line{font-size:15px;line-height:1.6;color:var(--muted);margin-bottom:14px}.game-frame{width:100%;height:max(580px,calc(100dvh - 305px));min-height:450px;border:1px solid var(--line);background:var(--paper);border-radius:5px}.play-layout{max-width:1320px}body.playing #top{height:65px}body.playing main{padding-top:16px;max-width:1400px}.companion{display:flex;gap:12px;align-items:center;border-top:1px solid var(--line);padding:12px 0;margin-top:14px}.companion img{height:78px;width:66px;object-fit:contain}.companion .speech{font-size:15px;flex:1}.companion button{font-size:12px}.new-stage{border:1px solid var(--line);padding:22px;background:#fff8e71c;min-height:370px;position:relative}.new-stage h3{text-align:center;margin-bottom:12px}.new-stage .rules{font-size:15px;text-align:center;color:var(--muted);max-width:650px;margin:0 auto 15px}.puzzle-board{max-width:650px;margin:15px auto}.number-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:8px}.number-grid button{min-height:52px;font:21px Georgia,serif;border-radius:50%;aspect-ratio:1}.number-grid .selected{background:var(--red);color:#fff3d3;border-color:var(--red)}.num-pad{display:flex;flex-wrap:wrap;justify-content:center;gap:10px}.num-pad button{min-width:54px;font:23px Georgia,serif}.feedback{text-align:center;color:var(--green);min-height:30px;margin:12px 0;font-size:17px}.feedback.error{color:var(--red)}.game-actions{display:flex;gap:12px;justify-content:center;flex-wrap:wrap;margin-top:18px}.magic-board{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;max-width:300px;margin:auto}.magic-board button{height:76px;font:30px Georgia;background:#a6874220}.magic-board button.fixed{background:#d7d4bd60;border:0;color:var(--muted)}.magic-board button.selected{border:2px solid var(--red)}.board2048{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;max-width:360px;margin:auto;padding:10px;background:#c8b998;border-radius:8px;touch-action:none}.tile2048{aspect-ratio:1;border-radius:5px;background:#e4d9c2;display:grid;place-items:center;font:bold 26px Georgia}.tile2048[data-v="2"],.tile2048[data-v="1"]{background:#fff6df}.tile2048[data-v="4"],.tile2048[data-v="3"]{background:#ecdfb9}.tile2048[data-v="8"],.tile2048[data-v="5"]{background:#d8a770;color:#fff9e7}.tile2048[data-v="16"],.tile2048[data-v="13"]{background:#b97857;color:white}.tile2048[data-v="32"],.tile2048[data-v="64"],.tile2048[data-v="21"]{background:#974332;color:white}.graph{width:100%;height:300px;touch-action:manipulation}.graph line{stroke:var(--line);stroke-width:8;stroke-linecap:round;cursor:pointer}.graph line.on{stroke:var(--red)}.graph line.used{stroke:var(--green)}.graph circle{fill:var(--light);stroke:var(--red);stroke-width:2;cursor:pointer}.graph circle.active{fill:var(--red)}.graph text{fill:var(--ink);font:16px Georgia;pointer-events:none}.graph circle.active+text{fill:var(--light)}.bead-art{position:relative;height:320px;max-width:570px;margin:auto}.bead-art svg{width:100%;height:100%;overflow:visible}.bead-art line{stroke:#a34b37;stroke-width:4}.bead-art circle{fill:#a82935;stroke:#7b3023;stroke-width:2;cursor:pointer}.bead-art circle.chosen{stroke:#b38c3d;stroke-width:5}.bead-art text{fill:#fff3d5;font:bold 22px Georgia;pointer-events:none}.bead-art .sum{fill:var(--muted);font:13px Georgia}.pair-list{display:flex;gap:10px;flex-wrap:wrap;justify-content:center;margin-top:20px}.pair{padding:10px 18px;border:1px solid var(--green);border-radius:5px;color:var(--green)}.polydots{display:grid;grid-template-columns:repeat(5,7px);gap:3px;justify-content:center;margin:8px}.polydots i{width:7px;height:7px;border-radius:50%;background:var(--red)}.big-number{font:48px Georgia;color:var(--red);text-align:center;margin:25px}.chain-strip{display:flex;gap:8px;flex-wrap:wrap;justify-content:center;margin:18px}.chain-strip span{border:1px solid var(--line);border-radius:20px;min-width:38px;padding:4px 10px;text-align:center}.chain-strip span:last-child{border-color:var(--red);color:var(--red)}#toast{position:fixed;bottom:25px;left:50%;transform:translate(-50%,20px);max-width:90vw;padding:12px 25px;border:1px solid var(--gold);border-radius:4px;background:#faf6e9f5;box-shadow:0 8px 25px #6551371f;opacity:0;pointer-events:none;transition:.2s;z-index:100}#toast.show{opacity:1;transform:translate(-50%,0)}dialog{position:fixed;background:var(--light);color:var(--ink);border:1px solid var(--line);border-radius:8px;width:min(760px,calc(100vw - 30px));max-height:85dvh;padding:36px 30px;box-shadow:0 20px 100px #3336}dialog::backdrop{background:#31372c65;backdrop-filter:blur(3px)}dialog h2{margin-bottom:15px}dialog p{margin:10px 0;color:var(--muted)}.record-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;margin-top:18px}.record{padding:15px;border:1px solid var(--line)}.record h3{font-size:18px}.record small{color:var(--muted);font:11px system-ui}.record button{margin-top:8px;font-size:13px}.score-pill{font:12px system-ui;color:var(--red);border:1px solid var(--line);padding:7px 13px;border-radius:30px}.return-note{font-size:12px;text-align:center;margin:15px;color:var(--muted)}
@media(max-width:760px){#top{padding:0 16px;height:74px;gap:7px}.brand{font-size:17px;letter-spacing:2px}.brand-sub{font-size:10px}.brand-seal{width:33px;height:36px;font-size:22px}.quiet{padding:7px;font-size:12px}main{padding:18px 17px 30px}.hero{grid-template-columns:1.25fr 1fr;gap:5px;min-height:240px}.hero h1{font-size:29px;letter-spacing:3px}.hero-art{height:225px}.hero-art img{height:210px}.hero-art:before{width:155px;height:155px}.hero-art:after{display:none}.hero-description{font-size:14px;margin:12px 0}.eyebrow{font-size:9px;letter-spacing:2px}.stage-entries{gap:9px}.stage-card{min-height:147px;padding:15px 9px}.stage-card h2{font-size:21px;letter-spacing:1px}.stage-card p{font-size:11px}.stage-card small{font-size:10px}.stage-card:after{font-size:12px;right:8px;bottom:9px}.section-head h2{font-size:23px}.section-head .muted{font-size:11px}.bottom-note{font-size:10px;gap:12px}.stage-intro{gap:12px}.stage-intro h1{font-size:29px}.space-grid{gap:9px}.space-card{padding:12px 9px;min-height:137px}.space-card h2{font-size:22px;display:block}.space-card .era{display:none}.space-card p{font-size:12px}.space-card small{font-size:9px}.journey-head{grid-template-columns:1fr 85px}.journey-head h1{font-size:28px}.journey-head p{font-size:14px}.journey-head img{max-height:120px}.topic-grid{grid-template-columns:1fr;gap:10px}.topic-card{padding:16px}.topic-cover{grid-template-columns:1fr 95px;gap:12px}.topic-cover h1{font-size:28px}.topic-cover img{height:145px}.phase-grid{gap:8px}.phase-btn{padding:12px 9px;min-height:133px}.phase-btn b{font-size:17px}.phase-btn span{font-size:12px}.task-description{font-size:16px;padding:16px 8px}.play-head{display:block}.play-tools{margin-top:8px;justify-content:space-between}.phase-tabs{gap:6px}.phase-tabs button{padding:5px 10px}.game-frame{height:calc(100dvh - 240px);min-height:490px}.new-stage{padding:16px 10px;min-height:390px}.play-meta{font-size:10px}.companion .speech{font-size:13px}.companion img{height:65px;width:50px}.companion button{font-size:10px;padding:7px}.number-grid{grid-template-columns:repeat(5,1fr);gap:6px}.number-grid button{font-size:18px;min-height:42px}.record-grid{grid-template-columns:1fr}dialog{padding:32px 20px}.bead-art{height:300px}.play-head h2{font-size:20px}}
@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}.hero-art img{content:url('assets/smile.png')}}
@media(min-width:761px) and (max-height:850px){body.playing #top{height:55px}body.playing main{padding-top:10px}.play-head{margin-bottom:5px}.play-head .eyebrow{margin-bottom:4px}.phase-tabs{margin:7px 0}.goal-line{margin-bottom:10px;font-size:13px}.new-stage{padding:12px;min-height:330px}.new-stage h3{font-size:20px;margin-bottom:6px}.new-stage .rules{font-size:13px;margin-bottom:8px}.bead-art{height:185px}.new-stage .puzzle-board{margin:8px auto}.feedback{font-size:14px;min-height:23px;margin:8px 0}.game-actions{margin-top:8px}.game-actions button{font-size:13px;min-height:36px}.companion{padding:7px 0;margin-top:9px}.companion img{height:58px}.graph{height:235px}}
@media(min-width:761px) and (max-height:800px){body:not(.playing) #top{height:75px}body:not(.playing) main{padding-top:15px}.hero{min-height:265px}.hero h1{font-size:46px}.hero-art{height:260px}.hero-art img{height:240px}.hero-description{margin:14px 0}.mountain{margin:0 0 14px}.stage-card{min-height:145px;padding:18px 22px}.section-head{margin:8px 0 15px}.bottom-note{margin-top:20px}}
.game-focus{overflow:hidden}.game-focus #top,.game-focus .phase-tabs,.game-focus .goal-line,.game-focus .companion{display:none}.game-focus main{padding:0}.game-focus .play-head{position:fixed;inset:0 0 auto;z-index:30;height:64px;background:var(--paper);padding:8px 16px;border-bottom:1px solid var(--line);display:flex;margin:0}.game-focus .play-head .eyebrow,.game-focus #timer{display:none}.game-focus .play-head h2{font-size:18px}.game-focus .play-tools{margin:0}.game-focus .game-frame,.game-focus .new-stage{position:fixed;left:0;top:64px;width:100vw;height:calc(100dvh - 64px);border:0;border-radius:0;min-height:0;overflow:auto}.game-focus .new-stage{padding-top:25px}.game-focus .bead-art{height:min(55dvh,370px)}
@media(max-width:760px){.hero h1{font-size:23px;letter-spacing:1px}.stage-card h2{font-size:18px;letter-spacing:0;white-space:nowrap}.stage-card small{font-size:10px;line-height:1.4}.stage-card:after{font-size:11px}.bottom-note{line-height:1.6}}
@media(max-width:760px) and (max-height:740px){#top{height:64px}main{padding-top:12px}.hero{min-height:210px}.hero-art{height:195px}.hero-art img{height:185px}.hero-description{margin:8px 0}.mountain{height:18px;margin:0 0 10px}.section-head{margin:8px 0 12px}.stage-card{min-height:140px;padding-top:13px}.bottom-note{margin-top:16px}}

/* iPad account controls and safe-area support */
#top{flex-wrap:wrap;gap:8px;padding-top:max(10px,env(safe-area-inset-top))}#journey-account{font-size:14px;max-width:100%;white-space:normal}#journey-dialog{width:min(640px,calc(100vw - 24px));max-height:85dvh;overflow:auto;padding:24px;border:1px solid #cdbfa3;border-radius:18px;background:#faf6e9;color:#414b3c}#journey-dialog label{display:block;margin:12px 0}#journey-dialog input:not([type=checkbox]){display:block;width:100%;min-height:44px;font-size:16px}#journey-dialog button,#top button{min-height:44px;touch-action:manipulation}#journey-dialog .close{float:right}#journey-dialog .actions{flex-wrap:wrap}#journey-dialog p{overflow-wrap:anywhere}#journey-dialog::backdrop{background:#0007}body{padding-bottom:env(safe-area-inset-bottom)}

/* The challenge owns the screen; navigation stays available without a toolbar. */
body.playing #top,body.task-intro #top{height:44px;max-width:1400px;padding:0 12px;border:0;gap:0}
body.playing #top>*:not(#back),body.task-intro #top>*:not(#back){display:none}
body.playing #back,body.task-intro #back{min-width:44px;min-height:44px;font:28px/1 system-ui}
body.playing main{padding:0 12px 12px;max-width:1400px}
.task-title{display:grid;place-items:center;min-height:calc(100dvh - 100px);text-align:center;padding:28px}
.task-title h1{font-size:clamp(30px,5vw,52px);letter-spacing:4px}
body.playing .game-frame{display:block;height:calc(100dvh - 68px);min-height:420px;border:0;border-radius:0;background:var(--paper)}
body.playing .new-stage{border:0;background:none;min-height:calc(100dvh - 110px);padding:12px 8px}
body.playing .new-stage>h3{display:none}
body.playing .new-stage .rules{color:var(--ink);font-size:17px;margin-bottom:20px}
.challenge-footer{display:flex;justify-content:center;gap:12px;flex-wrap:wrap}
.challenge-footer button{margin:12px 0}
button[hidden]{display:none!important}
@media(max-width:760px){body.playing main{padding:0 4px 8px}.task-title h1{font-size:30px;letter-spacing:2px}body.playing .new-stage .rules{font-size:16px}body.playing .new-stage{padding:10px 12px}}
