/* The Ginormous Pour: night-city arcade. Single deliberate dark theme. */
:root {
  --bg: #12102a;
  --bg-deep: #0b0a1c;
  --panel: #1f1b3d;
  --panel-2: #2a2550;
  --line: #3c3552;
  --text: #f3ecd8;
  --muted: #a99fc7;
  --accent: #ff5c3a;
  --accent-deep: #c9351b;
  --gold: #f6c945;
  --cyan: #5ee1ff;
  --green: #7ed957;
  --display: 'Press Start 2P', 'Courier New', monospace;
  --body: 'VT323', 'Courier New', monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 22px;
  line-height: 1.25;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
canvas.px { image-rendering: pixelated; image-rendering: crisp-edges; display: block; max-width: 100%; height: auto; }
button { font-family: inherit; color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
a { color: var(--cyan); }
[hidden] { display: none !important; }

.shell {
  max-width: 540px;
  margin: 0 auto;
  padding-inline: 16px;
  padding-block: 12px 32px;
  position: relative;
  z-index: 1;
}

/* Header ---------------------------------------------------------- */
.masthead { text-align: center; padding-block: 10px 6px; }
.masthead a { text-decoration: none; color: inherit; display: inline-block; }
.masthead h1 {
  font-family: var(--display);
  font-size: clamp(15px, 4.6vw, 22px);
  line-height: 1.5;
  margin: 0;
  color: var(--gold);
  text-shadow: 3px 3px 0 var(--accent-deep), 6px 6px 0 var(--bg-deep);
  letter-spacing: 1px;
  text-wrap: balance;
}
.masthead .tagline {
  font-family: var(--display);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 2px;
  margin-top: 8px;
}
.mode-pill {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 10px; padding: 4px 10px;
  border: 2px solid var(--line); background: var(--bg-deep);
  font-size: 18px; color: var(--muted);
}
.mode-pill .dot { width: 8px; height: 8px; background: var(--green); box-shadow: 0 0 6px var(--green); }
.mode-pill.local .dot { background: var(--gold); box-shadow: 0 0 6px var(--gold); }

/* Skyline --------------------------------------------------------- */
.skyline {
  position: relative; height: 120px; margin-top: 24px;
  background: linear-gradient(to top, var(--bg-deep), transparent);
  pointer-events: none;
}
.skyline canvas { position: absolute; bottom: 0; left: 0; width: 100%; height: 100%; image-rendering: pixelated; opacity: 0.9; }
.heli { position: absolute; top: 10px; animation: fly 22s linear infinite; }
@keyframes fly { from { left: -80px; } to { left: 110%; } }

/* Typography ------------------------------------------------------ */
h2 {
  font-family: var(--display);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 12px;
  color: var(--accent);
  text-shadow: 2px 2px 0 var(--bg-deep);
  text-wrap: balance;
}
h3 { font-family: var(--display); font-size: 10px; letter-spacing: 1px; color: var(--muted); margin: 0 0 8px; }
p { margin: 0 0 12px; max-width: 60ch; }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.eyebrow { font-family: var(--display); font-size: 9px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; }
.num { font-variant-numeric: tabular-nums; }

/* Buttons --------------------------------------------------------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 56px; padding: 12px 16px;
  font-family: var(--display); font-size: 11px; line-height: 1.5; letter-spacing: 1px;
  background: var(--panel-2); color: var(--text);
  border: 3px solid var(--bg-deep); box-shadow: 0 5px 0 var(--bg-deep);
  cursor: pointer; text-align: center; text-decoration: none;
  transition: transform 80ms, box-shadow 80ms;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--bg-deep); }
.btn.primary { background: var(--accent); color: #fff7ea; text-shadow: 2px 2px 0 var(--accent-deep); }
.btn.gold { background: var(--gold); color: var(--bg-deep); }
.btn.ghost { background: transparent; border-color: var(--line); box-shadow: 0 5px 0 var(--line); }
.btn.small { min-height: 44px; font-size: 9px; padding: 8px 12px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-row { display: grid; gap: 12px; }
.btn-row.two { grid-template-columns: 1fr 1fr; }
.btn canvas { flex: none; }

/* Panels ---------------------------------------------------------- */
.panel {
  background: var(--panel);
  border: 3px solid var(--bg-deep);
  box-shadow: 0 6px 0 var(--bg-deep), inset 0 0 0 2px var(--line);
  padding: 14px;
}
.stack { display: grid; gap: 14px; }
.notice {
  border: 2px dashed var(--line); padding: 10px 12px; font-size: 19px; color: var(--muted);
}
.notice.error { border-color: var(--accent); color: var(--text); }

/* Stat tiles ------------------------------------------------------ */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--bg-deep); border: 2px solid var(--line); padding: 10px 6px; text-align: center; }
.stat .big { font-family: var(--display); font-size: 20px; color: var(--gold); line-height: 1.4; }
.stat .lbl { font-size: 17px; color: var(--muted); letter-spacing: 1px; }

