/* BETHITO · Kiosco touch — tema "estadio de noche".
   CSS puro, sin recursos externos. Tablet horizontal 1280×800 (aguanta vertical). */

:root {
  --ink: #f2f6ff;
  --ink-dim: rgba(242, 246, 255, 0.62);
  --gold: #ffc93c;
  --green: #34d399;
  --danger: #ff6b6b;
  --glass-bg: rgba(13, 23, 46, 0.55);
  --glass-border: rgba(255, 255, 255, 0.11);
  --radius-lg: 26px;
  --radius-md: 18px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 14px 44px rgba(0, 0, 0, 0.38);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

/* overscroll-behavior: none mata el pull-to-refresh de la tablet — el cliente
   arrastraba el panel de momios y recargaba el kiosco a media apuesta. */
html, body { height: 100%; overscroll-behavior: none; }
.numpad { overscroll-behavior: contain; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #050b1c 0%, #081430 44%, #062a20 100%);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.stage {
  position: relative;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============ Fondo animado: reflectores, brillos, partículas ============ */

.bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.bg-glow {
  position: absolute;
  width: 68vw;
  height: 68vw;
  border-radius: 50%;
  filter: none;              /* blur(50px) sobre 870px era el gasto #1 de GPU */
  opacity: 0.55;
  will-change: transform;
}
/* El degradado de 3 paradas imita el difuminado que hacía el blur */
.bg-glow-a {
  top: -34vw; left: -18vw;
  background: radial-gradient(circle, rgba(41,84,190,.42) 0%, rgba(41,84,190,.16) 40%, transparent 72%);
  animation: glow-drift-a 26s ease-in-out infinite alternate;
}
.bg-glow-b {
  bottom: -38vw; right: -16vw;
  background: radial-gradient(circle, rgba(20,132,92,.38) 0%, rgba(20,132,92,.14) 40%, transparent 72%);
  animation: glow-drift-b 32s ease-in-out infinite alternate;
}
@keyframes glow-drift-a { to { transform: translate(9vw, 6vh) scale(1.12); } }
@keyframes glow-drift-b { to { transform: translate(-8vw, -6vh) scale(1.08); } }

.beam {
  position: absolute;
  top: -12vh;
  width: 32vw;
  height: 125vh;
  background: linear-gradient(to bottom,
    rgba(150, 190, 255, 0.16),
    rgba(150, 190, 255, 0.05) 45%,
    transparent 72%);
  clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%);
  transform-origin: 50% 0;
  filter: blur(7px);
  will-change: transform;
}
.beam-l { left: 4vw;  animation: beam-sway-l 16s ease-in-out infinite alternate; }
.beam-r { right: 4vw; animation: beam-sway-r 21s ease-in-out infinite alternate; }
@keyframes beam-sway-l { from { transform: rotate(-16deg); } to { transform: rotate(9deg); } }
@keyframes beam-sway-r { from { transform: rotate(15deg); }  to { transform: rotate(-10deg); } }

.particles {
  position: absolute;
  inset: 0 0 -100% 0;
  background-image:
    radial-gradient(2px 2px at 12% 18%, rgba(255, 255, 255, 0.35), transparent 60%),
    radial-gradient(1.6px 1.6px at 38% 64%, rgba(255, 255, 255, 0.22), transparent 60%),
    radial-gradient(2.4px 2.4px at 61% 32%, rgba(255, 214, 120, 0.25), transparent 60%),
    radial-gradient(1.6px 1.6px at 78% 74%, rgba(255, 255, 255, 0.2), transparent 60%),
    radial-gradient(2px 2px at 90% 12%, rgba(160, 200, 255, 0.28), transparent 60%),
    radial-gradient(1.4px 1.4px at 26% 88%, rgba(255, 255, 255, 0.18), transparent 60%);
  background-size: 640px 640px;
  animation: particles-rise 80s linear infinite;
  opacity: 0.7;
  will-change: transform;
}
@keyframes particles-rise { to { transform: translateY(-50%); } }

.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 42%, transparent 52%, rgba(2, 5, 12, 0.55) 100%);
}

/* ============ Vidrio (glassmorphism) ============ */

