/* ───────────────────────── HELL OF FAME ───────────────────────── */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink: #130208;
  --paper: #fff6ec;
  --red: #ff2d55;
  --purple: #7b2cff;
  --acid: #aaff00;
  --gold: #ffb020;
}

/* registered colour properties: gradients can't transition, but these CAN, so every gradient
   built from them (body, haze, lava, answers) crossfades smoothly when the circle changes.
   Browsers without @property simply snap, which is the old behaviour. */
@property --bg-a   { syntax: '<color>'; inherits: true; initial-value: #1b0530; }
@property --bg-b   { syntax: '<color>'; inherits: true; initial-value: #4a0d3c; }
@property --glow   { syntax: '<color>'; inherits: true; initial-value: #7b2cff; }
@property --accent { syntax: '<color>'; inherits: true; initial-value: #aaff00; }
@property --lava   { syntax: '<color>'; inherits: true; initial-value: #ff2d55; }

/* circle moods — hotter and louder as you descend */
body[data-circle="1"] { --bg-a: #1b0530; --bg-b: #4a0d3c; --glow: #7b2cff; --accent: #aaff00; --lava: #ff2d55; --pulse: 9s; }
body[data-circle="2"] { --bg-a: #26041f; --bg-b: #64102f; --glow: #b0267a; --accent: #ffd000; --lava: #ff4d2e; --pulse: 7s; }
body[data-circle="3"] { --bg-a: #330411; --bg-b: #8c1230; --glow: #e62e4d; --accent: #ffd000; --lava: #ff6a00; --pulse: 5.5s; }
body[data-circle="4"] { --bg-a: #3c0208; --bg-b: #a81f12; --glow: #ff5722; --accent: #fff200; --lava: #ffa200; --pulse: 4s; }
body[data-circle="5"] { --bg-a: #420000; --bg-b: #c93400; --glow: #ff8c00; --accent: #fff200; --lava: #ffd000; --pulse: 2.6s; }

/* without this iOS Safari inflates text on its own, blowing the phone layout past the fold */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; }

/* reading surfaces get a real text face; the display face stays on logos, buttons and HUD shouting */
#bubbletext, #devilsays, #endsays, .answer, .rules, .disclaimer, .modehelp,
.rcard, #receiptssub, .wallsays, #enddepth, #nextdaily, #wallcountdown,
.bigbtn small, #dailytag, #freetag, .kit-sub, .wallnote {
  font-family: 'DM Sans', 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
}

body {
  font-family: 'Archivo Black', 'Arial Black', 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
  background: radial-gradient(120% 90% at 50% 110%, var(--bg-b) 0%, var(--bg-a) 60%, #060108 100%);
  color: var(--paper);
  overflow: hidden;
  overscroll-behavior-y: none; /* no rubber-band bounce dragging the HUD around on phones */
  user-select: none;
  -webkit-user-select: none;
  /* descending a circle morphs the palette instead of snapping it */
  transition: --bg-a 1.4s ease, --bg-b 1.4s ease, --glow 1.4s ease, --accent 1.4s ease, --lava 1.4s ease;
}

/* ───────────── hellscape background ───────────── */
#hellscape { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

.haze {
  position: absolute; inset: -20%;
  background:
    radial-gradient(40% 30% at 20% 80%, var(--glow) 0%, transparent 70%),
    radial-gradient(35% 25% at 80% 85%, var(--lava) 0%, transparent 70%),
    radial-gradient(30% 20% at 55% 95%, var(--accent) 0%, transparent 75%);
  opacity: .33;
  filter: blur(30px);
  animation: hazepulse var(--pulse) ease-in-out infinite alternate;
}
@keyframes hazepulse {
  from { transform: scale(1) translateY(0); opacity: .26; }
  to   { transform: scale(1.12) translateY(-3%); opacity: .5; }
}

.lava {
  position: absolute; left: 0; right: 0; bottom: -6vh; height: 26vh;
  /* soft stops (6px → 18px fade) read as molten glow instead of hard rings */
  background:
    repeating-radial-gradient(circle at 12% 120%, var(--lava) 0 6px, transparent 18px 42px),
    repeating-radial-gradient(circle at 68% 130%, var(--glow) 0 8px, transparent 22px 54px),
    linear-gradient(to top, var(--lava), transparent 85%);
  opacity: .5;
  filter: blur(3px) saturate(1.6);
  /* a seamless there-and-back loop: no visible direction snap at the ends */
  animation: lavaroll calc(var(--pulse) * 2.8) ease-in-out infinite;
}
@keyframes lavaroll {
  0%, 100% { transform: translateX(-2%) scaleY(1); }
  50%      { transform: translateX(2%) scaleY(1.15); }
}

#embers { position: absolute; inset: 0; overflow: hidden; }
.ember {
  position: absolute; bottom: -8vh;
  font-size: 22px;
  opacity: 0;
  will-change: transform, opacity;
  animation: rise linear forwards;
  filter: drop-shadow(0 0 6px var(--lava));
}
@keyframes rise {
  0%   { transform: translateY(0) rotate(0deg) scale(.7); opacity: 0; }
  12%  { opacity: .9; }
  100% { transform: translateY(-118vh) rotate(var(--spin, 160deg)) scale(1.25); opacity: 0; }
}

/* ───────────── stage ───────────── */
#stage {
  position: relative; z-index: 2;
  max-width: 900px;
  margin: 0 auto;
  height: 100%;
  display: flex; flex-direction: column;
  padding: 14px clamp(10px, 3vw, 28px) 24px;
}
#stage.shake { animation: shake .45s; }
@keyframes shake {
  10%, 90% { transform: translate(-2px, 1px) rotate(-.4deg); }
  25%, 75% { transform: translate(5px, -2px) rotate(.5deg); }
  40%, 60% { transform: translate(-7px, 2px) rotate(-.7deg); }
  50%      { transform: translate(7px, -3px) rotate(.8deg); }
}

/* ───────────── HUD ───────────── */
#hud {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 8px 0 4px;
}

#lives { font-size: 30px; letter-spacing: 4px; filter: drop-shadow(0 0 8px var(--lava)); min-width: 110px; }
.life { display: inline-block; transition: all .4s ease; }
.life.dead {
  filter: grayscale(1) brightness(.35);
  transform: rotate(38deg) translateY(5px) scale(.85);
  opacity: .5;
}

#floorbox { text-align: center; line-height: 1; }
.floorword {
  display: block; font-size: 12px; letter-spacing: 6px; color: var(--accent);
  text-shadow: 0 0 10px var(--accent);
}
#floornum {
  font-size: clamp(34px, 5vw, 46px);
  color: #fff;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 4px 4px 0 var(--ink), 0 0 12px var(--lava);
  text-shadow: 4px 4px 0 var(--ink), 0 0 20px color-mix(in srgb, var(--lava) 35%, transparent);
  display: inline-block;
}
#floornum.pop { animation: pop .45s; }
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.7) rotate(-6deg); color: var(--accent); }
  100% { transform: scale(1); }
}
.floortotal { font-size: 18px; opacity: .75; margin-left: 2px; }
#circletag {
  display: block; font-size: 11px; letter-spacing: 2px; margin-top: 5px;
  color: var(--paper); opacity: .85; text-transform: uppercase;
}

#mutebtn {
  font-size: 20px; background: rgba(0,0,0,.45); color: #fff;
  /* a faint cream edge: the ink border vanished against the dark backdrop */
  border: 3px solid rgba(255, 246, 236, .3); border-radius: 12px;
  width: 44px; height: 44px; cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .1s;
}
#mutebtn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

/* ───────────── game area ───────────── */
#game {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: clamp(12px, 3vw, 30px);
  align-items: center;
  min-height: 0;
}