/* Hero (home) ------------------------------------------------------ */
.hero {
  position: relative; height: 150px; overflow: hidden;
  background: linear-gradient(180deg, #1a1740 0%, #2a1f4e 70%, var(--bg-deep) 100%);
  border: 3px solid var(--bg-deep); box-shadow: inset 0 0 0 2px var(--line);
}
.hero .moon { position: absolute; right: 26px; top: 14px; width: 28px; height: 28px; background: var(--gold); box-shadow: 0 0 20px rgba(246,201,69,.5); }
.hero .lineup { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; justify-content: space-evenly; align-items: flex-end; }
.hero .lineup canvas { animation: bob 1.6s ease-in-out infinite; }
.hero .lineup canvas:nth-child(2n) { animation-delay: -0.6s; }
.hero .lineup canvas:nth-child(3n) { animation-delay: -1.1s; }
.hero .roof-strip { position: absolute; left: 0; right: 0; bottom: 0; height: 16px; background-repeat: repeat-x; background-size: auto 100%; }
.hero .tank { position: absolute; bottom: 14px; animation: roll 18s linear infinite; }
@keyframes roll { from { left: 100%; } to { left: -70px; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* Forms ----------------------------------------------------------- */
label.field { display: grid; gap: 4px; }
label.field span { font-family: var(--display); font-size: 9px; letter-spacing: 1px; color: var(--muted); }
input[type=text] {
  width: 100%; font-family: var(--body); font-size: 24px; padding: 8px 10px;
  background: var(--bg-deep); color: var(--text); border: 3px solid var(--line);
}
input[type=text]::placeholder { color: #6d6590; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--bg-deep); border: 2px solid var(--line); padding: 4px 10px; font-size: 20px; cursor: pointer;
}
.chip:hover, .chip:focus-visible { border-color: var(--cyan); }

.monster-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.monster-pick {
  display: grid; justify-items: center; gap: 6px; padding: 8px 4px;
  background: var(--bg-deep); border: 3px solid var(--line); cursor: pointer;
}
.monster-pick .nm { font-family: var(--display); font-size: 7px; letter-spacing: 0; color: var(--muted); }
.monster-pick[aria-pressed=true] { border-color: var(--gold); background: var(--panel-2); box-shadow: 0 0 0 2px var(--gold) inset; }
.monster-pick[aria-pressed=true] .nm { color: var(--gold); }
.monster-pick[aria-pressed=true] canvas { animation: stomp 0.6s steps(2) infinite; }
@keyframes stomp { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-3px) } }
.monster-blurb { min-height: 28px; font-size: 20px; color: var(--cyan); }

/* Beer entry success ------------------------------------------------ */
.enter-city { text-align: center; display: grid; justify-items: center; gap: 10px; }
.enter-city canvas { animation: arrive 900ms cubic-bezier(.2,1.4,.4,1) both; }
@keyframes arrive { from { transform: translateY(-120px) scale(1.4); opacity: 0; } 60% { transform: translateY(6px) scale(1); opacity: 1; } to { transform: translateY(0); } }

/* Arena ----------------------------------------------------------- */
.round-head { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--display); font-size: 9px; color: var(--muted); letter-spacing: 1px; margin-bottom: 8px; }
.round-head b { color: var(--gold); }
.arena {
  --dir: 1;
  position: relative; height: 210px; overflow: hidden;
  background: linear-gradient(180deg, #171436 0%, #241d4b 75%, #1a1533 100%);
  border: 3px solid var(--bg-deep); box-shadow: inset 0 0 0 2px var(--line);
}
.arena .backdrop { position: absolute; left: 0; right: 0; bottom: 30px; height: 90px; opacity: .5; }
.arena .backdrop canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.arena .rooftop { position: absolute; left: 0; right: 0; bottom: 0; height: 32px; background-repeat: repeat-x; background-size: auto 100%; }
.arena .roofline { position: absolute; left: 0; right: 0; bottom: 30px; height: 6px; background: var(--bg-deep); }
.fighter {
  position: absolute; bottom: 34px; width: 44%;
  display: grid; justify-items: center; gap: 4px;
  transition: transform 200ms;
}
.fighter.left { left: 2%; --dir: 1; }
.fighter.right { right: 2%; --dir: -1; }
.fighter canvas { animation: bob 1.4s ease-in-out infinite; }
.fighter.right canvas { animation-delay: -0.7s; }
.fighter .tag {
  font-family: var(--display); font-size: 8px; color: var(--text); background: var(--bg-deep);
  padding: 4px 6px; border: 2px solid var(--line); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fighter.picked .tag { border-color: var(--gold); color: var(--gold); }
.vs {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  font-family: var(--display); font-size: 22px; color: var(--accent);
  text-shadow: 3px 3px 0 var(--bg-deep); animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-50%,-50%) scale(1.15); } }