.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  backdrop-filter: blur(16px) saturate(1.25);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* ============ Encabezado / pie ============ */

.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 3vw, 34px);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-logo {
  width: 46px; height: 46px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #ffc93c, #ff8a3c);
  color: #1a1204;
  font-size: 1.5rem;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(255, 178, 60, 0.35);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 1.3rem; font-weight: 800; letter-spacing: 0.06em; }
.venue-name { font-size: 0.92rem; color: var(--ink-dim); }

.match-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(0.95rem, 1.7vw, 1.2rem);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.competition { font-weight: 700; }
.meta-sep { color: var(--ink-dim); }
.kickoff { color: var(--gold); font-weight: 600; }

.foot {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 6px 0 8px;
  font-size: 0.72rem;
  color: rgba(242, 246, 255, 0.35);
}

/* ============ Vistas y transiciones ============ */

.views { position: relative; z-index: 2; flex: 1; min-height: 0; }

.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  /* min-width: 0 en la vista y en sus hijos: es lo que impide que un elemento
     ancho (la fila de pestañas, un nombre de equipo largo) estire la pantalla
     entera y saque el resto del texto de cuadro en un celular. */
  min-width: 0;
  padding: clamp(10px, 1.8vh, 22px) clamp(16px, 3vw, 34px);
  opacity: 0;
  transform: translateX(6%) scale(0.985);
  pointer-events: none;
  visibility: hidden;
  transition:
    opacity 0.45s var(--ease-out),
    transform 0.45s var(--ease-out),
    visibility 0s linear 0.45s;
}
.view > * { min-width: 0; }
.view.exit { transform: translateX(-6%) scale(0.985); }
.view.active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  visibility: visible;
  transition:
    opacity 0.45s var(--ease-out),
    transform 0.45s var(--ease-out),
    visibility 0s;
}

.center-box {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}
.loading-text { font-size: 1.25rem; color: var(--ink-dim); }
.loading-error { font-size: 1.05rem; color: var(--danger); }

/* ============ Botones base ============ */

button {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible { outline: 3px solid rgba(255, 201, 60, 0.8); outline-offset: 2px; }
button:disabled { opacity: 0.38; pointer-events: none; }

.btn {
  min-height: 60px;
  padding: 14px 34px;
  border-radius: 999px;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn:active { transform: scale(0.95); }
.btn.big { min-height: 72px; font-size: 1.35rem; padding: 16px 44px; }

.btn.primary {
  background: linear-gradient(135deg, #2dd4a0, #14b874);
  color: #04170e;
  box-shadow: 0 10px 26px rgba(28, 190, 122, 0.35);
}
.btn.primary:active { filter: brightness(1.08); }

.btn.secondary {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--ink);
}

.actions-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding-top: clamp(8px, 1.6vh, 18px);
  flex-wrap: wrap;
}

/* ============ 1. PRINCIPAL: héroe de equipos ============ */

.hero {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: clamp(10px, 2vw, 26px);
}

.team-card {
  --c1: #345;
  --c2: #123;
  position: relative;
  flex: 1;
  max-width: 460px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2vw, 24px);
  padding: clamp(12px, 2vh, 22px) clamp(14px, 2vw, 28px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  backdrop-filter: blur(16px) saturate(1.25);
  box-shadow: var(--shadow);
  overflow: hidden;
}
/* El brillo de vidrio vivía en ::after, pero más abajo se redeclara
   .team-card::after para el destello y lo mataba: van los dos degradados
   juntos en ::before y ::after queda libre para el barrido. */
.team-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.1), transparent 45%),
    linear-gradient(135deg, var(--c1), var(--c2));
  opacity: 0.3;
}
.team-card > * { position: relative; z-index: 1; }
.team-card.away { flex-direction: row-reverse; }

.flag-float { animation: flag-float 6s ease-in-out infinite; }
.team-card.away .flag-float { animation-delay: -3s; }
@keyframes flag-float {
  0%, 100% { transform: translateY(0) rotate(-1.4deg); }
  50%      { transform: translateY(-9px) rotate(1.4deg); }
}

