@font-face {
  font-family: "Inter PM";
  src: url("../assets/brand/polymarket-inter-font/Inter-Polymarket-VariableFont_opsz,wght.ttf") format("truetype");
  font-weight: 100 900;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg: #07070a;
  --bg-elevated: #0c0c10;
  --glass: rgba(14, 14, 18, 0.72);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-highlight: rgba(255, 255, 255, 0.04);
  --text: #f4f4f5;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --accent: #8b5cf6;
  --glow: rgba(139, 92, 246, 0.45);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.45), 0 1px 0 var(--glass-highlight) inset;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter PM", system-ui, -apple-system, sans-serif;
  font-feature-settings: "cv11", "ss01";
  touch-action: manipulation;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

.mono {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ── AMBIENT (Linear-style mesh + grid) ── */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 30%, black 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 30%, black 20%, transparent 75%);
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: drift 18s ease-in-out infinite;
}

.orb-a {
  width: 340px;
  height: 340px;
  top: -12%;
  left: -8%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.35), transparent 70%);
}

.orb-b {
  width: 280px;
  height: 280px;
  top: 40%;
  right: -12%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.22), transparent 70%);
  animation-delay: -6s;
}

.orb-c {
  width: 220px;
  height: 220px;
  bottom: -5%;
  left: 30%;
  background: radial-gradient(circle, rgba(52, 211, 153, 0.15), transparent 70%);
  animation-delay: -12s;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(12px, -18px) scale(1.05); }
}

#app {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100dvh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  contain: layout style;
  min-height: 0;
  overflow: hidden;
}

.hud { flex-shrink: 0; }

#boss-banner {
  flex-shrink: 0;
}

#boss-banner[hidden] {
  display: none !important;
}

.feed {
  flex-shrink: 0;
}

/* ── MOBILE PERF: kill expensive paint ── */
body.low-power .ambient,
body.low-power .orb { display: none; }

body.low-power .grid-bg {
  opacity: 0.35;
  background-size: 64px 64px;
}

body.low-power .glass,
body.low-power .feed,
body.low-power .hud {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--bg-elevated);
  box-shadow: none;
}

body.low-power .countdown,
body.low-power .result-overlay {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.low-power .display,
body.low-power h1 {
  filter: none;
}

body.low-power .progress-fill {
  box-shadow: none;
}

body.low-power .btn-glow {
  box-shadow: none;
}

body.low-power .screen {
  animation: none;
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}

.glass-inset {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}

/* ── HUD ── */
.hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  margin: 10px 12px 0;
  padding: 10px 14px;
  border-radius: var(--radius);
}

.hud-brand { min-width: 0; }

.hud-logo {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  background: linear-gradient(90deg, #e4e4e7, #a1a1aa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hud-act {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-center {
  justify-self: center;
  width: min(210px, 34vw);
}

.progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
}

.progress-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  border-radius: 99px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 16px var(--glow);
}

.progress-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
}

.hud-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}

.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--glass-border);
}

.chip-label {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-3);
}

.chip-void {
  border-color: rgba(139, 92, 246, 0.45);
  background: rgba(139, 92, 246, 0.12);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
}

.chip-void .chip-label {
  color: #c4b5fd;
}

.chip-val {
  font-size: 13px;
  font-weight: 700;
  min-width: 2ch;
}

.conviction-bar {
  width: 44px;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
  overflow: hidden;
}

@media (min-width: 480px) { .conviction-bar { width: 64px; } }

.conviction-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--amber), var(--green));
  border-radius: 99px;
  transition: width 0.35s ease;
}

.chip-timer {
  font-size: 15px;
  font-weight: 700;
  color: var(--amber);
  min-width: 48px;
  justify-content: center;
}

.chip-timer small {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  margin-left: 1px;
}

/* ── STAGE ── */
.stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 10px 12px 12px;
  min-height: 0;
  overflow: hidden;
}

.screen {
  width: 100%;
  height: 100%;
  max-width: 440px;
  display: none;
  flex-direction: column;
  animation: rise 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

.screen.active { display: flex; }

.panel {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 0;
}

.panel-hero {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 24px;
  background: transparent;
  border: none;
  box-shadow: none;
}

.hero-glow {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow), transparent 68%);
  filter: blur(40px);
  opacity: 0.5;
  pointer-events: none;
}

