:root {
  --night: #070b18;
  --panel: #0f1527;
  --panel-edge: #232c4a;
  --led: #ffc94a;
  --chalk: #f5f2e9;
  --muted: #9aa3bd;
  --strike: #ff4141;
  --hit: #7dff9b;
  --grass-1: #1b6236;
  --grass-2: #20703e;

  /* Cores do time da rodada (o game.js troca a cada rodada) */
  --crown: #0c2340;
  --brim: #0c2340;
  --logo: #ffffff;
  --accent: #ffffff;
  --ink: #ffffff;

  --font-ui: 'Bebas Neue', Impact, 'Arial Narrow Bold', sans-serif;
  --font-show: 'Bangers', 'Bebas Neue', Impact, sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

html, body { margin: 0; }

body {
  min-height: 100dvh;
  background:
    radial-gradient(60% 40% at 15% 0%, rgba(255, 255, 255, .08), transparent 70%),
    radial-gradient(60% 40% at 85% 0%, rgba(255, 255, 255, .08), transparent 70%),
    linear-gradient(180deg, #0a1022 0%, var(--night) 55%, #04060d 100%);
  color: var(--chalk);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.app {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px 24px;
}

/* ---------- Placar ---------- */
.scoreboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  padding: 10px;
  background: #05070f;
  border: 2px solid #1b2238;
  border-radius: 14px;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, .8);
}

.cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  background: #0b0f1c;
  border-radius: 8px;
  min-width: 0;
}

.label {
  font-family: var(--font-ui);
  font-size: 14px;
  letter-spacing: .14em;
  color: var(--muted);
}

.value {
  font-family: var(--font-ui);
  font-size: clamp(24px, 4.6vw, 34px);
  line-height: 1;
  color: var(--led);
  text-shadow: 0 0 10px rgba(255, 201, 74, .55);
  font-variant-numeric: tabular-nums;
}

.strikes { display: flex; gap: 6px; padding: 5px 0; }
.strikes i {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2a1414;
  box-shadow: inset 0 0 0 2px #4a1f1f;
  transition: background .25s, box-shadow .25s;
}
.strikes i.on {
  background: var(--strike);
  box-shadow: 0 0 12px rgba(255, 65, 65, .8), inset 0 0 0 2px #ff8a8a;
}

.mute {
  width: 52px;
  border: 0;
  border-radius: 8px;
  background: #0b0f1c;
  color: var(--chalk);
  font-size: 22px;
  cursor: pointer;
}
.mute:hover { background: #151b30; }

/* ---------- Faixa do time ---------- */
.banner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0;
  padding: 10px 18px 10px 12px;
  border-radius: 14px;
  background: var(--crown);
  color: var(--ink);
  box-shadow: inset 0 -6px 0 var(--accent), 0 10px 30px rgba(0, 0, 0, .35);
  overflow: hidden;
  transition: background-color .5s, color .5s, box-shadow .5s;
}
.banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(255, 255, 255, .14), transparent 45%);
  pointer-events: none;
}
.banner.enter { animation: banner-in .6s cubic-bezier(.2, .8, .2, 1); }

.banner-cap { flex: 0 0 auto; width: 68px; }
.banner-cap svg { display: block; width: 100%; height: auto; }

.banner-text { min-width: 0; }
.kicker {
  display: block;
  font-family: var(--font-ui);
  font-size: 15px;
  letter-spacing: .14em;
  opacity: .85;
}
.banner h1 {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: clamp(30px, 6.4vw, 52px);
  line-height: .95;
  letter-spacing: .03em;
  overflow-wrap: anywhere;
}

