:root {
  --ink: #090910;
  --bg-deep: #080a18;
  --pop-yellow: #ffea00;
  --pop-pink: #ff006e;
  --pop-cyan: #00f5d4;
  --pop-purple: #8338ec;
  --pop-orange: #ff6d00;
  --pop-red: #ff1744;
  --paper: #fffdf0;
  --font-display: 'Impact', 'Arial Black', 'PingFang SC', 'Microsoft YaHei', 'Heiti SC', sans-serif;
  --font-comic: 'PingFang SC', 'Microsoft YaHei', 'Heiti SC', 'Arial Black', sans-serif;
  --font-ui: 'PingFang SC', 'Microsoft YaHei', 'Heiti SC', system-ui, sans-serif;
}

* { box-sizing: border-box; user-select: none; -webkit-user-select: none; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; background: var(--bg-deep);
  font-family: var(--font-ui); color: #fff;
  touch-action: none;
}

/* 3D Stage & Impact Filters */
#stage-wrap {
  position: fixed; inset: 0; width: 100%; height: 100%;
  overflow: hidden;
  background: #060714;
  transition: filter 0.08s ease;
}
#arcade-bg-layer {
  position: absolute; inset: -2%; width: 104%; height: 104%;
  background-size: cover; background-position: center 42%;
  filter: blur(3.5px) brightness(0.38) saturate(0.78) contrast(1.08);
  pointer-events: none; z-index: 0;
}
#three-canvas { position: relative; z-index: 2; }
#stage-wrap.impact-frame {
  filter: grayscale(1) contrast(4.2) invert(1) brightness(1.18);
}
#stage-wrap.penalty-mood {
  filter: hue-rotate(-38deg) saturate(1.55) brightness(0.72);
}
#stage-wrap.rgb-split {
  filter: contrast(1.18) saturate(1.35);
}
#three-canvas {
  display: block; width: 100%; height: 100%; cursor: crosshair;
}

/* Comic Halftone Corner Vignette */
#halftone-vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 4;
  background-image: radial-gradient(rgba(0,0,0,0.5) 1.6px, transparent 1.7px);
  background-size: 6px 6px;
  mask-image: radial-gradient(circle at 50% 50%, transparent 58%, rgba(0,0,0,0.92) 100%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent 58%, rgba(0,0,0,0.92) 100%);
}

/* Front Acrylic Glass Narrative Layer (Goal 18: Comic Specular Blobs + Frame + Scratches) */
#glass-layer {
  position: fixed; inset: 0; pointer-events: none; z-index: 8; overflow: hidden;
}
.glass-sheen {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(122deg, transparent 12%, rgba(255,255,255,0.08) 13%, rgba(255,255,255,0.16) 14.2%, transparent 15.2%, transparent 17%, rgba(255,255,255,0.06) 17.8%, transparent 18.6%),
    linear-gradient(122deg, transparent 81%, rgba(0,245,212,0.06) 82.5%, rgba(255,255,255,0.09) 83.4%, transparent 84.5%);
}
.glass-trapezoid-l {
  position: absolute; top: 0; left: 0; width: 22%; height: 100%;
  background: linear-gradient(108deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.03) 38%, transparent 55%);
  clip-path: polygon(0 0, 100% 0, 62% 100%, 0 100%);
  pointer-events: none;
}
.glass-trapezoid-r {
  position: absolute; top: 0; right: 0; width: 22%; height: 100%;
  background: linear-gradient(252deg, rgba(0,245,212,0.07) 0%, rgba(255,0,110,0.04) 36%, transparent 58%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 38% 100%);
  pointer-events: none;
}
.glass-frame-edge {
  position: absolute; inset: 8px;
  border: 4px solid rgba(255,255,255,0.09);
  border-radius: 16px;
  box-shadow: inset 0 0 36px rgba(0,0,0,0.55), inset 0 2px 0 rgba(255,255,255,0.18);
}

/* Glass IOUs, Seals, Sarcastic Sticky Notes & Dust Slam */
.glass-note {
  position: absolute; pointer-events: none;
  border: 3.5px solid var(--ink);
  box-shadow: 6px 6px 0 rgba(0,0,0,0.78);
  font-weight: 900; color: var(--ink);
  padding: 9px 11px; max-width: 185px;
  transform-origin: center;
  animation: slamNote 0.34s cubic-bezier(0.18, 1.45, 0.36, 1) forwards;
}
.glass-note.iou-yellow {
  background: #fff35c;
  clip-path: polygon(0 2%, 97% 0, 100% 93%, 91% 100%, 4% 96%, 0 87%);
}
.glass-note.iou-red {
  background: #ff1744; color: #fff;
  border-width: 4px; max-width: 220px;
  box-shadow: 8px 8px 0 var(--ink);
}
.glass-note.sticky-taunt {
  background: #72efdd; color: var(--ink);
  font-size: 12px; padding: 7px 10px;
  clip-path: polygon(2% 0, 100% 2%, 98% 96%, 0 100%);
}
.glass-note.seal-strip {
  background: repeating-linear-gradient(-45deg, #ffea00 0 14px, #090910 14px 28px);
  color: #fff; padding: 6px 24px; max-width: 340px; white-space: nowrap;
  text-shadow: 2px 2px 0 #000, -1px -1px 0 #000;
  font-size: 14px; letter-spacing: 1.5px;
}
.glass-note.burning {
  animation: burnFly 0.9s ease-in forwards !important;
}
@keyframes slamNote {
  0% { transform: scale(2.8) rotate(var(--rot, -6deg)); opacity: 0; }
  65% { transform: scale(0.9) rotate(var(--rot, -6deg)); opacity: 1; }
  100% { transform: scale(1) rotate(var(--rot, -6deg)); opacity: 0.97; }
}
@keyframes burnFly {
  0% { filter: brightness(1); transform: scale(1) rotate(var(--rot, 0deg)); opacity: 1; }
  30% { filter: brightness(2.5) sepia(1) hue-rotate(-35deg) saturate(6); transform: scale(1.12) translateY(-16px) rotate(calc(var(--rot, 0deg) + 14deg)); opacity: 1; }
  100% { filter: brightness(0.3) blur(2px); transform: scale(0.25) translateY(-180px) translateX(70px) rotate(calc(var(--rot, 0deg) + 95deg)); opacity: 0; }
}

/* 2D Comic FX Layer & Particle Canvas */
#fx-layer {
  position: fixed; inset: 0; pointer-events: none; z-index: 18; overflow: hidden;
}
#fx-2d-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
}
#speed-lines {
  position: absolute; inset: -12%; opacity: 0; transition: opacity 0.14s ease;
  background: repeating-conic-gradient(
    from 0deg at 50% 50%,
    rgba(255,255,255,0.32) 0deg 1.3deg,
    transparent 1.3deg 7deg
  );
  mask-image: radial-gradient(circle at 50% 50%, transparent 25%, #000 68%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent 25%, #000 68%);
}
#speed-lines.active {
  opacity: 1;
  animation: spinLines 0.3s linear infinite;
}
@keyframes spinLines {
  from { transform: rotate(0deg) scale(1.06); }
  to { transform: rotate(18deg) scale(1.14); }
}