.accent-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--cyan), transparent);
  opacity: 0.95;
  z-index: 2;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--glass-border);
}

.panel-body {
  flex: 1;
  padding: 18px;
  min-height: 0;
  overflow-y: auto;
}

.panel-body.center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--glass-border);
}

.panel-foot-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.title-access {
  display: flex;
  gap: 8px;
  width: min(100%, 280px);
  margin: 14px auto 0;
}

.title-access .skip-code-input {
  flex: 1;
  min-width: 0;
}

.panel-foot .fine::after {
  content: " · void.hl";
  opacity: 0.35;
}

.play-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.play-meta {
  padding: 14px 16px 0;
  flex-shrink: 0;
}

.play-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.play-prompt {
  display: inline-block;
  flex: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.canvas-frame {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 12px 14px 14px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: #040406;
  box-shadow: inset 0 1px 0 var(--glass-highlight), 0 8px 32px rgba(0, 0, 0, 0.35);
}

/* ── TYPOGRAPHY ── */
.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}

.display, h1 {
  font-size: clamp(42px, 13vw, 58px);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.92;
  background: linear-gradient(135deg, #fafafa 0%, #c4b5fd 45%, #67e8f9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 40px rgba(139, 92, 246, 0.25));
}

h2 {
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.lede {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-2);
  max-width: 300px;
}

.fine {
  margin-top: 18px;
  font-size: 11px;
  color: var(--text-3);
}

.fine::after {
  content: " · void.hl";
  opacity: 0.35;
}

.logo-bento {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 28px 0 24px;
  flex-wrap: wrap;
}

.logo-bento.sm { margin: 0; justify-content: flex-start; }

.logo-tile {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.logo-bento.sm .logo-tile {
  width: 36px;
  height: 36px;
  padding: 6px;
}

.logo-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.callout {
  width: 100%;
  max-width: 400px;
  padding: 18px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}

.end-mark {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  font-size: 26px;
  font-weight: 700;
  color: var(--green);
  box-shadow: 0 0 32px rgba(52, 211, 153, 0.2);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 24px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 50px;
  touch-action: manipulation;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.btn:active { transform: scale(0.97); }

.btn-glow {
  background: linear-gradient(135deg, #fafafa 0%, #e4e4e7 100%);
  color: #09090b;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 4px 24px rgba(255, 255, 255, 0.12),
    0 0 40px var(--glow);
}

.btn-glow:hover {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.15),
    0 6px 28px rgba(255, 255, 255, 0.16),
    0 0 48px var(--glow);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
  border: 1px solid var(--glass-border);
}

.btn-x {
  background: linear-gradient(180deg, #16181c 0%, #0e1014 100%);
  color: #e7e9ea;
  border: 1px solid rgba(231, 233, 234, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.btn-sm {
  padding: 10px 20px;
  min-height: 42px;
  font-size: 13px;
}

.btn-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(280px, 88vw);
  margin-top: 10px;
}

/* ── CANVAS ── */
#game-canvas {
  flex: 1;
  width: 100%;
  min-height: 140px;
  display: block;
  touch-action: none;
  contain: strict;
  will-change: contents;
}

#game-canvas.shake, .canvas-frame.shake {
  animation: shake 0.12s ease;
}

@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-4px, 2px); }
}

#btn-tap {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.22em;
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.2), rgba(139, 92, 246, 0.08));
  border: none;
  border-top: 1px solid rgba(139, 92, 246, 0.25);
  color: #ddd6fe;
  flex-shrink: 0;
}

#btn-tap.pressed {
  background: rgba(139, 92, 246, 0.35);
}

.hint-bar {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

/* ── COUNTDOWN ── */
.countdown {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(7, 7, 10, 0.78);
  backdrop-filter: blur(8px);
  font-size: clamp(72px, 22vw, 104px);
  font-weight: 800;
  letter-spacing: -0.05em;
  z-index: 10;
  pointer-events: none;
  color: var(--text);
  text-shadow: 0 0 60px var(--glow);
}

.countdown.show { display: flex; }

/* ── RESULT ── */
.result-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  background: rgba(7, 7, 10, 0.88);
  backdrop-filter: blur(14px);
  z-index: 11;
  text-align: center;
  padding: 28px 24px;
}