@keyframes banner-in {
  from { transform: translateX(-24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ---------- Telão (jumbotron) ---------- */
.jumbotron {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(110% 75% at 50% 0%, color-mix(in srgb, var(--crown) 60%, #0b1020) 0%, #0a0f1f 72%);
  border: 6px solid #1a2140;
  box-shadow: 0 0 0 2px #000, 0 24px 60px rgba(0, 0, 0, .6), inset 0 0 70px rgba(0, 0, 0, .7);
  transition: background .6s;
  user-select: none;
  -webkit-user-select: none;
}

/* Textura de pontos de LED por cima de tudo */
.jumbotron::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.5px);
  background-size: 4px 4px;
}

.lights {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(30% 50% at 10% -10%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%),
    radial-gradient(30% 50% at 90% -10%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%);
  opacity: .6;
  transition: background .6s;
}

/* Muro do outfield com o nome do time, como no vídeo dos Angels */
.wall {
  position: absolute;
  left: 0;
  right: 0;
  top: 36%;
  height: 12.5%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .16) 0 2px, transparent 2px 9%),
    linear-gradient(180deg, #2c6146, #1b4430);
  border-top: 4px solid #f2c94c;
  box-shadow: inset 0 -8px 12px rgba(0, 0, 0, .35);
}
.wall-text {
  font-family: var(--font-show);
  font-size: clamp(22px, 5.2vw, 46px);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--crown);
  -webkit-text-stroke: .09em #ffffff;
  paint-order: stroke fill;
  transition: color .5s;
}

.field {
  position: absolute;
  left: 0;
  right: 0;
  top: 48.5%;
  bottom: 0;
  background:
    radial-gradient(ellipse 80% 62% at 50% 122%, #b9875a 0 60%, #a06c3e 61% 62%, transparent 63%),
    linear-gradient(180deg, rgba(0, 0, 0, .32), transparent 28%),
    repeating-linear-gradient(90deg, var(--grass-1) 0 8%, var(--grass-2) 8% 16%);
}

/* ---------- Vinhetas (estilo telão: HAT SHUFFLE, FOLLOW THE BALL, WHERE IS THE BALL?, HOME RUN, STRIKE) ---------- */
.vinhetas { position: absolute; inset: 0; z-index: 7; pointer-events: none; }

.vinheta {
  position: absolute;
  top: 5%;
  left: 0;
  right: 0;
  text-align: center;
  transform-origin: 50% 40%;
}

.show-text,
.vinheta-text {
  display: inline-block;
  font-family: var(--font-show);
  font-weight: 400;
  line-height: 1;
  letter-spacing: .03em;
  white-space: nowrap;
  paint-order: stroke fill;
}
.vinheta-text { font-size: clamp(34px, 8.2vw, 78px); }
.ch { display: inline-block; white-space: pre; }

/* vermelho com contorno branco (FOLLOW THE BALL / WHERE IS THE BALL?) */
.v-red {
  color: #d81f2d;
  -webkit-text-stroke: .1em #ffffff;
  text-shadow: 0 .05em 0 #7d0c16, 0 .09em 0 #4b060c, 0 .14em .22em rgba(0, 0, 0, .55);
}
/* branco com contorno escuro (HAT SHUFFLE) */
.v-white {
  color: #ffffff;
  -webkit-text-stroke: .1em #0d1020;
  text-shadow: 0 .06em 0 #0d1020, 0 .11em 0 #0d1020, 0 .17em .26em rgba(0, 0, 0, .6);
}
/* dourado (HOME RUN) */
.v-gold {
  color: #ffd23f;
  -webkit-text-stroke: .1em #8a1c0a;
  text-shadow: 0 .05em 0 #8a1c0a, 0 .1em 0 #4f0f05, 0 0 .5em rgba(255, 210, 63, .55);
}
/* strike: branco com contorno vermelho */
.v-strike {
  color: #ffffff;
  -webkit-text-stroke: .1em #c8102e;
  text-shadow: 0 .05em 0 #7d0c16, 0 .1em 0 #4b060c, 0 0 .5em rgba(255, 65, 65, .6);
}

.vinheta-sub {
  display: block;
  margin-top: .3em;
  font-family: var(--font-ui);
  font-size: clamp(16px, 2.8vw, 24px);
  letter-spacing: .12em;
  color: var(--led);
  text-shadow: 0 2px 0 #000, 0 0 12px rgba(255, 201, 74, .6);
}

/* Abertura de cada rodada */
.opener {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4%;
  overflow: hidden;
  background: var(--crown);
}
.opener .rays {
  position: absolute;
  inset: -60%;
  background: repeating-conic-gradient(
    from 0deg at 50% 50%,
    color-mix(in srgb, var(--crown) 70%, #000) 0deg 9deg,
    color-mix(in srgb, var(--crown) 85%, #fff) 9deg 18deg
  );
}
.opener::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(closest-side, transparent 35%, rgba(0, 0, 0, .55));
}
.opener-title { position: relative; z-index: 1; font-size: clamp(54px, 15vw, 118px); }
.opener-team {
  position: relative;
  z-index: 1;
  padding: .2em 1em;
  background: #ffffff;
  color: var(--crown);
  border-bottom: 5px solid var(--accent);
  box-shadow: 0 8px 0 rgba(0, 0, 0, .35);
  font-family: var(--font-ui);
  font-size: clamp(20px, 4.4vw, 40px);
  letter-spacing: .08em;
  transform: skewX(-12deg);
  white-space: nowrap;
}
.opener-team span { display: inline-block; transform: skewX(12deg); }

/* Selos ① ② ③ para o palpite, em cima de cada boné (como no vídeo do Nashville) */
.badge {
  position: absolute;
  top: 24%;
  translate: -50% 0;
  z-index: 5;
  display: grid;
  place-items: center;
  width: clamp(42px, 8.4vw, 78px);
  aspect-ratio: 1;
  padding: 0;
  border: 4px solid #ffffff;
  border-radius: 50%;
  background: var(--crown);
  color: #ffffff;
  font-family: var(--font-show);
  font-size: clamp(25px, 5vw, 48px);
  line-height: 1;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .35), 0 6px 14px rgba(0, 0, 0, .5);
  cursor: pointer;
}

/* Pontos subindo do boné certo */
.points-pop {
  position: absolute;
  z-index: 6;
  translate: -50% 0;
  font-family: var(--font-show);
  font-size: clamp(26px, 5vw, 46px);
  color: var(--led);
  -webkit-text-stroke: .08em #1a1204;
  paint-order: stroke fill;
  text-shadow: 0 0 14px rgba(255, 201, 74, .7);
  pointer-events: none;
  white-space: nowrap;
}

@keyframes pop {
  from { transform: scale(.6); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.jumbotron.shake { animation: shake .45s; }
@keyframes shake {
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

/* ---------- Bonés ---------- */
.slot {
  position: absolute;
  bottom: 12%;
  width: 26%;
  aspect-ratio: 200 / 165;
  transform: translateX(-50%);
  z-index: 2;
  padding: 0;
  border: 0;
  background: none;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

.slot .shadow {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: -5%;
  height: 16%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .6), transparent);
  transition: transform .38s, opacity .38s;
}

.slot .ball {
  position: absolute;
  z-index: 1;
  left: 35%;
  bottom: 8%;
  width: 30%;
  display: none;
}
.slot.has-ball .ball { display: block; }

.slot .cap {
  position: absolute;
  inset: 0;
  z-index: 2;
  transform-origin: 50% 100%;
  transition: transform .38s cubic-bezier(.3, .7, .3, 1.15);
}
.slot .cap svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .4));
  transition: filter .3s;
}

.slot.lifted .cap { transform: translateY(-62%) rotate(-8deg); }
.slot.lifted .shadow { transform: scale(.7); opacity: .55; }

.jumbotron.guessing .slot { cursor: pointer; }
.jumbotron.guessing .slot:hover .cap,
.jumbotron.guessing .slot:focus-visible .cap { transform: translateY(-7%); }

.slot:focus-visible { outline: 3px solid var(--led); outline-offset: 6px; border-radius: 14px; }
.slot.correct .cap svg { filter: drop-shadow(0 0 16px rgba(255, 214, 90, .95)); }
.slot.wrong .cap svg { filter: grayscale(.5) brightness(.75) drop-shadow(0 6px 6px rgba(0, 0, 0, .4)); }

/* ---------- Home run ---------- */
.slot.ball-gone .ball { visibility: hidden; }

.bat {
  position: absolute;
  z-index: 6;
  transform-origin: 0 50%;
  pointer-events: none;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .45));
}
.bat svg, .fly-ball svg { display: block; width: 100%; height: 100%; }

