#game.story-active{height:auto!important;overflow:visible!important;max-height:none!important;padding-bottom:24px}
.story-active .task-layout{height:auto!important;max-height:none!important;align-items:start;gap:18px!important}
.story-active .scene{height:auto!important;max-height:none!important;overflow:visible!important;display:flex;flex-direction:column;gap:16px!important;min-width:0}
.story-active .board{flex:none!important;min-height:0!important;overflow:visible!important}
.story-active .task-title{flex:none;position:relative;padding:16px 62px 16px 16px}
.story-active .task-story{display:block!important;margin:0 0 10px!important;font-size:14px!important;line-height:1.6!important;max-width:none!important}
.story-active .steps{display:flex!important;gap:12px!important;flex-wrap:wrap;align-items:center}
.story-step-note{font-size:12px;color:#74846b}.story-map{background:#f2f3e4;border:1px solid #d7dec2;border-radius:20px;padding:12px;display:flex;flex-direction:column;gap:12px;flex:none;overflow:hidden}
.story-landscape{display:block;width:100%;height:72px;flex:none}.story-trail{display:grid;grid-template-columns:repeat(var(--story-count,6),minmax(0,1fr));gap:10px}.story-stop{display:flex;flex-direction:column;align-items:center;gap:6px;color:#8b947e;text-align:center;min-width:0}.story-stop>span{width:32px;height:32px;border-radius:50%;background:#e0e5ce;display:grid;place-items:center;font-size:17px}.story-stop small{font-size:12px;line-height:1.4;overflow-wrap:anywhere}.story-stop.active{color:#315c42;font-weight:700}.story-stop.active>span{background:#ecda96;box-shadow:0 0 0 3px #fcf8dc}.story-stop.done>span{background:#447657;color:#fff}.story-map>p{font-size:12px;line-height:1.6;margin:0;text-align:center;color:#677557}.story-map .story-discovery{color:#315c42;font-weight:700}.story-landmark{transition:opacity .6s;transition-delay:var(--delay)}
.story-active #feedback:not(:empty){position:static!important;inset:auto!important;transform:none!important;width:auto!important;height:auto!important;max-height:none!important;min-height:64px;overflow:visible!important;margin:0!important;flex:none;padding:16px!important}
.story-active .task-actions{position:static!important;gap:12px!important;margin-top:0!important;flex-wrap:wrap}
.story-bonus{display:flex;align-items:center;gap:20px;padding:20px;margin-top:24px;border:1px solid #d3dabd;border-radius:20px;background:#eef1df;text-align:left}.story-bonus h2{font-size:20px;margin:0 0 10px}.story-bonus p{font-size:15px;line-height:1.6;margin:0 0 10px}.story-bonus small{font-size:12px;color:#6d795c}.story-bonus button{flex-shrink:0;white-space:normal}
@media(max-width:700px){.story-active .scene{padding:12px!important;gap:12px!important}.story-active .story-trail{grid-template-columns:repeat(var(--story-mobile-count,3),minmax(0,1fr));row-gap:12px}.story-active .story-landscape{height:48px}.story-active .task-title h1{font-size:20px!important}.story-active .task-title{padding:12px 48px 12px 12px}.story-step-note{display:none!important}.story-bonus{flex-direction:column;align-items:stretch;padding:16px}.story-active .guide{margin-top:0!important}}
@media(prefers-reduced-motion:reduce){.story-landmark{transition:none}}

html[data-view=result]:has(.story-result),html[data-view=result]:has(.story-result) body{height:auto!important;overflow-y:auto!important}
html[data-view=result] #game:has(.story-result){height:auto!important;max-height:none!important;overflow:visible!important;padding-bottom:32px!important}
html[data-view=result] .result.story-result{height:auto!important;max-height:none!important;overflow:visible!important;display:flex!important;flex-direction:column;gap:16px!important}
.story-result .story-bonus{flex:none;width:100%;margin-top:12px}.story-result .story-bonus button{margin:0!important}
/* A completed adventure is a keepsake, with room for every reward and action. */
html[data-client][data-view=result],html[data-client][data-view=result] body{height:auto!important;min-height:100dvh!important;overflow-y:auto!important;background:radial-gradient(ellipse at 50% 20%,#ede8c8,transparent 65%),#f6f4e9}
html[data-client][data-view=result] #game{min-height:100dvh!important;height:auto!important;max-height:none!important;display:flex!important;align-items:center!important;justify-content:center!important;padding:32px 20px!important;overflow:visible!important}
html[data-client][data-view=result] .result{position:relative;width:min(100%,760px);height:auto!important;max-height:none!important;overflow:visible!important;padding:32px clamp(18px,4vw,48px);gap:18px!important;border:1px solid #cbb574;border-radius:32px;background:linear-gradient(160deg,#fffdf2,#f5efd4);box-shadow:inset 0 0 0 7px #fffdf2,0 8px 0 #d6c89e,0 24px 64px #435b4020;text-align:center}
html[data-view=result] .result .eyebrow{color:#6c8058;letter-spacing:4px;font-size:12px}
html[data-view=result] .result-art{position:relative;width:210px;height:190px;font-size:24px;display:grid;place-items:center;background:radial-gradient(ellipse,#f0d37d80,transparent 70%)}
.reward-companion .companion-art{display:block;width:140px;height:174px}
.reward-orbit{position:absolute;left:14px;top:36px;color:#c79938;font-size:32px;transform:rotate(-12deg)}
.reward-orbit:after{content:'✧';position:absolute;left:160px;top:54px;font-size:24px}
.reward-ribbon{position:absolute;bottom:0;left:36px;right:36px;background:#335d48;color:#fff1be;border:1px solid #cbb574;padding:7px 12px;font-size:14px;font-weight:700;letter-spacing:3px;border-radius:8px;box-shadow:0 4px 0 #233f32}
html[data-view=result] .result h1{font-size:clamp(24px,3.5vw,34px);color:#294b3e}
html[data-view=result] .big-stars{display:flex;gap:14px;color:#d3a135;font-size:40px;text-shadow:0 3px 0 #b4822d}
.big-stars span{display:inline-block;animation:reward-star .65s both;animation-delay:calc(var(--star)*180ms)}
html[data-view=result] .result-rewards{max-width:600px;gap:14px}
html[data-view=result] .result-rewards>span{padding:18px 12px;background:#fffbed;border:1px solid #ddcf9d;box-shadow:0 4px 0 #e6dcc0;gap:8px;align-items:center;font-size:14px;border-radius:18px}
.reward-symbol{font-style:normal;color:#b18832;font-size:28px;line-height:28px}
html[data-view=result] .result-rewards b{font-size:30px;color:#346a4b}
html[data-view=result] .reward-message{font-size:16px;line-height:1.7}
.reward-saved{font-size:12px;color:#768064}
html[data-view=result] .result-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;padding-top:8px}
html[data-view=result] .result-actions .primary{grid-column:1/-1;font-size:17px;min-height:52px}
html[data-view=result] .result-actions button{min-height:48px;padding:10px;font-size:14px}
html[data-view=result] .story-bonus{margin-top:4px!important;padding:18px;background:#eaf0de;border:1px dashed #aebf91;gap:16px}
html[data-view=result] .story-bonus h2{font-size:18px}
html[data-view=task] #feedback.discovery-success{border:1px solid #bbcc9f;border-radius:22px;background:linear-gradient(130deg,#fffdf3,#edf3df);box-shadow:0 10px 30px #25433118;padding:22px;display:flex;flex-direction:column;align-items:center;gap:10px;text-align:center;animation:discovery-arrive .4s ease-out}
.discovery-seal{display:grid;place-items:center;flex:none;width:44px;height:44px;border-radius:50%;background:#3b7651;color:#fff4c9;font-size:26px;box-shadow:0 0 0 5px #dae6c5}
.discovery-label{font-size:12px;color:#718359;letter-spacing:2px;margin-top:4px}
html[data-view=task] #feedback.discovery-success>strong{font-size:20px;line-height:1.5}
html[data-view=task] #feedback.discovery-success>p{margin:0;font-size:18px}
html[data-view=task] #feedback.discovery-success .world-celebration{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap;width:100%;margin:4px 0 0;padding:12px;border:0;border-top:1px dashed #c9d3b7;border-radius:0;background:transparent;font-size:14px;color:#58704c}
.discovery-sparkles{color:#b28c35;letter-spacing:6px;animation:reward-star .7s both}.discovery-sparkles i{font-style:normal;font-size:24px}
@keyframes reward-star{from{opacity:0;transform:translateY(12px) scale(.65) rotate(-15deg)}to{opacity:1;transform:translateY(0) scale(1) rotate(0)}}
@keyframes discovery-arrive{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
@media(max-width:600px){html[data-client][data-view=result] #game{padding:20px 12px!important}html[data-client][data-view=result] .result{padding:24px 16px;gap:14px!important;border-radius:24px}html[data-view=result] .result-art{height:155px}.reward-companion .companion-art{width:112px;height:140px}html[data-view=result] .result-rewards{gap:10px}html[data-view=result] .result-rewards>span{padding:12px 6px;font-size:12px}html[data-view=result] .result-rewards b{font-size:25px}html[data-view=result] .result-actions{grid-template-columns:repeat(2,minmax(0,1fr))}html[data-view=result] .result-actions button:last-child{grid-column:1/-1}html[data-view=task] #feedback.discovery-success{padding:16px}html[data-view=task] #feedback.discovery-success>strong{font-size:17px}}
@media(prefers-reduced-motion:reduce){.big-stars span,.discovery-sparkles,html[data-view=task] #feedback.discovery-success{animation:none!important}}
/* Material gains float above controls instead of compressing the companion. */
#toast.reward-toast{top:auto;bottom:var(--reward-bottom,100px);width:max-content;max-width:min(620px,calc(100vw - 32px));padding:14px 16px;border-radius:18px;background:#fffdf2f5;box-shadow:0 8px 28px #294b3e24;transform:translate(-50%,8px);transition:opacity .25s,transform .25s}
#toast.reward-toast.show{transform:translate(-50%,0)}
#toast.reward-toast .reward-toast-heading{display:flex;gap:20px;margin-bottom:10px}
#toast.reward-toast .reward-toast-items{display:flex;flex-wrap:wrap;justify-content:center;gap:8px}
#toast.reward-toast .reward-toast-item{display:flex;flex-direction:row;align-items:center;gap:6px;padding:7px 9px;font-size:13px;white-space:nowrap}
#toast.reward-toast .reward-toast-item b{font-size:14px}
#toast.reward-toast .reward-toast-heading strong{font-size:14px}
@media(max-width:600px){#toast.reward-toast{width:calc(100vw - 32px);padding:12px}#toast.reward-toast .reward-toast-items{gap:8px}#toast.reward-toast .reward-toast-item{font-size:12px;padding:6px 8px}}
@media(prefers-reduced-motion:reduce){#toast.reward-toast{transition:none}}

/* Task controls belong to the scene and never cover teaching feedback. */
html[data-client][data-view=task],html[data-client][data-view=task] body{height:auto!important;min-height:100dvh!important;overflow-y:auto!important}
html[data-client][data-view=task] #game{height:auto!important;max-height:none!important;overflow:visible!important;padding-bottom:24px!important}
html[data-client][data-client][data-view=task] .task-layout{height:auto!important;max-height:none!important;align-items:stretch}
html[data-client][data-client][data-view=task] .scene{height:auto!important;max-height:none!important;min-height:0!important;overflow:visible!important;gap:16px;display:flex;flex-direction:column}
html[data-client][data-client][data-view=task] .board{flex:none!important;height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important}
html[data-client][data-client][data-view=task] #feedback:not(:empty){position:static!important;max-height:none!important;overflow:visible!important;width:100%;margin:0!important;flex:none}
html[data-client][data-client][data-view=task] .task-actions{position:static!important;inset:auto!important;transform:none!important;width:100%;height:auto;flex:none;margin:0!important;padding:16px 0 4px!important;background:transparent!important;border:0!important;border-top:1px solid #d6dec8!important;border-radius:0!important;box-shadow:none!important;display:flex;flex-wrap:wrap;justify-content:center;gap:12px!important}
html[data-client][data-view=task] .task-actions button{min-height:48px}
html[data-client][data-client][data-view=task] .guide{justify-content:center;gap:14px!important;overflow:visible!important}
html[data-client][data-client][data-view=task] .guide>small{margin:0!important}
html[data-client][data-client][data-view=task] .guide .companion-art{width:140px;max-width:100%;height:186px}
.scene .inline-material-gain{width:100%;padding:12px 14px;background:#eef3e2;border:1px solid #cfdbb9;border-radius:14px;box-shadow:none;margin:0;color:#365542}
.scene .inline-material-gain .reward-toast-heading{display:flex;gap:12px;margin-bottom:8px}
.scene .inline-material-gain .reward-toast-items{display:flex;flex-wrap:wrap;gap:8px}
.scene .inline-material-gain .reward-toast-item{flex-direction:row;white-space:nowrap;padding:6px 8px;font-size:12px}
.calculation-workbench{width:min(100%,390px);margin:0 auto;display:grid;gap:16px;text-align:center}
.calculation-workbench .calc-expression{font-size:24px;margin:0;color:#365542}
.calc-answers{display:grid;gap:12px;grid-template-columns:repeat(auto-fit,minmax(130px,1fr))}
.calc-answer{display:flex;flex-direction:column;gap:8px;min-height:74px;background:#fffcf3}
.calc-answer[aria-pressed=true]{border:2px solid #548160;background:#edf3de}
.calc-answer output{font-size:28px;font-weight:700}
.calc-keypad{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.calc-keypad button{min-height:48px;font-size:19px}
.calculation-workbench>small{font-size:13px;color:#6b795f}

html[data-client][data-client][data-view=task] .guide .pet-portrait{width:100%;min-width:0}
/* The completed task switches to its result; it does not stack two full boards. */
html[data-client=tablet][data-view=task] .board.solved { display:none!important; }
html[data-client=tablet][data-view=task] .scene:has(.board.solved) #feedback { flex:1;justify-content:center; }
.answer-review { overflow:auto;max-height:65dvh; }
.answer-review button { pointer-events:none; }
html[data-client=tablet][data-view=task] .scene:has(.board.solved) .story-map { display:none; }
html[data-client=tablet][data-client=tablet][data-view=task] #feedback.success { gap:8px;padding:16px; }
html[data-client=tablet][data-view=task] #feedback.success .discovery-seal { width:36px;height:36px;font-size:23px; }
