:root { --y: #FCE302; --k: #111; --w: #fff; --s: 1; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #fafafa; }
body { font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif; color: var(--k); }

/* viewport clip: the only element that may overflow is the bleed plate, and only inside here */
#viewport { position: fixed; inset: 0; overflow: hidden; }

/* SAFE AREA: 1920x1080, contain, bottom-centre anchored (position/scale set by JS) */
#stage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0;
  opacity: 0; transition: opacity .2s linear; }
body.ready #stage { opacity: 1; }
#shake { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; }
#stage > *, #shake > * { position: absolute; }
/* BLEED PLATE: 2880x1280, safe area at (480,200) */
#bg { left: -480px; top: -200px; width: 2880px; height: 1280px; transform-origin: 50% 100%; }
.layer { left: 0; top: 0; width: 1920px; height: 1080px; pointer-events: none; }

.shadow { border-radius: 50%; background: radial-gradient(closest-side, rgba(0,0,0,.22), rgba(0,0,0,0)); }
#sh-word { left: 560px; top: 783px; width: 572px; height: 30px; }
#sh-mascot { left: 1080px; top: 794px; width: 250px; height: 22px; opacity: .7; transform-origin: 50% 50%; }

/* mascot + bar animation origins */
#mascot { transform-origin: 1085px 460px; will-change: transform; }
#bar { transform-origin: 550px 150px; }

/* mascot = the control */
#mascot-btn { left: 843px; top: 307px; width: 485px; height: 306px; background: none; border: 0; cursor: pointer; border-radius: 16px; }
#mascot-btn:focus-visible { outline: 4px dashed var(--k); outline-offset: 10px; }