.fly-ball, .trail, .impact, .crack-text, .twinkle, .spark {
  position: absolute;
  translate: -50% -50%;
  pointer-events: none;
}
.fly-ball { z-index: 7; filter: drop-shadow(0 0 10px rgba(255, 255, 255, .6)); }
.trail { z-index: 6; border-radius: 50%; }
.impact {
  z-index: 7;
  background: radial-gradient(circle, #ffffff 0 30%, #ffe27a 45%, rgba(255, 210, 63, 0) 70%);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.crack-text {
  z-index: 7;
  font-family: var(--font-show);
  font-size: clamp(26px, 5vw, 48px);
  color: #ffd23f;
  -webkit-text-stroke: .09em #1a1204;
  paint-order: stroke fill;
  white-space: nowrap;
}
.twinkle {
  z-index: 7;
  background: #ffffff;
  clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%);
}
.spark { z-index: 6; border-radius: 50%; box-shadow: 0 0 10px 2px currentColor; }

/* ---------- Controles ---------- */
.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  min-height: 92px;
}

.btn {
  font-family: var(--font-ui);
  font-size: 26px;
  letter-spacing: .08em;
  padding: 12px 30px;
  border: 0;
  border-radius: 999px;
  background: var(--led);
  color: #1a1204;
  box-shadow: 0 6px 0 #b8862a, 0 12px 30px rgba(255, 201, 74, .25);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #b8862a; }
.btn:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.btn-big { font-size: 32px; padding: 14px 44px; }

.hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 5px;
  background: #151b30;
  border: 1px solid #2a3355;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--chalk);
}