.flag-frame {
  width: clamp(110px, 14vw, 190px);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.18);
  line-height: 0;
}
.flag-frame svg { width: 100%; height: auto; display: block; }

.team-name {
  font-size: clamp(1.35rem, 3vw, 2.3rem);
  font-weight: 800;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.5);
  text-align: center;
  overflow-wrap: anywhere;
}

.vs-badge {
  align-self: center;
  width: clamp(56px, 6.4vw, 82px);
  height: clamp(56px, 6.4vw, 82px);
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: clamp(1.05rem, 1.9vw, 1.5rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #1a1204;
  background: linear-gradient(135deg, #ffd76a, #ff9d3c);
  box-shadow: 0 8px 26px rgba(255, 170, 60, 0.4);
  animation: vs-pulse 3.4s ease-in-out infinite;
}
@keyframes vs-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.07); }
}

/* Era gris, chiquito y en mayúsculas: se leía como decoración, no como
   instrucción, y no decía QUÉ tocar primero. */
.hero-hint {
  text-align: center;
  color: rgba(242, 246, 255, 0.86);
  font-size: clamp(1.02rem, 1.8vw, 1.28rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  padding: clamp(6px, 1.2vh, 12px) 0 4px;
}

/* ============ Pestañas de mercados ============ */

/* "Marcador exacto" quedaba fuera de pantalla sin ninguna pista de que
   hubiera más pestañas: el difuminado del borde derecho ES la pista. */
.tabs {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 6px 2px 10px;
  padding-right: 26px;
  scrollbar-width: none;
  flex: none;
  /* Sin esto la fila de pestañas ensancha a TODA la pantalla: un hijo flex no
     encoge por debajo de su contenido (min-width: auto), así que los 7 chips
     juntos empujaban el ancho y el texto de arriba se cortaba en celular.
     El overflow-x: auto no sirve de nada si el contenedor puede crecer. */
  min-width: 0;
  max-width: 100%;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 8px;
  overscroll-behavior: contain;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent);
}
.tabs::-webkit-scrollbar { display: none; }

/* 60px de alto para atinarle con el pulgar en la tablet */
.tab-chip {
  flex: none;
  min-height: 60px;
  padding: 12px 26px;
  border-radius: 999px;
  font-size: 1.08rem;
  font-weight: 700;
  color: rgba(242, 246, 255, 0.82);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  scroll-snap-align: start;
  transition: transform 0.12s ease, background 0.25s ease, color 0.25s ease;
}
.tab-chip:active { transform: scale(0.94); }
.tab-chip.active {
  color: #04170e;
  background: linear-gradient(135deg, #ffd76a, #ffb03c);
  border-color: transparent;
  box-shadow: 0 8px 22px rgba(255, 176, 60, 0.32);
}

/* ============ Panel de mercados ============ */

/* Sin backdrop-filter: este panel scrollea, y el blur se recomponía en cada
   frame de scroll — el fondo opaco se ve casi igual y no cuesta GPU. */
.markets-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: clamp(12px, 1.8vh, 20px);
  border-radius: var(--radius-lg);
  background: rgba(9, 16, 34, 0.86);
  border: 1px solid var(--glass-border);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.market-block + .market-block { margin-top: clamp(14px, 2.2vh, 24px); }

/* La explicación del mercado era lo más chico y tenue de la pantalla:
   el cliente sin experiencia se iba a "Ganador" y no tocaba los otros 6. */
.market-help {
  font-size: 1.04rem;
  line-height: 1.35;
  color: rgba(242, 246, 255, 0.8);
  margin: 0 0 14px;
  max-width: 72ch;
}

.market-title {
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: none;
  color: var(--ink);
  margin-bottom: 10px;
}

.sel-grid {
  display: grid;
  /* min(230px, 100%) y no 230px pelón: en un celular de 390 px una columna de
     230 px mínimos ya no cabe con los rellenos, y la rejilla se desbordaba
     hacia la derecha cortando los textos. */
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  gap: 12px;
}
/* Los hijos de una rejilla NO encogen por debajo de su contenido: su
   min-width es `auto`. Sin esto, un texto largo como "$100 → $372" ensancha
   su columna y empuja toda la fila fuera de la pantalla. Es la causa real del
   desbordamiento en celular, no el número de columnas. */
.sel-grid > * { min-width: 0; }
.sel-btn > * { max-width: 100%; overflow-wrap: anywhere; }
.sel-grid.winner-grid { grid-template-columns: repeat(3, 1fr); }
/* 5 columnas = cada renglón es un marcador del LOCAL (0-x, 1-x, ...) */
.sel-grid.score-grid { grid-template-columns: repeat(5, 1fr); }
.score-grid .sel-btn.sel-other { grid-column: 1 / -1; min-height: 64px; }
.score-grid .sel-label { font-size: 1.5rem; letter-spacing: 0.04em; }
.score-grid .sel-odds { font-size: 0.88rem; white-space: nowrap; }

.score-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: -2px 0 12px;
  font-size: 1.05rem;
  font-weight: 700;
}
.score-legend .sl-dash { color: var(--ink-dim); font-weight: 400; }

