:root{--story-play:url('./art/lesson-hsk.webp');--story-accent:#ff6949;--story-glass:#fff9eedf}
:root[data-system=traditional]{--story-play:url('./art/lesson-tocfl.webp');--story-accent:#279fe9;--story-glass:#f0faffdf}
:root[data-view=stories] .pocket-header,:root[data-view=stories] .pocket-toolbar,:root[data-view=stories] .pocket-sync{display:none}
:root[data-view=stories] body{background:var(--story-world) center top/cover fixed;padding-bottom:calc(88px + env(safe-area-inset-bottom))}
:root[data-view=stories] main{padding:0;max-width:650px;min-height:calc(100dvh - 85px)}
:root[data-view=stories] .story-hub{border-radius:0;margin:0;box-shadow:none}
:root[data-view=stories] .pocket-nav{display:grid!important;background:#fff7eeed;border-top:2px solid #fff;backdrop-filter:blur(14px);padding-bottom:env(safe-area-inset-bottom);box-shadow:0 -6px 25px #24182420}
:root[data-system=traditional][data-view=stories] .pocket-nav{background:#edf7ffed}
:root[data-view=stories] .pocket-nav button[aria-current=page]{background:var(--brand-soft);color:var(--brand);border-radius:16px;box-shadow:none}
.story-hub-head{height:240px;background-image:linear-gradient(0deg,#541620c9,transparent 96%),var(--story-world)}
:root[data-system=traditional] .story-hub-head{background-image:linear-gradient(0deg,#063a68bd,transparent 96%),var(--story-world)}
.story-summary{background:var(--story-glass)}.story-hub>.story-main-cta{background:linear-gradient(145deg,var(--story-accent),var(--brand));box-shadow:0 5px 0 var(--brand-dark)}
.story-settings{position:absolute;right:15px;top:16px;background:#ffffffd9;color:var(--brand-dark);border:2px solid #fff;border-radius:15px;width:44px;height:44px;min-height:44px;font-size:23px;padding:0;box-shadow:0 3px 0 #0002}
.story-settings-sheet{width:min(90%,420px);box-sizing:border-box;border:0;border-radius:26px;padding:28px;background:var(--paper);color:var(--ink)}.story-settings-sheet::backdrop{background:#18273a90;backdrop-filter:blur(6px)}.story-settings-sheet label{display:block;margin:20px 0;font-size:14px}.story-settings-sheet select{display:block;width:100%;padding:14px;border-radius:14px;margin-top:8px}.story-settings-sheet>[data-close-settings]{float:right;background:var(--brand-soft);color:var(--ink);border-radius:50%;padding:10px}.story-settings-sheet>[data-setting-account]{width:100%;border-radius:14px}
:root[data-story-playing=true] body{background:linear-gradient(#fff3 0%,#fff0 60%),var(--story-play) center center/cover fixed!important;padding-bottom:calc(88px + env(safe-area-inset-bottom))}
:root[data-story-playing=true] main{padding:env(safe-area-inset-top) 12px 16px;box-sizing:border-box}
.story-lesson-top{background:var(--story-glass);padding:12px 10px;border-radius:18px;margin:10px 0 18px;box-shadow:0 4px 18px #30445320;backdrop-filter:blur(12px);top:env(safe-area-inset-top)}
.story-lesson-top progress::-webkit-progress-value{background:linear-gradient(90deg,var(--story-accent),#f8cb52)}
.story-lesson-card{background:var(--story-glass);border:2px solid #fff;border-radius:28px;box-shadow:0 12px 35px #20355425;backdrop-filter:blur(12px);padding:22px 18px}.story-lesson-card h1{color:var(--brand-dark)}
.story-new-cards{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.story-new-cards>div{padding:13px 5px;min-width:0;background:linear-gradient(145deg,var(--novel-bg),#ffffff);box-shadow:0 4px 0 color-mix(in srgb,var(--novel) 25%,white);border:1px solid color-mix(in srgb,var(--novel) 35%,white)}.story-new-cards .story-word{font-size:31px;min-height:48px}.story-new-cards em{font-size:13px;overflow-wrap:anywhere}.story-new-cards p{font-size:12px;line-height:1.4;margin:8px 2px;min-height:40px}.story-new-cards small{font-size:8px}.story-new-cards>div>button:last-child{font-size:11px;padding:9px 4px;width:100%}
.story-dialogue{background:#fffdf7ed;box-shadow:0 4px 0 color-mix(in srgb,var(--brand) 14%,white);border:1px solid #fff}.story-dialogue.mila{background:var(--brand-soft)}
.story-options>button,.story-matching button{background:#fffdfa;box-shadow:0 4px 0 color-mix(in srgb,var(--brand) 23%,white);border:2px solid color-mix(in srgb,var(--brand) 23%,white)}
.pinyin-candidates{display:flex;flex-wrap:wrap;gap:7px;margin:-7px 0 17px;padding:12px;border-radius:15px;background:var(--brand-soft);border:1px solid var(--border)}.pinyin-candidates small{width:100%;font-size:10px;color:var(--muted)}.pinyin-candidates button{width:auto!important;min-width:44px;min-height:42px!important;padding:7px 13px;font-size:23px;background:var(--paper);color:var(--ink);box-shadow:0 3px 0 var(--border)}
.story-finish{position:relative;overflow:hidden;background:var(--story-glass);margin-top:18px;border-radius:30px;border:2px solid #fff;padding:20px 17px 25px;box-shadow:0 12px 35px #20355425;backdrop-filter:blur(12px)}.story-sound{position:relative;z-index:2;display:block;margin-left:auto;border-radius:20px;background:#fff9;color:var(--brand-dark);box-shadow:none;font-size:11px;padding:9px 12px;min-height:40px}.story-victory-stage{position:relative;height:270px;display:grid;place-items:center;isolation:isolate}.story-victory-stage:before{content:'';position:absolute;inset:18px;background:radial-gradient(circle,#fff5ac 0%,#ffdf7260 35%,transparent 65%);border-radius:50%;z-index:-1}.story-victory-bear{height:230px;max-width:90%;object-fit:contain;filter:drop-shadow(0 5px 5px #58312220);animation:bear-joy 1.05s ease-in-out 3;transform-origin:50% 92%;position:relative;z-index:1}.story-bear-shadow{position:absolute;bottom:20px;width:105px;height:15px;background:#58412235;filter:blur(4px);border-radius:50%;animation:bear-shadow 1.05s ease-in-out 3}.story-particles{position:absolute;inset:0;overflow:hidden;pointer-events:none}.story-particles i{position:absolute;left:var(--left);top:55%;color:#e9a927;font-style:normal;font-size:23px;animation:celebration 2s ease-out both;animation-delay:calc(var(--i)*.045s)}.story-particles i:nth-child(3n+1){color:#f76881}.story-particles i:nth-child(3n+2){color:#39b8c9}.story-finish h1{margin-top:8px;color:var(--brand-dark)}
@keyframes bear-joy{0%,100%{transform:translateY(0) rotate(0) scale(1)}20%{transform:translateY(7px) scale(1.05,.94)}50%{transform:translateY(-28px) rotate(-6deg) scale(.97,1.04)}70%{transform:translateY(-10px) rotate(5deg)}}
@keyframes bear-shadow{50%{transform:scale(.65);opacity:.35}}
@keyframes celebration{0%{opacity:0;transform:translateY(35px) scale(.3) rotate(0)}20%{opacity:1}100%{opacity:0;transform:translateY(-150px) translateX(calc((var(--i) - 9)*7px)) rotate(160deg)}}
@media(prefers-reduced-motion:reduce){.story-victory-bear,.story-bear-shadow,.story-particles i{animation:none}.story-particles i{opacity:.7;top:calc(15% + var(--i)*3%)}.story-lesson-top{backdrop-filter:none}}
@media(max-width:350px){.story-new-cards{grid-template-columns:1fr}.story-new-cards>div{display:grid;grid-template-columns:1fr 1fr;align-items:center}.story-new-cards small{grid-column:1/-1}.story-new-cards .story-word{grid-row:2/4}.story-new-cards p{min-height:0}}

/* Let the landscape show between separate activity surfaces. */
:root{--activity-dark:#96263d;--activity-light:#f45652;--activity-soft:#ffe4eb;--activity-ink:#55213a;--activity-shadow:#6d263549}
:root[data-system=traditional]{--activity-dark:#194a96;--activity-light:#258bcf;--activity-soft:#dff4ff;--activity-ink:#19395f;--activity-shadow:#10375b49}
:root[data-story-playing=true] body{background:transparent!important;isolation:isolate}
:root[data-story-playing=true] body::before{content:'';position:fixed;inset:0;z-index:-1;pointer-events:none;opacity:1;mask-image:none;filter:none;background:var(--story-play) center center/cover no-repeat}
:root[data-story-playing=true] main{padding:env(safe-area-inset-top) 18px 26px;max-width:680px}
.story-player .story-lesson-card{padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;backdrop-filter:none;min-height:0}
.story-lesson-top{background:#ffffffed;border:1px solid #fff;margin:12px 0 24px;box-shadow:0 4px 16px var(--activity-shadow);padding:10px 12px;backdrop-filter:none;color:var(--activity-ink)}
.story-lesson-top>button{color:var(--activity-dark)}.story-lesson-top progress::-webkit-progress-bar{background:#dae1ef}.story-lesson-top progress::-webkit-progress-value{background:linear-gradient(90deg,var(--activity-light),#ffd25c)}
.story-activity-heading{display:flex;align-items:center;gap:8px;position:relative;background:linear-gradient(135deg,var(--activity-dark),var(--activity-light));border-radius:26px;padding:20px 16px;margin:0 0 28px;box-shadow:0 6px 0 color-mix(in srgb,var(--activity-dark) 75%,transparent),0 12px 25px var(--activity-shadow);border:1px solid #ffffff60;color:#fff;overflow:hidden}
.story-activity-heading>div{position:relative;min-width:0;flex:1;z-index:1}.story-activity-heading:before{content:'';position:absolute;width:180px;height:180px;right:-35px;top:-45px;border-radius:50%;background:#ffffff18}
.story-activity-heading img{width:86px;height:130px;object-fit:contain;flex-shrink:0;filter:drop-shadow(0 7px 5px #0003);align-self:center}.story-activity-heading h1{color:white!important;font-size:25px;line-height:1.15;margin:12px 0}.story-activity-heading p{font-size:13px;line-height:1.45;margin:0;color:#fff!important}.story-activity-heading .story-kicker{color:#fff1d5;font-size:9px;letter-spacing:.1em}.story-activity-heading .story-route{background:#ffffffde;color:var(--activity-dark)}
.story-player .story-exercise-cn{background:#ffffffed;border:2px solid #fff;padding:22px 20px;border-radius:24px;box-shadow:0 5px 0 #ffffff75,0 8px 20px var(--activity-shadow);font-size:30px!important;margin:26px 0;color:var(--activity-ink)}
.story-player .story-recall-meaning{background:linear-gradient(145deg,#ffda67,#ffa947);color:#563410;border:2px solid #fff3b0;margin:26px 0;box-shadow:0 5px 0 #d38a37,0 9px 22px var(--activity-shadow);border-radius:25px;font-size:24px}
:root[data-system=traditional] .story-player .story-recall-meaning{background:linear-gradient(145deg,#83e4e2,#39b5db);border-color:#c4ffff;box-shadow:0 5px 0 #208aa9,0 9px 22px var(--activity-shadow);color:#124455}
.story-player [data-story-recall]{padding:19px;background:#ffffffed;border:2px solid #fff;border-radius:24px;box-shadow:0 7px 22px var(--activity-shadow);margin:26px 0}.story-player [data-story-recall] label{color:var(--activity-ink);font-size:12px}.story-player [data-story-recall] input{background:#f5f8ff;border:2px solid #d5dfef;color:#233858;margin:10px 0 16px;box-shadow:inset 0 2px 3px #1a385808}
.story-player .story-audio-big{background:linear-gradient(140deg,#9b66e9,#6838b5);color:white;box-shadow:0 5px 0 #51268e,0 8px 20px var(--activity-shadow);border:2px solid #c6a0ff;min-height:64px;font-size:20px;margin:25px 0;border-radius:22px}
.story-player .story-soft{background:#fffffff0;border:2px solid #fff;color:var(--activity-dark);box-shadow:0 4px 0 #d9e3f0,0 7px 15px var(--activity-shadow);margin-top:18px;border-radius:19px}
.story-player .story-hint,.story-player .story-tap-tip{background:#ffffffed;padding:12px 16px;border-radius:18px;color:var(--activity-ink);font-size:12px;box-shadow:0 5px 15px var(--activity-shadow);margin:23px 0;text-align:left}.story-player .story-grammar{background:#ffffffed;box-shadow:0 5px 15px var(--activity-shadow);margin:24px 0}
.story-player .story-main-cta,.story-player [data-story-self],.story-player [data-story-order-check],.story-player [data-story-recall]>button{background:linear-gradient(145deg,#19ae8e,#078576);box-shadow:0 5px 0 #096557,0 8px 20px var(--activity-shadow);color:white;border:1px solid #72ecd0;min-height:55px;border-radius:19px;font-size:16px;width:100%}
.story-player .story-options{margin:28px 0;gap:15px}.story-player .story-options>button,.story-player .story-matching button{background:#ffffffed;border-color:#ffffff;color:var(--activity-ink);box-shadow:0 4px 0 #d2ddec,0 9px 17px var(--activity-shadow)}.story-player .story-matching .selected{border-color:var(--activity-light);background:var(--activity-soft)}
.story-player .story-dialogue{background:#ffffffed;border:2px solid #fff;margin-top:25px;margin-bottom:25px;box-shadow:0 5px 0 #d2ddec,0 8px 17px var(--activity-shadow)}.story-player .story-dialogue.mila{background:var(--activity-soft);border-color:#fff}.story-player .story-dialogue>small{color:var(--activity-dark)}
.story-player .story-new-cards{margin:30px 0;gap:12px}.story-player .story-new-cards>div{border:2px solid #fff;background:linear-gradient(150deg,#cff9ed,#f0fffa);box-shadow:0 5px 0 #2dab91,0 9px 17px var(--activity-shadow)}
:root[data-system=traditional] .story-player .story-new-cards>div{background:linear-gradient(150deg,#ffddf1,#fff5fb);box-shadow:0 5px 0 #bc65a1,0 9px 17px var(--activity-shadow)}
.story-player .story-built{background:#ffffffed;border:2px dashed var(--activity-dark);box-shadow:0 6px 16px var(--activity-shadow);margin:25px 0}.story-player .story-blocks{gap:12px;margin:25px 0}.story-player .story-blocks button,.story-player .story-built button{background:#fff;color:var(--activity-dark);border-color:#d2ddec;box-shadow:0 4px 0 #c7d5e5}
.story-player .story-feedback{border:2px solid white;box-shadow:0 7px 19px var(--activity-shadow);margin-top:25px;font-weight:650}.story-player .story-hint-model{background:#fff;border-radius:18px;padding:14px}
:root[data-view=stories] .pocket-nav{background:#ffffffed;border:1px solid white;box-shadow:0 -3px 20px #15365720;color:var(--activity-ink)}:root[data-system=traditional][data-view=stories] .pocket-nav{background:#ffffffed}:root[data-view=stories] .pocket-nav button[aria-current=page]{background:var(--activity-soft);color:var(--activity-dark)}
.story-finish{background:#ffffffd9;border-color:#fff;backdrop-filter:none;box-shadow:0 12px 30px var(--activity-shadow)}
.story-player [data-story-self]{display:block;margin-top:24px;padding:14px}
@media(min-width:600px){.story-activity-heading{padding:25px;gap:22px}.story-activity-heading h1{font-size:30px}.story-activity-heading img{width:115px;height:155px}.story-activity-heading p{font-size:14px}.story-player .story-lesson-card{padding:0}.story-player .story-exercise-cn{font-size:33px!important}}
@media(max-width:350px){:root[data-story-playing=true] main{padding-left:13px;padding-right:13px}.story-activity-heading{padding:17px 13px;gap:4px}.story-activity-heading img{width:65px;height:108px}.story-activity-heading h1{font-size:23px}}

.story-jump{position:absolute;top:20px;left:calc(50% - 120px);width:240px;height:240px;overflow:hidden;visibility:hidden;z-index:1;pointer-events:none}
.story-jump-sheet{position:absolute;left:0;top:0;width:300%;height:200%;max-width:none;max-height:none;object-fit:fill;transform:translate(0,0);filter:drop-shadow(0 4px 3px #45291e20)}
.sprite-ready .story-jump{visibility:visible;animation:shifu-jump-lift 1.15s ease-in-out 3}
.sprite-ready .story-jump-sheet{animation:shifu-jump-frames 1.15s steps(1,end) 3}
.sprite-ready .story-victory-bear{visibility:hidden;animation:none}
.sprite-ready .story-bear-shadow{animation:shifu-jump-shadow 1.15s ease-in-out 3}
.story-hub-head>img{width:145px;right:5px;bottom:4px}.story-hub-head h1{max-width:225px}.pocket-hero>img{object-fit:contain;width:125px;height:185px;transform:rotate(-3deg);filter:drop-shadow(0 10px 9px #0003)}
@keyframes shifu-jump-frames{0%{transform:translate(0,0)}16.667%{transform:translate(-33.333333%,0)}33.334%{transform:translate(-66.666667%,0)}50%{transform:translate(0,-50%)}66.667%{transform:translate(-33.333333%,-50%)}83.334%{transform:translate(-66.666667%,-50%)}100%{transform:translate(0,0)}}
@keyframes shifu-jump-lift{0%,100%{transform:translateY(0)}17%{transform:translateY(5px)}34%{transform:translateY(-12px)}50%{transform:translateY(-27px)}67%{transform:translateY(-12px)}84%{transform:translateY(5px)}}
@keyframes shifu-jump-shadow{0%,100%{transform:scale(1);opacity:1}17%,84%{transform:scale(1.08)}50%{transform:scale(.6);opacity:.3}}
@media(min-width:600px){.story-hub-head>img{width:175px;right:24px}.story-hub-head h1{max-width:360px}.pocket-hero>img{width:155px;height:205px}}
@media(max-width:350px){.story-hub-head>img{width:112px}.story-hub-head h1{max-width:205px;font-size:28px}.pocket-hero>img{width:100px;height:155px}}
@media(prefers-reduced-motion:reduce){.sprite-ready .story-jump,.sprite-ready .story-jump-sheet,.sprite-ready .story-bear-shadow{animation:none!important;transform:none!important}}

:root[data-view=stories]:not([data-story-playing=true]) main{max-width:none}
.story-full-map{position:relative;background:transparent;overflow:visible}.story-full-map .story-world{min-height:calc(100dvh - 76px);background-position:center center;border-radius:0}.story-full-map .story-world:before{background:none}
.story-map-tools{position:fixed;left:max(12px,env(safe-area-inset-left));top:calc(12px + env(safe-area-inset-top));z-index:8}
.story-map-tools>summary{display:flex;align-items:center;gap:8px;list-style:none;cursor:pointer;width:fit-content;background:#fffffff0;color:var(--activity-dark);border:2px solid #fff;border-radius:16px;padding:8px 12px;font-size:12px;font-weight:850;box-shadow:0 4px 0 #b9ccde,0 7px 20px #13335430;min-height:44px}.story-map-tools>summary::-webkit-details-marker{display:none}.story-map-tools>summary>span:first-child{font-size:22px}.story-map-tools>summary b{background:var(--activity-soft);padding:4px 7px;border-radius:10px;font-size:11px}
.story-map-panel{margin-top:12px;width:min(350px,calc(100vw - 24px));max-height:calc(100dvh - 160px);overflow:auto;overscroll-behavior:contain;background:#fffffff5;border:2px solid white;box-shadow:0 12px 40px #12345150;border-radius:24px;padding-bottom:16px}.story-map-panel .story-hub-head{height:150px;padding:16px;border-radius:21px 21px 0 0}.story-map-panel .story-hub-head h1{font-size:24px;margin-top:18px;max-width:190px}.story-map-panel .story-hub-head img{width:85px;right:12px}.story-map-panel .story-settings{top:12px;right:12px;width:38px;height:38px;min-height:38px;font-size:20px}.story-map-panel .story-summary{padding:14px 10px;background:transparent}.story-map-panel .story-main-cta{width:calc(100% - 28px);margin:10px 14px;font-size:14px;min-height:48px}.story-map-panel .story-review-button{margin:18px 14px;width:calc(100% - 28px);background:var(--activity-soft)}.story-map-panel .story-chapter{margin:16px 14px 0;background:#eef4fc;border:0}.story-map-panel .story-chapter p{font-size:12px}
.story-daily-map{margin:0 14px 18px;background:var(--activity-soft);border-radius:17px;padding:14px;display:flex;align-items:center;flex-wrap:wrap;gap:7px;font-size:12px;color:var(--activity-ink)}.story-daily-map>span{margin-left:auto;font-weight:800}.story-daily-map p{width:100%;margin:0;font-size:11px}.story-map-companion{position:absolute;top:auto;bottom:60px;right:5%;width:112px;filter:drop-shadow(0 12px 8px #0003);pointer-events:none;z-index:1}
.story-full-map .story-stop-name{background:#ffffffed}.story-full-map .story-here{background:var(--activity-dark);box-shadow:0 4px 10px #0002}
.story-daily-home>button{display:flex;align-items:center;gap:13px;text-align:left;background:linear-gradient(135deg,var(--activity-dark),var(--activity-light));color:white;border:2px solid #ffffff60;box-shadow:0 5px 0 var(--activity-dark);padding:17px;border-radius:23px}.story-daily-home .story-daily-icon{font-size:30px}.story-daily-home button>span:nth-child(2){flex:1;min-width:0}.story-daily-home b{display:block;font-size:15px}.story-daily-home small{display:block;margin-top:6px;font-size:11px;font-weight:450}.story-daily-home strong{font-size:18px;white-space:nowrap}.story-daily-home>progress{width:100%;height:10px;accent-color:#13a78e;margin-top:20px}.story-daily-home>p{font-size:12px}
@media(min-width:600px){.story-map-companion{width:150px;right:8%;top:auto;bottom:60px}}

/* A level is one continuous, scrollable trail; keep the scenery at phone scale. */
.story-full-map .story-world{background-size:100% auto;background-repeat:repeat-y;background-position:center top}
.story-level-title{font-weight:800;padding:12px}.arrival-missions progress{width:90%;accent-color:var(--activity-dark)}