/* jumbotrons */
.jumbo { width: 330px; top: 104px; background: var(--k); color: var(--w); padding: 14px 18px 16px; border-top: 8px solid var(--y); box-shadow: 8px 8px 0 rgba(0,0,0,.18); }
.jumbo::before, .jumbo::after { content: ''; position: absolute; top: -130px; width: 3px; height: 122px; background: #bbb; }
.jumbo::before { left: 40px; } .jumbo::after { right: 40px; }
#jumbo-l { left: 170px; } #jumbo-r { left: 1420px; }
.jumbo h3 { font: 600 15px/1 'Barlow Condensed'; letter-spacing: .18em; color: var(--y); margin-bottom: 10px; }
.row { display: flex; justify-content: space-between; align-items: baseline; padding: 5px 0; border-bottom: 1px solid #333; }
.row:last-child { border-bottom: 0; }
.row span { font: 600 17px/1 'Barlow Condensed'; letter-spacing: .12em; color: #bbb; }
.row b { font: 400 30px/1 'Anton'; color: var(--y); letter-spacing: .03em; display: inline-block; transform-origin: 50% 50%; }
.gauge { height: 16px; background: #2a2a2a; margin: 6px 0 12px; position: relative; overflow: hidden; }
.gauge i { position: absolute; inset: 0 auto 0 0; background: var(--y); width: 0; transition: width .4s ease; }
#volt { transition: none; } /* tracks the voltage exactly (no easing lag during the charge) */
.gauge.stripes i { background: repeating-linear-gradient(-60deg, var(--y) 0 12px, #fff 12px 16px); }

/* bar height tag, total-air marker, measuring callout */
#bar-tag { left: 910px; top: 104px; width: 100px; text-align: center; font: 400 20px/28px 'Anton'; background: var(--k); color: var(--y); letter-spacing: .04em; }
#air { left: 418px; top: 786px; width: 126px; height: 28px; transition: top .4s ease; }
#air b { position: absolute; left: 0; top: 0; width: 104px; font: 400 17px/28px 'Anton'; text-align: center; background: var(--y); border: 3px solid var(--k); line-height: 22px; }
#air::after { content: ''; position: absolute; right: 4px; top: 5px; border: 9px solid transparent; border-left: 16px solid var(--k); border-right: 0; }
#callout { left: 1296px; top: 560px; width: 190px; height: 60px; display: none; opacity: 1; transition: opacity .2s linear; }
#callout.on { display: block; }
#callout i { position: absolute; left: 0; width: 70px; height: 0; border-top: 3px dashed var(--k); }
#callout i:nth-child(1) { top: 52px; } #callout i:nth-child(2) { top: 52px; }
#callout b { position: absolute; left: 100px; top: 24px; font: 400 26px/34px 'Anton'; background: var(--y); border: 3px solid var(--k); padding: 0 10px; white-space: nowrap; }

/* stamp */
#stamp { left: 572px; top: 318px; width: 250px; transform: rotate(-9deg); background: var(--k); color: var(--y); font: 400 44px/.98 'Anton'; text-align: center; padding: 14px 8px 12px; border: 5px solid var(--k); outline: 4px solid var(--y); outline-offset: -11px; display: none; visibility: hidden; transform-origin: 50% 50%; }
#stamp small { display: block; font: 600 14px/1.2 'Barlow Condensed'; letter-spacing: .2em; color: var(--w); margin-top: 6px; }

/* lower third, CTA, CA */
#lower { left: 60px; top: 858px; width: 600px; height: 88px; background: var(--k); color: var(--w); padding: 12px 18px; border-left: 12px solid var(--y); box-shadow: 8px 8px 0 rgba(0,0,0,.18); }
#lower span { font: 600 14px/1 'Barlow Condensed'; letter-spacing: .2em; color: var(--y); }
#lower p { font: 600 25px/1.1 'Barlow Condensed'; margin-top: 7px; letter-spacing: .01em; }
#cta { left: 770px; top: 846px; width: 380px; height: 86px; background: var(--y); border: 5px solid var(--k); box-shadow: 8px 8px 0 var(--k); font: 400 54px/1 'Anton'; letter-spacing: .06em; color: var(--k); cursor: pointer; transform-origin: 50% 50%; }
#cta:hover { transform: translate(2px, 2px); box-shadow: 6px 6px 0 var(--k); }
#cta.pulse { animation: ctaPulse 2s ease-in-out infinite; }
#cta.pulse:hover { animation: none; }
#cta.pressed, #cta:disabled { background: #e6d200; color: #6b6100; box-shadow: 3px 3px 0 var(--k); transform: translate(3px, 3px); cursor: default; }
@keyframes ctaPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.03); } }
#hint { left: 770px; top: 950px; width: 380px; text-align: center; font: 600 16px/1 'Barlow Condensed'; letter-spacing: .2em; color: #555; }
#ca { left: 1260px; top: 858px; width: 600px; height: 88px; background: var(--w); border: 4px solid var(--k); box-shadow: 8px 8px 0 rgba(0,0,0,.18); display: flex; align-items: center; gap: 14px; padding: 0 14px 0 18px; }
#ca span { font: 400 26px/1 'Anton'; }
#ca code { flex: 1; font: 500 16px/1 'JetBrains Mono', monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ca button { font: 400 22px/1 'Anton'; letter-spacing: .06em; background: var(--k); color: var(--y); border: 0; padding: 14px 20px; cursor: pointer; }
#toast { left: 1260px; top: 954px; width: 600px; text-align: right; font: 600 17px/1 'Barlow Condensed'; letter-spacing: .14em; height: 18px; }
#legal { left: 460px; top: 1010px; width: 1000px; text-align: center; font: 500 13px/1 'Barlow Condensed'; letter-spacing: .08em; color: #8a8a8a; }

/* FX */
.fx { pointer-events: none; }
.bolt { position: absolute; }
.flash { position: absolute; width: 60px; height: 60px; background: radial-gradient(closest-side, #fff 0 22%, rgba(255,255,255,.85) 23% 40%, rgba(255,255,255,0) 70%); transform-origin: 50% 50%; }
.flash::before, .flash::after { content: ''; position: absolute; left: 50%; top: 50%; background: #fff; transform: translate(-50%, -50%); }
.flash::before { width: 120px; height: 4px; } .flash::after { width: 4px; height: 120px; }
.dust { position: absolute; border-radius: 50%; background: rgba(120,120,120,.5); pointer-events: none; }

/* electric outline on the mascot during the charge (static outline + flicker) */
#mascot.electric {
  filter: drop-shadow(3px 0 0 #111) drop-shadow(-3px 0 0 #111) drop-shadow(0 3px 0 #111) drop-shadow(0 -3px 0 #111);
  animation: flicker .09s steps(2, end) infinite;
}
@keyframes flicker {
  0%   { filter: drop-shadow(3px 0 0 #111) drop-shadow(-3px 0 0 #111) drop-shadow(0 3px 0 #111) drop-shadow(0 -3px 0 #111); }
  100% { filter: drop-shadow(4px 0 0 #111) drop-shadow(-4px 0 0 #111) drop-shadow(0 4px 0 #111) drop-shadow(0 -4px 0 #111); }
}

/* shake wrapper (art layers only) */
#shake.shk3 { animation: shk3 .08s steps(2, end) infinite; }
#shake.shk6 { animation: shk6 .06s steps(2, end) infinite; }
@keyframes shk3 {
  0% { transform: translate(3px, -3px); } 25% { transform: translate(-3px, 2px); }
  50% { transform: translate(2px, 3px); } 75% { transform: translate(-2px, -2px); }
  100% { transform: translate(3px, -3px); }
}
@keyframes shk6 {
  0% { transform: translate(6px, -6px); } 25% { transform: translate(-6px, 4px); }
  50% { transform: translate(4px, 6px); } 75% { transform: translate(-4px, -6px); }
  100% { transform: translate(6px, -6px); }
}

/* scoreboard value flip */
@keyframes flip { 0% { transform: scaleY(1); } 45% { transform: scaleY(.25); color: var(--w); } 100% { transform: scaleY(1); } }
.row b.flip { animation: flip .38s ease; }

/* confetti + flash overlays */
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }
#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 50; }

/* viewport-anchored chrome: scaled by --s, full viewport width */
#header { position: fixed; left: 0; width: calc(100vw / var(--s)); transform: scale(var(--s)); }
#header { top: 0; height: 84px; transform-origin: 0 0; display: flex; align-items: center; justify-content: space-between; padding: 0 40px; z-index: 40; }
#brand { display: flex; align-items: center; gap: 14px; }
#brand img { height: 46px; }
#brand b { font: 400 34px/1 'Anton'; letter-spacing: .02em; }
#brand em { font: 600 14px/1 'Barlow Condensed'; font-style: normal; letter-spacing: .2em; background: var(--k); color: var(--y); padding: 7px 10px 6px; margin-left: 8px; }
#brand em::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--y); margin-right: 8px; animation: liveblink 1.1s steps(1, end) infinite; }
@keyframes liveblink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: .15; } }
#nav { display: flex; gap: 12px; }
#nav a, #nav button { font: 600 18px/1 'Barlow Condensed'; letter-spacing: .14em; text-decoration: none; color: var(--w); background: var(--k); border: 3px solid var(--k); padding: 10px 18px 9px; cursor: pointer; }
#nav a:hover, #nav button:hover { background: var(--y); color: var(--k); }

/* reduced motion: no shake, no screen flash */
@media (prefers-reduced-motion: reduce) {
  #shake.shk3, #shake.shk6 { animation: none; }
  #mascot.electric { animation: none; }
  #cta.pulse { animation: none; }
  #brand em::before { animation: none; }
}