.sel-btn {
  min-height: 82px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease;
}
.sel-btn:active {
  transform: scale(0.94);
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.55);
}
/* El toque tarda ~medio segundo en cambiar de pantalla y el cliente volvía
   a picar creyendo que no había pasado nada: esto le contesta al instante. */
.sel-btn.picked {
  transform: scale(1.02);
  background: rgba(52, 211, 153, 0.22);
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.45);
}
.sel-btn.over-cap { opacity: 0.4; background: rgba(255, 255, 255, 0.03); }
.sel-btn.over-cap .sel-odds {
  color: var(--ink-dim);
  font-size: 0.88rem;
  font-weight: 600;
}
.score-grid .sel-btn { min-height: 72px; }

.sel-label {
  font-size: 1.14rem;
  font-weight: 700;
  text-align: center;
  overflow-wrap: anywhere;
}
/* odds-pulse animaba scale() sobre TEXTO: 26 momios re-rasterizando
   tipografía en cada frame era el lag del panel. Se quitó. */
.sel-odds {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
}

.panel-empty {
  text-align: center;
  color: var(--ink-dim);
  font-size: 1.2rem;
  padding: 40px 16px;
}

/* ============ 2. MONTO ============ */

.stake-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: clamp(12px, 2vw, 24px);
}

.stake-left, .stake-right {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(14px, 2.2vh, 26px);
}
.stake-left { justify-content: space-between; gap: 14px; }
.stake-right { gap: clamp(10px, 1.6vh, 16px); }

.pick-kicker {
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 8px;
}
.pick-market { font-size: 1.05rem; color: var(--ink-dim); font-weight: 600; }
.pick-selection {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 800;
  margin: 6px 0 10px;
  overflow-wrap: anywhere;
}
.pick-odds { font-size: 1.15rem; font-weight: 700; color: var(--gold); }
.pick-odds-label { color: var(--ink-dim); font-weight: 600; margin-right: 6px; }

.payout-preview {
  text-align: center;
  padding: clamp(12px, 2vh, 20px);
  border-radius: var(--radius-md);
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.28);
}
.payout-label { display: block; font-size: 1.02rem; color: var(--ink-dim); margin-bottom: 4px; }
.payout-amount {
  font-size: clamp(2rem, 4.6vw, 3.2rem);
  font-weight: 800;
  color: var(--green);
  text-shadow: 0 0 24px rgba(52, 211, 153, 0.35);
  transition: transform 0.15s ease;
}

.range-hint { text-align: center; font-size: 1rem; color: var(--ink-dim); }
.range-hint.warn { color: var(--gold); font-weight: 700; }

/* La cifra más grande de la pantalla no tenía etiqueta: el cliente no sabía
   si ese número era lo que paga o lo que cobra. */