.result-overlay.show { display: flex; }

.result-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.result-overlay h3 {
  font-size: clamp(28px, 8vw, 38px);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.result-overlay.win h3 {
  color: var(--green);
  text-shadow: 0 0 40px rgba(52, 211, 153, 0.35);
}

.result-overlay.fail h3 {
  color: var(--red);
  text-shadow: 0 0 40px rgba(248, 113, 113, 0.3);
}

.result-overlay p {
  color: var(--text-2);
  max-width: 320px;
  line-height: 1.6;
  font-size: 14px;
}

.skip-code-panel {
  width: min(100%, 300px);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(22, 27, 34, 0.72);
  border: 1px solid rgba(48, 54, 61, 0.9);
  text-align: left;
}

.skip-code-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}

.skip-code-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.skip-code-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(48, 54, 61, 0.95);
  background: rgba(7, 7, 10, 0.85);
  color: var(--text-1);
  font: 600 14px ui-monospace, monospace;
  letter-spacing: 0.06em;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.skip-code-input::placeholder {
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0;
}

.skip-code-input:focus {
  border-color: rgba(139, 92, 246, 0.55);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}

.skip-code-input.shake {
  animation: shake 0.12s ease;
  border-color: rgba(248, 113, 113, 0.55);
}

.skip-code-fine {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--text-3);
  text-align: center;
}

.void-skip-btn {
  border-color: rgba(139, 92, 246, 0.35);
  color: #c4b5fd;
}

.void-skip-btn:hover {
  border-color: rgba(139, 92, 246, 0.55);
  background: rgba(139, 92, 246, 0.1);
}

body.void-almighty .title-access {
  opacity: 0.45;
  pointer-events: none;
}

.result-hint {
  max-width: 320px;
  padding: 12px 16px;
  border-radius: var(--radius-xs);
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.22);
  color: #c4b5fd;
  font-size: 12px;
  line-height: 1.55;
  text-align: left;
}

/* ── DIALOGUE ── */
#dialogue-panel {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.dialogue-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dialogue-btn, .dialogue-options button {
  text-align: left;
  padding: 13px 15px;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  min-height: 52px;
  line-height: 1.45;
  touch-action: manipulation;
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  transition: border-color 0.14s, background 0.14s, transform 0.1s;
}

.dialogue-btn:active, .dialogue-options button:active {
  border-color: rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.08);
  transform: scale(0.99);
}

/* ── CT FEED ── */
.feed {
  margin: 0 12px 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  min-height: 46px;
  flex-shrink: 0;
}

.feed-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.feed-head img { width: 11px; height: 11px; opacity: 0.55; }

.feed-head::after {
  content: "void.hl";
  margin-left: auto;
  font-size: 8px;
  opacity: 0.28;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  font-weight: 500;
}

.feed-item {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-item strong { color: var(--text-2); font-weight: 600; }

/* ── MOBILE PREVIEW ── */
body.force-mobile #app {
  max-width: 390px;
  margin: 0 auto;
}

body.force-mobile {
  background: #000;
}

body.force-mobile .grid-bg { opacity: 0.6; }
body.force-mobile .ambient { opacity: 0.7; }

@media (max-width: 520px) {
  .hud {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    margin: 8px 10px 0;
  }
  .hud-brand { grid-column: 1; }
  .hud-stats { grid-column: 2; grid-row: 1; }
  .hud-center {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    justify-self: stretch;
  }
  .chip-label { display: none; }
  .panel-foot .fine { display: none; }
  .stage { padding: 8px 10px 10px; }
  .feed { margin: 0 10px 8px; }
}

@media (max-width: 380px) {
  .hud-logo { font-size: 10px; }
  .chip { padding: 5px 8px; }
}

