/* Storybook economy deck. Fixed 1600x900 stage, scaled to fit.
   One world per story: garden sky -> warm bakery -> building site -> night lab. */
:root {
  --ink: #1d2b45;
  --ink-soft: #4b5b7a;
  --white: #ffffff;
  --frame: #142036;
  --sky1: #a9dcf3;
  --sky2: #eaf7fd;
  --grass: #6cc25a;
  --grass-dark: #3d8f3a;
  --soil: #8a5a3c;
  --gold: #f6b52b;
  --gold-hi: #ffe79a;
  --gold-dark: #b07a08;
  --earn: #f2a900;
  --spend: #e35a46;
  --save: #179c86;
  --invest: #2f74d8;
  --return: #3aa845;
  --bakery1: #ffd9b8;
  --bakery2: #fff1e4;
  --site1: #cfd8e3;
  --site2: #f1f4f8;
  --lab1: #13203a;
  --lab2: #24365c;
  --cyan: #5fe1ff;
  --display: "Fredoka", "Baloo 2", "Trebuchet MS", "Segoe UI", sans-serif;
  --body: "Nunito", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --emoji: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
.house .rf, .house .rf::after { box-sizing: content-box; }
html, body { height: 100%; }
body { background: var(--frame); color: var(--ink); font-family: var(--body); overflow: hidden; }

#deck { position: fixed; inset: 0; background: var(--frame); }
#stage {
  position: absolute; left: 50%; top: 50%; width: 1600px; height: 900px;
  transform: translate(-50%, -50%) scale(var(--k, .5));
  transform-origin: center center;
}