.comic-sfx {
  position: absolute; transform: translate(-50%, -50%);
  font-family: var(--font-comic); font-weight: 900; font-style: italic;
  padding: 5px 14px; border: 3.5px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  text-shadow: 2px 2px 0 var(--ink), -1px -1px 0 var(--ink);
  white-space: nowrap; pointer-events: none;
  animation: popSfx 0.96s cubic-bezier(0.16, 1.35, 0.3, 1) forwards;
  clip-path: polygon(3% 0, 97% 4%, 100% 88%, 94% 100%, 0 95%, 2% 14%);
}
@keyframes popSfx {
  0% { transform: translate(-50%, -50%) scale(0.3) rotate(var(--r, -8deg)); opacity: 0; }
  22% { transform: translate(-50%, -78%) scale(1.28) rotate(var(--r, -8deg)); opacity: 1; }
  72% { transform: translate(-50%, -108%) scale(1.02) rotate(var(--r, -8deg)); opacity: 1; }
  100% { transform: translate(-50%, -152%) scale(0.84) rotate(var(--r, -8deg)); opacity: 0; }
}

/* Diagonal Slash Cut-in + Giant Bouncing Score Pop */
#cutin-banner {
  position: absolute; left: -14%; right: -14%; top: 32%;
  height: 128px; display: flex; align-items: center; justify-content: center; gap: 18px;
  background: linear-gradient(90deg, #090910, #ffb703 22%, #ffea00 50%, #00f5d4 78%, #090910);
  border-top: 7px solid var(--ink); border-bottom: 7px solid var(--ink);
  box-shadow: 0 16px 0 rgba(0,0,0,0.8);
  transform: rotate(-6deg) translateX(-125%);
  opacity: 0; pointer-events: none;
  transition: transform 0.2s cubic-bezier(0.12, 1.28, 0.35, 1), opacity 0.14s ease;
}
#cutin-banner.show {
  transform: rotate(-6deg) translateX(0);
  opacity: 1;
}
.cutin-title {
  font-family: var(--font-comic); font-size: clamp(26px, 5vw, 54px);
  color: #fff; font-weight: 900; letter-spacing: 2px;
  text-shadow: 4px 4px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink);
}
.cutin-big-num {
  font-family: var(--font-comic); font-size: clamp(34px, 6vw, 66px);
  color: var(--pop-yellow); font-weight: 900;
  text-shadow: 5px 5px 0 var(--ink), -2px -2px 0 var(--ink);
  animation: numBounce 0.45s cubic-bezier(0.18, 1.5, 0.35, 1) infinite alternate;
}
@keyframes numBounce {
  from { transform: scale(1) rotate(-4deg); }
  to { transform: scale(1.18) rotate(4deg); }
}
.cutin-sub {
  background: var(--ink); color: var(--pop-yellow); padding: 5px 14px;
  font-weight: 900; font-size: clamp(13px, 2vw, 20px); border: 3px solid #fff;
  transform: skewX(-10deg);
}

/* Penalty Cartoon Hand / Vacuum & King Auto-Cut Grabbing Hand */
#penalty-actor {
  position: absolute; right: -360px; top: 28%; width: 320px; height: 190px;
  pointer-events: none; transition: right 0.32s cubic-bezier(0.18, 1.28, 0.3, 1);
  filter: drop-shadow(8px 8px 0 #000);
}
#penalty-actor.strike { right: 8%; }

#king-grab-hand {
  position: absolute; top: -260px; left: 50%; transform: translateX(-50%);
  width: 240px; height: 220px; pointer-events: none; z-index: 21;
  transition: top 0.28s cubic-bezier(0.2, 1.35, 0.35, 1);
  filter: drop-shadow(8px 8px 0 #000);
}
#king-grab-hand.grab { top: 26%; }

