/* =============================================================
   VILLA AHORA — Ron Barceló · styles.css
   ============================================================= */

/* ===== Tipografías del brandbook ===== */
@font-face { font-family:'Knockout'; src:url('../assets/fonts/Knockout-72.otf') format('opentype'); font-weight:normal; font-display:swap; }
@font-face { font-family:'KnockoutBody'; src:url('../assets/fonts/Knockout-68.otf') format('opentype'); font-weight:normal; font-display:swap; }
@font-face { font-family:'FuturaCond'; src:url('../assets/fonts/FuturaStd-CondensedExtraBd.otf') format('opentype'); font-weight:normal; font-display:swap; }

:root {
  --crema:      #f0dcb0;
  --crema-2:    #e7cd97;
  --marron:     #33241a;
  --negro:      #141414;
  --rojo:       #E4322B;
  --rojo-osc:   #7c140f;
  --verde:      #96c93d;
  --blanco:     #ffffff;
  --oro:        #f4c53b;
  --plata:      #cdd3d8;
  --bronce:     #d79a5b;

  --sky-top:    #4a8fd8;
  --sky-mid:    #f4a6bd;
  --sky-bot:    #f9b04a;

  --font-head:  'Knockout', 'Oswald', Impact, sans-serif;
  --font-body:  'KnockoutBody', 'Oswald', system-ui, sans-serif;
  --font-legal: 'FuturaCond', 'Oswald', sans-serif;

  --app-max:    480px;

  /* —— Brand / HUD / Señal tokens (Figma qlGDWzYlOpuwhyFSFQtLGf) ——
     SoT: frame D «Villa Ahora-spot» 17:927863 (1920×1080)
       BARCELO 17:931878 = 529×115
       VILLA AHORA 17:931862 = 866×194  (stack bbox ~866×320; logo.svg 968×358)
     MASTER VERTICAL 15:56288 (1080×1920): SEÑAL 989×378, PUNTOS 337×171, VIDAS 337×165
     MASTER HORIZONTAL 15:168890 (1920×1080): SEÑAL 806×308, HUD same 337 */
  --figma-m-w: 1080;
  --figma-d-w: 1920;
  --brand-stack-w: 866; /* px diseño: ancho del cartel VILLA AHORA (domina el stack) */
  --brand-barcelo-w: 529;
  --brand-barcelo-h: 115;
  --brand-villa-w: 866;
  --brand-villa-h: 194;
  --brand-gap: 11; /* 217 − (91+115) en 17:927863 */
  --brand-logo-w-m: calc(var(--brand-stack-w) / var(--figma-m-w) * 100%); /* ~80.2% */
  --brand-logo-w-d: calc(var(--brand-stack-w) / var(--figma-d-w) * 100%); /* ~45.1% */
  --brand-logo-max-d: 866px;
  --hud-pill-w: 337;
  --hud-puntos-h: 171;
  --hud-vidas-h: 165;
  --senal-w-m: calc(989 / var(--figma-m-w) * 100%); /* ~91.6% */
  --senal-w-d: calc(806 / var(--figma-d-w) * 100%); /* ~42.0% */
  --senal-max-d: 806px;
}

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

html, body {
  height: 100%;
  background: #000;
  font-family: var(--font-body);
  color: var(--marron);
  overflow: hidden;
  overscroll-behavior: none;
}

#app {
  position: relative;
  width: 100%;
  max-width: var(--app-max);
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #000;
  user-select: none;
  -webkit-user-select: none;
}

/* ================= ESCENA DE FONDO ================= */
.scene { position: absolute; inset: 0; z-index: 0; overflow: hidden; }

/* Cielo día→noche (tira horizontal del brandbook). El desplazamiento
   horizontal (background-position-x) lo controla game.js según la dificultad:
   0% = día, 100% = noche. */
.scene-sky {
  position: absolute; inset: 0;
  background: url('../assets/final/fondo-degradado.svg') 0% center / auto 100% no-repeat,
              linear-gradient(180deg, var(--sky-top), var(--sky-bot));
  background-position-x: 0%;
  transition: background-position-x .6s linear;
}

/* Banderines (imagen) */
.bunting-img {
  position: absolute; top: 0; left: 0; width: 100%;
  z-index: 2; pointer-events: none;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.2));
}

/* Silueta de pueblo (pantallas de registro) */
.pueblo-img {
  position: absolute; left: 0; bottom: 6%; width: 100%; height: auto;
  z-index: 2; pointer-events: none;
}
#app.mode-game .pueblo-img { display: none; }

/* Césped bajo el pueblo en registro y durante el juego */
.cesped-img {
  position: absolute; left: 0; bottom: 0; width: 100%;
  z-index: 1; pointer-events: none; display: block;
}