.fighter.punch { animation: punch 700ms cubic-bezier(.3,0,.2,1) forwards; }
.fighter.punch canvas { animation: none; }
@keyframes punch {
  0% { transform: translateX(0); }
  35% { transform: translateX(calc(var(--dir) * -14px)); }
  60% { transform: translateX(calc(var(--dir) * 62px)) scale(1.08); }
  100% { transform: translateX(calc(var(--dir) * 10px)); }
}
.fighter.ko { animation: ko 1400ms cubic-bezier(.4,0,.9,.6) 380ms forwards; }
.fighter.ko canvas { animation: flash 120ms steps(2) 4; }
@keyframes ko {
  0% { transform: translate(0, 0) rotate(0); }
  30% { transform: translate(calc(var(--dir) * -30px), -60px) rotate(calc(var(--dir) * -40deg)); }
  100% { transform: translate(calc(var(--dir) * -90px), 320px) rotate(calc(var(--dir) * -420deg)); opacity: 0; }
}
@keyframes flash { 0% { filter: brightness(1); } 50% { filter: brightness(4) saturate(0); } 100% { filter: brightness(1); } }
.arena.shake { animation: shake 500ms linear 350ms; }
@keyframes shake { 0%,100% { transform: translate(0,0);} 20% { transform: translate(-6px, 3px);} 40% { transform: translate(6px,-3px);} 60% { transform: translate(-4px,2px);} 80% { transform: translate(4px,-2px);} }
.fx { position: absolute; pointer-events: none; }
.ko-banner {
  position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%) scale(0);
  font-family: var(--display); font-size: 40px; color: var(--gold);
  text-shadow: 4px 4px 0 var(--accent-deep), 8px 8px 0 var(--bg-deep);
  animation: kopop 500ms cubic-bezier(.2,1.6,.4,1) 520ms forwards;
}
@keyframes kopop { from { transform: translate(-50%,-50%) scale(0) rotate(-20deg);} to { transform: translate(-50%,-50%) scale(1) rotate(-6deg);} }
.winner-glow canvas { filter: drop-shadow(0 0 10px var(--gold)); }

/* Beer cards ------------------------------------------------------ */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.beer-card {
  display: grid; gap: 4px; text-align: left; padding: 10px;
  background: var(--panel); border: 3px solid var(--bg-deep); box-shadow: 0 5px 0 var(--bg-deep), inset 0 0 0 2px var(--line);
  cursor: pointer; min-height: 120px; align-content: start;
}
.beer-card:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--bg-deep), inset 0 0 0 2px var(--line); }
.beer-card .mon { font-family: var(--display); font-size: 7px; color: var(--muted); letter-spacing: 1px; }
.beer-card .name { font-size: 24px; line-height: 1.1; color: var(--text); overflow-wrap: anywhere; }
.beer-card .sub { font-size: 18px; color: var(--muted); overflow-wrap: anywhere; }
.beer-card .by { font-size: 17px; color: var(--cyan); }
.beer-card[aria-pressed=true] { border-color: var(--gold); box-shadow: 0 5px 0 var(--bg-deep), inset 0 0 0 2px var(--gold); }
.beer-card[aria-pressed=true] .mon { color: var(--gold); }
.beer-card.lost { opacity: .45; }
.hint { text-align: center; color: var(--muted); font-size: 20px; margin: 12px 0 0; }