#devilcol { text-align: center; }
/* the devil: body bobs, pose reacts, costume layer sits on top of the same viewBox */
#devilbody {
  position: relative;
  width: min(230px, 100%);
  margin: 0 auto;
  animation: bob 2.6s ease-in-out infinite;
}
#devilpose { position: relative; transform-origin: 50% 90%; }
#devilbody svg { display: block; width: 100%; overflow: visible; }
#devil { filter: drop-shadow(0 14px 22px rgba(0,0,0,.55)) drop-shadow(0 0 26px var(--glow)); }
#devilprops { position: absolute; inset: 0; height: 100%; pointer-events: none; }
#devilprops .p { display: none; }
#devilprops.on { animation: costume .45s cubic-bezier(.2,1.6,.4,1); transform-origin: 50% 35%; }
@keyframes costume { from { opacity: 0; transform: scale(.35) rotate(-10deg); } }
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-12px) rotate(1.5deg); }
}

/* cheeky idle life, on every copy of the devil */
.devil-svg .tail { transform-origin: 74px 214px; animation: wag 1.6s ease-in-out infinite; }
@keyframes wag { 0%,100% { transform: rotate(0deg);} 50% { transform: rotate(10deg);} }
.devil-svg .brow-r { transform-box: fill-box; transform-origin: center; animation: browwag 4.6s ease-in-out infinite; }
@keyframes browwag {
  0%, 76%, 100% { transform: translateY(0) rotate(0); }
  80%, 88% { transform: translateY(-6px) rotate(-8deg); }
  84%, 92% { transform: translateY(0) rotate(0); }
}
.devil-svg .eye-r { transform-box: fill-box; transform-origin: center; animation: wink 7s ease-in-out infinite; }
@keyframes wink { 0%, 90%, 100% { transform: scaleY(1); } 93%, 95% { transform: scaleY(.08); } }
.devil-svg .pupil { animation: shifty 5.5s ease-in-out infinite; }
@keyframes shifty {
  0%, 38%, 100% { transform: translateX(0); }
  44%, 56% { transform: translateX(-3px); }
  62%, 74% { transform: translateX(3px); }
}

/* reactions: smug hop when you're right, cackle when you're wrong */
#devilcol.happy #devilpose { animation: smug .6s ease; }
@keyframes smug { 30% { transform: translateY(-12px) rotate(-5deg); } 65% { transform: rotate(4deg); } }
#devilcol.grim #devilpose { animation: cackle .7s ease; }
@keyframes cackle {
  10%, 30%, 50%, 70% { transform: rotate(-6deg) translateY(-4px); }
  20%, 40%, 60% { transform: rotate(6deg) translateY(0); }
}

#devilname {
  font-size: 12px; letter-spacing: 2px; margin-top: 6px; opacity: .8;
  text-transform: uppercase;
}
#devilname b { color: var(--accent); }

/* speech bubble */
#bubble {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  border: 4px solid var(--ink);
  border-radius: 22px;
  box-shadow: 7px 7px 0 var(--ink), 0 0 30px rgba(0,0,0,.3);
  padding: 18px 20px;
  min-height: 112px;
  display: flex; align-items: center;
}
#bubble::before {
  content: '';
  position: absolute; left: -24px; top: 46%;
  border: 12px solid transparent;
  border-right-color: var(--ink);
}
#bubble::after {
  content: '';
  position: absolute; left: -16px; top: 46.5%;
  border: 10px solid transparent;
  border-right-color: var(--paper);
}
#bubbletext {
  font-size: clamp(17px, 2.1vw, 21px);
  font-weight: 900;
  line-height: 1.35;
  animation: bubblein .22s ease;
  width: 100%;
}
@keyframes bubblein { from { opacity: 0; transform: translateY(6px) scale(.98); } }
#bubbletext .reaction { display: block; color: #a0128f; }
#bubbletext .receipt { display: block; margin-top: 8px; font-size: .85em; font-weight: 700; opacity: .92; }
#bubbletext .skiphint { display:block; margin-top: 8px; font-size: 10px; letter-spacing: 2px; opacity:.5; text-transform: uppercase; }

/* timer */
#timerwrap {
  height: 16px; margin: 14px 0 12px;
  background: rgba(0,0,0,.5);
  border: 3px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 3px 3px 0 var(--ink);
}
#timerbar {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--acid), var(--gold), var(--red));
  border-radius: 6px;
  transform-origin: left center;
}
#timerwrap.low #timerbar { animation: panic .28s steps(2) infinite; }
@keyframes panic { 50% { filter: brightness(2) hue-rotate(-30deg); } }
#timerwrap.hidden { visibility: hidden; }