.amount-kicker {
  text-align: center;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 6px;
}
/* cifras del mismo ancho: si no, el monto se sacude al arrastrar */
.payout-amount, .amount-display, .sel-odds, .pick-odds,
.crow dd, .slider-ends, .ticket-code, .success-payout strong {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

.amount-display {
  text-align: center;
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  font-weight: 800;
  padding: 8px 0;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  letter-spacing: 0.03em;
}
.amount-display.zero { color: rgba(242, 246, 255, 0.35); }
.amount-display.invalid { color: var(--gold); }

.payout-amount.pop { animation: payout-pop 0.22s ease; }
@keyframes payout-pop {
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* --- Slider de monto: el control principal, grande y táctil --- */
.slider-zone { padding: 6px 4px 0; }
#stakeSlider {
  --fill: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 46px;
  background: transparent;
  touch-action: none;
  cursor: pointer;
}
#stakeSlider::-webkit-slider-runnable-track {
  height: 16px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--gold) var(--fill),
    rgba(255, 255, 255, 0.1) var(--fill));
  border: 1px solid rgba(255, 255, 255, 0.14);
}
#stakeSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 44px;
  height: 44px;
  margin-top: -15px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, var(--gold) 65%);
  border: 3px solid rgba(13, 19, 33, 0.9);
  box-shadow: 0 4px 18px rgba(255, 201, 60, 0.45);
  transition: transform 0.12s ease;
}
#stakeSlider:active::-webkit-slider-thumb { transform: scale(1.15); }
#stakeSlider::-moz-range-track {
  height: 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
}
#stakeSlider::-moz-range-progress {
  height: 16px;
  border-radius: 10px;
  background: var(--gold);
}
#stakeSlider::-moz-range-thumb {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, var(--gold) 65%);
  border: 3px solid rgba(13, 19, 33, 0.9);
  box-shadow: 0 4px 18px rgba(255, 201, 60, 0.45);
}
.slider-ends {
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
  color: var(--ink-dim);
  padding: 0 2px 2px;
}
.slider-cap {
  text-align: center;
  font-size: 0.95rem;
  color: var(--gold);
  padding: 4px 0 2px;
}

.numpad-toggle {
  align-self: center;
  background: none;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  color: var(--ink-dim);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-size: 0.98rem;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.numpad-toggle.open { color: var(--gold); border-color: rgba(255, 201, 60, 0.5); }

.presets { display: flex; gap: 10px; flex-wrap: wrap; }
.preset-btn {
  flex: 1;
  min-width: 86px;
  min-height: 56px;
  border-radius: var(--radius-md);
  font-size: 1.22rem;
  font-weight: 800;
  color: var(--ink);
  background: rgba(255, 201, 60, 0.13);
  border: 1px solid rgba(255, 201, 60, 0.35);
  transition: transform 0.12s ease, background 0.2s ease;
}
.preset-btn:active { transform: scale(0.93); background: rgba(255, 201, 60, 0.3); }

.numpad {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: minmax(56px, 1fr);
  gap: 10px;
}
.numpad-key {
  border-radius: var(--radius-md);
  font-size: 1.6rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.1s ease, background 0.15s ease;
}
.numpad-key:active { transform: scale(0.93); background: rgba(255, 255, 255, 0.16); }
.numpad-key.fn { color: var(--gold); font-size: 1.35rem; }

/* ============ 3. CONFIRMAR ============ */

.confirm-card {
  margin: auto;
  width: min(720px, 100%);
  padding: clamp(20px, 3.4vh, 36px) clamp(20px, 3.4vw, 44px);
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2.4vh, 24px);
}

.confirm-title {
  text-align: center;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 800;
}