/* 2D Mixed-Media Collage King (Goal 16: Aligned to Top of 3D Cabinet) */
#king-layer {
  position: fixed; top: -440px; left: 50%; transform: translateX(-50%);
  width: min(520px, 94vw); z-index: 22; pointer-events: none; opacity: 0;
  transition: top 0.4s cubic-bezier(0.2, 1.25, 0.35, 1), opacity 0.25s ease;
}
#king-layer.peek { top: 18px; opacity: 1; }
#king-layer.slam { top: 32px; animation: kingSlam 0.35s ease; }
@keyframes kingSlam {
  0%, 100% { transform: translateX(-50%) scale(1); }
  40% { transform: translateX(-50%) scale(1.09) translateY(12px); }
}
#king-left-paw, #king-right-paw {
  transform-origin: center;
  animation: pawTap 2.2s ease-in-out infinite;
}
#king-right-paw { animation-delay: 0.9s; }
@keyframes pawTap {
  0%, 82%, 100% { transform: translateY(0); }
  88% { transform: translateY(-7px); }
  94% { transform: translateY(2px); }
}
#king-speech {
  position: relative; margin: 0 auto 8px; width: min(520px, 94vw);
  background: #ffea00; color: #090910;
  border: 5px solid #090910; box-shadow: 8px 8px 0 #090910;
  padding: 13px 20px; font-weight: 900; font-size: clamp(16px, 2.3vw, 21px);
  line-height: 1.38; text-align: center; letter-spacing: 0.4px;
  transform: rotate(-1.6deg);
  animation: tauntPop 0.36s cubic-bezier(0.18, 1.45, 0.35, 1);
}
#king-speech::after {
  content: ''; position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%);
  border-width: 18px 14px 0 14px; border-style: solid;
  border-color: #090910 transparent transparent transparent;
}
#king-speech.tier-1 {
  background: #ffea00; color: #090910;
  box-shadow: 8px 8px 0 #090910, 0 0 22px rgba(255, 234, 0, 0.7);
}
#king-speech.tier-2 {
  background: #ff6d00; color: #fff;
  text-shadow: 2px 2px 0 #090910;
  box-shadow: 9px 9px 0 #090910, 0 0 26px rgba(255, 109, 0, 0.85);
}
#king-speech.tier-3 {
  background: #ff1744; color: #ffea00;
  border-width: 6px; font-size: clamp(17px, 2.5vw, 23px);
  text-shadow: 2.5px 2.5px 0 #090910;
  box-shadow: 10px 10px 0 #090910, 0 0 34px rgba(255, 23, 68, 0.95);
  animation: tauntPop 0.36s ease, tauntShake 0.4s ease 0.35s 2;
}
#king-speech.tier-defeat {
  background: #00f5d4; color: #090910;
  box-shadow: 8px 8px 0 #090910, 0 0 24px rgba(0, 245, 212, 0.8);
}
@keyframes tauntPop {
  0% { transform: scale(0.45) rotate(-5deg); opacity: 0; }
  70% { transform: scale(1.08) rotate(-1.6deg); opacity: 1; }
  100% { transform: scale(1) rotate(-1.6deg); opacity: 1; }
}
@keyframes tauntShake {
  0%, 100% { transform: rotate(-1.6deg) translateX(0); }
  25% { transform: rotate(-3deg) translateX(-7px); }
  75% { transform: rotate(1deg) translateX(7px); }
}
.king-modal-taunt {
  margin-bottom: 12px; padding: 12px 14px;
  border: 4px solid #090910; box-shadow: 6px 6px 0 #090910;
  font-weight: 900; font-size: 16px; line-height: 1.45;
  transform: rotate(-0.8deg);
}
.king-modal-taunt.t1 { background: #ffea00; color: #090910; }
.king-modal-taunt.t2 { background: #ff6d00; color: #fff; text-shadow: 1.5px 1.5px 0 #090910; }
.king-modal-taunt.t3 { background: #ff1744; color: #ffea00; text-shadow: 2px 2px 0 #090910; font-size: 17px; }

/* Comic-Book Skewed Pop HUD (Goal 18) */
#hud-top {
  position: fixed; top: 10px; left: 10px; right: 10px; z-index: 25;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  pointer-events: none; flex-wrap: wrap;
}
.hud-group {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap; pointer-events: auto;
}
.comic-stat {
  background: rgba(11, 13, 27, 0.92); color: #d8ddf2;
  border: 3px solid var(--ink); border-left-width: 6px;
  box-shadow: 4px 4px 0 var(--ink), inset 0 1px 0 rgba(255,255,255,0.12);
  padding: 5px 13px; font-weight: 900; font-size: 12px;
  display: inline-flex; align-items: center; gap: 8px;
  transform: skewX(-9deg);
  backdrop-filter: blur(4px);
}
.comic-stat .stat-lbl {
  font-family: var(--font-ui); font-size: 11px; letter-spacing: 0.6px; color: #b9c1e3;
}
.comic-stat .stat-num {
  font-family: var(--font-display); font-size: 25px; letter-spacing: 1.2px; line-height: 0.95;
  text-shadow: 2px 2px 0 var(--ink);
}
.comic-stat.gold { border-left-color: #ffea00; }
.comic-stat.gold .stat-num { color: #ffea00; }
.comic-stat.debt { border-left-color: #ff1744; }
.comic-stat.debt .stat-num { color: #ff4d6d; }
.comic-stat.net { border-left-color: #00f5d4; }
.comic-stat.net .stat-num { color: #00f5d4; }
.comic-stat.combo {
  background: linear-gradient(135deg, #ff006e, #ff5400); color: #fff;
  border-left-color: #ffea00; animation: popCombo 0.25s ease;
}
.comic-stat.combo .stat-lbl { color: #fffdf0; }
.comic-stat.combo .stat-num { color: #ffea00; }
@keyframes popCombo {
  0% { transform: skewX(-8deg) scale(1.3); }
  100% { transform: skewX(-8deg) scale(1); }
}

.pop-btn {
  cursor: pointer; font-family: var(--font-ui); font-weight: 900; font-size: 12px;
  border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
  padding: 6px 11px; color: var(--ink); background: #fff;
  transform: skewX(-6deg);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  display: inline-flex; align-items: center; gap: 5px;
}
.pop-btn:hover { transform: skewX(-6deg) translate(-1px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.pop-btn:active { transform: skewX(-6deg) translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.pop-btn.pink { background: var(--pop-pink); color: #fff; }
.pop-btn.yellow { background: var(--pop-yellow); color: var(--ink); }
.pop-btn.cyan { background: var(--pop-cyan); color: var(--ink); }
.pop-btn.purple { background: var(--pop-purple); color: #fff; }
.pop-btn.dark { background: #191d36; color: #fff; }
.pop-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: skewX(-6deg); }

/* Bottom Controls */
#hud-bottom {
  position: fixed; bottom: 12px; left: 12px; right: 12px; z-index: 25;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
  pointer-events: none; flex-wrap: wrap;
}
.bottom-cluster {
  display: flex; align-items: center; gap: 9px; pointer-events: auto; flex-wrap: wrap;
}
.big-drop-btn {
  position: relative;
  background: radial-gradient(circle at 35% 28%, #ff5c8a 0%, #ff0055 58%, #b8003c 100%);
  color: #fff; font-family: var(--font-comic); font-size: 18px; letter-spacing: 1.2px;
  padding: 12px 26px; border: 4px solid var(--ink); border-radius: 999px;
  box-shadow: 0 7px 0 #5c0020, 0 11px 0 var(--ink), inset 0 4px 0 rgba(255,255,255,0.45);
  text-shadow: 2px 2px 0 var(--ink); font-weight: 900; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.big-drop-btn:hover { filter: brightness(1.08); }
.big-drop-btn:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 #5c0020, 0 5px 0 var(--ink), inset 0 3px 0 rgba(255,255,255,0.35);
}
.boost-btn {
  background: linear-gradient(135deg, #ff006e 0%, #8338ec 100%);
  color: #fff; font-size: 14px; padding: 10px 16px;
  border: 4px solid var(--ink); box-shadow: 5px 5px 0 var(--ink);
  transform: skewX(-7deg); font-weight: 900; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}
.boost-btn.ready { animation: pulseBoost 0.85s infinite alternate; }
@keyframes pulseBoost {
  from { box-shadow: 5px 5px 0 var(--ink), 0 0 0 rgba(255,0,110,0.4); }
  to { box-shadow: 5px 5px 0 var(--ink), 0 0 20px rgba(0,245,212,0.95); }
}
.charge-pips { display: inline-flex; gap: 4px; }
.pip {
  width: 11px; height: 11px; border: 2px solid var(--ink); border-radius: 50%;
  background: rgba(255,255,255,0.22);
}
.pip.on { background: var(--pop-yellow); box-shadow: 0 0 7px var(--pop-yellow); }

.aim-bar-wrap {
  background: rgba(14, 17, 34, 0.9); border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink); padding: 6px 12px;
  transform: skewX(-6deg); display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 900;
}
#aim-slider { width: 130px; accent-color: var(--pop-cyan); cursor: pointer; }

/* Toast Banner */
#toast-area {
  position: fixed; top: 64px; right: 12px; z-index: 35;
  display: flex; flex-direction: column; gap: 6px; pointer-events: none; max-width: 290px;
}
.toast-item {
  background: var(--paper); color: var(--ink);
  border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--ink);
  padding: 7px 12px; font-weight: 900; font-size: 12px;
  transform: rotate(-1deg);
  animation: slideToast 0.24s ease forwards;
}
@keyframes slideToast {
  from { transform: translateX(40px) rotate(-1deg); opacity: 0; }
  to { transform: translateX(0) rotate(-1deg); opacity: 1; }
}

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(6, 7, 16, 0.8); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; padding: 14px;
}
.modal-backdrop.open { display: flex; }
.modal-card {
  width: min(580px, 96vw); max-height: 90vh; overflow-y: auto;
  border: 4px solid var(--ink); box-shadow: 10px 10px 0 var(--ink);
  background: var(--paper); color: var(--ink); position: relative;
  padding: 18px;
}
.modal-close {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px; border: 3px solid var(--ink);
  background: var(--pop-pink); color: #fff; font-weight: 900; cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
}

/* Thumbprint Contract Ritual Button (Goal 17) */
.thumbprint-pad {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 12px; font-size: 16px; font-weight: 900;
  background: #ff1744; color: #fff; border: 4px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink); cursor: pointer;
  transition: transform 0.1s ease;
}
.thumbprint-pad:active { transform: scale(0.97) translate(2px, 2px); }
.thumbprint-pad:disabled { opacity: 0.45; cursor: not-allowed; }

/* Next-Day Compound Ledger Overlay (Goal 17) */
#ledger-overlay {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(9, 9, 16, 0.84);
  display: none; align-items: center; justify-content: center; padding: 16px;
}
#ledger-overlay.open { display: flex; }
.ledger-book {
  width: min(440px, 94vw); background: #fff8dc; color: var(--ink);
  border: 5px solid var(--ink); box-shadow: 12px 12px 0 #ff1744;
  padding: 20px; text-align: center;
  animation: slamNote 0.35s ease;
}
.ledger-num {
  font-family: var(--font-comic); font-size: 46px; color: #ff1744;
  text-shadow: 3px 3px 0 var(--ink); margin: 8px 0;
}

/* Vogue Magazine Style (Goal 19: Barcode, Issue Badge, Crown Frame) */
.vogue-board {
  background: linear-gradient(155deg, #fffdf4 0%, #fff2b2 55%, #ffd6ff 100%);
  border: 4px solid var(--ink); padding: 14px; position: relative;
}
.vogue-masthead {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(28px, 6vw, 44px); font-weight: 900; letter-spacing: 3px;
  text-align: center; border-bottom: 4px solid var(--ink); padding-bottom: 6px;
  margin-bottom: 8px; line-height: 1;
}
.vogue-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; font-weight: 900; margin-bottom: 10px;
}
.vogue-barcode {
  display: inline-block; width: 64px; height: 22px;
  background: repeating-linear-gradient(90deg, #090910 0 2px, transparent 2px 4px, #090910 4px 7px, transparent 7px 9px);
  border: 2px solid var(--ink); background-color: #fff;
}
.rank-row {
  display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 8px;
  padding: 8px 10px; margin-bottom: 6px;
  border: 3px solid var(--ink); background: #fff;
  box-shadow: 3px 3px 0 var(--ink); font-weight: 800; font-size: 13px;
}
.rank-row.me { background: var(--pop-yellow); }
.rank-row.top1 { background: linear-gradient(90deg, #ffea00, #fff4a3); border-width: 4px; }

/* Wanted Tabloid Style (Goal 19: Height Ruler, Mugshot, Red Stamp) */
.wanted-board {
  background:
    repeating-linear-gradient(0deg, transparent 0 18px, rgba(0,0,0,0.08) 18px 20px),
    linear-gradient(180deg, #f4e4bc, #e9d29c);
  border: 4px solid var(--ink); padding: 14px; position: relative;
}
.wanted-header {
  background: var(--pop-red); color: #fff; text-align: center;
  font-family: var(--font-comic); font-size: clamp(24px, 5vw, 38px);
  padding: 6px; border: 4px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
  letter-spacing: 3px; transform: rotate(-1.2deg); margin-bottom: 10px;
}
.wanted-stamp {
  position: absolute; top: 18px; right: 18px;
  border: 4px solid #ff1744; color: #ff1744; font-family: var(--font-comic);
  font-size: 14px; padding: 3px 8px; transform: rotate(14deg);
  background: rgba(255,255,255,0.75); pointer-events: none;
}
.shame-tag {
  display: inline-block; background: var(--ink); color: var(--pop-yellow);
  font-size: 11px; padding: 2px 6px; margin-left: 4px; transform: rotate(-2deg);
}

/* QA Verification Drawer */
#qa-drawer {
  position: fixed; top: 58px; left: 10px; z-index: 40;
  width: min(335px, 92vw); max-height: 76vh; overflow-y: auto;
  background: rgba(13, 15, 30, 0.96); color: #fff;
  border: 4px solid var(--ink); box-shadow: 7px 7px 0 var(--ink);
  padding: 12px; display: none;
}
#qa-drawer.open { display: block; }
.qa-section-title {
  font-size: 12px; font-weight: 900; color: var(--pop-cyan);
  margin: 10px 0 6px; border-bottom: 2px solid rgba(255,255,255,0.14); padding-bottom: 3px;
}
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.qa-btn {
  cursor: pointer; background: #23284a; color: #fff;
  border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
  padding: 5px 7px; font-size: 11px; font-weight: 800; text-align: left;
}
.qa-btn:hover { background: var(--pop-purple); }

.tab-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.tab-btn {
  flex: 1; padding: 8px; font-weight: 900; font-size: 14px; cursor: pointer;
  border: 3px solid var(--ink); background: #e2e5f1; color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}
.tab-btn.active { background: var(--pop-yellow); transform: translate(-1px,-1px); }

#poster-canvas {
  width: 100%; max-width: 360px; height: auto; display: block; margin: 10px auto;
  border: 4px solid var(--ink); box-shadow: 5px 5px 0 var(--ink);
}

@media (max-width: 640px) {
  .comic-stat { font-size: 10px; padding: 3px 8px; }
  .comic-stat .stat-num { font-size: 16px; }
  .pop-btn { font-size: 11px; padding: 5px 8px; }
  .big-drop-btn { font-size: 14px; padding: 9px 15px; }
  .aim-bar-wrap { display: none; }
}

/* AI Mixed-Media Collage King Portrait Framing (Goal 16) */
.king-collage-stage {
  position: relative; width: 250px; height: 210px; margin: 0 auto;
  display: flex; align-items: flex-end; justify-content: center;
}
#king-portrait-img {
  width: 225px; height: 225px; object-fit: contain;
  filter: drop-shadow(-5px 3px 0 #00f5d4) drop-shadow(5px -3px 0 #ff006e) drop-shadow(0 10px 0 #090910);
  transition: filter 0.2s ease, transform 0.2s ease;
}
#king-portrait-img.mood-annoyed {
  filter: drop-shadow(-4px 3px 0 #ffea00) drop-shadow(5px 5px 0 #090910);
  transform: rotate(-2deg) scale(1.03);
}
#king-portrait-img.mood-furious {
  filter: drop-shadow(-6px 4px 0 #ff1744) drop-shadow(6px -3px 0 #ffea00) drop-shadow(0 10px 0 #090910);
  transform: scale(1.08) rotate(2deg);
}
#king-portrait-img.mood-defeated {
  filter: drop-shadow(-4px 3px 0 #00f5d4) drop-shadow(0 8px 0 #090910);
  transform: scale(0.95) translateY(10px) rotate(-5deg);
}
#king-mood-badge {
  position: absolute; top: 8px; right: 4px;
  background: #ffea00; color: #090910; border: 3.5px solid #090910;
  box-shadow: 4px 4px 0 #090910; padding: 3px 9px;
  font-family: var(--font-comic); font-size: 16px; font-weight: 900;
  transform: rotate(10deg);
}

/* === JUICE OVERDRIVE CSS (Goals 6, 8, 9, 11, 18, 19) === */
.comic-stat.stat-pop { animation: statPop 0.22s cubic-bezier(0.18, 1.6, 0.35, 1); }
@keyframes statPop {
  0% { transform: skewX(-8deg) scale(1); }
  45% { transform: skewX(-8deg) scale(1.24); }
  100% { transform: skewX(-8deg) scale(1); }
}

#fever-frame {
  position: fixed; inset: 0; pointer-events: none; z-index: 16;
  border: 0px solid transparent; opacity: 0; transition: opacity 0.25s ease;
}
#fever-frame.active {
  opacity: 1;
  box-shadow: inset 0 0 40px rgba(255, 234, 0, 0.72), inset 0 0 14px rgba(0, 245, 212, 0.85);
  animation: feverPulse 0.48s ease-in-out infinite alternate;
}
@keyframes feverPulse {
  from { box-shadow: inset 0 0 28px rgba(0, 245, 212, 0.55), inset 0 0 10px rgba(255, 234, 0, 0.75); }
  to { box-shadow: inset 0 0 54px rgba(255, 195, 0, 0.88), inset 0 0 18px rgba(255, 234, 0, 1); }
}
#fever-badge {
  position: fixed; top: 58px; left: 50%; transform: translateX(-50%) skewX(-8deg);
  background: linear-gradient(90deg, #ffea00, #ffd60a, #00f5d4);
  color: #090910; border: 4px solid #090910; box-shadow: 5px 5px 0 #090910;
  padding: 4px 16px; font-family: var(--font-comic); font-size: 18px; font-weight: 900;
  display: none; z-index: 26; pointer-events: none;
}
#fever-frame.active #fever-badge { display: block; animation: numBounce 0.35s infinite alternate; }

#suspense-vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 15; opacity: 0;
  background: radial-gradient(circle at 50% 34%, transparent 32%, rgba(9, 4, 24, 0.82) 100%);
  transition: opacity 0.22s ease;
}
#suspense-vignette.active { opacity: 1; animation: heartbeatVig 0.52s ease-in-out infinite; }
@keyframes heartbeatVig {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.045); }
}

#cliff-alert-bar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 10px;
  pointer-events: none; z-index: 17; opacity: 0;
  background: linear-gradient(90deg, #ff1744, #ffea00, #ff1744);
  transition: opacity 0.25s ease;
}
#cliff-alert-bar.active { opacity: 0.85; animation: cliffBeat 0.65s ease-in-out infinite alternate; }
@keyframes cliffBeat {
  from { opacity: 0.3; transform: scaleY(0.7); }
  to { opacity: 0.95; transform: scaleY(1.3); }
}

#king-layer.king-yeet {
  animation: kingYeetAnim 0.85s ease-in forwards !important;
}
@keyframes kingYeetAnim {
  0% { transform: translateX(-50%) rotate(0deg); }
  20% { transform: translateX(-56%) rotate(-12deg); }
  40% { transform: translateX(-44%) rotate(14deg); }
  100% { transform: translateX(-50%) translateY(-420px) rotate(55deg) scale(0.5); opacity: 0; }
}

#slot-lock-banner {
  position: fixed; top: 102px; left: 50%; transform: translateX(-50%) skewX(-8deg);
  background: #090910; color: #ffea00; border: 3px solid #ffea00;
  box-shadow: 4px 4px 0 #090910; padding: 4px 14px;
  font-weight: 900; font-size: 12px; z-index: 26; pointer-events: none;
  opacity: 0; transition: opacity 0.2s ease;
}
#slot-lock-banner.active { opacity: 1; }

/* Restrained Cohesive Top-Right Arcade Buttons (Typography & Color Harmony) */
.pop-btn { font-family: var(--font-ui); letter-spacing: 0.5px; }
.pop-btn.hero-king {
  background: linear-gradient(180deg, #ffea00 0%, #ffb703 100%);
  color: #090910; border: 3px solid #090910;
  box-shadow: 4px 4px 0 #090910, inset 0 2px 0 rgba(255,255,255,0.55);
  font-family: var(--font-comic); font-size: 15px; letter-spacing: 1px; padding: 6px 14px;
}
.pop-btn.nav-dark {
  background: rgba(13, 16, 34, 0.92); color: #e8ecff;
  border: 3px solid #090910; border-bottom: 4px solid #3c4570;
  box-shadow: 4px 4px 0 #090910; padding: 6px 12px; font-size: 12px;
}
.pop-btn.nav-dark.accent-cyan { border-bottom-color: #00f5d4; }
.pop-btn.nav-dark.accent-pink { border-bottom-color: #ff006e; }
.pop-btn.nav-dark:hover { background: #21264a; color: #ffea00; }

/* Upgraded Red Arcade Push Button Typography */
.big-drop-btn { padding: 10px 24px; gap: 10px; }
.big-drop-btn .drop-main {
  font-family: var(--font-comic); font-size: 22px; letter-spacing: 1.5px; line-height: 1;
}
.big-drop-btn .drop-sub {
  background: rgba(9, 9, 16, 0.45); color: #ffea00;
  border: 2px solid rgba(255,255,255,0.28); border-radius: 999px;
  padding: 2px 8px; font-family: var(--font-ui); font-size: 10px; font-weight: 900;
  letter-spacing: 0.5px; text-shadow: none;
}

/* Restrained Boost Button when idle vs electric pulse when ready */
.boost-btn:disabled {
  background: rgba(18, 18, 36, 0.88); color: #8c94b8;
  border-color: #090910; opacity: 0.82;
}
.boost-btn { font-family: var(--font-comic); font-size: 16px; letter-spacing: 1px; }

/* Crisp Aim Slider Bar */
.aim-bar-wrap {
  background: rgba(11, 13, 27, 0.92); color: #d8ddf2;
  border-bottom: 4px solid #00f5d4;
}

/* Upgrade Comic Onomatopoeia & Cut-in Display Typography */
.comic-sfx { font-family: var(--font-display); letter-spacing: 1.2px; }
.cutin-title { font-family: var(--font-display); letter-spacing: 3px; }
.cutin-big-num { font-family: var(--font-display); letter-spacing: 2px; }
#king-speech { font-family: var(--font-ui); }

.pop-btn.nav-dark.accent-gold { border-bottom-color: #ffea00; }
#onboard-tip {
  position: fixed; bottom: 72px; left: 50%; transform: translateX(-50%);
  z-index: 28; display: flex; align-items: center; gap: 10px;
  background: rgba(11, 13, 27, 0.94); color: #fffdf0;
  border: 3px solid #00f5d4; box-shadow: 5px 5px 0 #090910;
  padding: 7px 14px; font-size: 12px; font-weight: 800; max-width: 92vw;
}
#onboard-tip.hidden { display: none; }

/* Independent Fullscreen Visual Effect Layers (Motion 4: No Filter Collisions!) */
#penalty-tint-layer {
  position: fixed; inset: 0; pointer-events: none; z-index: 12; opacity: 0;
  background: radial-gradient(circle at 50% 45%, rgba(131,56,236,0.22), rgba(45,0,75,0.68));
  mix-blend-mode: multiply; transition: opacity 0.18s ease;
}
#penalty-tint-layer.active { opacity: 1; }

#rgb-chroma-layer {
  position: fixed; inset: 0; pointer-events: none; z-index: 13; opacity: 0;
  box-shadow: inset 10px 0 24px rgba(0, 245, 212, 0.55), inset -10px 0 24px rgba(255, 23, 68, 0.55);
  transition: opacity 0.14s ease;
}
#rgb-chroma-layer.active {
  opacity: 1;
  animation: chromaJitter 0.12s steps(2) infinite;
}
@keyframes chromaJitter {
  0% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
  100% { transform: translateX(-2px); }
}

#impact-flash-layer {
  position: fixed; inset: 0; pointer-events: none; z-index: 14; opacity: 0;
  backdrop-filter: grayscale(1) contrast(3.8) invert(1);
  -webkit-backdrop-filter: grayscale(1) contrast(3.8) invert(1);
}
#impact-flash-layer.active { opacity: 1; }

/* King Subtle Idle Breathing (Motion 10) */
#king-portrait-img {
  animation: kingBreath 2.4s ease-in-out infinite;
}
@keyframes kingBreath {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.015); }
}
body.reduced-motion #impact-flash-layer,
body.reduced-motion #rgb-chroma-layer,
body.reduced-motion #speed-lines { display: none !important; }

/* Slot cues follow a point in the machine and stay between the HUD rails. */
#spin-giggle, #chest-drop-label, #chest-impact {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, -100%);
  text-align: center;
}
#spin-giggle {
  z-index: 3;
  --word-width: clamp(130px, 21vw, 260px);
  width: var(--word-width);
  left: clamp(calc(var(--word-width) / 2 + 10px), var(--fx-x), calc(100% - var(--word-width) / 2 - 10px));
  top: clamp(calc(var(--playfield-top, 8px) + var(--word-width) * 0.52), var(--fx-y), var(--playfield-bottom, 98vh));
  animation: giggle-pop 0.7s both;
}
#spin-giggle img { display: block; width: 100%; }
.spin-giggle-fallback {
  color: #130e16; font: italic 1000 clamp(45px, 9vw, 112px)/1 var(--font-comic);
  paint-order: stroke fill;
  -webkit-text-stroke: 6px #fff1c5;
  filter: drop-shadow(4px 3px 0 #ff277f) drop-shadow(-4px -2px 0 #55dcd9);
}
@keyframes giggle-pop {
  0% { opacity: 0; transform: translate(-50%, -68%) scale(0.64) rotate(-9deg); }
  25% { opacity: 1; transform: translate(-50%, -104%) scale(1.08) rotate(2deg); }
  64% { opacity: 1; transform: translate(-50%, -100%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -118%) scale(0.91) rotate(4deg); }
}
#chest-drop-label {
  z-index: 2;
  left: clamp(68px, var(--fx-x), calc(100% - 68px));
  top: clamp(calc(var(--playfield-top, 8px) + 40px), var(--fx-y), var(--playfield-bottom, 98vh));
  color: #fff1c5;
  background: #221a21;
  border: 2px solid #ffbf65;
  box-shadow: 4px 4px 0 #100d16;
  font: 900 clamp(13px, 2vw, 19px)/1.2 var(--font-comic);
  padding: 5px 10px;
  white-space: nowrap;
}
#chest-impact {
  z-index: 4;
  --word-width: clamp(202px, 30vw, 408px);
  width: var(--word-width);
  height: clamp(92px, 14vw, 165px);
  left: clamp(calc(var(--word-width) / 2 + 9px), var(--fx-x), calc(100% - var(--word-width) / 2 - 9px));
  top: clamp(calc(var(--playfield-top, 8px) + 110px), var(--fx-y), var(--playfield-bottom, 98vh));
}
#fx-layer:has(#chest-impact:not([hidden])) .comic-sfx { visibility: hidden; }
.chest-impact-word, .chest-impact-reward { position: absolute; inset: 0; }
.chest-impact-word {
  padding-top: 0.07em;
  color: #ffae35;
  font: italic 1000 clamp(77px, 12vw, 160px)/0.92 var(--font-comic);
  letter-spacing: -0.14em;
  padding-right: 0.14em;
  paint-order: stroke fill;
  -webkit-text-stroke: 0.085em #211226;
  filter: drop-shadow(0.033em 0.04em 0 #fff3cc) drop-shadow(-0.028em -0.022em 0 #fff3cc);
  animation: chest-boom 1.2s both;
}
.chest-impact-reward {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  animation: chest-reward 1.2s both;
}
#chest-impact-amount {
  color: #fff4d2;
  font: italic 1000 clamp(34px, 5.5vw, 78px)/1 var(--font-comic);
  white-space: nowrap;
  paint-order: stroke fill;
  -webkit-text-stroke: 0.11em #1c1020;
  text-shadow: 0.045em 0.055em #d18133;
}
#chest-impact-debt {
  background: #1b1724;
  color: #fff4d2;
  border: 2px solid #e8b97a;
  padding: 3px 8px;
  font: 800 12px/1.25 var(--font-ui);
  white-space: nowrap;
}
#chest-impact-debt:empty { display: none; }
@keyframes chest-boom {
  0% { opacity: 0; transform: scale(0.42) rotate(-12deg); }
  13% { opacity: 1; transform: scale(1.14) rotate(-9deg); }
  30% { opacity: 1; transform: scale(1) rotate(-7deg); }
  45%, 100% { opacity: 0; transform: scale(1.15) rotate(-5deg); }
}
@keyframes chest-reward {
  0%, 32% { opacity: 0; transform: translateY(9px) scale(0.94); }
  44%, 90% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-8px); }
}
body.reduced-motion #spin-giggle,
body.reduced-motion .chest-impact-word,
body.reduced-motion .chest-impact-reward { animation: none; }
body.reduced-motion .chest-impact-word { transform: translateY(-50%) scale(0.72) rotate(-5deg); }
body.reduced-motion #fever-frame.active,
body.reduced-motion #fever-frame.active #fever-badge { animation: none; }