/* answers */
#answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.answer {
  display: flex; align-items: center; gap: 12px;
  font-family: inherit;
  font-size: clamp(15px, 1.9vw, 19px);
  font-weight: 900;
  text-align: left;
  color: var(--paper);
  background: linear-gradient(145deg, rgba(255,255,255,.12), rgba(0,0,0,.4)), var(--bg-b);
  border: 4px solid var(--ink);
  border-radius: 18px;
  box-shadow: 5px 5px 0 var(--ink);
  padding: 14px 16px;
  min-height: 72px;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease, background .12s;
}
.answer:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); background: linear-gradient(145deg, rgba(255,255,255,.22), rgba(0,0,0,.35)), var(--bg-b); }
.answer:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.answer:disabled { cursor: default; opacity: .92; }
.answer .key {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 34px; height: 34px;
  background: var(--ink); color: var(--accent);
  border-radius: 10px;
  font-size: 16px;
  text-shadow: 0 0 8px var(--accent);
}
.answer.correct {
  background: linear-gradient(145deg, #c6ff4d, #4fae00) !important;
  color: #09280b;
  animation: correctflash .35s;
}
.answer.correct .key { color: #c6ff4d; }
@keyframes correctflash { 0% { filter: brightness(2.2);} }
.answer.wrong {
  background: linear-gradient(145deg, #ff5d5d, #9c0f1c) !important;
  animation: wrongshake .3s;
}
@keyframes wrongshake { 25% { transform: translateX(-6px);} 75% { transform: translateX(6px);} }
.answer.reveal { animation: revealpulse .55s ease infinite alternate; }
@keyframes revealpulse {
  from { box-shadow: 5px 5px 0 var(--ink), 0 0 0 0 rgba(170,255,0,.9); }
  to   { box-shadow: 5px 5px 0 var(--ink), 0 0 0 10px rgba(170,255,0,0); }
}
.answer.dim { opacity: .45; }

/* ───────────── overlays ───────────── */
.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  /* see-through with a red tint, so the flames and embers of hell show behind the menus */
  background: radial-gradient(90% 90% at 50% 50%, rgba(46,4,14,.58), rgba(16,0,8,.84));
  backdrop-filter: blur(1.5px);
  animation: overlayin .3s ease;
  padding: 20px;
}
@keyframes overlayin { from { opacity: 0; } }
.overlay.hidden { display: none; }
.card-inner { max-width: 640px; }

.biglogo {
  font-size: clamp(54px, 10vw, 110px);
  line-height: .95;
  letter-spacing: 2px;
  /* the brand red, detuned: fully saturated hues vibrate on dark backgrounds */
  color: #f1516e;
  -webkit-text-stroke: 3px var(--ink);
  /* glows carry their own transparency: iOS renders text-shadow blur far denser than Chrome */
  text-shadow: 6px 6px 0 var(--ink), 0 0 30px rgba(241, 81, 110, .32);
  animation: logothrob 2.2s ease-in-out infinite alternate;
}
.biglogo .of {
  display: inline-block;
  font-size: .32em;
  color: var(--acid);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 3px 3px 0 var(--ink), 0 0 12px rgba(170, 255, 0, .35);
  margin: 0 .2em;
  transform: rotate(-8deg) translateY(-.6em);
}
@keyframes logothrob { from { transform: scale(1);} to { transform: scale(1.04) rotate(-.5deg);} }
/* iOS only: OLED + P3 render these glows hotter than desktop, so trim them one notch there */
@supports (-webkit-touch-callout: none) {
  .biglogo { text-shadow: 6px 6px 0 var(--ink), 0 0 24px rgba(241, 81, 110, .25); }
  .stat b { text-shadow: 2px 2px 0 var(--ink), 0 0 8px rgba(170, 255, 0, .24); }
}

.tagline { margin: 14px 0 18px; font-size: 18px; color: var(--gold); letter-spacing: 1px; }
.rules .pname { color: var(--gold); text-transform: none; }
.rules { font-size: 14px; line-height: 1.9; opacity: .92; margin-bottom: 26px; font-weight: 700; }

.bigbtn {
  font-family: inherit;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 900;
  color: var(--ink);
  background: linear-gradient(180deg, var(--acid), #5fae00);
  border: 5px solid var(--ink);
  border-radius: 20px;
  box-shadow: 7px 7px 0 var(--ink), 0 0 26px rgba(170,255,0,.28);
  padding: 16px 38px;
  cursor: pointer;
  letter-spacing: 2px;
  transition: transform .08s, box-shadow .08s;
}
.bigbtn:hover { transform: translate(-2px,-2px); box-shadow: 10px 10px 0 var(--ink), 0 0 32px rgba(170,255,0,.4); }
.bigbtn:active { transform: translate(4px,4px); box-shadow: 2px 2px 0 var(--ink); }
.bigbtn.alt { background: linear-gradient(180deg, #ffb020, #ff6a00); box-shadow: 7px 7px 0 var(--ink), 0 0 26px rgba(255,176,32,.28); }

.keyshelp { margin-top: 22px; font-size: 12px; letter-spacing: 2px; opacity: .75; text-transform: uppercase; }
.keyshelp b { color: var(--accent); }

/* title card */
#titlecard { background: radial-gradient(90% 90% at 50% 50%, rgba(40,0,10,.9), rgba(8,0,6,.98)); }
#cardcircle {
  font-size: clamp(20px, 3vw, 28px);
  letter-spacing: 10px;
  color: var(--gold);
  text-shadow: 0 0 14px rgba(255, 176, 32, .4);
  animation: cardzoom .5s ease;
}
#cardname {
  font-size: clamp(42px, 8vw, 84px);
  line-height: 1.02;
  margin: 12px 0;
  color: #fff;
  -webkit-text-stroke: 3px var(--ink);
  text-shadow: 6px 6px 0 var(--ink), 0 0 26px var(--lava);
  text-shadow: 6px 6px 0 var(--ink), 0 0 44px color-mix(in srgb, var(--lava) 32%, transparent);
  animation: cardzoom .5s cubic-bezier(.17,.89,.32,1.28);
  text-transform: uppercase;
}
#cardtag { font-size: 16px; color: var(--accent); letter-spacing: 2px; animation: cardzoom .7s ease; }
@keyframes cardzoom { from { opacity: 0; transform: scale(1.6); } }

/* end screen */
#endemoji { font-size: 76px; animation: bob 2.6s ease-in-out infinite; }
#endtitle {
  font-size: clamp(36px, 6vw, 62px);
  color: var(--red);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 5px 5px 0 var(--ink), 0 0 24px rgba(255, 45, 85, .35);
  margin: 8px 0 14px;
}
#enddepth { font-size: 19px; font-weight: 900; margin-bottom: 10px; }
#endrank {
  font-size: 15px; letter-spacing: 3px; color: var(--acid);
  text-shadow: 0 0 10px rgba(170, 255, 0, .4); margin-bottom: 10px; text-transform: uppercase;
}
#endquip { font-size: 15px; opacity: .85; font-style: italic; margin-bottom: 26px; }
.endbtns { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* fx particles */
#fx { position: fixed; inset: 0; z-index: 20; pointer-events: none; overflow: hidden; }
.spark {
  position: absolute;
  font-size: 24px;
  will-change: transform, opacity;
  animation: fly .75s ease-out forwards;
}
@keyframes fly {
  from { transform: translate(0, 0) scale(.8) rotate(0); opacity: 1; }
  to   { transform: translate(var(--dx), var(--dy)) scale(1.5) rotate(var(--rot)); opacity: 0; }
}

/* descend flash */
#stage.descend #game { animation: fall .55s ease; }
@keyframes fall {
  0% { transform: translateY(0); }
  35% { transform: translateY(-26px); opacity: .6; }
  70% { transform: translateY(14px); }
  100% { transform: translateY(0); }
}

/* ───────────── homepage v2 ───────────── */
.ticker {
  position: absolute; top: 0; left: 0; right: 0;
  overflow: hidden;
  border-bottom: 3px solid var(--ink);
  background: rgba(0,0,0,.55);
  padding: 8px 0;
}
/* tabloid tape: the gossip slides under a BREAKING chip, like a TV ticker */
.ticker::before {
  content: '🔥 BREAKING';
  position: absolute; left: 0; top: 0; bottom: 0; z-index: 2;
  display: flex; align-items: center;
  padding: 0 10px 0 12px;
  background: var(--gold); color: var(--ink);
  font-size: 11px; font-weight: 900; letter-spacing: 2px;
  border-right: 3px solid var(--ink);
}
.ticker-track {
  display: inline-flex; gap: 42px;
  white-space: nowrap;
  font-size: 13px; font-weight: 900; letter-spacing: 1px;
  color: var(--gold);
  animation: tick 40s linear infinite; /* slow roll: readable without chasing it */
}
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* the host leans over his own marquee: big, tilted, feet on the title */
#startdevil {
  position: relative; z-index: 2; pointer-events: none;
  margin-bottom: -48px;
  transform: translateX(54px) rotate(9deg);
}
#startdevil svg { width: 190px; filter: drop-shadow(0 0 26px var(--glow)); animation: bob 2.6s ease-in-out infinite; }

.statrow { display: flex; justify-content: center; gap: 26px; margin: 10px 0 14px; }
.stat { display: flex; flex-direction: column; line-height: 1.1; }
.stat b {
  font-size: 26px; color: var(--acid);
  -webkit-text-stroke: 1px var(--ink);
  text-shadow: 2px 2px 0 var(--ink), 0 0 10px rgba(170, 255, 0, .32);
}
.stat i { font-style: normal; font-size: 10px; letter-spacing: 3px; text-transform: uppercase; opacity: .82; }

.startbtns { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; align-items: stretch; }
.bigbtn small { display: block; font-size: 10px; letter-spacing: 2px; opacity: .75; margin-top: 3px; }
/* poster energy: the two start buttons lean into each other (IDs out-rank the generic hover rules) */
#dailybtn { transform: rotate(-1.3deg); }
#dailybtn:hover { transform: rotate(-1.3deg) translate(-2px, -2px); }
#dailybtn:active { transform: rotate(-1.3deg) translate(4px, 4px); }
#startbtn { transform: rotate(1.3deg); }
#startbtn:hover { transform: rotate(1.3deg) translate(-2px, -2px); }
#startbtn:active { transform: rotate(1.3deg) translate(4px, 4px); }

/* ───────────── streak badge ─────────────
   a sticker pinned to the floor box's corner: it moves with the box, so a two-digit
   floor or a narrow screen can never push it into the quit/mute buttons */
#floorbox { position: relative; }
#streakbadge {
  position: absolute; right: -4px; top: -14px; transform: rotate(10deg);
  display: flex; align-items: center; gap: 4px;
  font-size: 18px; font-weight: 900;
  color: var(--gold);
  -webkit-text-stroke: 0;
  text-shadow: 2px 2px 0 var(--ink), 0 0 8px var(--lava);
  text-shadow: 2px 2px 0 var(--ink), 0 0 12px color-mix(in srgb, var(--lava) 40%, transparent);
  animation: pop .3s;
  z-index: 3;
  pointer-events: none;
}
#streakbadge.hidden { display: none; }
#streakbadge.blazing #streakfire { animation: pop .4s infinite alternate; }
#hud { position: relative; }

