:root {
  --ink: #080b0a;
  --ink-2: #121715;
  --paper: #f4f0e5;
  --gold: #f3b51b;
  --green: #00866a;
  --green-hi: #19c49b;
  --red: #e0453a;
  --muted: #9aa39d;
  --line: rgba(244, 240, 229, 0.16);
  --pixel: "Press Start 2P", ui-monospace, monospace;
  --display: "Archivo Black", Impact, "Arial Black", sans-serif;
  --body: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(0, 134, 106, 0.22), transparent 60%),
    radial-gradient(80% 50% at 50% 100vh, rgba(243, 181, 27, 0.08), transparent 70%);
  background-color: var(--ink);
  background-repeat: no-repeat;
  color: var(--paper);
  font-family: var(--body);
  font-size: 18px;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.app {
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px calc(env(safe-area-inset-bottom, 0px) + 8px);
  display: flex;
  flex-direction: column;
}

.hud { display: grid; gap: 8px; }
.meters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.meter { position: relative; display: grid; justify-items: center; gap: 4px; }
.meter-tile {
  position: relative;
  width: 100%;
  height: 54px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--ink-2);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.meter-fill {
  position: absolute;
  inset: auto 0 0;
  height: 50%;
  background: linear-gradient(to top, var(--green), var(--green-hi));
  transition: height 0.45s cubic-bezier(.2,.9,.3,1.2), background 0.3s;
}
.meter.danger .meter-fill { background: linear-gradient(to top, #8f1d16, var(--red)); }
.meter-icon { position: relative; font-size: 26px; filter: drop-shadow(0 2px 0 rgba(0,0,0,.6)); }
.meter-label { font-family: var(--pixel); font-size: 7px; letter-spacing: 0.04em; color: var(--muted); text-transform: uppercase; white-space: nowrap; }
.pip {
  position: absolute;
  top: -9px;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: var(--paper);
  transform: scale(0);
  transition: transform 0.15s;
  z-index: 2;
}
.pip.small { transform: scale(0.8); }
.pip.big { transform: scale(1.5); }
.meter.bump-up .meter-tile { animation: bump-up 0.5s; }
.meter.bump-down .meter-tile { animation: bump-down 0.5s; }
@keyframes bump-up { 30% { border-color: var(--green-hi); transform: translateY(-3px); } }
@keyframes bump-down { 30% { border-color: var(--red); transform: translateY(3px); } }

.calendar {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-family: var(--pixel);
  font-size: 9px;
  color: var(--muted);
  padding-block: 4px 2px;
}
.calendar b { color: var(--gold); font-weight: 400; }
.calendar .sep { opacity: 0.4; }

.screen { flex: 1; display: flex; flex-direction: column; align-items: center; }

.title-screen { text-align: center; gap: 10px; padding-top: 18px; }
.badge { width: 72px; height: 72px; }
.kicker { margin: 0; font-family: var(--pixel); font-size: 9px; letter-spacing: 0.08em; color: var(--gold); text-transform: uppercase; }
.logo {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(30px, 10.4vw, 54px);
  line-height: 0.95;
  letter-spacing: 0.01em;
  color: var(--paper);
  text-shadow: 4px 4px 0 var(--green), 8px 8px 0 rgba(0, 0, 0, 0.55);
}
.pitch { margin: 6px 0 0; font-size: 20px; line-height: 1.25; max-width: 30ch; }
.pitch strong { color: var(--gold); }
.hero-sprite { image-rendering: pixelated; width: 116px; height: auto; margin: 6px 0; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.how { margin: 4px 0 0; color: var(--muted); font-size: 16px; line-height: 1.3; max-width: 34ch; }
.records { margin: 0; font-family: var(--pixel); font-size: 9px; color: var(--muted); min-height: 1em; line-height: 1.6; }

.big-button, .ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 26px;
  border-radius: 6px;
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  border: 0;
  transition: transform 0.08s;
}
.big-button { background: var(--green); color: var(--paper); box-shadow: 0 5px 0 #004c3c; }
.big-button.gold { background: var(--gold); color: var(--ink); box-shadow: 0 5px 0 #9c7108; }
.big-button:active { transform: translateY(4px); box-shadow: 0 1px 0 #004c3c; }
.big-button.gold:active { box-shadow: 0 1px 0 #9c7108; }
.ghost-button { background: transparent; color: var(--paper); border: 2px solid var(--line); font-size: 15px; min-height: 46px; }
.ghost-button:active { transform: translateY(2px); }
.link-button { background: none; border: 0; color: var(--muted); font-family: var(--pixel); font-size: 9px; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; padding: 10px; line-height: 1.6; }

.play-screen { justify-content: flex-start; gap: 10px; padding-top: 10px; }
.card-text {
  margin: 0;
  min-height: 5.2em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: clamp(19px, 5.2vw, 22px);
  font-weight: 500;
  line-height: 1.22;
  max-width: 28ch;
}
.card-text.aside { color: var(--gold); font-style: italic; }

.stage { position: relative; width: min(78vw, 310px); aspect-ratio: 4 / 5; touch-action: none; user-select: none; -webkit-user-select: none; }
.card-under, .card {
  position: absolute;
  inset: 0;
  border-radius: 14px;
}
.card-under { background: var(--ink-2); border: 2px solid var(--line); transform: translateY(8px) scale(0.96); }
.card {
  overflow: hidden;
  border: 3px solid var(--paper);
  background:
    radial-gradient(70% 55% at 50% 38%, rgba(243, 181, 27, 0.28), transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 46px, rgba(224, 69, 58, 0.55) 46px 49px),
    linear-gradient(#1b2420, #0c110f);
  background-size: 100% 100%, 100% 150px, 100% 100%;
  background-position: center, center 18px, center;
  background-repeat: no-repeat, no-repeat, no-repeat;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  cursor: grab;
  will-change: transform;
  transform-origin: 50% 110%;
}
.card.dragging { cursor: grabbing; }
.card.snap { transition: transform 0.28s cubic-bezier(.2,.9,.3,1.25); }
.card.fly { transition: transform 0.32s ease-in, opacity 0.32s ease-in; opacity: 0; }
.card.enter { animation: card-in 0.32s cubic-bezier(.2,.9,.3,1.15); }
@keyframes card-in { from { transform: translateY(26px) scale(0.92); opacity: 0; } }
.card.back {
  background:
    radial-gradient(60% 45% at 50% 45%, rgba(0, 134, 106, 0.5), transparent 70%),
    linear-gradient(#0f1513, #070a09);
}

.choice-banner {
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  padding: 14px 12px 22px;
  font-family: var(--display);
  font-size: 19px;
  line-height: 1.1;
  text-transform: uppercase;
  background: linear-gradient(rgba(8, 11, 10, 0.95), rgba(8, 11, 10, 0));
  opacity: 0;
  transition: opacity 0.12s;
  pointer-events: none;
}
.choice-banner.left { text-align: right; }
.choice-banner.right { text-align: left; }
.choice-banner.show { opacity: 1; }

.portrait { position: absolute; inset: 14% 0 22%; display: grid; place-items: end center; }
.portrait img { image-rendering: pixelated; height: 100%; width: auto; max-width: 92%; object-fit: contain; filter: drop-shadow(0 6px 0 rgba(0,0,0,.45)); }
.portrait .emoji { font-size: clamp(96px, 30vw, 132px); line-height: 1; align-self: center; filter: drop-shadow(0 6px 0 rgba(0,0,0,.45)); }
.portrait .redacted {
  align-self: center;
  width: 62%;
  height: 78%;
  background: #000;
  border-radius: 46% 46% 8px 8px / 30% 30% 8px 8px;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 0 rgba(0,0,0,.45);
}
.portrait .redacted span { font-family: var(--pixel); font-size: 10px; color: var(--red); border: 2px solid var(--red); padding: 6px; transform: rotate(-12deg); }
.portrait .card-logo { width: 46%; align-self: center; opacity: 0.95; }

.nameplate {
  position: absolute;
  inset: auto 10px 12px;
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  background: rgba(8, 11, 10, 0.88);
  border-left: 5px solid var(--gold);
}
.np-name { font-family: var(--display); font-size: 19px; line-height: 1.05; text-transform: uppercase; }
.np-tag { font-size: 15px; color: var(--muted); line-height: 1.1; }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 10px; }
.choice-button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: var(--ink-2);
  font-family: var(--body);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.1;
  text-align: left;
  cursor: pointer;
}
#right-button { justify-content: flex-end; text-align: right; }
.choice-button .arrow { color: var(--gold); font-size: 13px; flex: none; }
.choice-button:hover, .choice-button:focus-visible { border-color: var(--gold); }
.choice-button:active { transform: translateY(2px); }

.end-screen { text-align: center; gap: 10px; padding-top: 16px; }
.end-title { margin: 0; font-family: var(--display); font-size: clamp(30px, 9vw, 42px); line-height: 1; text-transform: uppercase; text-shadow: 3px 3px 0 var(--red); }
.end-screen.win .end-title { text-shadow: 3px 3px 0 var(--green); color: var(--gold); }
.end-portrait { height: 150px; display: grid; place-items: end center; }
.end-portrait img { image-rendering: pixelated; height: 150px; width: auto; animation: bob 1.6s ease-in-out infinite; }
.end-portrait .emoji { font-size: 110px; line-height: 1; }
.end-portrait .redacted { width: 90px; height: 130px; background: #000; border-radius: 40px 40px 6px 6px; }
.end-text { margin: 0; font-size: 20px; line-height: 1.25; max-width: 32ch; }
.end-stats { margin: 0; font-family: var(--pixel); font-size: 9px; color: var(--muted); line-height: 1.8; }
.end-stats b { color: var(--gold); font-weight: 400; }
.end-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 4px; }
.share-status { margin: 0; min-height: 1.2em; font-size: 15px; color: var(--green-hi); }

.real-show {
  width: 100%;
  margin-top: 10px;
  padding: 18px 16px 20px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(rgba(0, 134, 106, 0.16), rgba(0, 0, 0, 0));
  display: grid;
  justify-items: center;
  gap: 10px;
}
.real-show img { width: 220px; height: auto; }
.real-show h3 { margin: 0; font-family: var(--display); font-size: 22px; text-transform: uppercase; }
.real-show p { margin: 0; font-size: 18px; line-height: 1.3; color: var(--paper); }
.real-show .big-button, .real-show .ghost-button { width: 100%; max-width: 320px; }

.gallery-screen { gap: 10px; padding-top: 14px; text-align: center; }
.gallery-screen h2 { margin: 0; font-family: var(--display); font-size: 34px; text-transform: uppercase; }
.gallery-sub { margin: 0; color: var(--muted); }
.gallery { list-style: none; margin: 6px 0 12px; padding: 0; width: 100%; display: grid; gap: 8px; text-align: left; }
.gallery li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; padding: 10px 12px; border: 2px solid var(--line); border-radius: 8px; background: var(--ink-2); }
.gallery li .g-icon { font-size: 22px; text-align: center; }
.gallery li strong { display: block; font-family: var(--display); font-size: 16px; text-transform: uppercase; }
.gallery li small { color: var(--muted); font-size: 15px; }
.gallery li.locked { opacity: 0.45; }
.gallery li.win { border-color: var(--gold); }

.foot { display: flex; align-items: center; justify-content: center; gap: 10px; padding-top: 14px; font-size: 14px; color: var(--muted); }
.icon-button { background: none; border: 2px solid var(--line); border-radius: 6px; width: 38px; height: 34px; cursor: pointer; font-size: 16px; }

.noscript { padding: 2rem; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .hero-sprite, .end-portrait img { animation: none; }
  .card.enter { animation: none; }
  .card.snap, .card.fly, .meter-fill { transition: none; }
}

@media (min-height: 860px) {
  .stage { width: min(78vw, 330px); }
}