/* ── V2: ACT THEMES & SMOOTHNESS ── */
body[data-act="1"] { --accent: var(--act-accent, #8b5cf6); }
body[data-act="2"] { --accent: var(--act-accent, #627eea); }
body[data-act="3"] { --accent: var(--act-accent, #14f195); }
body[data-act="4"] { --accent: var(--act-accent, #f87171); }

body.act-transition .stage {
  animation: actFlash 0.9s ease;
}

@keyframes actFlash {
  0% { filter: brightness(1); }
  35% { filter: brightness(1.35) saturate(1.2); }
  100% { filter: brightness(1); }
}

.screen {
  animation: screenIn 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.canvas-frame canvas {
  border-radius: var(--radius-sm);
  will-change: transform;
}

/* ── PLAY: edge-to-edge canvas (boss levels especially) ── */
body[data-screen="play"] .feed {
  display: none;
}

body[data-screen="play"] .stage {
  padding: 0;
  align-items: stretch;
}

body[data-screen="play"] .screen.active {
  max-width: none;
  height: 100%;
}

body[data-screen="play"] .play-card {
  height: 100%;
  border-radius: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

body[data-screen="play"] .play-card .accent-line {
  display: none;
}

body[data-screen="play"] .hud {
  margin: 4px 6px 0;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
}

body[data-screen="play"] #boss-banner:not([hidden]) {
  position: absolute;
  top: calc(var(--safe-top) + 52px);
  left: 8px;
  right: 8px;
  z-index: 25;
  margin: 0;
  padding: 5px 10px;
  font-size: 9px;
  pointer-events: none;
}

body[data-screen="play"] .play-shell {
  height: 100%;
}

body[data-screen="play"] .play-meta {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  padding: 6px 10px 4px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(3, 3, 5, 0.82) 0%, transparent 100%);
}

body[data-screen="play"] .play-meta-row,
body[data-screen="play"] .hint-bar {
  pointer-events: auto;
}

body[data-screen="play"] .hint-bar {
  margin-top: 6px;
  padding: 8px 10px;
}

body[data-screen="play"] .canvas-frame {
  flex: 1;
  margin: 0;
  min-height: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: #020203;
}

body[data-screen="play"] #game-canvas {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
}

body[data-screen="play"].boss-day .play-meta {
  top: 28px;
}

@media (max-width: 520px) {
  body[data-screen="play"] #boss-banner:not([hidden]) {
    top: calc(var(--safe-top) + 78px);
  }

  body[data-screen="play"].boss-day .play-meta {
    top: 32px;
  }
}

.shake {
  animation: shakeAnim 0.16s ease;
}

@keyframes shakeAnim {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-4px, 2px); }
  50% { transform: translate(4px, -2px); }
  75% { transform: translate(-2px, -1px); }
}

/* ── TITLE V2 ── */
.title-rank {
  font-size: 13px;
  font-weight: 600;
  color: var(--cyan);
  margin-bottom: 14px;
}

.title-actions {
  justify-content: center;
  margin-bottom: 10px;
}

.title-actions.secondary {
  gap: 8px;
  flex-wrap: wrap;
}

#btn-daily.done {
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--green);
}

/* ── HUD ICONS ── */
.btn-icon {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  width: 34px;
  height: 34px;
  font-size: 14px;
  cursor: pointer;
  touch-action: manipulation;
}

/* ── BOSS BANNER ── */
.boss-banner {
  margin: 6px 12px 0;
  padding: 8px 14px;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #fef3c7;
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.15), rgba(248, 113, 113, 0.15));
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: var(--radius-xs);
  animation: bossPulse 1.6s ease-in-out infinite;
}

@keyframes bossPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(251, 191, 36, 0); }
  50% { box-shadow: 0 0 20px rgba(251, 191, 36, 0.25); }
}

/* ── INSTALL BANNER ── */
.install-banner {
  position: fixed;
  top: calc(var(--safe-top) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  max-width: calc(100% - 24px);
}

.install-banner[hidden] { display: none !important; }

/* ── TUTORIAL & MODALS ── */
.tutorial-overlay,
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
}

.tutorial-overlay.show,
.modal-overlay.show {
  display: flex;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tutorial-panel,
.modal-panel {
  width: min(400px, 100%);
  padding: 22px;
  text-align: center;
}

.stats-grid {
  text-align: left;
  margin: 16px 0 20px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--glass-border);
  font-size: 14px;
}

.stat-row strong { color: var(--text); }

.stat-badges {
  margin-top: 12px;
  font-size: 12px;
  color: var(--cyan);
  line-height: 1.5;
}

/* ── RESULT SHARE ── */
.result-overlay.show {
  animation: resultIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes resultIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: none; }
}

.countdown.show {
  animation: countPop 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes countPop {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

#btn-tap.pressed {
  transform: scale(0.94);
  transition: transform 0.08s;
}