.toast {
  position: fixed; left: 50%; top: 30%;
  transform: translate(-50%, 0) rotate(-4deg);
  z-index: 25;
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 900;
  color: var(--acid);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 5px 5px 0 var(--ink), 0 0 26px rgba(170, 255, 0, .38);
  pointer-events: none;
  animation: toastpop .9s ease forwards;
}
@keyframes toastpop {
  0% { opacity: 0; transform: translate(-50%, 24px) scale(.5) rotate(-4deg); }
  25% { opacity: 1; transform: translate(-50%, 0) scale(1.15) rotate(-4deg); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -34px) scale(1) rotate(-4deg); }
}

/* ───────────── descent shaft ───────────── */
#titlecard { overflow: hidden; }
#shaft { position: absolute; inset: 0; pointer-events: none; }
#shaft::before, #shaft::after {
  content: '';
  position: absolute; top: -100%; bottom: -100%;
  width: 90px;
  background: repeating-linear-gradient(to bottom, transparent 0 70px, rgba(0,0,0,.5) 70px 160px),
    linear-gradient(to right, rgba(0,0,0,.8), transparent);
  animation: wallrush 1.9s linear infinite;
}
#shaft::before { left: 0; }
#shaft::after { right: 0; transform: scaleX(-1); }
@keyframes wallrush { from { transform: translateY(0); } to { transform: translateY(45%); } }
#shaft::after { animation: wallrushR 1.9s linear infinite; }
@keyframes wallrushR { from { transform: scaleX(-1) translateY(0); } to { transform: scaleX(-1) translateY(45%); } }
.shaftbit {
  position: absolute; bottom: -12vh;
  font-size: 26px;
  opacity: .9;
  animation: shaftrise .9s linear forwards;
  filter: blur(.5px) drop-shadow(0 0 8px var(--lava));
}
@keyframes shaftrise {
  from { transform: translateY(0) rotate(0); opacity: .9; }
  to { transform: translateY(-130vh) rotate(var(--spin, 120deg)); opacity: 0; }
}
#falldevil { position: absolute; left: 50%; top: -24%; transform: translateX(-50%); pointer-events: none; }
#falldevil svg { width: 110px; }
#titlecard:not(.hidden) #falldevil { animation: devilfall 2s ease-in forwards; }
@keyframes devilfall {
  0% { top: -24%; transform: translateX(-50%) rotate(-14deg); }
  55% { top: 32%; transform: translateX(-50%) rotate(10deg); }
  80% { top: 110%; transform: translateX(-50%) rotate(28deg); }
  100% { top: 130%; transform: translateX(-50%) rotate(30deg); }
}

#endbest {
  font-size: 16px; letter-spacing: 3px; color: var(--gold);
  text-shadow: 2px 2px 0 var(--ink), 0 0 12px rgba(255, 176, 32, .4);
  margin-bottom: 14px;
  animation: pop .5s;
}
#endbest.hidden { display: none; }
#modetag { font-size: 12px; letter-spacing: 3px; color: var(--gold); opacity: .9; margin-bottom: 8px; text-transform: uppercase; }