/* Señal VILLA AHORA plantada (solo en juego / resultados) — token --senal-w-* */
.scene .villa-signpost {
  position: absolute; left: 50%; bottom: 40px;
  transform: translateX(-50%);
  width: var(--senal-w-m);
  max-width: none;
  z-index: 3;
  display: none;
}
#app.mode-game .scene .villa-signpost { display: block; }
.villa-signpost .senal-img { display: block; width: 100%; height: auto; }
.villa-signpost .post {
  position: absolute; top: 62%;
  width: 8px; height: 60px;
  background: linear-gradient(90deg, #1f1f1f, #3a3a3a 50%, #1f1f1f);
  border-radius: 2px;
  z-index: -1;
}
.villa-signpost .post-l { left: 26%; }
.villa-signpost .post-r { right: 26%; }

/* ================= CARTEL "VILLA AHORA" (estable) ================= *
   Construcción robusta: dos capas de flecha (roja + blanca interior)
   detrás del texto, para que el borde rojo sea uniforme también en la
   punta. Idéntico en todas las pantallas gracias a los modificadores. */
.flag-sign {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-head);
  color: var(--negro);
  letter-spacing: 1px;
  line-height: 1;
  isolation: isolate;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.28));
}
.flag-sign > span { position: relative; z-index: 1; white-space: nowrap; }
.flag-sign::before,
.flag-sign::after { content: ""; position: absolute; inset: 0; }
.flag-sign::before {           /* borde rojo (flecha exterior) */
  background: var(--rojo);
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 50%, calc(100% - 22px) 100%, 0 100%);
  z-index: -2;
}
.flag-sign::after {            /* relleno blanco (flecha interior) */
  inset: 3px;
  background: var(--blanco);
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 50%, calc(100% - 20px) 100%, 0 100%);
  z-index: -1;
}
/* Modificadores de tamaño (misma estética) */
.flag-sign.small { font-size: 22px; padding: 8px 34px 8px 16px; }
.flag-sign.big   { font-size: 46px; padding: 16px 56px 16px 26px; justify-content: flex-start; }
.villa-signpost .flag-sign.big::before { clip-path: polygon(0 0, calc(100% - 34px) 0, 100% 50%, calc(100% - 34px) 100%, 0 100%); }
.villa-signpost .flag-sign.big::after  { inset: 4px; clip-path: polygon(0 0, calc(100% - 31px) 0, 100% 50%, calc(100% - 31px) 100%, 0 100%); }

/* ================= PANTALLAS ================= */
.screen {
  position: absolute; inset: 0;
  z-index: 5;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 18px 104px;
  text-align: center;
}
.screen.active { display: flex; animation: fadein .35s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Cabecera de marca — UN solo contrato (tokens arriba). Sin overrides en cascada. */
.brandhead {
  position: static;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  z-index: 6;
  width: 100%;
  flex: 0 0 auto;
}
.brand-logo {
  display: block;
  width: var(--brand-logo-w-m);
  max-width: none;
  height: auto;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,.25));
}
/* Capas separadas (Figma BARCELO + VILLA AHORA) si se usan en vez del stack combinado */
.brand-barcelo {
  display: block;
  width: calc(var(--brand-barcelo-w) / var(--figma-m-w) * 100%);
  height: auto;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.2));
}
.brand-villa {
  display: block;
  width: var(--brand-logo-w-m);
  height: auto;
  margin-top: calc(var(--brand-gap) / var(--figma-m-w) * 100%);
  filter: drop-shadow(0 3px 5px rgba(0,0,0,.25));
}