/* ---------- slides ---------- */
.slide {
  position: absolute; inset: 0; overflow: hidden; border-radius: 6px;
  background: linear-gradient(180deg, var(--sky1), var(--sky2) 70%);
  opacity: 0; visibility: hidden; transition: opacity .5s ease, visibility 0s linear .5s;
}
.slide.active { opacity: 1; visibility: visible; transition: opacity .5s ease; }
.slide.bakery { background: radial-gradient(circle at 70% 10%, var(--bakery2), var(--bakery1) 75%); }
.slide.site { background: linear-gradient(180deg, var(--site1), var(--site2) 75%); }
.slide.lab { background: radial-gradient(circle at 75% 15%, var(--lab2), var(--lab1) 70%); color: var(--white); }
.slide.lab .sub, .slide.lab .muted { color: #b9c8e6; }
.slide .notes { display: none; }

.ground { position: absolute; left: -40px; right: -40px; bottom: -60px; height: 190px; border-radius: 50% 50% 0 0 / 40% 40% 0 0; background: var(--grass); box-shadow: inset 0 18px 0 rgba(255,255,255,.25); }
.ground.dirt { background: #d9c3a3; }
.sun { position: absolute; right: 90px; top: 60px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #fff3b0, #ffcf3a); box-shadow: 0 0 0 18px rgba(255,214,70,.25), 0 0 0 40px rgba(255,214,70,.12); animation: spin-glow 6s ease-in-out infinite; }
.cloud { position: absolute; width: 180px; height: 56px; background: #fff; border-radius: 40px; opacity: .9; animation: drift 40s linear infinite; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 80px; height: 80px; left: 28px; top: -40px; }
.cloud::after { width: 60px; height: 60px; left: 92px; top: -26px; }
.stars { position: absolute; inset: 0; background-image: radial-gradient(2px 2px at 10% 20%, #fff8, transparent), radial-gradient(2px 2px at 30% 70%, #fff6, transparent), radial-gradient(2px 2px at 55% 15%, #fff9, transparent), radial-gradient(2px 2px at 80% 60%, #fff6, transparent), radial-gradient(2px 2px at 90% 30%, #fff8, transparent), radial-gradient(2px 2px at 45% 85%, #fff5, transparent); }
@keyframes drift { from { transform: translateX(-300px); } to { transform: translateX(1900px); } }
@keyframes spin-glow { 50% { box-shadow: 0 0 0 26px rgba(255,214,70,.25), 0 0 0 54px rgba(255,214,70,.1); } }

/* ---------- type ---------- */
h1, h2, h3, .display { font-family: var(--display); font-weight: 700; letter-spacing: -.5px; text-wrap: balance; margin: 0; }
.slide h1 { font-size: 112px; line-height: 1; }
.slide h2 { font-size: 72px; line-height: 1.05; }
.slide h3 { font-size: 40px; line-height: 1.1; }
.sub { font-size: 36px; color: var(--ink-soft); font-weight: 700; margin: 0; }
.big { font-size: 44px; font-weight: 800; }
.muted { color: var(--ink-soft); }
.title-bar { position: absolute; left: 80px; top: 56px; right: 80px; display: flex; flex-direction: column; gap: 10px; }
.kicker { font-family: var(--display); font-size: 28px; font-weight: 600; text-transform: uppercase; letter-spacing: 3px; color: var(--ink-soft); }
.lab .kicker { color: var(--cyan); }
.em { font-size: 1.1em; font-family: var(--emoji); font-style: normal; line-height: 1; }
.hl { padding: 0 .2em; border-radius: .2em; }
.c-earn { color: var(--earn); } .c-spend { color: var(--spend); } .c-save { color: var(--save); } .c-invest { color: var(--invest); } .c-return { color: var(--return); }
.bg-earn { background: var(--earn); } .bg-spend { background: var(--spend); } .bg-save { background: var(--save); } .bg-invest { background: var(--invest); } .bg-return { background: var(--return); }

/* ---------- step reveal ---------- */
.fx { opacity: 0; transform: translateY(24px) scale(.92); transition: opacity .55s ease, transform .6s cubic-bezier(.3,1.5,.5,1); }
.fx.on { opacity: 1; transform: none; }
.fx.fade { transform: none; }
.fx.left { transform: translateX(-120px); } .fx.right { transform: translateX(160px); }
.fx.left.on, .fx.right.on { transform: none; }
.fx.zoom { transform: scale(.2); } .fx.zoom.on { transform: none; }
.fx.on.bounce { animation: bounce .8s cubic-bezier(.3,1.6,.5,1); }
@keyframes bounce { 0% { transform: scale(.3); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.wiggle { display: inline-block; animation: wiggle 1.6s ease-in-out infinite; }
@keyframes wiggle { 0%,100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
.float { animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-14px); } }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* ---------- coins & zones ---------- */
.coin {
  position: absolute; left: 0; top: 0; width: 58px; height: 58px; border-radius: 50%; z-index: 30;
  background: radial-gradient(circle at 35% 30%, var(--gold-hi), var(--gold) 55%, #d89a12);
  border: 3px solid var(--gold-dark); box-shadow: 0 4px 0 var(--gold-dark), 0 8px 14px rgba(0,0,0,.18);
  display: grid; place-items: center; font: 800 30px/1 var(--display); color: #8a5a00;
  transition: transform 1s cubic-bezier(.45,-.25,.35,1.35), opacity .45s ease;
  pointer-events: none;
}
.coin::after { content: "$"; }
.coin.hide { opacity: 0; }
.coin.shine { animation: shine 1.2s ease-out; }

.zone {
  position: absolute; display: flex; flex-direction: column; gap: 10px; align-items: stretch;
  background: rgba(255,255,255,.88); border: 5px solid var(--ink); border-radius: 28px;
  padding: 14px 18px 18px; box-shadow: 0 10px 0 rgba(29,43,69,.12);
}
.lab .zone { background: rgba(255,255,255,.08); border-color: var(--cyan); color: var(--white); }
.zone .tag { align-self: flex-start; font: 700 26px/1 var(--display); color: #fff; padding: 8px 16px 9px; border-radius: 999px; background: var(--ink); letter-spacing: .5px; }
.zone .what { font-size: 24px; font-weight: 800; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.zone .what .em { font-size: 44px; }
.zone .slots { flex: 1; min-height: 70px; }
.zone.earn { border-color: var(--earn); } .zone.earn .tag { background: var(--earn); }
.zone.spend { border-color: var(--spend); } .zone.spend .tag { background: var(--spend); }
.zone.save { border-color: var(--save); } .zone.save .tag { background: var(--save); }
.zone.invest { border-color: var(--invest); } .zone.invest .tag { background: var(--invest); }
.zone.return { border-color: var(--return); } .zone.return .tag { background: var(--return); }

/* savings jar */
.jar { border-radius: 30px 30px 60px 60px; background: linear-gradient(90deg, rgba(23,156,134,.08), rgba(255,255,255,.9) 40%, rgba(23,156,134,.12)); }
.jar::before { content: ""; position: absolute; left: 22%; right: 22%; top: -24px; height: 22px; border-radius: 10px 10px 4px 4px; background: var(--save); }

/* flow arrow */
.arrow { position: absolute; height: 14px; background: var(--ink); border-radius: 7px; transform-origin: left center; }
.arrow::after { content: ""; position: absolute; right: -14px; top: -11px; border: 18px solid transparent; border-left: 24px solid var(--ink); border-right: 0; }
.arrow.dash { background: repeating-linear-gradient(90deg, var(--ink) 0 26px, transparent 26px 40px); }

/* bubble / cards */
.bubble { position: absolute; background: #fff; color: var(--ink); border: 5px solid var(--ink); border-radius: 30px; padding: 22px 30px; font-size: 34px; font-weight: 800; box-shadow: 0 10px 0 rgba(29,43,69,.12); }
.bubble.tail-l::after { content: ""; position: absolute; left: 40px; bottom: -34px; border: 18px solid transparent; border-top: 26px solid var(--ink); }
.card { background: #fff; border: 5px solid var(--ink); border-radius: 28px; padding: 24px; box-shadow: 0 10px 0 rgba(29,43,69,.12); }
.lab .card { background: rgba(255,255,255,.08); border-color: var(--cyan); color: #fff; box-shadow: 0 0 30px rgba(95,225,255,.15); }
.challenge { position: absolute; background: #fff4d6; border: 5px dashed var(--spend); border-radius: 24px; padding: 18px 26px; font-size: 30px; font-weight: 800; display: flex; gap: 16px; align-items: center; }
.challenge .em { font-size: 54px; }
.challenge small { display: block; font-size: 22px; font-weight: 700; color: var(--ink-soft); }
.question { position: absolute; background: var(--ink); color: #fff; border-radius: 26px; padding: 18px 30px; font: 600 34px/1.2 var(--display); display: flex; gap: 14px; align-items: center; }
.question .em { font-size: 46px; }

/* production steps */
.steps { position: absolute; display: flex; gap: 22px; }
.pstep { width: 200px; display: flex; flex-direction: column; align-items: center; gap: 8px; background: rgba(255,255,255,.9); border: 5px solid var(--ink); border-radius: 26px; padding: 16px 10px 14px; }
.pstep .em { font-size: 78px; display: block; }
.pstep b { font: 700 28px/1 var(--display); }
.pstep i { font-style: normal; font-size: 20px; color: var(--ink-soft); font-weight: 700; text-align: center; }
.pstep.on .em { animation: wiggle 1.4s ease-in-out infinite; }
.pnum { position: absolute; top: -18px; left: -14px; width: 46px; height: 46px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font: 700 26px/1 var(--display); }
.pstep { position: relative; }

/* people */
.av { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.av svg { display: block; overflow: visible; }
.av .nm { font: 700 26px/1.05 var(--display); text-align: center; white-space: nowrap; }
.av .rl { font-size: 19px; font-weight: 800; color: var(--ink-soft); text-align: center; white-space: nowrap; }
.lab .av .rl { color: #b9c8e6; }
.walk { animation: walk-bob .5s ease-in-out infinite; }
@keyframes walk-bob { 50% { transform: translateY(-6px) rotate(2deg); } }
.walker.fx { transform: translateX(420px); transition: opacity .3s, transform 2.2s cubic-bezier(.2,.7,.3,1); }
.walker.fx.on { transform: none; }

/* market stall */
.stall { position: absolute; width: 420px; height: 300px; }
.stall .roof { position: absolute; left: -20px; right: -20px; top: 0; height: 80px; border-radius: 16px 16px 30px 30px; background: repeating-linear-gradient(90deg, var(--spend) 0 52px, #fff 52px 104px); border: 5px solid var(--ink); }
.stall .post { position: absolute; top: 70px; width: 18px; height: 170px; background: #9b6a43; border: 4px solid var(--ink); }
.stall .counter { position: absolute; left: 0; right: 0; bottom: 0; height: 120px; background: #c98a5a; border: 5px solid var(--ink); border-radius: 12px; display: flex; justify-content: center; align-items: flex-start; gap: 6px; padding-top: 6px; }
.stall .counter .em { font-size: 58px; margin-top: -40px; }
.stall .sign { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); background: #fff; border: 4px solid var(--ink); border-radius: 12px; padding: 4px 18px; font: 700 28px/1.1 var(--display); white-space: nowrap; }

/* price tags */
.ptag { position: absolute; background: #fff; border: 5px solid var(--ink); border-radius: 14px 40px 40px 14px; padding: 10px 56px 10px 20px; white-space: nowrap; font: 700 44px/1 var(--display); }
.ptag::after { content: ""; position: absolute; right: 16px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; border: 4px solid var(--ink); background: var(--sky2); }

/* legend chips */
.chip { display: inline-flex; align-items: center; gap: 10px; padding: 8px 18px; border-radius: 999px; color: #fff; font: 700 30px/1 var(--display); }

/* compare bars */
.vs { position: absolute; display: flex; gap: 28px; align-items: flex-end; }
.vs .col { display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 800; font-size: 26px; }
.vs .stack { display: flex; flex-direction: column-reverse; gap: 6px; }
.vs .stack i { width: 48px; height: 48px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--gold-hi), var(--gold) 55%, #d89a12); border: 3px solid var(--gold-dark); }

/* cookie factory */
.belt { position: absolute; height: 150px; border-radius: 75px; background: #2b3d63; border: 6px solid var(--cyan); overflow: hidden; }
.belt .track { position: absolute; left: 0; top: 30px; display: flex; gap: 46px; animation: belt 7s linear infinite; }
.belt.on .track { animation-duration: 4.5s; }
.meter .fill.grow.on { width: 97% !important; }
.strike { position: relative; display: inline-block; }
.strike::after { content: ""; position: absolute; left: -6px; right: -6px; top: 50%; height: 10px; margin-top: -5px; background: var(--spend); border-radius: 5px; transform: rotate(-20deg) scaleX(0); transition: transform .5s ease .2s; }
.strike.on::after { transform: rotate(-20deg) scaleX(1); }
.people { display: flex; flex-wrap: wrap; gap: 4px; font-size: 34px; line-height: 1; }
.cookie { width: 86px; height: 86px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #f3c27a, #d8963f 70%); box-shadow: inset 0 0 0 5px #b87526; position: relative; flex: none; transition: background .6s, box-shadow .6s; }
.cookie::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(7px 7px at 30% 40%, #5a3416 60%, transparent 62%), radial-gradient(7px 7px at 62% 30%, #5a3416 60%, transparent 62%), radial-gradient(7px 7px at 55% 66%, #5a3416 60%, transparent 62%); }
.cookie.burnt { background: radial-gradient(circle at 30% 30%, #6b4a2f, #2a1a0e 75%); box-shadow: inset 0 0 0 5px #120a04; }
.belt.on .cookie.burnt { background: radial-gradient(circle at 30% 30%, #f3c27a, #d8963f 70%); box-shadow: inset 0 0 0 5px #b87526; }
@keyframes belt { from { transform: translateX(0); } to { transform: translateX(-528px); } }
.meter { position: absolute; display: flex; flex-direction: column; gap: 10px; }
.meter .bar { height: 40px; border-radius: 20px; background: rgba(255,255,255,.12); overflow: hidden; width: 520px; }
.meter .fill { height: 100%; border-radius: 20px; transition: width 1.4s cubic-bezier(.3,1,.4,1); }

/* scientific loop */
.loop { position: absolute; width: 560px; height: 560px; }
.loop .ring { position: absolute; inset: 70px; border-radius: 50%; border: 10px dashed rgba(95,225,255,.55); animation: rot 30s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.loop .node { position: absolute; width: 190px; text-align: center; transform: translate(-50%, -50%); }
.loop .node .em { font-size: 72px; display: block; }
.loop .node b { font: 700 30px/1.1 var(--display); color: #fff; }

/* family tree */
.gen { position: absolute; left: 60px; right: 60px; display: flex; justify-content: space-around; align-items: flex-end; }
.couple { display: flex; gap: 8px; align-items: flex-end; padding: 10px 18px; border-radius: 26px; background: rgba(255,255,255,.65); border: 4px solid rgba(29,43,69,.18); }
.kids-row { display: flex; gap: 2px; align-items: flex-end; }

/* quiz table */
.qtable { position: absolute; left: 70px; right: 70px; top: 200px; border-collapse: separate; border-spacing: 0 12px; font-size: 30px; }
.qtable th { font: 700 28px/1 var(--display); text-align: left; padding: 0 16px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 2px; }
.qtable td { background: rgba(255,255,255,.92); padding: 16px; font-weight: 800; border-top: 4px solid var(--ink); border-bottom: 4px solid var(--ink); }
.qtable td:first-child { border-left: 4px solid var(--ink); border-radius: 20px 0 0 20px; font-family: var(--display); font-weight: 700; }
.qtable td:last-child { border-right: 4px solid var(--ink); border-radius: 0 20px 20px 0; }
.qtable td .em { font-size: 38px; }
.qtable .ans { opacity: 0; transition: opacity .5s; } .qtable .ans.on { opacity: 1; }

/* three little pigs houses */
.house { position: absolute; width: 300px; }
.house .rf { width: 0; height: 0; border-left: 170px solid transparent; border-right: 170px solid transparent; border-bottom: 120px solid var(--ink); margin-left: -20px; position: relative; }
.house .rf::after { content: ""; position: absolute; left: -158px; top: 10px; border-left: 158px solid transparent; border-right: 158px solid transparent; border-bottom: 106px solid var(--rf, #c0392b); }
.house .bd { height: 180px; border: 5px solid var(--ink); border-top: 0; position: relative; }
.house .door { position: absolute; left: 50%; bottom: 0; width: 64px; height: 100px; margin-left: -32px; background: #6b3f22; border: 4px solid var(--ink); border-bottom: 0; border-radius: 32px 32px 0 0; }
.house .pig { position: absolute; right: -10px; bottom: -6px; font-size: 64px; }
.house.straw .bd { background: repeating-linear-gradient(0deg, #f4d35e 0 10px, #d9ad2b 10px 14px); }
.house.straw { --rf: #e9c046; }
.house.sticks .bd { background: repeating-linear-gradient(90deg, #a0703f 0 20px, #6e4724 20px 25px); }
.house.sticks { --rf: #8a5a30; }
.house.brick .bd { background-color: #c8553d; background-image: linear-gradient(#efe2d0 4px, transparent 4px), linear-gradient(90deg, #efe2d0 4px, transparent 4px); background-size: 64px 32px, 64px 32px; }
.house.brick { --rf: #8e2f20; }
.blow { transition: transform 1.6s cubic-bezier(.5,0,.8,.4), opacity 1.4s ease .3s; }
.blow.on { transform: translate(-260px, -520px) rotate(-70deg) scale(.6); opacity: 0; }
.shake.on { animation: shake .35s ease-in-out 4; }
@keyframes shake { 25% { transform: translateX(-8px) rotate(-1deg); } 75% { transform: translateX(8px) rotate(1deg); } }
.wind { position: absolute; font-size: 90px; }
.wind.on .em { animation: gust 1.2s ease-in-out infinite; display: inline-block; }
@keyframes gust { 0% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(-180px); opacity: 0; } }
.build { position: absolute; display: flex; flex-direction: column-reverse; gap: 4px; }
.build .row { display: flex; gap: 4px; }
.build .blk { width: 62px; height: 34px; background: #aeb7c2; border: 3px solid var(--ink); border-radius: 4px; box-shadow: inset 0 -6px 0 rgba(0,0,0,.12); }

/* photos */
.photo { position: absolute; border-radius: 24px; overflow: hidden; border: 6px solid #fff; box-shadow: 0 14px 30px rgba(0,0,0,.3); background: #0d1526; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 20px 14px; background: linear-gradient(transparent, rgba(0,0,0,.82)); color: #fff; font: 700 30px/1.15 var(--display); }
.photo .cap small { display: block; font: 700 20px/1.3 var(--body); color: #dfe8f7; }
.photo .credit { position: absolute; right: 10px; top: 8px; font-size: 13px; font-weight: 700; color: #fff; background: rgba(0,0,0,.45); padding: 3px 9px; border-radius: 8px; }
.stat { text-align: center; }
.stat b { display: block; font: 700 64px/1 var(--display); color: var(--gold); }
.stat span { font-size: 22px; font-weight: 800; }

/* cookie machine */
.mach-belt { position: absolute; height: 104px; border-radius: 52px; background: #2b3d63; border: 6px solid #8fa3c7; overflow: hidden; z-index: 2; }
.mach-belt .track { position: absolute; left: 0; top: 0; bottom: 0; display: flex; align-items: center; gap: 20px; animation: belt2 5s linear infinite; }
.mach-belt.on .track { animation-duration: 3.2s; }
.mach-belt .s { width: 120px; display: grid; place-items: center; flex: none; }
@keyframes belt2 { from { transform: translateX(-560px); } to { transform: translateX(0); } }
.ck { width: 80px; height: 80px; border-radius: 50%; position: relative; background: radial-gradient(circle at 30% 30%, #f3c27a, #d8963f 70%); box-shadow: inset 0 0 0 5px #b87526; transition: width .9s, height .9s, background .9s, box-shadow .9s; }
.ck::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background-image: radial-gradient(6px 6px at 30% 40%, #5a3416 60%, transparent 62%), radial-gradient(6px 6px at 62% 30%, #5a3416 60%, transparent 62%), radial-gradient(6px 6px at 55% 66%, #5a3416 60%, transparent 62%); }
.ck.big { width: 100px; height: 100px; } .ck.small { width: 52px; height: 52px; }
.ck.burnt { background: radial-gradient(circle at 30% 30%, #6b4a2f, #2a1a0e 75%); box-shadow: inset 0 0 0 5px #120a04; }
.ck.raw { background: radial-gradient(circle at 30% 30%, #fbecd0, #ecd3a4 75%); box-shadow: inset 0 0 0 4px #d4b47c; }
.mach-belt.on .ck { width: 80px; height: 80px; }
.mach-belt.on .ck.burnt { background: radial-gradient(circle at 30% 30%, #f3c27a, #d8963f 70%); box-shadow: inset 0 0 0 5px #b87526; }
.hopper { position: absolute; background: linear-gradient(180deg, #e9d3a8, #cfb07a); clip-path: polygon(0 0, 100% 0, 70% 100%, 30% 100%); display: grid; place-items: start center; padding-top: 22px; font: 700 26px/1 var(--display); color: #6b4a22; }
.cutter { position: absolute; background: linear-gradient(90deg, #aeb9cc, #e4eaf4, #aeb9cc); border: 5px solid #e5ecf7; border-radius: 10px; animation: press 1.25s ease-in-out infinite; z-index: 3; }
.mach-belt.on ~ .cutter { animation-duration: .8s; }
@keyframes press { 50% { transform: translateY(22px); } }
.oven2 { position: absolute; background: linear-gradient(#cdd6e5, #94a3bd); border: 6px solid #e5ecf7; border-radius: 26px; z-index: 5; box-shadow: 0 18px 30px rgba(0,0,0,.35); }
.oven2 .win { position: absolute; left: 30px; right: 30px; top: 36px; height: 110px; border-radius: 16px; border: 5px solid var(--ink); background: radial-gradient(circle at 50% 110%, #ffcf5a, #f0601e 45%, #4a1608 85%); animation: flicker 1.1s ease-in-out infinite; }
@keyframes flicker { 50% { filter: brightness(1.25); } }
.oven2 b { position: absolute; left: 0; right: 0; bottom: 20px; text-align: center; font: 700 34px/1 var(--display); color: var(--ink); letter-spacing: 4px; }
.ctrl { position: absolute; border-radius: 20px; padding: 14px 18px; z-index: 6; display: flex; gap: 14px; align-items: center; }
.ctrl.old { background: linear-gradient(#8e96a3, #666e7b); border: 5px solid #c3c9d3; color: #fff; }
.ctrl.old .dial { width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle, #333 30%, #ddd 32%); border: 4px solid #444; flex: none; }
.ctrl.ai { background: #0b1830; border: 5px solid var(--cyan); color: #fff; box-shadow: 0 0 40px rgba(95,225,255,.55); }
.ctrl b { font: 700 24px/1.05 var(--display); }
.ctrl small { display: block; font-size: 16px; font-weight: 700; color: #d7e2f5; }
.leave { transition: transform 1s cubic-bezier(.5,0,.8,.4), opacity .8s ease .2s; }
.leave.on { transform: translate(-60px, -260px) rotate(-18deg); opacity: 0; }
.sensor { position: absolute; z-index: 7; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sensor .em { font-size: 52px; filter: drop-shadow(0 0 10px rgba(95,225,255,.8)); }
.sensor .chip { font-size: 17px; padding: 5px 10px; background: var(--cyan); color: var(--ink); }
.beam { position: absolute; z-index: 4; background: linear-gradient(rgba(95,225,255,.55), rgba(95,225,255,.05)); clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%); animation: scan 1.6s ease-in-out infinite; }
@keyframes scan { 50% { opacity: .45; } }
.flow { fill: none; stroke: var(--cyan); stroke-width: 5; stroke-dasharray: 14 10; animation: dash .9s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -24; } }

/* ---------- controls ---------- */
#ui { position: fixed; right: calc(14px + env(safe-area-inset-right, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 8px; align-items: center; z-index: 100; opacity: .25; transition: opacity .3s; }
#ui:hover, #ui:focus-within, body.show-ui #ui { opacity: 1; }
#ui button { font: 700 15px/1 var(--body); color: #fff; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.3); border-radius: 10px; padding: 9px 12px; cursor: pointer; }
#ui button:hover { background: rgba(255,255,255,.28); }
#ui button:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
#count { color: #fff; font: 700 14px/1 var(--body); font-variant-numeric: tabular-nums; min-width: 64px; text-align: center; }
#progress { position: fixed; left: 0; bottom: 0; height: 5px; background: var(--gold); z-index: 99; transition: width .4s ease; }
#notes { position: fixed; left: calc(14px + env(safe-area-inset-left, 0px)); right: calc(14px + env(safe-area-inset-right, 0px)); bottom: calc(62px + env(safe-area-inset-bottom, 0px)); max-width: 900px; margin: 0 auto; background: rgba(13,21,38,.94); color: #f2f6ff; border: 1px solid rgba(255,255,255,.2); border-radius: 14px; padding: 16px 20px; font-size: 16px; line-height: 1.5; z-index: 101; max-height: 40vh; overflow: auto; }
#notes b { color: var(--gold); }
#help { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); background: rgba(13,21,38,.9); color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 14px; z-index: 102; transition: opacity .6s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .coin, .fx, .walker.fx { transition-duration: .2s !important; }
}