/* ───────────── receipts recap ───────────── */
.bigbtn.purple {
  background: linear-gradient(180deg, #b37bff, var(--purple));
  color: #fff;
  box-shadow: 7px 7px 0 var(--ink), 0 0 34px rgba(123,44,255,.45);
}
#receiptsscreen { align-items: flex-start; overflow-y: auto; padding: 28px 16px 40px; }
.receipts-inner { width: 100%; max-width: 760px; margin: 0 auto; text-align: left; }
.receipts-head { text-align: center; margin-bottom: 18px; }
#receiptstitle {
  font-size: clamp(30px, 5vw, 52px);
  color: var(--paper);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 5px 5px 0 var(--ink), 0 0 22px rgba(123, 44, 255, .4);
}
#receiptssub { margin-top: 6px; font-size: 14px; letter-spacing: 2px; color: var(--accent); text-transform: uppercase; }
#receiptslist { list-style: none; display: flex; flex-direction: column; gap: 14px; counter-reset: rc; }
.rcard {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  border: 4px solid var(--ink);
  border-radius: 18px;
  box-shadow: 6px 6px 0 var(--ink);
  padding: 14px 16px 14px 64px;
  animation: bubblein .3s ease both;
}
.rcard::before {
  counter-increment: rc;
  content: counter(rc);
  position: absolute; left: 12px; top: 14px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--ink); color: var(--accent);
  font-size: 16px;
}
.rcard .rmeta { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; opacity: .6; margin-bottom: 6px; }
.rcard .rclue { font-size: 15px; line-height: 1.35; margin-bottom: 10px; }
.rcard .rpicks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.rcard .chip {
  font-size: 13px; font-weight: 900;
  padding: 5px 10px; border-radius: 10px; border: 3px solid var(--ink);
}
.chip.ok { background: #c6ff4d; }
.chip.bad { background: #ff7d7d; text-decoration: line-through; }
.chip.timeout { background: #ffd36b; }
.chip.right { background: #c6ff4d; }
.rcard .rreceipt { font-size: 13px; font-weight: 700; line-height: 1.4; opacity: .9; border-top: 2px dashed rgba(19,2,8,.25); padding-top: 8px; }
.rcard .rreceipt .ryear { color: #a0128f; }
.rcard.missed { background: #ffe9e3; }
.rcard .rflag { font-size: 11px; font-style: italic; opacity: .6; margin-top: 4px; }
.receipts-foot { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }
#receiptsempty { text-align: center; font-size: 16px; opacity: .8; padding: 30px 0; }

/* ───────────── ask the devil ───────────── */
#devilcol { position: relative; }
#devilsays {
  position: absolute; z-index: 4;
  left: 50%; top: -18px;
  transform: translateX(-50%);
  width: 220px;
  background: var(--paper); color: var(--ink);
  border: 4px solid var(--ink); border-radius: 18px;
  box-shadow: 5px 5px 0 var(--ink);
  padding: 10px 12px;
  font-size: 15px; font-weight: 900; line-height: 1.25;
  animation: sayin .35s cubic-bezier(.17,.89,.32,1.4);
  pointer-events: none;
}
#devilsays::after {
  content: ''; position: absolute; left: 50%; bottom: -16px; transform: translateX(-50%);
  border: 10px solid transparent; border-top-color: var(--ink);
}
#devilsays.hidden { display: none; }
@keyframes sayin { from { opacity: 0; transform: translateX(-50%) scale(.4) rotate(-6deg); } }

#helprow { display: flex; justify-content: center; margin-top: 14px; }
#helpbtn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: inherit; font-size: 15px; font-weight: 900; letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(180deg, #b37bff, var(--purple));
  border: 4px solid var(--ink); border-radius: 16px;
  box-shadow: 4px 4px 0 var(--ink), 0 0 22px rgba(123,44,255,.5);
  padding: 8px 16px 8px 10px;
  cursor: pointer;
  transition: transform .08s, box-shadow .08s, opacity .2s;
}
#helpbtn .key {
  display: grid; place-items: center; width: 28px; height: 28px;
  background: var(--ink); color: var(--accent); border-radius: 8px; font-size: 14px;
}
#helpbtn b { color: var(--accent); text-shadow: 0 0 8px var(--accent); }
#helpbtn:hover:not(:disabled) { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--ink), 0 0 28px rgba(123,44,255,.7); }
#helpbtn:active:not(:disabled) { transform: translate(3px,3px); box-shadow: 1px 1px 0 var(--ink); }
#helpbtn:disabled { opacity: .4; cursor: default; }
#helpbtn.spent { filter: grayscale(.85); }
#helpbtn.spent b { color: #ff7d7d; text-shadow: none; }

.answer.gone {
  opacity: .14 !important;
  filter: grayscale(1);
  transform: scale(.95);
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.answer.gone .atext { text-decoration: line-through; }
.chip.helped { background: #d9c2ff; }

/* ───────────── sassy end-screen devil ───────────── */
/* the host gets the same star treatment as the start screen: big, tilted, feet on the headline */
#enddevilwrap {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-bottom: -6px;
  pointer-events: none;
}
#enddevil, #endsays { pointer-events: auto; }
/* only the devil leans down onto the headline; the speech bubble stays clear of the mode tag */
#enddevil { transform: rotate(8deg) translateY(12px); }
#enddevil:hover { transform: rotate(2deg) translateY(12px) scale(1.06); }
#enddevil:active { transform: rotate(8deg) translateY(12px) scale(.94); }
#enddevil svg {
  width: 170px;
  filter: drop-shadow(0 0 22px var(--glow));
  animation: bob 2.2s ease-in-out infinite;
}
#endscreen.won #enddevil svg { animation: partydevil .5s ease-in-out infinite alternate; }
@keyframes partydevil {
  from { transform: rotate(-10deg) translateY(0) scale(1); }
  to   { transform: rotate(10deg) translateY(-10px) scale(1.06); }
}
#enddevilwrap.crowned #enddevil { position: relative; }
#enddevilwrap.crowned #enddevil::before {
  content: '👑';
  position: absolute; left: 50%; top: -34px; transform: translateX(-50%) rotate(-10deg);
  font-size: 52px; z-index: 2;
  filter: drop-shadow(0 0 12px var(--gold));
  animation: pop .6s;
}
#endsays {
  position: relative;
  max-width: 300px;
  text-align: left;
  background: var(--paper); color: var(--ink);
  border: 4px solid var(--ink); border-radius: 20px;
  box-shadow: 6px 6px 0 var(--ink);
  padding: 12px 16px;
  font-size: 17px; font-weight: 900; line-height: 1.3;
  animation: sayin2 .45s cubic-bezier(.17,.89,.32,1.4) .15s both;
}
#endsays::before {
  content: ''; position: absolute; left: -22px; top: 50%; transform: translateY(-50%);
  border: 10px solid transparent; border-right-color: var(--ink);
}
@keyframes sayin2 { from { opacity: 0; transform: scale(.3) rotate(8deg); } }

#endstamp {
  display: inline-block;
  margin: 2px 0 16px;
  padding: 8px 18px;
  font-size: clamp(18px, 3vw, 26px); font-weight: 900; letter-spacing: 2px;
  color: var(--acid);
  border: 5px solid var(--acid);
  border-radius: 12px;
  transform: rotate(-6deg);
  text-shadow: 0 0 10px rgba(170, 255, 0, .45);
  box-shadow: 0 0 16px rgba(170,255,0,.3), inset 0 0 12px rgba(170,255,0,.18);
  animation: stampin .5s cubic-bezier(.2,1.6,.4,1) .4s both;
}
#endstamp.hidden { display: none; }
@keyframes stampin { from { opacity: 0; transform: rotate(-6deg) scale(3); } }

.rainbit {
  position: absolute; top: -10vh;
  will-change: transform;
  animation: rainfall linear forwards;
}
@keyframes rainfall {
  to { transform: translateY(125vh) rotate(var(--spin, 360deg)); }
}

/* the finale card at floor 20 */
#titlecard.finale #cardname {
  color: var(--acid);
  text-shadow: 6px 6px 0 var(--ink), 0 0 36px rgba(170, 255, 0, .32);
  font-size: clamp(54px, 11vw, 120px);
}
#titlecard.finale #cardcircle { color: #fff; }
#titlecard.finale #cardtag { color: var(--gold); max-width: 520px; margin: 0 auto; line-height: 1.5; }

/* the end screen holds a lot now: keep it inside short desktop windows */
#endscreen { overflow-y: auto; }
#endscreen .card-inner { padding-top: 26px; }
#endtitle { margin: 4px 0 10px; }
#endrank { margin-bottom: 8px; }
.endbtns { display: grid; grid-template-columns: repeat(2, auto); justify-content: center; gap: 14px; }
.endbtns .bigbtn { font-size: clamp(18px, 2.2vw, 24px); padding: 12px 26px; white-space: nowrap; }
/* room for the buttons' drop shadow before the countdown line */
.endbtns { margin-bottom: 22px; }
@media (max-height: 820px) and (min-width: 701px) {
  #enddevil svg { width: 136px; }
  #endtitle { font-size: 44px; }
}

