/* Soft candy materials are the approved game identity. Controls and type stay crisp. */
:root {
 color-scheme:light;
 --ink:#654767; --muted:#745967; --accent:#76528e; --cream:#fff8ed;
 --lilac:#e7d5ee; --peach:#f4d6c0; --gold:#a16d29; --focus:#795397;
 --pad-size:60px; --pad-gap:18px; --skill-width:62px;
 font-family:ui-rounded,"SF Pro Rounded","PingFang SC","Microsoft Yahei",system-ui,sans-serif;
 font-synthesis:none; -webkit-tap-highlight-color:transparent;
}
* { box-sizing:border-box }
html,body { margin:0;width:100%;height:100%;overflow:hidden;background:#fff5e6;overscroll-behavior:none }
body { touch-action:none;user-select:none }
button { font:inherit;cursor:pointer;touch-action:manipulation;border:0;color:inherit }
button,svg { flex-shrink:0 }
button:focus-visible,input:focus-visible { outline:3px solid var(--focus);outline-offset:4px }
button:disabled { cursor:default }
button:active:not(:disabled) { transform:translateY(2px) scale(.97) }
svg { width:24px;height:24px;display:block }
[hidden] { display:none!important }
::selection { background:#dfc7ed;color:var(--ink) }
input { caret-color:var(--accent) }
dialog,.result { scrollbar-width:thin;scrollbar-color:#c2a6cf var(--cream) }
dialog::-webkit-scrollbar,.result::-webkit-scrollbar { width:6px }
dialog::-webkit-scrollbar-thumb,.result::-webkit-scrollbar-thumb { background:#c2a6cf;border-radius:6px }
#game-shell { position:relative;width:100%;height:100dvh;overflow:hidden;color:var(--ink) }
#game { display:block;position:absolute;inset:0;touch-action:none }

/* Live play: the field leads, the goal and current score can be read at a glance. */
.hud { position:absolute;z-index:2;top:max(22px,env(safe-area-inset-top));left:max(32px,env(safe-area-inset-left));right:max(32px,env(safe-area-inset-right));display:flex;align-items:center;gap:24px;pointer-events:none }
.chapter { margin-right:auto;min-width:0 }
.chapter small { display:block;font-size:12px;font-weight:600;color:var(--muted);margin-bottom:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis }
.chapter h1 { font-size:23px;margin:0;letter-spacing:.02em;font-weight:750;white-space:nowrap;overflow:hidden;text-overflow:ellipsis }
.journey-counter { display:flex;flex-direction:column;align-items:flex-end;gap:4px;font-variant-numeric:tabular-nums }
.journey-counter b { font-size:23px;color:var(--accent) }
.journey-counter small,.sugar-counter small { display:block;font-size:11px;color:var(--muted);font-weight:500;white-space:nowrap }
.sugar-counter { display:flex;align-items:center;gap:8px;font-size:19px;font-variant-numeric:tabular-nums }
.sugar-counter b { display:block;font-weight:750;white-space:nowrap }
.sugar-counter small { margin-top:4px }
.sugar-counter>span { color:var(--gold) }
.sugar-counter svg { width:28px;height:28px;fill:#ffe4a0;stroke-width:1.5 }
.sugar-counter.goal-ready { color:#526e56 }
.sugar-counter.goal-ready small { color:#526e56;font-weight:700 }
.hud.collecting .journey-counter b,.hud.collecting .sugar-counter b { color:var(--gold) }
.round-button { pointer-events:auto;width:48px;height:48px;border-radius:50%;display:grid;place-items:center;background:var(--cream);box-shadow:0 4px 7px #b69a9636;color:var(--accent) }
.hint { position:absolute;z-index:1;top:87px;left:24px;right:24px;text-align:center;pointer-events:none;transition:opacity .2s ease-out }
.hint p { margin:0 }
.hint #story { font-size:13px;color:var(--muted);line-height:1.45 }
.hint #instruction { font-size:14px;font-weight:650;margin-top:5px;line-height:1.45 }
.hint.faded { opacity:0;visibility:hidden }
.gear-hud { position:absolute;z-index:2;top:calc(var(--board-top,150px) - 26px);left:50%;transform:translateX(-50%);display:flex;gap:10px;pointer-events:none;color:var(--accent) }
.gear-hud>span { display:flex;align-items:center;gap:3px;font-size:18px }
.gear-hud svg { width:18px;height:18px }
.gear-hud small { font-size:11px }

/* Controls: one continuous gesture surface, a centered cross, a separate ability column. */
.bottom-controls { position:absolute;z-index:2;bottom:calc(env(safe-area-inset-bottom) + 52px);left:48px;right:48px;display:flex;align-items:flex-end;justify-content:space-between;pointer-events:none }
.bottom-controls button { pointer-events:auto }
.touch-pad { display:none;grid-template:repeat(3,var(--pad-size))/repeat(3,var(--pad-size));gap:var(--pad-gap);pointer-events:auto;touch-action:none }
.touch-pad button { border-radius:20px;background:var(--cream);box-shadow:0 4px 6px #b79c9b36;color:var(--accent);display:grid;place-items:center;padding:0;touch-action:none }
.touch-pad svg { width:28px;height:28px;stroke-width:2.8 }
.touch-pad button[data-dir=up] { grid-area:1/2 }
.touch-pad button[data-dir=left] { grid-area:2/1 }
.touch-pad button[data-dir=right] { grid-area:2/3 }
.touch-pad button[data-dir=down] { grid-area:3/2 }
.touch-pad i { grid-area:2/2;border-radius:50%;background:#d9c2dc44;margin:19px }
.touch-pad button.pressed { background:#dfc7ef;color:#654278;transform:translateY(2px) scale(.97);box-shadow:0 2px 4px #ad8ebe45 }
.keyboard-note { font-size:12px;color:var(--muted);letter-spacing:.02em }
.skills { display:flex;gap:13px;align-items:center }
.skill { height:80px;min-width:74px;border-radius:25px;background:var(--lilac);box-shadow:0 5px 7px #ad8abe45;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;color:#684978;padding:8px }
.skill.peach { background:var(--peach);box-shadow:0 5px 7px #b9896945;color:#805037 }
.skill strong { font-size:12px }
.skill small { font-size:11px;font-weight:600;white-space:nowrap }
.skill:disabled { opacity:.62 }
.skill.active { background:#d1e6e7;color:#3f6876;box-shadow:0 5px 7px #87b0b145;opacity:1 }
.next-power { display:flex;gap:8px;align-items:center;font-size:11px;line-height:1.65;color:var(--muted) }
.next-power svg { width:26px;height:26px }
.passives { font-size:12px;display:flex;justify-content:flex-end;gap:12px;margin-bottom:14px;color:var(--muted);min-height:18px }
.passives span { display:flex;align-items:center;gap:3px;min-height:24px;padding:2px;border-radius:8px }
.passives svg { width:18px;height:18px }
.passives.magnet-flash [data-power=magnet],.passives[data-flash=thorn] [data-power=thorn],.passives[data-flash=shield] [data-power=shield] { color:var(--accent);background:#e6d2ef }
.small-brand { position:absolute;left:50%;bottom:15px;transform:translateX(-50%);font-size:10px;letter-spacing:.18em;color:var(--muted);pointer-events:none;white-space:nowrap }
.small-brand span { font-size:10px;letter-spacing:.08em;margin-left:5px }
#toast { position:absolute;z-index:4;left:50%;bottom:calc(env(safe-area-inset-bottom) + 6px);max-width:calc(100% - 24px);padding:5px 14px;font-size:12px;line-height:1.4;text-align:center;transform:translate(-50%,4px);opacity:0;transition:opacity .15s ease-out,transform .15s ease-out;pointer-events:none;border-radius:16px;background:var(--cream);box-shadow:0 3px 10px #bb9eb225;white-space:nowrap;color:var(--ink) }
#toast.show { opacity:1;transform:translate(-50%,0) }
#toast.show~.small-brand { opacity:0 }
.guard { position:absolute;z-index:3;top:90px;left:0;right:0;text-align:center;font-size:13px;font-weight:650;color:var(--ink);background:#fff8ecef;padding:11px 10px }
#save-status { position:absolute;bottom:6px;left:0;right:0;margin:0;text-align:center;color:#885948;font-size:11px }

/* Arrival remains immediate: automatic 3/2/1, without a blocking tutorial. */
.countdown { position:absolute;z-index:5;top:var(--board-top,138px);left:0;right:0;height:var(--board-height,400px);display:flex;flex-direction:column;align-items:center;justify-content:center;pointer-events:none;color:var(--accent) }
.countdown>span { display:grid;place-items:center;min-width:118px;height:118px;padding:0 23px;border-radius:50%;background:#fff8e9ed;box-shadow:0 8px 16px #b090aa25;font-size:76px;font-weight:800;line-height:1 }
.countdown>small { margin-top:21px;max-width:calc(100% - 32px);font-size:13px;font-weight:650;color:var(--ink);background:#fff8eccc;padding:7px 14px;border-radius:20px;text-align:center;line-height:1.5 }
.audio-unlock { position:absolute;z-index:6;bottom:calc(env(safe-area-inset-bottom) + 96px);left:max(48px,env(safe-area-inset-left));width:44px;height:44px;border-radius:50%;padding:10px;background:var(--cream);color:var(--accent);box-shadow:0 3px 8px #bb9eb225 }

/* Result path: outcome, next action, consequences. Developer notes stay out of play. */
.overlay { position:absolute;inset:0;z-index:8;background:#f9eedead;display:grid;place-items:center;padding:24px }
.result { text-align:center;max-width:370px;width:100%;padding:26px 24px 20px;border-radius:32px;background:var(--cream);box-shadow:0 20px 60px #95758130;max-height:calc(100dvh - 40px);overflow:auto;touch-action:pan-y;overscroll-behavior:contain }
.result h2 { font-size:26px;margin:12px 0 10px;color:var(--ink);font-weight:750;line-height:1.3;text-wrap:balance }
.result h2:focus { outline:none }
.result p { font-size:13px;line-height:1.65;color:var(--muted);margin:12px 0 }
.result .eyebrow { font-size:12px;color:var(--muted) }
.result-mark { display:grid;place-items:center;width:48px;height:48px;margin:0 auto 12px;border-radius:50%;background:#ffecc0;color:var(--gold) }
.result-mark svg { width:28px;height:28px;fill:#ffdf90 }
.result .result-reason { margin:0 0 16px }
.score-total { font-size:38px;font-weight:750;color:var(--accent);font-variant-numeric:tabular-nums;line-height:1.1 }
.score-total small { display:block;font-size:12px;font-weight:500;color:var(--muted);margin-top:7px;line-height:1.5 }
.result .personal-best { font-size:12px;margin:8px 0 20px }
.result .restart-rule { font-size:12px;margin:16px 0;line-height:1.8 }
.restart-rule strong { font-size:14px;color:var(--ink);font-weight:650 }
.primary,.secondary { width:100%;padding:14px 12px;border-radius:18px;font-size:14px;font-weight:650;min-height:48px;margin-top:10px }
.primary { background:var(--accent);color:#fffaff;box-shadow:0 4px 9px #76528e26 }
.secondary { background:#efe2ec;color:var(--ink) }
.primary:disabled { opacity:.72 }
.quiet { background:none;padding:12px 8px;font-size:13px;color:var(--accent);min-height:44px }
.result .fine { font-size:12px;line-height:1.5;color:var(--muted);margin:9px 0 }
.result-actions { display:flex;justify-content:center;gap:10px;margin-top:7px }
.result .request-feedback { color:#885948;font-size:13px }
.result .reward { font-size:18px;font-weight:700;display:flex;justify-content:center;align-items:center;gap:9px;color:var(--accent);margin-top:22px }
.result .reward svg { width:28px;height:28px }
.result .next-route { font-size:12px;color:var(--ink);line-height:1.7;margin-top:18px }
.reward-instruction { color:var(--accent);font-weight:700 }
.result.reward-result { max-width:670px }
.choice-grid { display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-top:20px;touch-action:pan-y }
.choice { background:#f2e4ed;border-radius:22px;display:flex;flex-direction:column;align-items:center;padding:18px 12px;gap:9px;text-align:center;min-height:210px }
.choice:focus-visible { outline-offset:1px }
.choice strong { font-size:15px;color:var(--accent) }
.choice>span:not(.charm-symbol) { font-size:13px;line-height:1.55;color:var(--muted) }
.choice small { font-size:12px;color:var(--muted) }
.choice em { font-size:12px;font-style:normal;color:#805037 }
.charm-symbol { height:36px;font-size:32px;color:var(--accent);display:grid;place-items:center }
.charm-symbol svg { width:31px;height:31px }
.replacement-grid button { font-size:13px }

dialog { width:min(460px,calc(100% - 28px));max-height:85dvh;border:0;border-radius:30px;background:var(--cream);color:var(--ink);padding:28px;box-shadow:0 20px 60px #8e758643;overscroll-behavior:contain;touch-action:pan-y;overflow-x:hidden }
dialog::backdrop { background:#b59ba480 }
dialog h2 { margin:0 0 20px;font-size:22px }
dialog h3 { font-size:14px;margin:23px 0 10px }
dialog p { font-size:13px;color:var(--muted);line-height:1.7 }
.close { position:absolute;right:14px;top:11px;background:transparent;font-size:28px;width:44px;height:44px;color:var(--accent) }
.ability-list { display:grid;gap:9px }
.ability-list article { font-size:13px;line-height:1.7;color:var(--muted) }
.ability-list strong { color:var(--ink) }
.setting { display:flex;align-items:center;justify-content:space-between;background:#efe2eb;border-radius:16px;padding:13px 14px;width:100%;margin-top:9px;text-align:left;font-size:13px;min-height:46px }
.local-stats { display:grid;grid-template-columns:repeat(3,1fr);gap:10px;text-align:center;font-variant-numeric:tabular-nums }
.local-stats b { display:block;font-size:21px;margin-bottom:5px }
.local-stats small { font-size:12px;color:var(--muted) }
.practice-picker { display:flex;gap:10px;align-items:center }
.practice-picker input { flex:0 0 64px;width:64px;min-width:0;border:0;border-radius:15px;background:#f0e3eb;color:var(--ink);padding:13px;font:inherit;min-height:48px;user-select:text;touch-action:manipulation }
.practice-picker .secondary { flex:1;width:auto;min-width:0;margin:0 }

@media(hover:hover) {
 .primary:hover { background:#68447f }
 .secondary:hover,.choice:hover { background:#e5d2e9 }
 .quiet:hover { color:#533168;background:#f1e6ec;border-radius:12px }
 .touch-pad button:hover { background:#efdfef }
}
@media(pointer:coarse),(max-width:650px) {
 .hud { top:max(21px,env(safe-area-inset-top));left:max(16px,env(safe-area-inset-left));right:max(16px,env(safe-area-inset-right));gap:12px }
 .chapter h1 { font-size:18px }.chapter small { font-size:11px;letter-spacing:0 }
 .journey-counter b { font-size:20px }.journey-counter small,.sugar-counter small { font-size:11px }
 .sugar-counter { font-size:16px;gap:5px }.sugar-counter svg { width:24px;height:24px }
 .round-button { width:44px;height:44px }
 .hint { top:calc(max(21px,env(safe-area-inset-top)) + 65px);left:17px;right:17px }
 .hint #story { font-size:12px }.hint #instruction { font-size:13px }
 .touch-pad { display:grid }.keyboard-note { display:none }
 .bottom-controls { left:0;right:0;height:calc(var(--pad-size)*3 + var(--pad-gap)*2) }
 .direction-controls { position:absolute;left:50%;bottom:0;transform:translateX(-50%) }
 .right-controls { position:absolute;right:max(14px,env(safe-area-inset-right));bottom:4px;padding:0 }
 .skills { flex-direction:column;gap:8px }
 .skill { width:var(--skill-width);min-width:var(--skill-width);height:66px;border-radius:21px;padding:6px }
 .skill svg { width:21px;height:21px }
 .passives { position:absolute;bottom:100%;right:0;white-space:nowrap;gap:5px;margin-bottom:10px }
 .next-power { flex-direction:column;width:var(--skill-width);gap:5px;text-align:center;font-size:11px }
 .small-brand span { display:none }
 .audio-unlock { left:max(14px,env(safe-area-inset-left));bottom:calc(env(safe-area-inset-bottom) + 60px) }
 .overlay { padding:14px }.result { padding:24px 20px 18px }
 .choice-grid { grid-template-columns:1fr;gap:9px;margin-top:14px }
 .choice { display:grid;grid-template-columns:38px 1fr;gap:4px 10px;min-height:100px;padding:12px 15px;text-align:left;align-items:center }
 .charm-symbol { grid-row:1/4;align-self:center }
 .choice small,.choice strong,.choice>span:not(.charm-symbol),.choice em { grid-column:2 }
 .choice>span:not(.charm-symbol) { font-size:12px }.choice strong { font-size:14px }
 .result.reward-result { padding:20px 18px }.result.reward-result h2 { font-size:23px;margin:8px 0 }
}
@media(max-width:389px) {
 :root { --pad-size:56px;--pad-gap:16px;--skill-width:56px }
 .right-controls { right:max(10px,env(safe-area-inset-right)) }.touch-pad i { margin:17px }
}
@media(max-width:360px) {
 :root { --pad-size:52px;--skill-width:48px }
 .hud { left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right));gap:8px }
 .chapter h1 { font-size:16px }.chapter small { font-size:11px }
 .journey-counter b { font-size:18px }.sugar-counter { font-size:14px;gap:3px }.sugar-counter svg { width:20px;height:20px }
 .right-controls { right:max(8px,env(safe-area-inset-right)) }.touch-pad i { margin:15px }
 .hint #story { font-size:11px }.hint #instruction { font-size:12px }
 .result { padding:20px 16px 16px }.result h2 { font-size:22px }.score-total { font-size:32px }
 .result-actions { gap:4px }.quiet { font-size:12px }
 .choice { min-height:96px }.result.reward-result { padding:16px }
 #toast { white-space:normal;width:max-content }
}
@media(max-height:650px) and (max-aspect-ratio:1/1) {
 .countdown>span { min-width:80px;height:80px;font-size:54px }
 .countdown>small { margin-top:12px;font-size:12px;padding:5px 12px }
}
@media(max-height:600px) and (min-aspect-ratio:4/3) {
 .hud { top:max(10px,env(safe-area-inset-top));left:max(20px,env(safe-area-inset-left));right:max(20px,env(safe-area-inset-right));gap:12px }
 .chapter h1 { font-size:17px }.chapter small { font-size:11px;margin-bottom:3px }
 .journey-counter b { font-size:18px }.sugar-counter { font-size:15px }.sugar-counter svg { width:24px;height:24px }
 .round-button { width:44px;height:44px }
 .hint { top:15px;left:200px;right:210px }.hint #story { display:none }.hint #instruction { font-size:11px;max-width:300px;margin:0 auto }
 .bottom-controls { left:0;right:0;height:110px;bottom:calc(env(safe-area-inset-bottom) + 36px) }
 .direction-controls { position:absolute;left:50%;bottom:0;transform:translateX(-50%) }
 .touch-pad { display:grid;grid-template:repeat(2,48px)/repeat(3,56px);gap:14px 16px }
 .touch-pad button[data-dir=down] { grid-area:2/2 }.touch-pad i,.keyboard-note,.small-brand { display:none }
 .right-controls { position:absolute;right:max(14px,env(safe-area-inset-right));bottom:4px }
 .skills { flex-direction:row;gap:8px }.skill { min-width:62px;width:62px;height:66px }
 .passives { position:absolute;bottom:100%;right:0;white-space:nowrap;margin-bottom:8px }
 .gear-hud { top:60px;left:80px }
 .overlay { padding:10px }.result { padding:14px 22px;max-width:410px;max-height:calc(100dvh - 20px) }
 .result h2 { margin:6px 0;font-size:22px }.result p { margin:7px 0;font-size:12px }
 .result-mark { width:36px;height:36px;margin-bottom:6px }.result-mark svg { width:23px;height:23px }
 .score-total { font-size:28px }.score-total small { margin-top:3px }
 .result .personal-best { margin:6px 0 }.result .restart-rule { margin:8px 0;line-height:1.6 }
 .primary,.secondary { padding:10px;min-height:44px;margin-top:7px }
 .result-actions { margin:0 }.quiet { padding:8px;min-height:44px }
 .choice-grid { grid-template-columns:repeat(3,1fr) }.choice { display:flex;min-height:156px;padding:10px;gap:6px }
 .result.reward-result { max-width:630px;padding:14px }.result.reward-result p { font-size:12px }
 .charm-symbol { font-size:26px;height:28px }
 .audio-unlock { bottom:calc(env(safe-area-inset-bottom) + 52px);left:max(32px,env(safe-area-inset-left)) }
 .countdown { top:0;height:100%;justify-content:flex-start;padding-top:60px }
 .countdown>span { min-width:88px;height:88px;font-size:54px }
 .countdown>small { position:absolute;top:75px;right:max(16px,env(safe-area-inset-right));max-width:160px;margin-top:0 }
 .guard { top:60px }.guard,#toast { font-size:11px }
}
@media(prefers-reduced-motion:reduce) {
 * { transition:none!important;scroll-behavior:auto!important }
 .touch-pad button.pressed,button:active:not(:disabled) { transform:none }
}