.confirm-rows { display: flex; flex-direction: column; gap: 2px; }
.crow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  padding: 12px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}
.crow dt { color: var(--ink-dim); font-size: 1.05rem; flex: none; }
.crow dd { font-size: 1.18rem; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.crow.hl { border-bottom: none; }
.crow.hl dt { color: var(--ink); font-weight: 700; }
.crow.hl dd { color: var(--green); font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; }

/* ============ 4. ÉXITO ============ */

.success-card {
  margin: auto;
  width: min(680px, 100%);
  padding: clamp(18px, 3vh, 34px) clamp(20px, 3.4vw, 44px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.2vh, 12px);
  text-align: center;
}

.check { width: clamp(84px, 12vh, 120px); height: auto; }
.check-circle {
  fill: none;
  stroke: var(--green);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transform: rotate(-90deg);
  transform-origin: center;
}
.check-mark {
  fill: none;
  stroke: var(--green);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 76;
  stroke-dashoffset: 76;
}
.check.play .check-circle { animation: draw-circle 0.6s var(--ease-out) forwards; }
.check.play .check-mark { animation: draw-mark 0.4s 0.45s var(--ease-out) forwards; }
@keyframes draw-circle { to { stroke-dashoffset: 0; } }
@keyframes draw-mark { to { stroke-dashoffset: 0; } }

.success-title { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 800; }
.ticket-code-label {
  font-size: 0.88rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-top: 4px;
}
.ticket-code {
  font-family: Consolas, 'Segoe UI', monospace;
  font-size: clamp(2.3rem, 6.4vw, 3.8rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(255, 201, 60, 0.4);
  padding: 6px 22px;
  border-radius: var(--radius-md);
  background: rgba(255, 201, 60, 0.08);
  border: 1px dashed rgba(255, 201, 60, 0.45);
}
/* Es la única instrucción que evita que el cliente pierda su dinero
   (sin ticket no cobra): dejó de ser texto gris de relleno. */
.success-note {
  font-size: 1.26rem;
  line-height: 1.4;
  font-weight: 600;
  color: rgba(242, 246, 255, 0.93);
  max-width: 42ch;
}
.success-payout { font-size: 1.2rem; }
.success-payout strong { color: var(--green); font-size: 1.5rem; }
.countdown { font-size: 1.02rem; color: rgba(242, 246, 255, 0.7); min-height: 1.3em; margin-top: 4px; }

.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i {
  position: absolute;
  top: -24px;
  width: 12px;
  height: 18px;
  border-radius: 3px;
  opacity: 0;
  animation-name: confetti-fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes confetti-fall {
  0%   { opacity: 0; transform: translateY(0) rotate(0deg); }
  8%   { opacity: 1; }
  100% { opacity: 0; transform: translateY(95vh) rotate(560deg); }
}

/* ============ PAUSA ============ */

.paused-box {
  width: 100%;
  max-width: 680px;
  padding: clamp(30px, 6vh, 60px) clamp(30px, 6vw, 80px);
}
.paused-brand {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--gold);
}
.paused-icon { display: flex; gap: 12px; }
.paused-icon i {
  width: 18px;
  height: 58px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  animation: paused-breathe 2.6s ease-in-out infinite;
}
.paused-icon i:last-child { animation-delay: -1.3s; }
@keyframes paused-breathe { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.paused-title {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
}
.paused-msg { max-width: 100%; overflow-wrap: anywhere; font-size: 1.25rem; color: var(--ink-dim); }

/* ============ Spinner y toast ============ */

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--ink);
  animation: spin 0.8s linear infinite;
}
.spinner.big { width: 54px; height: 54px; border-width: 5px; border-top-color: var(--gold); }
.spinner.small { width: 22px; height: 22px; border-top-color: #04170e; border-color: rgba(4, 23, 14, 0.25); border-top-color: #04170e; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: absolute;
  z-index: 9;
  left: 50%;
  bottom: 108px;   /* a 34px nacía JUSTO encima de "Cancelar / Continuar" */
  transform: translateX(-50%);
  max-width: min(640px, calc(100vw - 40px));
  padding: 16px 26px;
  border-radius: var(--radius-md);
  background: rgba(66, 14, 20, 0.88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 107, 107, 0.5);
  color: #ffd9d9;
  font-size: 1.12rem;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow);
  animation: toast-in 0.35s var(--ease-out);
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 18px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Verde para lo informativo: en rojo, "Los momios se actualizaron." se leía
   como que algo se rompió, justo antes de confirmar. */
.toast.info {
  background: rgba(10, 32, 26, 0.92);
  border-color: rgba(52, 211, 153, 0.5);
  color: #d6ffee;
}

#printFrameHolder iframe {
  position: absolute;
  width: 1px;
  height: 1px;
  left: -9999px;
  top: 0;
  border: 0;
  visibility: hidden;
}

/* ============ Vertical / pantallas angostas ============ */