/* ───────────── overlays never clip: centred when they fit, scrollable when they don't ───────────── */
.overlay { overflow-y: auto; align-items: flex-start; }
.overlay > .card-inner, .overlay > .receipts-inner { margin-block: auto; }
.biglogo { font-size: clamp(50px, 8.5vw, 96px); }
#startdevil svg { width: 190px; }
.tagline { margin: 10px 0 12px; }
.rules { margin-bottom: 18px; }
#startscreen .keyshelp { margin-top: 14px; }

/* ───────────── launch: URL in frame ─────────────
   a creator watermark: only streamer/vertical recordings show it, normal players never see it */
#urlbar {
  display: none;
  flex: 0 0 auto;
  margin-top: 10px;
  text-align: center;
  font-size: 13px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--paper); opacity: .85;
}
body.streamer #urlbar, body.vertical #urlbar { display: block; }
#urlbar b, .siteurl { color: var(--acid); text-shadow: 0 0 10px var(--acid); letter-spacing: 1px; text-transform: none; }
#urlbar .streamtag { display: none; color: var(--gold); margin-right: 8px; }
.siteurl { white-space: nowrap; }
.cardurl { margin-top: 22px; font-size: 18px; font-weight: 900; letter-spacing: 1px; color: var(--acid); text-shadow: 0 0 12px var(--acid); }

/* ───────────── launch: mode toggles ───────────── */
.modetoggles { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
/* creator tools live behind the gear so the start screen stays clean for players */
#gearbtn { padding: 6px 10px; opacity: .75; }
#gearbtn[aria-expanded="true"], #gearbtn:hover { opacity: 1; }
#creatorpanel { margin-top: 2px; }
#creatorpanel.hidden { display: none; }
#creatorpanel .modetoggles { margin-top: 12px; }
.toggle {
  font-family: inherit; font-size: 13px; font-weight: 900; letter-spacing: 1px;
  color: var(--paper);
  background: rgba(0,0,0,.45);
  border: 3px solid var(--ink); border-radius: 12px;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 8px 12px; cursor: pointer;
}
.toggle b { color: #ff7d7d; margin-left: 4px; }
.toggle.on { background: linear-gradient(180deg, #b37bff, var(--purple)); }
.toggle.on b { color: var(--acid); }
.toggle:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }

/* ───────────── launch: streamer mode ───────────── */
body.streamer #urlbar { font-size: 17px; opacity: 1; }
body.streamer #urlbar .streamtag { display: inline; }
#bubbletext .skiphint.hold {
  font-size: 12px; opacity: .95; color: #a0128f; letter-spacing: 2px;
  animation: holdpulse 1s ease-in-out infinite alternate;
}
@keyframes holdpulse { from { opacity: .45; } to { opacity: 1; } }

/* ───────────── launch: vertical 9:16 frame ───────────── */
/* dvh = the height actually visible in iOS Safari and TikTok/IG in-app browsers (vh overshoots there) */
body.vertical { --colw: min(100vw, calc(100vh * 9 / 16)); }
@supports (height: 100dvh) { body.vertical { --colw: min(100vw, calc(100dvh * 9 / 16)); } }
body.vertical #stage {
  width: var(--colw); max-width: none;
  height: 100vh; height: 100dvh; overflow-y: auto;
  padding: 8px 12px calc(14px + env(safe-area-inset-bottom, 0px));
  background: rgba(0,0,0,.22);
  box-shadow: 0 0 0 2px rgba(170,255,0,.22), 0 0 80px rgba(0,0,0,.7);
}
body.vertical .overlay { left: calc(50% - var(--colw) / 2); right: auto; width: var(--colw); padding: 16px 12px; }
body.vertical #receiptsscreen { padding: 20px 10px 30px; }

/* ───────────── content kit (?kit) ───────────── */
.kit-inner { width: 100%; max-width: 1240px; margin: 0 auto; text-align: left; }
.kit-head { text-align: center; }
.kit-title {
  font-size: clamp(30px, 5vw, 48px); color: var(--paper);
  -webkit-text-stroke: 2px var(--ink); text-shadow: 5px 5px 0 var(--ink), 0 0 22px rgba(123, 44, 255, .4);
}
.kit-sub { font-size: 14px; font-weight: 700; opacity: .85; margin: 6px auto 0; max-width: 640px; line-height: 1.5; }
.kit-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 16px 0 12px; }
.kit-controls input[type=search], .kit-controls select {
  font: inherit; font-size: 14px; padding: 10px 12px;
  border-radius: 12px; border: 3px solid var(--ink); background: var(--paper); color: var(--ink);
}
.kit-controls input[type=search] { flex: 1 1 220px; }
.kit-check { font-size: 13px; font-weight: 900; display: flex; gap: 6px; align-items: center; }
#kitcount { font-size: 12px; opacity: .7; letter-spacing: 1px; }
.kit-body { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
#kitlist { list-style: none; max-height: 72vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 6px; }
#kitlist button {
  width: 100%; text-align: left; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 900; color: var(--paper);
  background: rgba(0,0,0,.45); border: 3px solid var(--ink); border-radius: 12px; padding: 8px 10px;
}
#kitlist button:hover { background: rgba(123,44,255,.35); }
#kitlist button.active { background: var(--purple); }
#kitlist small { display: block; opacity: .7; font-weight: 700; margin-top: 3px; line-height: 1.3; }
.kitbadge { font-size: 10px; margin-left: 6px; color: var(--acid); letter-spacing: 1px; }
.kitbadge.soon { color: var(--gold); }
#kitpicked { font-size: 15px; font-weight: 900; color: var(--acid); margin-bottom: 8px; }
.kit-preview { min-width: 0; }
#kitslides { display: flex; gap: 12px; }
#kitslides canvas {
  flex: 1 1 0; width: 0; min-width: 0; height: auto;
  border: 4px solid var(--ink); border-radius: 14px; box-shadow: 5px 5px 0 var(--ink);
}
.kit-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.kit-actions .bigbtn { font-size: 18px; padding: 12px 20px; }
#kitwarn { margin-top: 10px; color: var(--gold); font-weight: 900; font-size: 14px; }
.kit-exit { display: inline-block; margin-top: 18px; color: var(--acid); font-weight: 900; }
@container (max-width: 700px) {
  .kit-body { grid-template-columns: 1fr; }
  #kitlist { max-height: 30vh; }
}