.margin-pick { margin-top: 12px; }
.margin-pick .btn { justify-content: space-between; text-align: left; }
.margin-pick .btn small { font-family: var(--body); font-size: 18px; letter-spacing: 0; color: var(--muted); text-transform: none; }
.margin-pick .btn.primary small { color: #ffd9cd; }

.result { text-align: center; margin-top: 12px; }
.result .line { font-size: 26px; line-height: 1.15; }
.result .line b { color: var(--gold); }
.result .delta { font-family: var(--display); font-size: 10px; color: var(--green); margin: 6px 0 12px; }

/* Roster ---------------------------------------------------------- */
.roster { display: grid; gap: 8px; }
.roster-row {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center;
  background: var(--panel); border: 2px solid var(--line); padding: 8px;
}
.roster-row .name { font-size: 23px; line-height: 1.1; }
.roster-row .sub { font-size: 17px; color: var(--muted); }
.roster-row .rec { font-family: var(--display); font-size: 9px; color: var(--muted); text-align: right; line-height: 1.7; }

/* Tower ----------------------------------------------------------- */
.brawl {
  position: relative; height: 170px; overflow: hidden;
  background: linear-gradient(180deg, #171436 0%, #241d4b 80%, #1a1533 100%);
  border: 3px solid var(--bg-deep); box-shadow: inset 0 0 0 2px var(--line);
}
.brawl .rooftop { position: absolute; left: 0; right: 0; bottom: 0; height: 24px; background-repeat: repeat-x; background-size: auto 100%; }
.brawl .brawler { position: absolute; bottom: 24px; animation: brawl 1.1s ease-in-out infinite alternate; }
@keyframes brawl { from { transform: translateX(-14px) rotate(-6deg); } to { transform: translateX(14px) rotate(6deg); } }
.brawl .fx { animation: none; }
.brawl.done .brawler { animation: none; }

.tower { position: relative; margin-top: 16px; display: grid; }
.tower .sky-top { display: grid; justify-items: center; position: relative; height: 130px; }
.tower .sky-top .champ { position: absolute; bottom: 24px; display: grid; justify-items: center; gap: 2px; }
.tower .sky-top .champ canvas.crown { animation: bob 1.4s ease-in-out infinite; }
.tower .sky-top .roof { position: absolute; bottom: 0; z-index: 1; }
.tower .sky-top .roofline { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: var(--bg-deep); }
.tower .beacon { position: absolute; top: 0; left: 50%; }
.floor {
  position: relative; min-height: 64px; display: grid; align-items: center;
  background-repeat: repeat-x; background-size: auto 100%;
  animation: rise 500ms ease-out both;
}
.floor.damaged { }
.floor .card {
  margin: 8px 20px; display: grid; grid-template-columns: 34px 44px 1fr auto; gap: 8px; align-items: center;
  background: var(--bg-deep); border: 2px solid var(--line); padding: 6px 8px;
}
.floor.rank-1 .card { border-color: var(--gold); box-shadow: 0 0 12px rgba(246,201,69,.35); }
.floor.rank-2 .card { border-color: #c9d6e6; }
.floor.rank-3 .card { border-color: #c98a4a; }
.floor .rank { font-family: var(--display); font-size: 14px; color: var(--gold); text-align: center; }
.floor.rank-2 .rank { color: #c9d6e6; }
.floor.rank-3 .rank { color: #c98a4a; }
.floor .rank.low { font-size: 11px; color: var(--muted); }
.floor .name { font-size: 22px; line-height: 1.05; overflow-wrap: anywhere; }
.floor .sub { font-size: 16px; color: var(--muted); }
.floor .rec { font-family: var(--display); font-size: 8px; color: var(--muted); text-align: right; line-height: 1.8; white-space: nowrap; }
.floor .rec b { color: var(--text); font-weight: normal; }
.floor .fire { position: absolute; bottom: 4px; animation: flicker 300ms steps(2) infinite; }
@keyframes flicker { 50% { transform: scaleX(-1); } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.tower .street { height: 20px; background-repeat: repeat-x; background-size: auto 100%; }

.report { margin-top: 16px; }
.report dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; }
.report dt { color: var(--muted); }
.report dd { margin: 0; text-align: right; color: var(--gold); }

.footer-note { text-align: center; color: var(--muted); font-size: 17px; margin-top: 20px; }

@media (max-width: 380px) {
  .monster-grid { grid-template-columns: repeat(3, 1fr); }
  .stats .big { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