/* ---------- Telas de início e fim ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
  background: rgba(4, 7, 16, .84);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.card {
  width: 100%;
  max-width: 640px;
  padding: clamp(22px, 5vw, 38px);
  text-align: center;
  background: linear-gradient(180deg, #141c33, #0c1224);
  border: 1px solid var(--panel-edge);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  animation: pop .45s cubic-bezier(.2, 1.3, .4, 1);
}

.eyebrow {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 18px;
  letter-spacing: .2em;
  color: var(--muted);
}

.title {
  margin: 6px 0 16px;
  font-family: var(--font-show);
  font-weight: 400;
  font-size: clamp(50px, 12vw, 88px);
  line-height: .95;
  letter-spacing: .03em;
  color: #ffffff;
  -webkit-text-stroke: .1em #0d1020;
  paint-order: stroke fill;
  text-shadow: 0 .06em 0 #0d1020, 0 .11em 0 #0d1020, 0 .17em .26em rgba(0, 0, 0, .6);
}
.title.lost { color: #d81f2d; -webkit-text-stroke-color: #ffffff; text-shadow: 0 .05em 0 #7d0c16, 0 .09em 0 #4b060c; }
.title.won { color: #ffd23f; -webkit-text-stroke-color: #8a1c0a; text-shadow: 0 .05em 0 #8a1c0a, 0 .1em 0 #4f0f05; }

.rules {
  display: inline-block;
  margin: 0 0 10px;
  padding-left: 22px;
  text-align: left;
  line-height: 1.6;
}
.rules-note {
  margin: 0 auto 22px;
  max-width: 46ch;
  color: var(--muted);
  line-height: 1.5;
  font-size: 15px;
}

.end-sub { margin: 0 0 18px; color: var(--muted); line-height: 1.5; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.stats > div {
  display: flex;
  flex-direction: column;
  padding: 10px 6px;
  background: #0a0f1f;
  border-radius: 12px;
}
.stat-value {
  font-family: var(--font-ui);
  font-size: 38px;
  line-height: 1;
  color: var(--led);
}
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

.new-record {
  margin: 0 0 12px;
  font-family: var(--font-ui);
  font-size: 24px;
  letter-spacing: .1em;
  color: var(--hit);
}

.cap-wall {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 4px;
  margin-top: 26px;
}
.cap-wall svg { width: 46px; height: auto; }
.cap-wall.small { margin: 0 0 22px; }
.cap-wall.small svg { width: 38px; }

/* ---------- Telas pequenas ---------- */
@media (max-width: 600px) {
  .scoreboard { grid-template-columns: repeat(2, 1fr) auto; }
  .scoreboard .mute { grid-row: 1 / span 2; grid-column: 3; }
  .jumbotron { aspect-ratio: 1 / 1; }
  .slot { width: 31%; bottom: 14%; }
  .banner-cap { width: 52px; }
  .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .banner.enter, .card, .jumbotron.shake { animation: none; }
}