/* ───────────── free-run cap + the VIP wall ───────────── */
#startbtn.locked { background: linear-gradient(180deg, #8a8a8a, #4a4a4a); box-shadow: 7px 7px 0 var(--ink); }
#startbtn small { display: block; font-size: 10px; letter-spacing: 2px; opacity: .8; margin-top: 3px; }
#wallscreen .card-inner { max-width: 520px; }
#walldevil svg { width: 120px; filter: drop-shadow(0 0 24px var(--glow)); animation: bob 2.6s ease-in-out infinite; }
.walltitle {
  font-size: clamp(34px, 6vw, 52px); color: var(--red); margin: 6px 0 10px;
  -webkit-text-stroke: 2px var(--ink); text-shadow: 5px 5px 0 var(--ink), 0 0 36px var(--red);
}
.wallsays {
  display: inline-block; background: var(--paper); color: var(--ink);
  border: 4px solid var(--ink); border-radius: 18px; box-shadow: 5px 5px 0 var(--ink);
  padding: 10px 16px; font-size: 17px; font-weight: 900; margin-bottom: 10px;
}
.wallcountdown { font-size: 15px; font-weight: 900; color: var(--gold); letter-spacing: 1px; margin-bottom: 18px; }
.wallbtns { display: flex; flex-direction: column; gap: 14px; align-items: stretch; margin-bottom: 18px; }
.wallbtns .bigbtn { font-size: clamp(18px, 2.4vw, 22px); padding: 14px 18px; text-decoration: none; text-align: center; }
.wallbtns .bigbtn small { display: block; font-size: 10px; letter-spacing: 2px; opacity: .8; margin-top: 4px; }
.wallbtns .hidden { display: none; }
.wallnote { font-size: 13px; font-weight: 900; opacity: .75; }

/* ───────────── the devil is the home button ───────────── */
.homedevil, #devilbody { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.homedevil { display: inline-block; transition: transform .12s ease; }
.homedevil:hover { transform: scale(1.06) rotate(-4deg); }
.homedevil:active { transform: scale(.94); }
.homedevil:focus-visible { outline: 3px solid var(--acid); outline-offset: 4px; border-radius: 16px; }
.headhome {
  background: none; border: 0; padding: 0; margin-bottom: 6px;
}
.headhome img { width: 64px; display: block; filter: drop-shadow(0 0 16px var(--glow)); }

/* ───────────── daily lock + sandbox teaser ───────────── */
#dailybtn.done { background: linear-gradient(180deg, #ffd36b, #c98a00); }
#dailybtn.done small { opacity: .9; }
#nextdaily { margin: 0 0 12px; font-size: 14px; font-weight: 900; letter-spacing: 1px; color: var(--gold); }
#nextdaily.hidden { display: none; }
.sandboxlink {
  display: inline-block; margin-top: 14px;
  font-size: 15px; font-weight: 900; letter-spacing: 1px; text-decoration: none;
  color: #fff; padding: 8px 14px;
  border: 3px dashed var(--acid); border-radius: 12px;
  background: rgba(123,44,255,.25);
  text-shadow: 0 0 10px var(--purple);
}
.sandboxlink span { color: var(--acid); }
.sandboxlink:hover { background: rgba(123,44,255,.45); }
#endscreen .sandboxlink { margin: 4px 0 8px; font-size: 14px; }
.modetoggles .sandboxlink { margin-top: 0; font-size: 13px; padding: 6px 12px; }

/* ───────────── launch: disclaimer, corrections, tips ───────────── */
.disclaimer {
  margin: 16px auto 0; max-width: 520px;
  font-size: 11px; line-height: 1.5; letter-spacing: .5px; opacity: .6; font-weight: 700;
}
.disclaimer a, .rreport, .kofi { color: var(--acid); }
.rreport {
  display: inline-block; margin-top: 6px;
  font-size: 11px; font-weight: 900; letter-spacing: 1px; text-decoration: none;
  color: #a0128f; opacity: .7;
}
.rreport:hover { opacity: 1; text-decoration: underline; }
.kofi {
  display: inline-block; margin-top: 10px;
  font-size: 14px; font-weight: 900; letter-spacing: 1px; text-decoration: none;
}
.kofi:hover { text-decoration: underline; }
.hidden-unset { display: none !important; }

/* ───────────── review fixes: menus, HUD, touch ───────────── */
/* the quiz board only shows during a run, never behind menus or on first load.
   z-index 12 lifts the stage's stacking context above the overlays (z-index 10) so the mute
   button below can float over them; everything else in the stage stays hidden and click-through */
body.inmenu #stage { visibility: hidden; z-index: 12; }
/* ...but sound is a menu decision too: the mute button stays reachable on the start screen */
body.inmenu #mutebtn {
  visibility: visible;
  position: fixed; top: 48px; right: 12px; z-index: 30; /* below the BREAKING tape */
}
/* HUD buttons sit together on the right */
.hudbtns { display: flex; gap: 8px; }
#quitbtn {
  font-size: 16px; font-weight: 900; background: rgba(0,0,0,.45); color: #fff;
  border: 3px solid rgba(255, 246, 236, .3); border-radius: 12px; width: 44px; height: 44px; cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
}
#quitbtn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
#circletag { white-space: nowrap; }
/* the falling devil passes behind the circle title, not over it */
#titlecard .card-inner { position: relative; z-index: 2; }
#falldevil { z-index: 1; }
/* reserve room so the answers don't jump when the receipt is longer than the clue */
#bubble { min-height: 150px; }
.modehelp { margin-top: 10px; font-size: 11px; letter-spacing: 1px; opacity: .7; font-weight: 700; }
body.touch #verticalbtn, body.touch .vhelp, body.touch #helpbtn .key { display: none; }

/* calmer on small screens and for players who ask for less motion */
@media (max-width: 700px) {
  .overlay { backdrop-filter: none; }
  .haze { filter: blur(14px); }
}
@media (prefers-reduced-motion: reduce) {
  .haze, .lava, #devilbody, .devil-svg *, .biglogo, #startdevil svg, #enddevil svg, #walldevil svg { animation: none !important; }
  #embers, #flash { display: none; }
}

/* paparazzi: a double camera-flash around the frame edge on every reveal */
#flash {
  position: fixed; inset: 0; z-index: 24; pointer-events: none; opacity: 0;
  background: radial-gradient(120% 120% at 50% 42%,
    rgba(255,255,255,.3) 0%, rgba(255,255,255,.05) 45%, rgba(255,255,255,.95) 100%);
}
#flash.go { animation: flashpop .5s ease-out; }
@keyframes flashpop {
  0% { opacity: 0; }
  8% { opacity: 1; }
  26% { opacity: .08; }
  38% { opacity: .6; }
  100% { opacity: 0; }
}

/* ───────────── phone layout ───────────── */
/* ───────────── phone layout ─────────────
   Narrow phones and the desktop 9:16 "vertical" frame share one layout: the game frame and each
   overlay are size containers, so the rules below react to the frame's width, not the screen's. */
#stage, .overlay { container-type: inline-size; }
@keyframes sayinm { from { opacity: 0; transform: translateY(-50%) scale(.4); } }

@media (max-width: 700px) {
  body { overflow-y: auto; }
  #stage { padding: 8px 12px 12px; height: auto; min-height: 100%; }
}