@media (orientation: portrait), (max-width: 860px) {
  body { overflow-y: auto; }
  .stage { height: auto; min-height: 100vh; min-height: 100dvh; }
  .views { min-height: 78vh; }
  .view { position: relative; inset: auto; display: none; min-height: 78vh; }
  .view.active { display: flex; }

  .topbar { justify-content: center; text-align: center; }
  .hero { flex-direction: column; align-items: stretch; }
  .team-card, .team-card.away { flex-direction: row; max-width: none; }
  .vs-badge { margin: -6px auto; z-index: 2; }
  .flag-frame { width: clamp(84px, 22vw, 130px); }
  .sel-grid.winner-grid { grid-template-columns: 1fr; }
  .score-legend { font-size: 0.95rem; gap: 8px; }
  .score-grid .sel-odds { font-size: 0.78rem; }
  /* En vertical la página ya scrollea: si el panel también scrollea, el dedo
     no sabe cuál mueve y el kiosco se siente atorado. Aquí crece y ya. */
  .markets-panel {
    overflow: visible;
    flex: none;
    min-height: 0;
    background: rgba(9, 16, 34, 0.86);
  }
  .stake-layout { flex-direction: column; }
  .numpad { grid-auto-rows: 62px; }
}

/* ============ Celular de pie (el modo virtual vive aquí) ============
   En el modo sin mueble el cliente apuesta desde SU teléfono, así que esta
   no es una pantalla secundaria: es la principal para ese negocio. */
@media (max-width: 520px) {
  /* Red de seguridad: si algo se pasa de ancho, la página no se va de lado.
     Vale más un elemento recortado que toda la pantalla corrida. */
  html, body { overflow-x: hidden; }
  .stage { overflow-x: hidden; }

  .view { padding: 10px 12px; }
  .markets-panel { padding: 12px 10px; border-radius: 16px; }

  /* 5 columnas dan celdas de ~60 px: no se puede atinar con el pulgar y los
     momios quedan ilegibles. Con 3, cada celda pasa de 100 px. */
  .sel-grid.score-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .score-grid .sel-label { font-size: 1.15rem; }
  .score-grid .sel-odds { font-size: 0.72rem; }
  .score-legend { font-size: 0.9rem; }

  .sel-grid { gap: 10px; }
  .hero-hint { font-size: 1rem; }
  .market-help { font-size: 0.96rem; }

  /* Los textos largos parten en vez de estirar su caja */
  .team-name, .sel-label, .pick-selection, .market-title {
    overflow-wrap: anywhere;
  }
}

/* ============ Menos movimiento ============ */

@media (prefers-reduced-motion: reduce) {
  .bg-glow, .beam, .particles, .flag-float, .vs-badge,
  .paused-icon i, .confetti i { animation: none !important; }
  .view { transition-duration: 0.01s; }
}

/* ===== v0.4.0: entrada orquestada y brillos de la pantalla principal ===== */

/* Entrada escalonada cada vez que la vista principal se activa */
#view-main.active .team-card {
  animation: enter-side 0.65s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
#view-main.active .team-card.away {
  animation-name: enter-side-r;
  animation-delay: 0.08s;
}
#view-main.active .vs-badge {
  animation: enter-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) 0.22s backwards;
}
#view-main.active .tabs {
  animation: enter-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.3s backwards;
}
#view-main.active .markets-panel {
  animation: enter-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.38s backwards;
}
@keyframes enter-side {
  from { opacity: 0; transform: translateX(-46px) scale(0.96); }
}
@keyframes enter-side-r {
  from { opacity: 0; transform: translateX(46px) scale(0.96); }
}
@keyframes enter-up {
  from { opacity: 0; transform: translateY(26px); }
}
@keyframes enter-pop {
  from { opacity: 0; transform: scale(0.3) rotate(-14deg); }
}

/* Destello de vidrio que barre las tarjetas de equipo cada tanto.
   Animaba 'left', que redistribuye el layout en cada frame; con transform
   el barrido corre en el compositor y deja de trabar el scroll. */
