:root{
  --cream:#F3E5C4;
  --cream-2:#EBD9B3;
  --cream-3:#E0CBA0;
  --chrome-1:#FFF7E4;
  --chrome-2:#D9CFBB;
  --chrome-3:#A89C86;
  --cocoa:#3E342C;
  --cocoa-soft:#5C4B3B;
  --tomato:#E4502B;
  --tomato-deep:#B93A1D;
  --teal:#17958F;
  --teal-deep:#0F6E69;
  --mustard:#F2B31F;
  --mustard-deep:#C98E12;
  --blue:#8FD0E8;
  --blue-dust:#A9C3D0;
  --green:#63B04A;
  --concrete:#C9BBA0;
  --num:'Chivo Mono',ui-monospace,monospace;
  --text:'Figtree',system-ui,sans-serif;
  --display:'Alfa Slab One',Georgia,serif;
  --fascia-h:clamp(66px,10.5vh,96px);
  --shadow-soft:0 10px 24px rgba(62,52,44,.28);
}

*{box-sizing:border-box;}
.hidden{display:none !important;}
html,body{height:100%;margin:0;overflow:hidden;background:#8FB9CE;}
body{
  font-family:var(--text);
  color:var(--cocoa);
  -webkit-font-smoothing:antialiased;
  user-select:none;-webkit-user-select:none;
  overscroll-behavior:none;
}
#sprite{position:absolute;width:0;height:0;overflow:hidden;}
svg{display:block;}

#app{position:fixed;inset:0;overflow:hidden;}
#scene{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none;}

.num{font-family:var(--num);font-variant-numeric:tabular-nums;letter-spacing:.01em;}

/* ------------------------------- HUD fascia ------------------------------ */
#hud{position:absolute;inset:0;pointer-events:none;}
#fascia{
  position:absolute;left:clamp(6px,1.2vw,18px);right:clamp(6px,1.2vw,18px);top:clamp(5px,1vh,12px);
  height:var(--fascia-h);
  background:
    linear-gradient(180deg,var(--chrome-1) 0%,var(--cream) 16%,var(--cream) 74%,var(--cream-2) 100%);
  border:3px solid rgba(62,52,44,.6);
  border-radius:16px;
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,.8),
    inset 0 -5px 0 rgba(168,156,134,.5),
    inset 0 0 0 2px rgba(255,255,255,.25),
    0 3px 0 rgba(62,52,44,.35),
    var(--shadow-soft);
  pointer-events:auto;
  z-index:6;
}
.fascia-sheen{
  position:absolute;inset:5px 8px auto;height:34%;border-radius:10px;
  background:linear-gradient(180deg,rgba(255,255,255,.55),rgba(255,255,255,0));
  pointer-events:none;
}
.fascia-inner{
  position:relative;height:100%;display:flex;align-items:center;gap:clamp(8px,1.4vw,22px);
  padding:0 clamp(12px,1.8vw,26px);
}
.fascia-stripe{
  position:absolute;left:10px;right:10px;bottom:5px;height:5px;border-radius:3px;
  background:linear-gradient(90deg,var(--teal) 0 46%,var(--mustard) 46% 100%);
  opacity:.9;
}
.rivet{
  position:absolute;width:9px;height:9px;border-radius:50%;top:50%;transform:translateY(-50%);
  background:radial-gradient(circle at 35% 30%,#FFF9EA,#CDBFA6 60%,#9A8C74);
  box-shadow:0 1px 1px rgba(62,52,44,.5),inset 0 -1px 1px rgba(62,52,44,.4);
}
.rivet.r1{left:7px;}.rivet.r2{left:19px;}
.rivet.r3{right:7px;}.rivet.r4{right:19px;}
.rivet.r5,.rivet.r6,.rivet.r7,.rivet.r8{display:block;}
.rivet.r5{left:31px;}.rivet.r6{left:43px;}
.rivet.r7{right:31px;}.rivet.r8{right:43px;}

.plate-label{font-size:9px;letter-spacing:.18em;font-weight:800;color:#7A6A57;text-transform:uppercase;line-height:1;}

.money-plate{display:flex;align-items:center;gap:10px;min-width:0;}
.plate-icon{width:clamp(34px,4.6vh,46px);height:clamp(34px,4.6vh,46px);flex:0 0 auto;
  border-radius:50%;background:radial-gradient(circle at 35% 25%,#FBF0D6,#E3D2AE 70%,#CBB994);
  border:2px solid rgba(62,52,44,.5);display:grid;place-items:center;
  box-shadow:inset 0 -2px 3px rgba(62,52,44,.18),0 2px 4px rgba(62,52,44,.18);
}
.plate-icon svg{width:78%;height:78%;}
.plate-text{display:flex;flex-direction:column;gap:2px;min-width:0;}
#moneyValue{font-size:clamp(20px,3.4vh,31px);font-weight:700;color:var(--cocoa);line-height:1;text-shadow:0 1px 0 rgba(255,255,255,.7);}
#moneyValue.bump{animation:moneyBump .32s cubic-bezier(.3,1.8,.5,1);}
@keyframes moneyBump{0%{transform:scale(1);}45%{transform:scale(1.18);color:var(--teal);}100%{transform:scale(1);}}

.money-plate::after{
  content:"";width:10px;height:26px;border-radius:4px;margin-left:2px;
  background:linear-gradient(180deg,#6E6254,#4B4034 55%,#80725F);
  box-shadow:inset 0 0 0 2px rgba(255,255,255,.16),0 1px 2px rgba(0,0,0,.25);
}

.fuel-widget{display:flex;flex-direction:column;gap:4px;min-width:74px;padding-left:clamp(8px,1.2vw,18px);border-left:2px dashed rgba(62,52,44,.18);}
.fuel-head{display:flex;align-items:baseline;gap:8px;justify-content:space-between;}
#fuelValue{font-size:clamp(13px,1.9vh,17px);font-weight:700;}
.fuel-dial{position:relative;display:flex;align-items:flex-end;gap:6px;height:clamp(34px,5.6vh,52px);}
 .fuel-glass{
  position:relative;width:clamp(17px,2.3vh,23px);height:100%;border-radius:5px;
  background:linear-gradient(90deg,#EFE4CB,#FFF9EC 35%,#CDBFA6);
  border:2px solid rgba(62,52,44,.55);overflow:hidden;
  box-shadow:inset 0 2px 3px rgba(62,52,44,.22);
}
.fuel-fill{position:absolute;left:1px;right:1px;bottom:1px;height:100%;border-radius:3px;
  background:linear-gradient(180deg,#2CB8AF,#17958F 60%,#0F6E69);
  transition:height .25s ease,background .3s ease;
}
.fuel-fill.warn{background:linear-gradient(180deg,#FFD05A,#F2B31F 60%,#C98E12);}
.fuel-fill.crit{background:linear-gradient(180deg,#FF7C57,#E4502B 60%,#B93A1D);}
.fuel-dial.low .fuel-glass{animation:dialPulse 1s ease-in-out infinite;}
@keyframes dialPulse{0%,100%{box-shadow:inset 0 2px 3px rgba(62,52,44,.22);}50%{box-shadow:inset 0 2px 3px rgba(62,52,44,.22),0 0 0 3px rgba(228,80,43,.35);}}
.fuel-ticks{position:absolute;inset:2px 2px;display:flex;flex-direction:column;justify-content:space-between;}
.fuel-ticks i{height:1px;background:rgba(243,229,196,.75);width:100%;}
.fuel-cap{width:9px;height:9px;border-radius:50%;background:radial-gradient(circle at 35% 30%,#FFF9EA,#C7B99F);border:2px solid rgba(62,52,44,.5);margin-bottom:-2px;}

.level-widget{display:flex;align-items:center;gap:8px;padding-left:clamp(8px,1.2vw,18px);border-left:2px dashed rgba(62,52,44,.18);}
.star-badge{position:relative;width:clamp(40px,5.6vh,54px);height:clamp(40px,5.6vh,54px);display:grid;place-items:center;flex:0 0 auto;}
.star-shape{position:absolute;inset:12%;width:76%;height:76%;filter:drop-shadow(0 2px 1px rgba(62,52,44,.25));}
#levelValue{position:relative;font-size:clamp(14px,2.2vh,20px);font-weight:800;color:#4B3C2B;margin-top:1px;text-shadow:0 1px 0 rgba(255,255,255,.5);}
.lvl-ring{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg);}
.lvl-ring circle{fill:none;stroke-width:3.2;}
.lvl-ring circle:first-child{stroke:rgba(62,52,44,.16);}
.lvl-ring circle:last-child{stroke:var(--teal);stroke-linecap:round;stroke-dasharray:119.4;stroke-dashoffset:119.4;transition:stroke-dashoffset .6s ease;}
.level-text{display:flex;flex-direction:column;gap:3px;min-width:0;}
.mini{font-size:9px;color:#8A7963;letter-spacing:.02em;white-space:nowrap;}

.fascia-actions{margin-left:auto;display:flex;align-items:center;gap:clamp(5px,.8vw,10px);}
.btn-enamel{
  display:flex;align-items:center;gap:6px;border:2px solid rgba(62,52,44,.6);border-radius:11px;
  background:linear-gradient(180deg,#FFF6E1,#E9D7B2 65%,#D8C49C);
  color:var(--cocoa);font-family:var(--text);font-weight:800;font-size:12px;letter-spacing:.08em;
  padding:6px 10px 7px 7px;cursor:pointer;
  box-shadow:inset 0 2px 0 rgba(255,255,255,.8),inset 0 -3px 0 rgba(168,156,134,.35),0 3px 0 rgba(62,52,44,.25);
  transition:transform .1s ease,box-shadow .1s ease;
  touch-action:manipulation;
}
.btn-enamel svg{width:22px;height:22px;}
.btn-enamel:active{transform:translateY(2px);box-shadow:inset 0 2px 0 rgba(255,255,255,.7),0 1px 0 rgba(62,52,44,.25);}
.btn-enamel:hover{background:linear-gradient(180deg,#FFFCF0,#EEDDB9 65%,#DCC8A0);}
.btn-round{
  width:clamp(34px,4.4vh,42px);height:clamp(34px,4.4vh,42px);padding:0;flex:0 0 auto;
  border-radius:50%;border:2px solid rgba(62,52,44,.55);
  background:radial-gradient(circle at 35% 28%,#FFFBEF,#EDDCBA 60%,#D6C299);
  display:grid;place-items:center;cursor:pointer;
  box-shadow:inset 0 2px 1px rgba(255,255,255,.8),0 2px 0 rgba(62,52,44,.22);
  touch-action:manipulation;
}
.btn-round svg{width:64%;height:64%;}
.btn-round.off svg{opacity:.55;}

/* ---------------------------------- day pill ----------------------------- */
#dayPill{
  position:absolute;top:calc(var(--fascia-h) + clamp(12px,2vh,24px));left:50%;transform:translateX(-50%);
  display:flex;align-items:center;gap:7px;pointer-events:none;
  background:linear-gradient(180deg,#FFF7E2,#EAD8B5);
  border:2px solid rgba(62,52,44,.45);border-radius:999px;
  padding:4px 13px 5px;
  box-shadow:0 2px 0 rgba(62,52,44,.18),inset 0 1px 0 rgba(255,255,255,.8);
  font-size:10px;letter-spacing:.12em;color:#7A6A57;font-weight:700;
  z-index:5;
}
#dayValue{font-size:13px;color:var(--cocoa);font-weight:700;}
#servedValue{font-size:12px;color:var(--teal-deep);font-weight:700;}
.day-sep{width:1px;height:12px;background:rgba(62,52,44,.25);}
.day-pill-label{letter-spacing:.06em;}
.day-pill-k{letter-spacing:.14em;}

/* ---------------------------------- bubbles ------------------------------ */
#bubbles{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:4;}
.bubble{
  position:absolute;left:0;top:0;transform:translate(-50%,-100%);
  min-width:66px;padding:5px 8px 6px;text-align:center;
  border-radius:13px;
  background:linear-gradient(180deg,#FFF9E9,#F3E5C4 62%,#E9D6AF);
  border:2.5px solid var(--mustard);
  box-shadow:0 0 0 1.5px rgba(62,52,44,.55),0 6px 11px rgba(62,52,44,.2);
  transition:border-color .2s ease,background .2s ease,transform .12s ease;
  will-change:transform;
}
.bubble::after{content:"";position:absolute;left:50%;bottom:-7px;width:11px;height:8px;transform:translateX(-50%);
  background:var(--cream);border-left:2.5px solid var(--mustard);border-bottom:2.5px solid var(--mustard);
  border-radius:0 0 0 3px;box-shadow:0 1px 0 1px rgba(62,52,44,.45);}
.bubble .b-num{font-family:var(--num);font-weight:700;font-size:15px;line-height:1;color:var(--cocoa);white-space:nowrap;}
.bubble .b-unit{font-size:8px;font-weight:700;color:#7C6A55;margin-left:1px;}
.bubble .b-label{font-size:6.5px;letter-spacing:.12em;font-weight:800;color:#8A7659;margin-bottom:2px;}
.bubble .b-bar{position:relative;height:6px;margin-top:4px;border-radius:4px;background:#DCCBAA;box-shadow:inset 0 1px 2px rgba(62,52,44,.25);overflow:hidden;}
.bubble .b-bar i{position:absolute;left:0;top:0;bottom:0;width:0%;border-radius:4px;background:var(--mustard);transition:width .09s linear,background .2s ease;}
.bubble .b-target{position:absolute;top:-3px;bottom:-3px;width:3px;background:var(--cocoa);border-radius:2px;transform:translateX(-1px);box-shadow:0 0 0 1px rgba(243,229,196,.7);}
.bubble .b-chips{display:flex;gap:2px;justify-content:center;margin-top:3px;}
.bubble .chip{display:flex;align-items:center;justify-content:center;width:16px;height:16px;border-radius:50%;
  background:#EBD9B3;border:1.5px solid rgba(62,52,44,.3);}
.bubble .chip svg{width:12px;height:12px;}
.bubble .chip.done{background:#D9EDCB;border-color:#7AAE5F;}
.bubble .chip.hot{background:#FBD8C9;border-color:var(--tomato);}
.bubble.filling{border-color:var(--mustard-deep);}
.bubble.hot{border-color:var(--tomato);background:linear-gradient(180deg,#FFF0E7,#FBE0D2);}
.bubble.hot .b-bar i{background:var(--tomato);}
.bubble.over{border-color:var(--tomato);animation:bubbleShake .4s ease;}
@keyframes bubbleShake{0%,100%{margin-left:0;}25%{margin-left:-5px;}50%{margin-left:4px;}75%{margin-left:-2px;}}
.bubble.paid{border-color:var(--green);background:linear-gradient(180deg,#F6FFEF,#E4F3D8);}
.bubble.paid .b-num{color:#3C7A2E;font-size:11px;letter-spacing:.04em;}
.bubble.gone{opacity:0;transition:opacity .25s ease;}

/* ---------------------------------- floaters ----------------------------- */
#floaters{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:5;}
.floater{
  position:absolute;transform:translate(-50%,-50%);
  font-family:var(--num);font-weight:700;font-size:17px;color:#FFF9E9;
  text-shadow:0 2px 0 rgba(62,52,44,.65),0 0 8px rgba(62,52,44,.35);
  animation:floatUp 1.1s ease-out forwards;white-space:nowrap;
}
.floater.good{color:#E8FFD8;}
.floater.bad{color:#FFD2C2;}
@keyframes floatUp{0%{opacity:0;transform:translate(-50%,-30%) scale(.7);}18%{opacity:1;transform:translate(-50%,-60%) scale(1.06);}100%{opacity:0;transform:translate(-50%,-160%) scale(1);}}

/* ---------------------------------- coins -------------------------------- */
#coins{position:absolute;inset:0;pointer-events:none;z-index:8;overflow:hidden;}
.coin-flight{position:fixed;width:22px;height:22px;margin:-11px 0 0 -11px;will-change:transform;filter:drop-shadow(0 3px 3px rgba(62,52,44,.35));}

/* ---------------------------------- toasts ------------------------------- */
#toasts{position:absolute;top:calc(var(--fascia-h) + clamp(16px,2.6vh,30px));left:50%;transform:translateX(-50%);
  display:flex;flex-direction:column;gap:6px;align-items:center;z-index:7;pointer-events:none;}
.toast{
  background:linear-gradient(180deg,#FFF8E7,#EBDAB7);border:2px solid rgba(62,52,44,.5);
  border-radius:10px;padding:6px 14px 7px;font-size:12px;font-weight:700;letter-spacing:.02em;
  color:var(--cocoa);box-shadow:0 4px 14px rgba(62,52,44,.24);
  animation:toastIn .25s ease, toastOut .4s ease 2.2s forwards;max-width:min(88vw,440px);text-align:center;
}
.toast.warn{background:linear-gradient(180deg,#FFF1E8,#FAD9C9);border-color:rgba(228,80,43,.6);}
.toast.ok{background:linear-gradient(180deg,#F7FFEF,#DFF0CF);border-color:rgba(99,176,74,.6);}
@keyframes toastIn{from{opacity:0;transform:translateY(-8px) scale(.96);}to{opacity:1;transform:none;}}
@keyframes toastOut{to{opacity:0;transform:translateY(-6px);}}

/* ---------------------------------- controls ----------------------------- */
#controls{position:absolute;left:0;right:0;bottom:0;height:clamp(150px,24vh,230px);pointer-events:none;z-index:9;}
#stickWell{
  position:absolute;left:clamp(14px,2.4vw,34px);bottom:clamp(16px,3vh,34px);
  width:clamp(110px,15vh,150px);height:clamp(110px,15vh,150px);border-radius:50%;
  background:radial-gradient(circle at 50% 48%,#7E7261 0%,#51473B 46%,#3A322A 72%,#2C261F 100%);
  border:3px solid rgba(62,52,44,.6);
  box-shadow:inset 0 8px 16px rgba(23,19,15,.55),inset 0 -3px 2px rgba(255,244,222,.18),0 4px 0 rgba(62,52,44,.3),0 10px 22px rgba(62,52,44,.26);
  pointer-events:auto;touch-action:none;
}
.well-pool{position:absolute;inset:12%;border-radius:50%;background:radial-gradient(circle at 50% 60%,rgba(20,16,12,.55),rgba(20,16,12,0) 70%);}
#stickKnob{
  position:absolute;left:50%;top:50%;width:46%;height:46%;border-radius:50%;transform:translate(-50%,-50%);
  background:radial-gradient(circle at 36% 28%,#FFF9E7,#F0DFBC 52%,#D2BE95 82%,#B3A07A);
  border:2px solid rgba(62,52,44,.55);
  box-shadow:inset 0 2px 3px rgba(255,255,255,.8),inset 0 -5px 7px rgba(62,52,44,.22),0 6px 12px rgba(23,19,15,.4);
  will-change:transform;
}
.knob-cap{position:absolute;left:50%;top:38%;width:44%;height:14%;transform:translate(-50%,-50%);border-radius:50%;
  background:linear-gradient(180deg,#FFFCF0,#D9C9A7);opacity:.8;}
.knob-band{position:absolute;left:50%;top:50%;width:94%;height:26%;transform:translate(-50%,-50%);border-radius:50%;
  background:linear-gradient(180deg,#FFFDF4 0%,#CDBFA6 45%,#9A8C74 55%,#E6D8BB 100%);
  border-top:1px solid rgba(255,255,255,.7);opacity:.9;}
.knob-cross{position:absolute;inset:0;width:100%;height:100%;}

#controlHint{
  position:absolute;left:clamp(14px,2.4vw,34px);bottom:calc(clamp(16px,3vh,34px) + clamp(110px,15vh,150px) + 8px);
  display:flex;align-items:center;gap:4px;font-size:9px;letter-spacing:.1em;color:#FFF3D8;font-weight:700;
  text-shadow:0 1px 2px rgba(62,52,44,.7);pointer-events:none;flex-wrap:wrap;
}
.keycap{
  display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 4px;
  border-radius:5px;border:1.5px solid rgba(62,52,44,.65);
  background:linear-gradient(180deg,#FFFAEF,#E9D9B6 70%,#D6C49C);
  color:var(--cocoa);font-family:var(--num);font-size:10px;font-weight:700;
  box-shadow:0 2px 0 rgba(62,52,44,.4),inset 0 1px 0 rgba(255,255,255,.75);
  text-shadow:none;
}
.keycap.wide{min-width:46px;font-size:9px;letter-spacing:.06em;}
.hint-text{margin:0 4px 0 2px;opacity:.9;}

.action-btn{
  position:absolute;right:clamp(18px,3vw,44px);bottom:clamp(18px,3.4vh,38px);
  width:clamp(84px,12.5vh,116px);height:clamp(84px,12.5vh,116px);border-radius:50%;padding:0;border:none;background:none;
  pointer-events:auto;touch-action:none;cursor:pointer;
  filter:drop-shadow(0 6px 0 rgba(62,52,44,.35)) drop-shadow(0 10px 18px rgba(62,52,44,.3));
  transition:filter .2s ease, transform .08s ease;
}
.action-ring{
  position:absolute;inset:0;border-radius:50%;
  background:radial-gradient(circle at 38% 30%,#FFF8E8 0%,#F3E5C4 55%,#D9C7A1 100%);
  border:3px solid rgba(62,52,44,.55);
  box-shadow:inset 0 3px 2px rgba(255,255,255,.85),inset 0 -6px 8px rgba(62,52,44,.18);
}
.action-face{
  position:absolute;inset:13%;border-radius:50%;display:grid;place-items:center;
  background:radial-gradient(circle at 38% 28%,#CE8166,#B65B43 60%,#7E3A29);
  border:2px solid rgba(62,52,44,.6);
  box-shadow:inset 0 4px 8px rgba(20,16,12,.5),inset 0 -2px 1px rgba(255,244,222,.15);
  transition:background .2s ease,box-shadow .2s ease,transform .08s ease;
}
.action-face svg{width:56%;height:56%;opacity:.45;filter:grayscale(1);transition:opacity .2s ease,filter .2s ease;}
.action-label{
  position:absolute;left:50%;bottom:calc(100% + 7px);transform:translateX(-50%);
  font-size:9px;letter-spacing:.16em;font-weight:800;color:#FFF3D8;text-shadow:0 1px 2px rgba(62,52,44,.8);white-space:nowrap;
}
.action-btn.lit{filter:drop-shadow(0 6px 0 rgba(62,52,44,.35)) drop-shadow(0 0 18px rgba(242,179,31,.55)) drop-shadow(0 10px 18px rgba(62,52,44,.3));}
.action-btn.lit .action-face{
  background:radial-gradient(circle at 38% 28%,#FF744C,#E4502B 58%,#B93A1D);
  box-shadow:inset 0 4px 8px rgba(120,30,10,.35),inset 0 -3px 2px rgba(255,220,190,.35),0 0 0 2px rgba(255,238,206,.35);
}
.action-btn.lit .action-face svg{opacity:1;filter:none;}
.action-btn.press{transform:translateY(3px);filter:drop-shadow(0 3px 0 rgba(62,52,44,.35)) drop-shadow(0 6px 10px rgba(62,52,44,.3));}
.action-btn.press .action-face{transform:scale(.96);}
.action-btn.busy .action-face{background:radial-gradient(circle at 38% 28%,#FFB05A,#E4502B 60%,#B93A1D);}

#pausedFlag{
  position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) rotate(-4deg);
  background:var(--tomato);color:var(--cream);font-family:var(--display);font-size:14px;letter-spacing:.12em;
  padding:8px 18px;border-radius:6px;border:2px solid rgba(62,52,44,.5);box-shadow:0 8px 20px rgba(62,52,44,.3);
  z-index:10;pointer-events:none;
}

/* ---------------------------------- thief banner ------------------------- */
#thiefBanner{
  position:absolute;right:clamp(14px,2.4vw,30px);top:calc(var(--fascia-h) + clamp(12px,2vh,24px));
  display:flex;align-items:center;gap:8px;
  background:linear-gradient(180deg,#FFF1E8,#FBD7C7);
  border:2px solid var(--tomato);border-radius:10px;padding:5px 12px 6px;
  font-size:10px;font-weight:800;letter-spacing:.1em;color:var(--tomato-deep);
  box-shadow:0 4px 12px rgba(62,52,44,.22);z-index:6;pointer-events:none;
  animation:bannerPulse 1.2s ease-in-out infinite;
}
.thief-dot{width:8px;height:8px;border-radius:50%;background:var(--tomato);box-shadow:0 0 0 0 rgba(228,80,43,.5);animation:dotPulse 1.2s ease-out infinite;}
@keyframes bannerPulse{0%,100%{transform:scale(1);}50%{transform:scale(1.02);}}
@keyframes dotPulse{0%{box-shadow:0 0 0 0 rgba(228,80,43,.45);}70%{box-shadow:0 0 0 8px rgba(228,80,43,0);}100%{box-shadow:0 0 0 0 rgba(228,80,43,0);}}

/* ---------------------------------- overlays ----------------------------- */
.overlay{
  position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  z-index:20;padding:clamp(10px,2vh,28px);pointer-events:auto;
  background:rgba(54,44,36,.2);
}
.overlay.hidden{display:none;}
.title-screen{
  background:
    radial-gradient(120% 90% at 50% 20%,rgba(247,231,199,.05),rgba(62,52,44,.38) 100%);
  backdrop-filter:blur(1.5px);
}
#dayCard.overlay, #shopPanel.overlay, #helpPanel.overlay{backdrop-filter:blur(1.5px);}
.title-screen.overlay{backdrop-filter:blur(1.5px);}
.title-wrap{display:flex;flex-direction:column;align-items:center;gap:clamp(8px,1.6vh,18px);text-align:center;max-width:min(94vw,860px);}
.title-board{
  position:relative;width:min(88vw,760px);
  background:linear-gradient(180deg,#FFF9EB,#EDDCBA 58%,#DECBA4);
  border:4px solid rgba(62,52,44,.6);border-radius:18px;
  box-shadow:inset 0 4px 0 rgba(255,255,255,.8),inset 0 0 0 3px rgba(255,255,255,.25),inset 0 -8px 0 rgba(168,156,134,.45),0 6px 0 rgba(62,52,44,.35),0 22px 44px rgba(40,32,26,.35);
  padding:clamp(8px,1.4vh,14px) clamp(12px,2vw,22px);
  transform:rotate(-.7deg);
}
.title-stripe{position:absolute;left:16px;right:16px;height:8px;border-radius:4px;box-shadow:inset 0 -2px 1px rgba(62,52,44,.25);}
.title-stripe.top{top:8px;background:linear-gradient(180deg,#28B3AC,var(--teal) 60%,var(--teal-deep));}
.title-stripe.bottom{bottom:8px;background:linear-gradient(180deg,#FFCF55,var(--mustard) 55%,var(--mustard-deep));}
.title-plate{display:flex;align-items:center;justify-content:center;gap:clamp(6px,1.4vw,18px);padding:clamp(14px,2.4vh,24px) 0;}
.title-plate h1{
  margin:0;font-family:var(--display);font-weight:400;
  font-size:clamp(26px,6.4vh,58px);line-height:.92;letter-spacing:.015em;
  color:var(--tomato);
  text-shadow:
    0 1px 0 #FFE1C8,
    0 3px 0 #B93A1D,
    0 4px 0 #8E2C16,
    0 7px 10px rgba(62,52,44,.35);
  -webkit-text-stroke:1.5px #8E2C16;
  display:flex;flex-direction:column;
}
.title-plate h1 span{display:block;font-size:.78em;letter-spacing:.06em;color:var(--tomato);}
.title-drop{width:clamp(22px,4.6vh,40px);height:clamp(22px,4.6vh,40px);flex:0 0 auto;filter:drop-shadow(0 2px 1px rgba(62,52,44,.25));}
.title-drop svg{width:100%;height:100%;}
.rivet.t1{left:10px;top:10px;transform:none;}
.rivet.t2{right:10px;top:10px;transform:none;left:auto;}
.rivet.t3{left:10px;bottom:10px;top:auto;transform:none;}
.rivet.t4{right:10px;bottom:10px;top:auto;transform:none;left:auto;}
.title-sub{margin:0;font-size:clamp(12px,2vh,16px);font-weight:600;color:#FFF6E2;text-shadow:0 2px 4px rgba(50,40,32,.6);letter-spacing:.02em;}
.play-btn{
  font-family:var(--display);font-size:clamp(14px,2.4vh,19px);letter-spacing:.08em;
  color:#FFF7E6;background:linear-gradient(180deg,#FF744C,var(--tomato) 52%,#C23E1F);
  border:3px solid rgba(62,52,44,.65);border-radius:13px;
  padding:clamp(9px,1.6vh,14px) clamp(24px,4vw,44px);
  cursor:pointer;box-shadow:inset 0 3px 0 rgba(255,205,180,.55),inset 0 -4px 0 rgba(120,30,10,.4),0 5px 0 rgba(62,52,44,.35),0 12px 22px rgba(40,32,26,.3);
  transition:transform .08s ease,box-shadow .08s ease;touch-action:manipulation;
}
.play-btn:active{transform:translateY(3px);box-shadow:inset 0 3px 0 rgba(255,205,180,.5),0 2px 0 rgba(62,52,44,.35);}
.play-btn.small{font-size:clamp(12px,2vh,16px);padding:8px 24px;}
.title-how{display:flex;flex-wrap:wrap;gap:6px 18px;justify-content:center;max-width:640px;}
.how-item{display:flex;align-items:center;gap:6px;font-size:clamp(10px,1.6vh,13px);font-weight:600;color:#FFF6E2;text-shadow:0 1px 3px rgba(50,40,32,.6);}
.how-icon{width:22px;height:22px;display:grid;place-items:center;border-radius:50%;
  background:linear-gradient(180deg,#FFF9E9,#E6D3AC);border:2px solid rgba(62,52,44,.45);flex:0 0 auto;}
.how-icon svg{width:70%;height:70%;}
.title-note{margin:0;font-size:clamp(9px,1.4vh,11px);color:#F4E4C4;opacity:.85;max-width:520px;text-shadow:0 1px 3px rgba(50,40,32,.7);}

/* day card / help sheet / ledger */
.day-sheet,.help-sheet{
  position:relative;width:min(92vw,540px);max-height:92vh;overflow:auto;
  background:
    repeating-linear-gradient(180deg,transparent 0 27px,rgba(228,80,43,.14) 27px 28px),
    linear-gradient(180deg,#FFF9EA,#F3E5C4 70%,#EAD8B4);
  border:3px solid rgba(62,52,44,.55);border-radius:14px;
  box-shadow:inset 0 0 0 2px rgba(255,255,255,.35),0 6px 0 rgba(62,52,44,.3),0 24px 50px rgba(40,32,26,.4);
  padding:clamp(18px,3vh,30px) clamp(18px,3.4vw,34px) clamp(14px,2.6vh,26px);
  transform:rotate(-.5deg);
}
.sheet-clip{
  position:absolute;top:-12px;left:50%;transform:translateX(-50%);
  width:86px;height:26px;border-radius:6px;
  background:linear-gradient(180deg,#FFFDF4,#D6C8AE 55%,#B3A488);
  border:2px solid rgba(62,52,44,.45);
  box-shadow:0 3px 5px rgba(62,52,44,.3);
}
.sheet-clip::after{content:"";position:absolute;left:12px;right:12px;top:11px;height:2px;background:rgba(62,52,44,.25);}
.day-sheet h2,.help-sheet h2{
  margin:0 0 4px;font-family:var(--display);font-weight:400;font-size:clamp(18px,3.4vh,28px);
  color:var(--tomato);letter-spacing:.03em;text-shadow:0 1px 0 #FFE7D4,0 2px 0 rgba(185,58,29,.4);
  text-align:center;
}
.day-blurb{margin:0 0 14px;font-size:12px;color:#7A6A57;text-align:center;}
.day-stats{display:flex;flex-direction:column;gap:1px;margin-bottom:12px;}
.day-stats>div{display:flex;justify-content:space-between;align-items:baseline;border-bottom:1px dashed rgba(122,106,87,.35);padding:5px 2px;}
.stat-k{font-size:9px;letter-spacing:.16em;font-weight:800;color:#8A7963;}
#dayEarned{font-size:22px;color:var(--teal-deep);font-weight:700;}
#dayServed,#dayFuel{font-size:16px;font-weight:700;}
.day-board{margin-bottom:14px;}
.day-board .stat-k{display:block;margin-bottom:5px;}
#boardList{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:3px;}
#boardList li{display:flex;justify-content:space-between;font-size:12px;padding:3px 6px;border-radius:6px;background:rgba(243,229,196,.55);}
#boardList li.me{background:#D9EDCB;}
#boardList li .bl-name{font-weight:700;}
#boardList .board-empty{opacity:.6;justify-content:center;}
.day-sheet .play-btn{display:block;margin:0 auto;}

.help-list{margin:0 0 16px;padding:0 0 0 18px;display:flex;flex-direction:column;gap:7px;font-size:12px;line-height:1.42;color:#5C4B3B;}
.help-list b{color:var(--cocoa);}
.help-sheet{width:min(94vw,620px);}
.help-sheet h2{margin-bottom:12px;}

/* ledger */
.ledger{
  position:relative;width:min(96vw,900px);max-height:94vh;display:flex;flex-direction:column;
  background:
    repeating-linear-gradient(180deg,transparent 0 31px,rgba(228,80,43,.12) 31px 32px),
    linear-gradient(180deg,#FFFBF0,#F4E7CB 80%,#EAD8B4);
  border:3px solid rgba(62,52,44,.55);border-radius:14px;
  box-shadow:inset 0 0 0 2px rgba(255,255,255,.35),0 6px 0 rgba(62,52,44,.3),0 26px 54px rgba(40,32,26,.42);
  transform:rotate(.35deg);
  overflow:hidden;
}
.ledger-clip{position:absolute;top:-12px;left:50%;transform:translateX(-50%);width:104px;height:28px;border-radius:7px;
  background:linear-gradient(180deg,#FFFDF4,#D6C8AE 55%,#B3A488);border:2px solid rgba(62,52,44,.45);box-shadow:0 3px 5px rgba(62,52,44,.3);z-index:2;}
.ledger-clip::after{content:"";position:absolute;left:14px;right:14px;top:12px;height:2px;background:rgba(62,52,44,.25);}
.ledger-head{display:flex;align-items:flex-start;gap:14px;padding:clamp(16px,2.6vh,26px) clamp(16px,2.6vw,28px) 10px;flex-wrap:wrap;}
.ledger-head h2{margin:0 0 2px;font-family:var(--display);font-weight:400;font-size:clamp(16px,2.8vh,24px);color:var(--tomato);letter-spacing:.03em;text-shadow:0 1px 0 #FFE7D4,0 2px 0 rgba(185,58,29,.4);}
.ledger-head p{margin:0;font-size:11px;color:#7A6A57;}
.ledger-money{display:flex;align-items:center;gap:6px;margin-left:auto;background:linear-gradient(180deg,#FFF9E9,#E9D6AF);border:2px solid rgba(62,52,44,.45);border-radius:999px;padding:3px 12px 4px 6px;box-shadow:inset 0 1px 0 rgba(255,255,255,.7);}
.ledger-money svg{width:22px;height:22px;}
.ledger-money span{font-size:17px;font-weight:700;}
.ledger-close{
  width:32px;height:32px;border-radius:50%;border:2px solid rgba(62,52,44,.5);
  background:linear-gradient(180deg,#FFF6E2,#E3D2AE);color:var(--cocoa);
  font-family:var(--display);font-size:12px;cursor:pointer;flex:0 0 auto;
  box-shadow:0 2px 0 rgba(62,52,44,.25);touch-action:manipulation;
}
.shop-rows{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px clamp(10px,1.6vw,18px);
  padding:6px clamp(16px,2.6vw,28px) 8px;overflow:auto;min-height:0;
}
.shop-card{
  position:relative;display:flex;gap:10px;align-items:flex-start;
  background:linear-gradient(180deg,#FFFDF6,#F7ECD4);
  border:2px solid rgba(62,52,44,.4);border-radius:9px;padding:10px 12px 11px;
  box-shadow:0 2px 0 rgba(62,52,44,.16),inset 0 1px 0 rgba(255,255,255,.8);
  transition:transform .18s ease,box-shadow .18s ease;
  min-height:84px;
}
.shop-card:hover{transform:translateY(-1px);box-shadow:0 4px 0 rgba(62,52,44,.14),0 8px 16px rgba(62,52,44,.12);}
.shop-card.bought{transform:rotate(-1.1deg);background:linear-gradient(180deg,#F7FFEF,#E8F5DA);border-color:rgba(99,176,74,.55);}
.shop-card.bought:nth-child(even){transform:rotate(.9deg);}
.shop-icon{
  width:46px;height:46px;flex:0 0 auto;border-radius:50%;display:grid;place-items:center;
  background:radial-gradient(circle at 36% 28%,#FFF9EC,#EBDBBB 65%,#D2C09A);
  border:2px solid rgba(62,52,44,.4);
  box-shadow:inset 0 1px 1px rgba(255,255,255,.8),0 1px 2px rgba(62,52,44,.15);
  transform:rotate(-5deg);
}
.shop-icon svg{width:72%;height:72%;}
.shop-card.bought .shop-icon{transform:rotate(4deg);}
.shop-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px;}
.shop-title{font-weight:800;font-size:12.5px;letter-spacing:.01em;color:var(--cocoa);line-height:1.15;}
.shop-desc{font-size:10.5px;line-height:1.3;color:#7A6A57;}
.shop-foot{display:flex;align-items:center;justify-content:space-between;gap:6px;margin-top:5px;}
.shop-price{font-family:var(--num);font-weight:700;font-size:14px;color:var(--tomato);letter-spacing:.02em;
  transform:rotate(-3deg);border:2px solid rgba(228,80,43,.65);border-radius:5px;padding:1px 7px 2px;
  background:rgba(255,246,232,.6);}
.shop-price.free{color:var(--teal-deep);border-color:rgba(23,149,143,.6);}
.shop-buy{
  font-family:var(--text);font-weight:800;font-size:10px;letter-spacing:.08em;
  border:2px solid rgba(62,52,44,.5);border-radius:7px;padding:4px 10px 5px;
  background:linear-gradient(180deg,#FFF6E2,#E6D4AE);color:var(--cocoa);cursor:pointer;
  box-shadow:0 2px 0 rgba(62,52,44,.22);touch-action:manipulation;white-space:nowrap;
}
.shop-buy:disabled{opacity:.45;cursor:default;}
.shop-buy.can{background:linear-gradient(180deg,#FFE28C,#F2B31F 65%,#D99C10);}
.shop-tick{
  position:absolute;right:8px;top:8px;width:34px;height:34px;opacity:.9;
  transform:rotate(-12deg);pointer-events:none;
}
.shop-tick svg{width:100%;height:100%;filter:drop-shadow(0 1px 0 rgba(62,52,44,.2));}
.shop-tick .stamp{font-size:0;}
.ledger-foot{margin:0;padding:8px clamp(16px,2.6vw,28px) 14px;font-size:10px;color:#8A7963;font-style:italic;}

@media (max-width:640px){
  .shop-rows{grid-template-columns:1fr;}
  .ledger-head h2{font-size:16px;}
}

/* narrow vertical phones */
@media (max-width:560px){
  :root{--fascia-h:clamp(60px,9vh,76px);}
  .fascia-inner{gap:6px;padding:0 10px;}
  .plate-icon{width:30px;height:30px;}
  #moneyValue{font-size:19px;}
  .money-plate::after{display:none;}
  .fuel-widget{padding-left:6px;min-width:56px;}
  .level-widget{padding-left:6px;}
  .level-text{display:none;}
  .fascia-actions{gap:4px;}
  .shop-btn span{display:none;}
  .shop-btn{padding:5px;border-radius:9px;}
  .btn-round{width:32px;height:32px;}
  #controlHint{display:none;}
  #dayPill{font-size:9px;padding:3px 10px;}
  .title-board{transform:rotate(-.4deg);}
  .title-plate h1{font-size:clamp(22px,8vw,40px);}
  .title-how{display:none;}
  #stickWell{width:104px;height:104px;left:12px;bottom:16px;}
  .action-btn{width:86px;height:86px;right:16px;bottom:16px;}
  .action-label{bottom:-16px;font-size:8px;}
  .title-screen{padding-top:calc(var(--fascia-h) + 12px);}
}

@media (max-height:480px){
  :root{--fascia-h:58px;}
  .title-wrap{gap:6px;}
  .title-plate h1{font-size:clamp(22px,7vh,36px);}
  .title-sub{font-size:11px;}
  .title-how{display:none;}
  .title-note{display:none;}
  .play-btn{padding:7px 26px;font-size:14px;}
  #dayPill{top:calc(var(--fascia-h) + 8px);}
  #stickWell{width:96px;height:96px;bottom:12px;}
  .action-btn{width:80px;height:80px;bottom:12px;}
  #controlHint{display:none;}
  .title-board{width:min(80vw,620px);}
  .title-plate{padding:10px 0;}
}

/* before the shift starts */
body:not(.playing) #controls,
body:not(.playing) #dayPill,
body:not(.playing) #thiefBanner {opacity:0;pointer-events:none;}
body:not(.playing) #controls{transform:translateY(10px);}
#controls{transition:opacity .35s ease, transform .35s ease;}
#dayPill{transition:opacity .3s ease;}
.bubble .b-num{font-size:15px;}
.bubble .b-num .b-unit{font-size:8px;}
#boardList a{text-decoration:none;}
#boardList a:hover{text-decoration:underline;}

@media (max-width:560px){
  #thiefBanner{top:calc(var(--fascia-h) + 42px);font-size:8px;padding:4px 8px;}
  .action-label{bottom:calc(100% + 22px);}
}

/* short landscape: fit the whole ledger, including worker bots and speed rows */
@media (max-height:600px){
  .ledger{max-height:97vh;}
  .ledger-clip{top:-7px;height:19px;}
  .ledger-head{padding:9px 16px 4px;gap:8px;}
  .ledger-head h2{font-size:15px;}
  .ledger-head p{display:none;}
  .ledger-money{padding:2px 8px 3px 4px;}
  .ledger-money span{font-size:13px;}
  .ledger-money svg{width:17px;height:17px;}
  .ledger-close{width:26px;height:26px;font-size:10px;}
  .shop-rows{grid-template-columns:repeat(3,minmax(0,1fr));gap:5px 9px;padding:4px 14px 5px;}
  .shop-card{min-height:0;padding:5px 7px 6px;gap:6px;}
  .shop-icon{width:31px;height:31px;}
  .shop-icon svg{width:70%;height:70%;}
  .shop-title{font-size:10.5px;line-height:1.12;}
  .shop-desc{font-size:8.5px;line-height:1.18;}
  .shop-foot{margin-top:2px;gap:3px;}
  .shop-price{font-size:10px;padding:0 4px 1px;border-width:1.5px;}
  .shop-buy{font-size:8px;padding:2px 6px 3px;border-width:1.5px;}
  .shop-tick{width:24px;height:24px;top:4px;right:4px;}
  .ledger-foot{display:none;}
  .overlay{padding:5px;}
}
#scene{filter:saturate(1.32) contrast(1.12) brightness(.98);}

/* keep the order bubbles from covering the toy cars on a short landscape phone */
@media (max-height:500px){
  .bubble{min-width:54px;padding:4px 6px 5px;border-radius:11px;}
  .bubble .b-num{font-size:13px;}
  .bubble .b-label{font-size:6px;}
  .bubble .b-bar{height:5px;margin-top:3px;}
}