@container (max-width: 700px) {
  #game {
    grid-template-columns: 1fr;
    gap: 6px;
    align-content: start;
  }
  #devilcol { display: flex; align-items: center; justify-content: center; gap: 4px; }
  #devilbody { width: 80px; margin: 0; animation-duration: 3s; }
  #devilname { display: none; }
  #bubble { min-height: 96px; padding: 12px 14px; }
  #bubble::before { left: 50%; top: -24px; transform: translateX(-50%); border: 12px solid transparent; border-bottom-color: var(--ink); }
  #bubble::after { left: 50%; top: -16px; transform: translateX(-50%); border: 10px solid transparent; border-bottom-color: var(--paper); }
  #bubbletext { font-size: 16px; }
  #answers { grid-template-columns: 1fr; gap: 6px; }
  .answer { min-height: 48px; padding: 8px 12px; font-size: 16px; }
  #timerwrap { margin: 10px 0 8px; }
  #lives { font-size: 24px; min-width: 84px; }
  #mutebtn { width: 44px; height: 44px; font-size: 19px; }
  #hud { flex-wrap: nowrap; }
  .biglogo { font-size: 15cqw; }
  .rules { font-size: 13px; }
  #startdevil { margin-bottom: -30px; transform: translateX(34px) rotate(8deg); }
  #startdevil svg { width: 128px; }
  .statrow { gap: 16px; }
  .stat b { font-size: 20px; }
  .startbtns { flex-direction: column; }
  .ticker-track { font-size: 11px; }
  #streakbadge { font-size: 15px; }
  .endbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .endbtns .bigbtn { font-size: 15px; padding: 12px 8px; letter-spacing: 1px; white-space: normal; }
  #devilsays {
    /* left + right + max-width: never wider than the space to the frame's edge (375px phones) */
    left: calc(50% + 50px); right: 0; top: 50%;
    transform: translateY(-50%);
    width: auto; max-width: 170px; font-size: 12px; padding: 8px 10px;
    animation-name: sayinm;
  }
  #devilsays::after {
    left: -16px; top: 50%; bottom: auto;
    transform: translateY(-50%);
    border: 8px solid transparent; border-right-color: var(--ink);
  }
  #helprow { margin-top: 6px; }
  #helpbtn { width: 100%; justify-content: center; font-size: 14px; padding: 8px 14px; }
  #enddevil svg { width: 112px; }
  #endsays { font-size: 14px; padding: 10px 12px; max-width: 230px; }
  #enddevilwrap.crowned #enddevil::before { font-size: 32px; top: -24px; }
  .rcard { padding: 12px 12px 12px 54px; }
  .rcard::before { width: 32px; height: 32px; left: 10px; font-size: 14px; }
  .rcard .rclue { font-size: 14px; }
  .receipts-foot .bigbtn { font-size: 18px; padding: 12px 22px; }
  .keyshelp { display: none; }
  /* in a narrow frame the streamer tag gets its own line so the address never breaks */
  body.streamer #urlbar { font-size: 15px; }
  body.streamer #urlbar .streamtag { display: block; font-size: 11px; margin: 0 0 2px; }
  body.streamer #urlbar .streamtag .dot { display: none; }
  #circletag { font-size: 9px; letter-spacing: 1px; }
  #quitbtn, #mutebtn { width: 40px; height: 40px; font-size: 15px; }
  .hudbtns { gap: 6px; flex-shrink: 0; }
  #lives { min-width: 0; font-size: 21px; flex-shrink: 0; }
  #floorbox { min-width: 0; }
  #circletag { letter-spacing: .3px; font-size: 8.5px; }
  #bubble { min-height: 108px; }
  .startbtns .bigbtn { font-size: 20px; }
}

/* older browsers without container queries (iOS 15 and earlier): same phone layout, keyed to screen width.
   Generated from the @container block above; keep the two in step. */
@supports not (container-type: inline-size) {
  @media (max-width: 700px) {
  #game {
    grid-template-columns: 1fr;
    gap: 6px;
    align-content: start;
  }
  #devilcol { display: flex; align-items: center; justify-content: center; gap: 4px; }
  #devilbody { width: 80px; margin: 0; animation-duration: 3s; }
  #devilname { display: none; }
  #bubble { min-height: 96px; padding: 12px 14px; }
  #bubble::before { left: 50%; top: -24px; transform: translateX(-50%); border: 12px solid transparent; border-bottom-color: var(--ink); }
  #bubble::after { left: 50%; top: -16px; transform: translateX(-50%); border: 10px solid transparent; border-bottom-color: var(--paper); }
  #bubbletext { font-size: 16px; }
  #answers { grid-template-columns: 1fr; gap: 6px; }
  .answer { min-height: 48px; padding: 8px 12px; font-size: 16px; }
  #timerwrap { margin: 10px 0 8px; }
  #lives { font-size: 24px; min-width: 84px; }
  #mutebtn { width: 44px; height: 44px; font-size: 19px; }
  #hud { flex-wrap: nowrap; }
  .biglogo { font-size: 15cqw; }
  .rules { font-size: 13px; }
  #startdevil { margin-bottom: -30px; transform: translateX(34px) rotate(8deg); }
  #startdevil svg { width: 128px; }
  .statrow { gap: 16px; }
  .stat b { font-size: 20px; }
  .startbtns { flex-direction: column; }
  .ticker-track { font-size: 11px; }
  #streakbadge { font-size: 15px; }
  .endbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .endbtns .bigbtn { font-size: 15px; padding: 12px 8px; letter-spacing: 1px; white-space: normal; }
  #devilsays {
    /* left + right + max-width: never wider than the space to the frame's edge (375px phones) */
    left: calc(50% + 50px); right: 0; top: 50%;
    transform: translateY(-50%);
    width: auto; max-width: 170px; font-size: 12px; padding: 8px 10px;
    animation-name: sayinm;
  }
  #devilsays::after {
    left: -16px; top: 50%; bottom: auto;
    transform: translateY(-50%);
    border: 8px solid transparent; border-right-color: var(--ink);
  }
  #helprow { margin-top: 6px; }
  #helpbtn { width: 100%; justify-content: center; font-size: 14px; padding: 8px 14px; }
  #enddevil svg { width: 112px; }
  #endsays { font-size: 14px; padding: 10px 12px; max-width: 230px; }
  #enddevilwrap.crowned #enddevil::before { font-size: 32px; top: -24px; }
  .rcard { padding: 12px 12px 12px 54px; }
  .rcard::before { width: 32px; height: 32px; left: 10px; font-size: 14px; }
  .rcard .rclue { font-size: 14px; }
  .receipts-foot .bigbtn { font-size: 18px; padding: 12px 22px; }
  .keyshelp { display: none; }
  /* in a narrow frame the streamer tag gets its own line so the address never breaks */
  body.streamer #urlbar { font-size: 15px; }
  body.streamer #urlbar .streamtag { display: block; font-size: 11px; margin: 0 0 2px; }
  body.streamer #urlbar .streamtag .dot { display: none; }
  #circletag { font-size: 9px; letter-spacing: 1px; }
  #quitbtn, #mutebtn { width: 40px; height: 40px; font-size: 15px; }
  .hudbtns { gap: 6px; flex-shrink: 0; }
  #lives { min-width: 0; font-size: 21px; flex-shrink: 0; }
  #floorbox { min-width: 0; }
  #circletag { letter-spacing: .3px; font-size: 8.5px; }
  #bubble { min-height: 108px; }
  .startbtns .bigbtn { font-size: 20px; }
}
}