#btn-hud-more { display: none; }
#secondary-tools { display: flex; gap: 7px; }
@media (max-width: 640px) {
  #hud-top { display: grid; gap: 7px; align-items: start; }
  .hud-balances { gap: 4px; }
  .hud-balances .comic-stat { padding-inline: 5px; gap: 4px; border-left-width: 4px; }
  .hud-balances .stat-lbl { font-size: 10px; letter-spacing: 0; }
  .hud-balances .stat-num { letter-spacing: 0; }
  .hud-balances .combo .stat-lbl { display: none; }
  .hud-actions { position: relative; width: max-content; }
  #btn-hud-more { display: inline-flex; }
  #secondary-tools {
    display: none;
    position: absolute;
    z-index: 2;
    left: 0;
    top: calc(100% + 6px);
    flex-direction: column;
    padding: 6px;
    background: #111726;
    border: 2px solid #566574;
    min-width: 100%;
  }
  #btn-hud-more[aria-expanded="true"] + #secondary-tools { display: flex; }
  #secondary-tools button { min-height: 42px; text-align: left; }
  #hud-bottom {
    bottom: max(14px, env(safe-area-inset-bottom));
    gap: 5px;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
  }
  #hud-bottom .bottom-cluster:first-child { justify-content: flex-end; }
  #hud-bottom .bottom-cluster:first-child:has(#btn-quick-repay[style*="none"]) { display: none; }
  #hud-bottom .bottom-cluster:last-child { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
  #hud-bottom #btn-drop { justify-content: center; min-height: 48px; padding: 8px 12px; }
  #hud-bottom .drop-main { font-size: 20px; white-space: nowrap; }
  #hud-bottom .drop-sub { font-size: 9px; padding-inline: 4px; letter-spacing: 0; white-space: nowrap; }
  #hud-bottom #btn-boost { min-height: 46px; padding: 8px; font-size: 13px; gap: 5px; transform: none; }
  #hud-bottom .charge-pips { gap: 2px; }
  #hud-bottom .pip { width: 9px; height: 9px; }
  .drop-shortcut { display: none; }
  #onboard-tip { width: calc(100% - 32px); bottom: 76px; padding: 5px 7px; font-size: 11px; }
  #btn-dismiss-tip { flex: none; white-space: nowrap; }
  #slot-lock-banner { top: var(--playfield-top, 98px); white-space: nowrap; max-width: calc(100vw - 28px); padding-inline: 6px; }
  #fever-badge { top: var(--playfield-top, 98px); right: 12px; left: auto; transform: skewX(-4deg); font-size: 12px; padding: 3px 7px; white-space: nowrap; }
  #fever-frame.active #fever-badge { animation: none; }
  #king-layer.peek, #king-layer.slam { top: calc(var(--playfield-top, 98px) + 40px); }
  #king-speech { font-size: 14px; padding: 6px 10px; }
  .king-collage-stage { width: 190px; height: 160px; }
  #spin-giggle { --word-width: clamp(133px, 45vw, 220px); }
}