/* Tarjetas */
.card {
  position: relative;
  z-index: 6;
  width: 100%; max-width: 372px;
  background: var(--crema);
  border: 4px solid var(--marron);
  border-radius: 18px;
  box-shadow: 0 10px 0 rgba(51,36,26,.35), 0 18px 40px rgba(0,0,0,.35);
  padding: 24px 22px;
  margin-top: 96px;
}
.result .card { margin-top: 12px; }
.card-win  { background: var(--verde); border-color: #4d6b16; color: #1e2b06; }
.card-over { background: var(--rojo); border-color: var(--rojo-osc); color: #fff; }
.card-form { max-width: 400px; }

/* Tipografía de tarjeta */
.card h1 { font-family: var(--font-head); font-size: 38px; line-height: .98; letter-spacing: .5px; }
.card h1.giant { font-size: 62px; }
.card h2 { font-family: var(--font-head); font-size: 25px; line-height: 1.04; letter-spacing: .5px; }
.card .hl { color: var(--rojo); }
.card-win h1  { font-size: 54px; color: #1e2b06; }
.card-over h1 { font-size: 46px; color: #fff; }

.sub  { font-family: var(--font-head); font-size: 16px; margin-top: 10px; letter-spacing: .5px; color: var(--marron); }
.lead { font-size: 18px; font-weight: 600; margin-top: 10px; }
.body { font-size: 13.5px; font-weight: 400; margin-top: 12px; line-height: 1.35; }
.fine { font-size: 13px; opacity: .8; margin-top: 12px; font-weight: 400; }
.hook { font-size: 15px; font-weight: 700; margin-top: 14px; color: var(--rojo); }
.foot { font-size: 12px; font-weight: 500; margin-top: 14px; opacity: .85; line-height: 1.3; }
.prize { font-family: var(--font-head); font-size: 20px; line-height: 1.05; margin-top: 10px; color: #1e2b06; letter-spacing: .3px; }
.over-msg { font-size: 14px; font-weight: 600; margin-top: 10px; color: #fff; }

.score-line { margin-top: 14px; font-size: 16px; font-weight: 600; }
.score-line b { font-family: var(--font-head); font-size: 24px; }
.score-cap { margin-top: 12px; font-size: 13px; letter-spacing: 2px; font-weight: 600; }
.score-big { font-family: var(--font-head); font-size: 52px; line-height: 1; color: #fff; }

.huge-emoji { font-size: 60px; line-height: 1; margin-bottom: 4px; }
.trophies { font-size: 40px; line-height: 1; margin: 6px 0 2px; letter-spacing: 4px; }

.hearts-inline { display: inline-flex; gap: 4px; margin-top: 12px; }
.hearts-inline img { width: 24px; }

.spot-box {
  display: block; width: 100%; margin-top: 16px;
  background: #b9b9b9; color: #444;
  border: 2px dashed #7a7a7a; border-radius: 10px;
  padding: 22px 10px; font-weight: 700; letter-spacing: 1px;
  cursor: pointer; font-family: var(--font-body); font-size: 14px;
}

/* Botones */
.btn-row { display: flex; gap: 12px; justify-content: center; margin-top: 20px; }
.btn {
  font-family: var(--font-head);
  font-size: 22px; letter-spacing: 1px;
  background: var(--negro); color: #fff;
  border: none; border-radius: 12px;
  padding: 14px 30px; min-width: 120px;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0,0,0,.4);
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.4); }
.btn-ghost { background: transparent; color: var(--negro); border: 3px solid var(--negro); box-shadow: 0 5px 0 rgba(0,0,0,.2); }

/* Formularios */
form { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
input[type=text], input[type=email], input[type=tel], input[type=date] {
  font-family: var(--font-body); font-size: 16px;
  padding: 12px 14px;
  border: 3px solid var(--marron);
  border-radius: 10px;
  background: #fff8ea; color: var(--marron);
  outline: none;
}
input:focus { border-color: var(--rojo); }
input.invalid { border-color: var(--rojo); background: #ffecea; }
.field-label { text-align: left; font-size: 12px; font-weight: 600; margin-top: 8px; text-transform: uppercase; letter-spacing: .5px; }
form .btn { margin-top: 14px; align-self: center; }

.err { color: var(--rojo); font-size: 12.5px; font-weight: 600; text-align: left; min-height: 4px; }

.check { display: flex; gap: 10px; text-align: left; font-size: 12.5px; align-items: flex-start; margin-top: 10px; font-weight: 500; }
.check input { width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--rojo); margin-top: 1px; }
.check a { color: var(--rojo); font-weight: 700; }

/* ================= PODIO DIARIO ================= */
.podio {
  position: relative; z-index: 6;
  width: 100%; max-width: 340px;
  background: var(--crema);
  border: 4px solid var(--marron);
  border-radius: 16px;
  padding: 10px 14px 14px;
  box-shadow: 0 8px 0 rgba(51,36,26,.3), 0 14px 30px rgba(0,0,0,.3);
}
.podio-title {
  font-family: var(--font-head); font-size: 18px; letter-spacing: 1px;
  color: var(--marron); margin-bottom: 8px;
}
.podio-row { display: flex; align-items: flex-end; justify-content: center; gap: 8px; }
.podio-col { display: flex; flex-direction: column; align-items: center; flex: 1; }
.podio-col .medal {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 16px; color: #4a3208;
  border: 2px solid rgba(0,0,0,.35); margin-bottom: 4px;
}
.podio-col.c1 .medal { background: var(--oro); }
.podio-col.c2 .medal { background: var(--plata); }
.podio-col.c3 .medal { background: var(--bronce); }
.podio-col .bar {
  width: 100%; border-radius: 6px 6px 0 0;
  background: linear-gradient(#fff, #f2e6cb);
  border: 2px solid var(--marron); border-bottom: none;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 6px 2px 4px;
}
.podio-col.c1 .bar { height: 74px; }
.podio-col.c2 .bar { height: 56px; }
.podio-col.c3 .bar { height: 44px; }
.podio-col .pscore { font-family: var(--font-head); font-size: 17px; color: var(--marron); font-variant-numeric: tabular-nums; }
.podio-col .pname { font-size: 9px; font-weight: 600; color: var(--marron); opacity: .8; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podio-col.me .bar { outline: 3px solid var(--rojo); outline-offset: -1px; }

/* ================= HUD ================= */
#screen-juego { padding: 0; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; display: block; touch-action: none; }

.hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: none; justify-content: space-between; align-items: flex-start;
  padding: 14px 14px 0;
  pointer-events: none;
}
#app.mode-game .hud { display: flex; }
.hud-pill {
  background: var(--rojo); color: #fff;
  border: 3px solid #fff;
  border-radius: 999px;
  padding: 5px 14px 4px;
  display: flex; flex-direction: column; align-items: center; line-height: 1;
  box-shadow: 0 3px 10px rgba(0,0,0,.3);
}
.hud-label { font-size: 10px; letter-spacing: 1px; font-weight: 700; margin-bottom: 2px; }
.hud-val { font-family: var(--font-head); font-size: 24px; font-variant-numeric: tabular-nums; }

.hud-lives { display: flex; gap: 3px; }
.hud-lives img { width: 24px; height: 24px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); transition: transform .25s, opacity .25s, filter .25s; }
.hud-lives img.lost { opacity: .25; filter: grayscale(1) brightness(.6); transform: scale(.82); }

.hud-pena {
  position: absolute; top: 66px; left: 0; right: 0; z-index: 19;
  text-align: center; font-family: var(--font-head); font-size: 15px;
  color: #fff; letter-spacing: 1px;
  text-shadow: 0 2px 4px rgba(0,0,0,.5);
  pointer-events: none;
}

/* ================= CAPA DE EFECTOS ================= */
.fx-layer { position: absolute; inset: 0; z-index: 15; pointer-events: none; overflow: hidden; }
.rocket { position: absolute; width: 46px; transform: translate(-50%, 0); will-change: transform, opacity; }
.badge {
  position: absolute; font-family: var(--font-head); font-size: 30px; color: #fff;
  text-shadow: 0 2px 0 var(--rojo), 0 0 12px rgba(228,50,43,.8);
  transform: translate(-50%, -50%); will-change: transform, opacity;
}
.badge.bad { text-shadow: 0 2px 0 #000, 0 0 12px rgba(0,0,0,.7); color: var(--rojo); font-size: 34px; }
@keyframes badgeUp {
  0%   { opacity: 0; transform: translate(-50%,-30%) scale(.6); }
  20%  { opacity: 1; transform: translate(-50%,-60%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%,-160%) scale(1); }
}
@keyframes shake {
  0%,100% { transform: translate(0,0); }
  20% { transform: translate(-8px, 4px); } 40% { transform: translate(8px, -4px); }
  60% { transform: translate(-6px, -3px); } 80% { transform: translate(6px, 3px); }
}
#app.shake { animation: shake .32s; }
.hit-flash {
  position: absolute; inset: 0; z-index: 14; pointer-events: none;
  background: radial-gradient(circle at center, rgba(228,50,43,0) 40%, rgba(228,50,43,.45) 100%);
  opacity: 0;
}
.hit-flash.on { animation: flash .35s ease; }
@keyframes flash { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }

.countdown {
  position: absolute; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 120px; color: #fff;
  text-shadow: 0 6px 0 var(--rojo), 0 0 30px rgba(0,0,0,.5);
  pointer-events: none;
}

/* ================= COOKIE BAR (bloqueante) ================= */
.cookie-scrim {
  position: absolute; inset: 0; z-index: 38;
  background: rgba(0,0,0,.28);
  display: none;
}
.cookie-scrim.on { display: block; }

.cookie-bar {
  position: absolute; left: 8px; right: 8px; bottom: 40px;
  z-index: 41;
  background: rgba(20,20,20,.97);
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  box-shadow: 0 6px 24px rgba(0,0,0,.5);
  font-size: 12.5px;
}
.cookie-bar p { flex: 1 1 150px; }
.cookie-bar a { color: var(--verde); font-weight: 700; }
.cookie-btns { display: flex; gap: 8px; }
.btn-cookie {
  font-family: var(--font-body); font-weight: 700; font-size: 13px;
  border: none; border-radius: 8px; padding: 9px 16px; cursor: pointer;
}
.btn-cookie.accept { background: var(--verde); color: #1e2b06; }
.btn-cookie.reject { background: #444; color: #fff; }
.cookie-bar.hidden { display: none; }
.cookie-note { flex: 1 1 100%; color: #ffd34d; font-weight: 700; font-size: 12px; margin-top: 2px; }
.cookie-note:empty { display: none; }
.cookie-bar.pulse { animation: cookiePulse .5s ease; }
@keyframes cookiePulse {
  0%,100% { transform: scale(1); }
  30% { transform: scale(1.04); box-shadow: 0 0 0 4px rgba(150,201,61,.7), 0 6px 24px rgba(0,0,0,.5); }
}

/* ================= FOOTER LEGAL + DISCLAIMER ================= */
.legal-footer {
  position: absolute; left: 0; right: 0; bottom: 18px;
  z-index: 35;
  display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 6px 8px;
  background: rgba(0,0,0,.35);
  font-family: var(--font-legal);
  font-size: 11px; letter-spacing: .3px;
}
.legal-footer a { color: #fff; text-decoration: none; opacity: .9; }
.legal-footer a:hover { text-decoration: underline; }
.legal-footer span { color: rgba(255,255,255,.6); }
.legal-footer.hidden { display: none; }

.disclaimer {
  position: absolute; left: 0; right: 0; bottom: 0;
  z-index: 34;
  text-align: center; font-family: var(--font-legal); font-size: 10px; letter-spacing: .3px;
  color: rgba(255,255,255,.85);
  background: rgba(0,0,0,.4);
  padding: 3px 6px;
}

/* ================= PANEL ADMIN ================= */
#admin-overlay {
  position: absolute; inset: 0; z-index: 60;
  display: none; align-items: center; justify-content: center;
  background: rgba(20,16,12,.85); padding: 16px;
}
.admin-card {
  width: 100%; max-width: 420px; max-height: 90%;
  background: var(--crema); border: 4px solid var(--marron); border-radius: 16px;
  padding: 18px; display: flex; flex-direction: column; gap: 10px; overflow: hidden;
}
.admin-card h2 { font-family: var(--font-head); font-size: 24px; letter-spacing: 1px; }
.admin-sub { font-size: 12px; font-weight: 600; opacity: .8; }
.admin-card .btn { font-size: 18px; padding: 12px 18px; }
.admin-table-wrap { overflow: auto; border: 2px solid var(--marron); border-radius: 8px; background: #fff8ea; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-table th, .admin-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid rgba(51,36,26,.2); white-space: nowrap; }
.admin-table th { background: var(--marron); color: var(--crema); position: sticky; top: 0; }
.admin-table td:nth-child(4), .admin-table td:nth-child(5) { font-variant-numeric: tabular-nums; text-align: right; }
.admin-note { font-size: 10px; opacity: .7; line-height: 1.3; }
.admin-close { background: none; border: none; text-decoration: underline; font-weight: 700; color: var(--marron); cursor: pointer; font-size: 13px; }

/* ================= FASE 4 · TARJETAS SVG + OVERLAYS ================= */
/* Coloca las pantallas usando las tarjetas del brandbook tal cual, con los
   controles interactivos superpuestos en posiciones (% del propio SVG). */
.screen[data-reg="1"] { justify-content: flex-start; padding: 184px 14px 88px; }
.screen.result { justify-content: center; padding: 16px 14px 64px; gap: 10px; }

.svgcard {
  position: relative;
  width: min(88%, 360px);
  aspect-ratio: var(--w) / var(--h);
  filter: drop-shadow(0 10px 24px rgba(0,0,0,.35));
}
.result .svgcard { filter: drop-shadow(0 8px 18px rgba(0,0,0,.3)); }
.svgcard .cardbg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.ov { position: absolute; box-sizing: border-box; }
.ov-btn { background: transparent; border: 0; padding: 0; cursor: pointer; border-radius: 10px; }
.ov-btn:active { filter: brightness(1.15); }

.ov-input {
  background: transparent; border: 0; outline: 0;
  font-family: var(--font-body); color: #33241a;
  font-size: clamp(13px, 3.8vw, 17px); letter-spacing: .3px;
  padding: 0 4%;
}
.ov-input::placeholder { color: rgba(51,36,26,.4); }
.ov-input.invalid { box-shadow: inset 0 0 0 2px var(--rojo); border-radius: 8px; }

/* Checkbox: marcado => transparente (se ve el check dibujado del SVG);
   sin marcar => tapa cuadrada color tarjeta sobre el check dibujado. */
.ov-chk { -webkit-appearance: none; appearance: none; margin: 0; cursor: pointer; background: transparent; border-radius: 3px; z-index: 2; }
.ov-chk:not(:checked) { background: #FBCAA1; box-shadow: inset 0 0 0 2px #33241a; }

/* Hotspot sobre el copy legal del SVG (bases / privacidad) */
.ov-legal-link { z-index: 1; cursor: pointer; background: transparent; }

/* Cómo jugar: asset PNG (no emoji del sistema; evita tofu/cuadrados negros) */
.cj-fires {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  user-select: none;
  overflow: hidden;
}

.cj-fires img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.ov-err { margin: 0; color: var(--rojo); font-family: var(--font-body); font-size: 11px; font-weight: 700; line-height: 1.1; }
.card-over-ctx .ov-err, .num-over ~ .ov-err { color: #fff; }

.ov-num {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); line-height: 1; overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.num-over   { font-size: clamp(30px, 11vw, 56px); }
.num-record { font-size: clamp(16px, 5.2vw, 26px); border-radius: 4px; }
.podio-n1, .podio-n2, .podio-n3 { color: #0e2a33; background: #4FC1DB; font-size: clamp(12px, 3.4vw, 17px); border-radius: 2px; }

.podio-wrap { width: min(78%, 320px); }
.podio-card { width: 100%; }

/* ================= HUD (pastillas) — tokens --hud-* / Figma 337×171 / 337×165 ================= */
.hud { position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  justify-content: space-between; align-items: flex-start;
  padding: 16px 16px 0; pointer-events: none; }
.hud-score,
.hud-lives {
  width: calc(var(--hud-pill-w) / var(--figma-m-w) * 100%);
  max-width: calc(var(--hud-pill-w) * 1px);
}
.hud-score { position: relative; }
.hud-pill-img,
.hud-lives img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.3));
}
.hud-val { position: absolute; left: 16%; top: 49%; width: 68%; height: 38%;
  display: flex; align-items: center; justify-content: center;
  background: #ED1C24; color: #fff; font-family: var(--font-head);
  font-size: 22px; font-variant-numeric: tabular-nums; }

/* ================= FIX · banderines, cookies, efectos ================= */
/* Banderines en droop simétrico (dos mitades espejadas) */
.bunting-img { position: absolute; top: 0; left: auto; right: auto; width: 52%; z-index: 2; pointer-events: none; filter: drop-shadow(0 3px 3px rgba(0,0,0,.2)); }
.bunting-l { left: 0; }
.bunting-r { right: 0; transform: scaleX(-1); }

/* Banner de cookies con el diseño del brandbook */
.cookie-bar { position: absolute; left: 0; right: 0; bottom: 40px; z-index: 41;
  background: none; box-shadow: none; padding: 0; font-size: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cookie-card { position: relative; width: min(90%, 380px); aspect-ratio: 758 / 183;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,.4)); }
.cookie-card .cardbg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* Efecto de acierto: badge +10 (imagen del brandbook) */
.badge-img { position: absolute; width: 74px; transform: translate(-50%, -50%); will-change: transform, opacity; }

/* ================= FIX v13 (feedback diseño) ================= */
/* Fuegos artificiales de fondo (solo registro, detrás de las tarjetas) */
.fw { position: absolute; z-index: 0; pointer-events: none; opacity: .55; }
.fw-a { top: 15%; left: -7%; width: 40%; }
.fw-b { top: 34%; right: -6%; width: 36%; }
.fw-c { top: 55%; left: 3%;  width: 30%; opacity: .4; }
#app.mode-game .fw { display: none; }

/* Cohetes ilustrados registro (VKP-9029) — no confundir con .cohete-fx del juego */
.cohete-reg {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  display: block;
}
.cohete-reg-a { top: 28%; left: -4%; width: 22%; transform: rotate(-12deg); }
.cohete-reg-b { top: 42%; right: -6%; width: 24%; transform: rotate(18deg); }
.cohete-reg-c { top: 58%; left: 8%; width: 18%; transform: rotate(-6deg); opacity: .9; }
#app.mode-game .cohete-reg { display: none; }

/* Footer legal con footer.svg (sin fondo oscuro) */
.legal-footer { position: absolute; left: 50%; transform: translateX(-50%); right: auto; bottom: 20px;
  width: 94%; max-width: 430px; z-index: 35; background: none; padding: 0; display: block; }
.footer-img { display: block; width: 100%; }
.legal-hot { position: absolute; top: -4px; height: calc(100% + 8px); display: block; }

/* Disclaimer con legal.svg (sin fondo) */
.disclaimer { position: absolute; left: 0; right: 0; bottom: 2px; z-index: 34; background: none; padding: 0; text-align: center; }
.disclaimer-img { height: 13px; width: auto; display: inline-block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }

/* Banner de cookies más arriba (bajo la tarjeta de edad) */
.cookie-bar { bottom: 40%; }

/* Banderines: droop simétrico, un poco más arriba y a media pantalla */
.bunting-img { width: 50.5%; top: -1%; }

/* Resultados: ordenados de arriba a abajo, sin solaparse con el cartel */
.screen.result {
  justify-content: flex-start;
  align-items: center;
  padding: 78px 14px 172px;
  gap: 12px;
}
.result .svgcard[data-va-card] { width: min(84%, 338px); }
.podio-wrap {
  width: min(72%, 300px);
  margin-inline: auto;
  align-self: center;
  flex: 0 0 auto;
}
/* .result .svgcard capaba el podio a 338px dentro del wrap → se pegaba a la izquierda */
.podio-wrap .podio-card {
  width: 100%;
  max-width: none;
}
.screen.result .svgcard[data-va-card] {
  margin-inline: auto;
  align-self: center;
}

/* Números de puntuación con el estilo del diseño (relleno + trazo negro) */
.num-over { color: #fff; -webkit-text-stroke: 2.5px #141414; paint-order: stroke fill; }
.podio-n1, .podio-n2, .podio-n3 { color: #fff; -webkit-text-stroke: 1.3px #141414; paint-order: stroke fill; }
.num-record { color: #33241a; -webkit-text-stroke: 0; }
.copas-img { object-fit: contain; }

/* ================= FIX v16 · separar cartel de banderines ================= */
.bunting-img { width: 47%; }
.screen[data-reg="1"] { padding-top: 214px; }

/* ================= FIX v17 · orden y aire (ref 1080x1920) ================= */
/* brandhead: tamaño SOLO vía tokens (:root + .brand-logo). No redefinir width aquí. */
.screen[data-reg="1"] {
  justify-content: flex-start;
  padding: 84px 16px 78px;   /* top: deja hueco a los banderines */
  gap: 22px;                 /* aire entre cartel y tarjeta */
}
/* Tarjetas de registro algo más pequeñas para que respire todo */
.screen[data-reg="1"] .svgcard { width: min(82%, 328px); }

/* ================= FIX v18 · inputs 100% transparentes dentro del recuadro ================= */
.ov-input { -webkit-appearance: none; appearance: none; background: transparent; border: 0; box-shadow: none; }
.ov-input[type="date"] { background: transparent; }
.ov-input[type="date"]::-webkit-calendar-picker-indicator { opacity: .55; }
.ov-input.invalid { box-shadow: none; color: var(--rojo); } /* sin caja; solo el texto en rojo si hay error */

/* ================= FIX v19 · evitar compresión de las tarjetas ================= */
/* El flex comprimía la altura de la tarjeta y deformaba el SVG (descolocando
   los recuadros). flex:0 0 auto respeta el aspect-ratio => posiciones exactas. */
.svgcard { flex: 0 0 auto; }

/* ================= FIX v20 · inputs sin caja blanca, relleno naranja + Knockout 30 ================= */
@font-face { font-family:'Knockout30'; src:url('../assets/fonts/Knockout-30.otf') format('opentype'); font-weight:normal; font-display:swap; }
/* Anula el estilo antiguo de <input> (fondo blanco + borde 3px) que ganaba por especificidad.
   El input queda transparente => se ve el recuadro naranja y su trazo fino ya dibujados en el SVG. */
.svgcard input.ov-input,
.svgcard input.ov-input[type="email"],
.svgcard input.ov-input[type="text"],
.svgcard input.ov-input[type="date"] {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0 5%;
  font-family: 'Knockout30', 'KnockoutBody', sans-serif;
  font-size: clamp(14px, 4.4vw, 20px);
  letter-spacing: .3px;
  color: #33241a;
}

/* ================= FIX v21 · números reales sustituyendo a los del diseño ================= */
/* Tapado = color EXACTO del fondo local (invisible) + número en el mismo estilo del diseño.
   Solo se ve UNA puntuación (la real), nunca dos superpuestas. */
/* HUD PUNTOS: pastilla BLANCA, números ROJOS con trazo negro */
.hud-val { background: #ffffff; color: #ED1C24;
  -webkit-text-stroke: 2px #141414; paint-order: stroke fill; }
/* GAME OVER: sobre rojo, número BLANCO con trazo negro */
.num-over { background: #ED1C24; color: #fff; -webkit-text-stroke: 3px #141414; paint-order: stroke fill; }
/* PODIO: sobre azul, número BLANCO con trazo negro */
.podio-n1, .podio-n2, .podio-n3 { background: #4FC1DB; color: #fff; -webkit-text-stroke: 1.6px #141414; paint-order: stroke fill; }
/* RÉCORD: sobre crema, número oscuro sin trazo (como "XXXX" del diseño) */
.num-record { background: #FBCAA1; color: #33241a; -webkit-text-stroke: 0; font-family: "KnockoutBody","Oswald",sans-serif; font-size: clamp(15px,4.6vw,22px); }

/* v22 · tamaño del número de game over ajustado a la cifra del diseño */
.num-over { font-size: clamp(30px, 9.4vw, 50px); }

/* ================= FIX v23 · SVG sin número: números centrados en Knockout-90 ================= */
@font-face { font-family:'Knockout90'; src:url('../assets/fonts/Knockout-90.otf') format('opentype'); font-weight:normal; font-display:swap; }

/* Sin tapado (el SVG ya no trae número). Todo centrado. */
.ov-num { font-family:'Knockout90','Knockout',sans-serif; background: transparent !important;
  display:flex; align-items:center; justify-content:center; text-align:center; }

/* PUNTOS (HUD): rojo con trazo negro, centrado en la pastilla bajo "PUNTOS" */
.hud-val { background: transparent; font-family:'Knockout90','Knockout',sans-serif;
  left:0; right:0; top:34%; bottom:6%; height:auto;
  display:flex; align-items:center; justify-content:center;
  color:#ED1C24; -webkit-text-stroke: 2px #141414; paint-order: stroke fill;
  font-size: 30px; }

/* GAME OVER: blanco con trazo negro, centrado */
.num-over { color:#fff; -webkit-text-stroke: 3.5px #141414; paint-order: stroke fill;
  font-size: clamp(34px, 11vw, 58px); }

/* PODIO: blanco con trazo negro, centrado en cada caja */
.podio-n1, .podio-n2, .podio-n3 { color:#fff; -webkit-text-stroke: 1.6px #141414; paint-order: stroke fill;
  font-size: clamp(13px, 3.8vw, 19px); }

/* RÉCORD: línea "Has conseguido X puntos" centrada, fuente del cuerpo */
.num-record-line { margin:0; text-align:center; font-family:'KnockoutBody','Oswald',sans-serif;
  color:#33241a; font-size: clamp(15px, 4.6vw, 22px); line-height:1; }
.num-record-line #record-score { font-family:'KnockoutBody','Oswald',sans-serif; }

/* v24 · afinar trazo de los números (Knockout-90 ya es muy grueso) */
.hud-val { -webkit-text-stroke: 1.4px #141414; }
.num-over { -webkit-text-stroke: 2.4px #141414; }
.podio-n1, .podio-n2, .podio-n3 { -webkit-text-stroke: 0.8px #141414; letter-spacing: .5px; }

/* v25 · separar dígitos (Knockout-90 es muy ancha, se pegan) */
.hud-val { letter-spacing: 2px; -webkit-text-stroke: 1.2px #141414; }
.num-over { letter-spacing: 6px; -webkit-text-stroke: 2px #141414; }
.podio-n1, .podio-n2, .podio-n3 { letter-spacing: 1.5px; -webkit-text-stroke: .6px #141414; font-size: clamp(12px,3.4vw,17px); }

/* v26 · más separación para que el trazo no una los dígitos */
.num-over { letter-spacing: 9px; }
.hud-val { letter-spacing: 3px; }
.podio-n1, .podio-n2, .podio-n3 { letter-spacing: 2px; }

/* v27 · HUD PUNTOS: Knockout-90 más pequeña para que "0000" quepa en la pastilla */
.hud-val { font-size: 17px; letter-spacing: .5px; -webkit-text-stroke: 1px #141414; padding: 0 4%; }

/* v29 · HUD PUNTOS: tamaño justo para que "0000" quepa holgado en la pastilla */
.hud-val { font-size: 14px; letter-spacing: 0; -webkit-text-stroke: .7px #141414; }

/* v30 · PUNTOS más grande y centrado (como referencia) + podio centrado */
.hud-val { left:0; right:0; top:42%; bottom:8%; width:auto; height:auto;
  display:flex; align-items:center; justify-content:center; text-align:center;
  font-size: clamp(22px, 7vw, 36px); letter-spacing: 0; -webkit-text-stroke: 1.2px #141414; padding:0; }
.podio-n1, .podio-n2, .podio-n3 { display:flex; align-items:center; justify-content:center; }

/* v31 · mobile gameover/record usan assets «sin número»; tapado num-over de seguridad.
   Desktop usa card D limpias (VKP-9028); récord sin placa crema (delataba ghosting). */
.num-over {
  color: #fff;
  -webkit-text-stroke: 2px #141414;
  paint-order: stroke fill;
}
#app[data-viewport="mobile"] .num-over {
  background: #ED1C24 !important;
}
.num-record-line {
  background: transparent;
  padding: 0;
}

/* ================= VIEWPORT D vs M (UI-SPEC §5) ================= */
/* Mobile-first: FOOTER.svg + columna ~480. Desktop ≥900px: landscape + pills. */

.footer-mobile { position: relative; width: 100%; display: block; }
.footer-desktop { display: none; }
.va-spot-card { margin-top: 12px; }

#app[data-viewport="mobile"] .footer-desktop { display: none !important; }
#app[data-viewport="mobile"] .footer-mobile { display: block; }
#app[data-viewport="mobile"] .disclaimer-mobile { display: block; }

#app[data-viewport="desktop"] .footer-mobile { display: none !important; }
#app[data-viewport="desktop"] .disclaimer-mobile { display: none !important; }

/* VKP-9025: disclaimer 37,5° en juego/resultados (footer legal oculto; strip mobile fuera del footer) */
#app.mode-game .disclaimer-mobile {
  display: block;
  z-index: 36;
}
#app[data-viewport="desktop"].mode-game .disclaimer-mobile {
  display: block !important;
}
#app[data-viewport="desktop"] .footer-desktop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(96%, 1100px);
  margin: 0 auto;
  padding: 8px 12px;
  background: rgba(51, 36, 26, .82);
  border-radius: 4px;
}
#app[data-viewport="desktop"] .footer-d-group {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
#app[data-viewport="desktop"] .legal-pill {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 14px;
  background: #c4a574;
  color: #33241a;
  font-family: var(--font-legal);
  font-size: 12px;
  letter-spacing: .2px;
  text-decoration: none;
  border-radius: 4px;
  white-space: nowrap;
}
#app[data-viewport="desktop"] .legal-pill:hover { filter: brightness(1.08); }
#app[data-viewport="desktop"] .footer-d-legal {
  height: 14px; width: auto; flex: 0 0 auto;
}

@media (min-width: 900px) {
  #app[data-viewport="desktop"] .hud { padding: 22px 26px 0; }
  #app[data-viewport="desktop"] .hud-score,
  #app[data-viewport="desktop"] .hud-lives {
    width: calc(var(--hud-pill-w) / var(--figma-d-w) * 100%);
    max-width: calc(var(--hud-pill-w) * 1px);
  }
  #app[data-viewport="desktop"] .hud-val { font-size: clamp(30px, 3vw, 42px); }

  #app {
    max-width: none;
    width: 100%;
  }

  #app[data-viewport="desktop"] .brand-logo {
    width: var(--brand-logo-w-d);
    max-width: var(--brand-logo-max-d);
  }
  #app[data-viewport="desktop"] .brand-barcelo {
    width: calc(var(--brand-barcelo-w) / var(--figma-d-w) * 100%);
    max-width: calc(var(--brand-barcelo-w) * 1px);
  }
  #app[data-viewport="desktop"] .brand-villa {
    width: var(--brand-logo-w-d);
    max-width: var(--brand-logo-max-d);
    margin-top: calc(var(--brand-gap) / var(--figma-d-w) * 100%);
  }
  #app[data-viewport="desktop"] .scene .villa-signpost {
    width: var(--senal-w-d);
    max-width: var(--senal-max-d);
  }

  /* Reg D: logo fijo bajo banderines (Figma BARCELO y≈91). flex-start + padding
     compartido evita el salto edad/rechazo/intro que provocaba justify:center
     y el override #screen-intro { padding-top:100px }. */
  #app[data-viewport="desktop"] .screen[data-reg="1"] {
    padding: 100px 4vw 96px;
    justify-content: flex-start;
    gap: 18px;
  }

  #app[data-viewport="desktop"] .screen[data-reg="1"] .svgcard[data-va-card],
  #app[data-viewport="desktop"] .screen[data-reg="1"] form.svgcard[data-va-card] {
    width: min(70vw, 720px);
  }

  /* Cards anchas D (datos 1596, instrucciones 1380, rechazo 1171, intro spot 1226) */
  #app[data-viewport="desktop"] #screen-datos [data-va-card],
  #app[data-viewport="desktop"] #screen-comojugar [data-va-card],
  #app[data-viewport="desktop"] #screen-rechazo [data-va-card],
  #app[data-viewport="desktop"] #screen-intro [data-va-card="intro"] {
    width: min(86vw, 980px);
  }

  /* Intro D: Figma 17:927863 — una sola INFO SPOT (no dual criterio+spot) */
  #app[data-viewport="desktop"] #screen-intro [data-va-spot] {
    display: none;
  }

  #app[data-viewport="desktop"] .legal-footer {
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: none;
    bottom: 12px;
  }

  /* Figma 17:1074243 (1920×1080): podio y=135, card y=454, gap≈51.
     Misma columna: align-items + margin-inline en wrap y card. */
  #app[data-viewport="desktop"] .screen.result {
    padding: clamp(72px, 12.5vh, 135px) 4vw clamp(96px, 18vh, 200px);
    gap: clamp(20px, 4.7vh, 51px);
    align-items: center;
  }
  /* Podio 528/1920 = 27.5% — card al 100% del wrap (no hereda tope 338px) */
  #app[data-viewport="desktop"] .screen.result .podio-wrap {
    width: min(27.5vw, 528px);
    margin-inline: auto;
    align-self: center;
  }
  #app[data-viewport="desktop"] .screen.result .podio-wrap .podio-card {
    width: 100%;
    max-width: none;
  }
  #app[data-viewport="desktop"] .screen.result .svgcard[data-va-card] {
    margin-inline: auto;
    align-self: center;
  }
  /* GAME OVER card 935/1920 ≈ 48.7% (antes min(52vw, 560px) aplastaba el landscape).
     SVG D: peach/podio offset +0.5px; red leftPad 6.5 / rightPad 18.5 (−6px = −0.64%) — despreciable. */
  #app[data-viewport="desktop"] #screen-gameover .svgcard[data-va-card] {
    width: min(48.7vw, 935px);
  }
  #app[data-viewport="desktop"] #screen-record .svgcard[data-va-card] {
    width: min(46vw, 884px);
  }
  #app[data-viewport="desktop"] #screen-pase .svgcard[data-va-card] {
    width: min(46vw, 885px);
  }
  /* Score D: Knockout ~105px @ frame 1920 */
  #app[data-viewport="desktop"] #screen-gameover .num-over {
    font-size: clamp(56px, 5.5vw, 105px);
    letter-spacing: 4px;
    -webkit-text-stroke: 2.5px #141414;
  }

  #app[data-viewport="desktop"] .pueblo-img { width: 100%; height: auto; }

  #app[data-viewport="desktop"] .cohete-reg-a { width: 12%; left: 4%; top: 22%; }
  #app[data-viewport="desktop"] .cohete-reg-b { width: 13%; right: 6%; top: 30%; }
  #app[data-viewport="desktop"] .cohete-reg-c { width: 10%; left: 18%; top: 48%; }
}