.team-card::after {
  content: '';
  position: absolute;
  inset: -20% auto -20% 0;
  width: 42%;
  transform: translateX(-240%) skewX(-18deg);
  background: linear-gradient(90deg, transparent,
    rgba(255,255,255,.09) 45%, rgba(255,255,255,.16) 50%,
    rgba(255,255,255,.09) 55%, transparent);
  animation: card-shine 7s ease-in-out infinite;
  pointer-events: none;
}
.team-card.away::after { animation-delay: 3.5s; }
@keyframes card-shine {
  0%, 74%   { transform: translateX(-240%) skewX(-18deg); opacity: 0; }
  80%       { opacity: 1; }
  92%, 100% { transform: translateX(300%)  skewX(-18deg); opacity: 0; }
}

/* El VS respira con un aro dorado */
.vs-badge { position: relative; }
.vs-badge::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 201, 60, 0.5);
  animation: vs-ring 2.6s ease-out infinite;
  pointer-events: none;
}
@keyframes vs-ring {
  0% { transform: scale(0.82); opacity: 0.9; }
  70%, 100% { transform: scale(1.45); opacity: 0; }
}

/* Aquí vivía sel-breathe: con "Marcador exacto" abierto eran 26 botones
   animando box-shadow (repinta) dentro de un panel que scrollea. Fuera. */

/* Aurora lenta de color al fondo de la pantalla principal */
#view-main::before {
  content: '';
  position: absolute;
  inset: -12%;
  background:
    radial-gradient(42% 34% at 22% 18%, rgba(47, 109, 246, 0.16), transparent 70%),
    radial-gradient(36% 30% at 80% 72%, rgba(52, 211, 153, 0.10), transparent 70%),
    radial-gradient(30% 26% at 68% 12%, rgba(255, 201, 60, 0.07), transparent 70%);
  animation: aurora-drift 22s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: -1;
}
@keyframes aurora-drift {
  from { transform: translate3d(-2.5%, -2%, 0) scale(1); }
  to { transform: translate3d(2.5%, 2.5%, 0) scale(1.07); }
}

/* La marca del encabezado tiene un brillo dorado ocasional */
.brand-name {
  background: linear-gradient(100deg, #f2f6ff 42%, #ffc93c 50%, #f2f6ff 58%);
  background-size: 240% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: brand-glint 9s ease-in-out infinite;
}
@keyframes brand-glint {
  0%, 82% { background-position: 120% 0; }
  95%, 100% { background-position: -60% 0; }
}

@media (prefers-reduced-motion: reduce) {
  #view-main.active .team-card,
  #view-main.active .team-card.away,
  #view-main.active .vs-badge,
  #view-main.active .tabs,
  #view-main.active .markets-panel,
  .team-card::after,
  .vs-badge::before,
  #view-main::before,
  .brand-name { animation: none !important; }
}

/* Accesos discretos de personal en el pie */
.staff-links { margin-left: 10px; }
.staff-sep { margin: 0 4px; color: rgba(242, 246, 255, 0.25); }
.staff-link {
  color: rgba(242, 246, 255, 0.4);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}
.staff-link:active { color: var(--gold); background: rgba(255, 255, 255, 0.08); }

/* ============ Modo virtual: el QR en la pantalla del cliente ============
   En los negocios sin mueble no hay papel: el cliente enseña esto en la caja.
   Fondo blanco sólido y buen tamaño porque lo va a leer un lector o la cámara
   de otro teléfono, muchas veces con poca luz y la pantalla sucia. */
.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 4px 0 2px;
}
.qr-box img {
  width: clamp(160px, 42vw, 220px);
  height: auto;
  aspect-ratio: 1;
  background: #fff;
  padding: 10px;
  border-radius: 14px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35);
  transition: opacity 0.3s;
}
.qr-reloj {
  font-size: 1.02rem;
  font-weight: 650;
  color: var(--ink-dim);
  text-align: center;
}
/* Faltando dos minutos deja de ser un dato y pasa a ser una urgencia */
.qr-reloj.urge { color: var(--gold); }
.qr-reloj.vencido { color: var(--danger); font-weight: 750; }
/* Ya la cobraron en la caja: el reloj deja de correr y lo dice. */
.qr-reloj.pagada { color: var(--ok, #34d399); font-weight: 750; }
