/* Adoquiná Madryn · Matercon. Tipografía de la casa (Archivo para títulos, Familjen Grotesk para texto): NUNCA Poppins. */
@font-face { font-family: 'Archivo'; src: url('fuentes/Archivo-900.ttf') format('truetype'); font-weight: 900; font-display: swap; }
@font-face { font-family: 'Archivo'; src: url('fuentes/Archivo-800.ttf') format('truetype'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Familjen Grotesk'; src: url('fuentes/FamiljenGrotesk-400.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Familjen Grotesk'; src: url('fuentes/FamiljenGrotesk-600.ttf') format('truetype'); font-weight: 600; font-display: swap; }

:root {
  /* colores MEDIDOS en el logo y en las piezas de Matercon (ver config.js) */
  --rojo: #d40a12; --rojo-oscuro: #86060c; --rojo-claro: #ef3a40; --grafito-marca: #383838; --gris-claro: #e8e8e8;
  --blanco: #ffffff; --tiza: #f3efe6; --grafito: #1b1c1f; --hormigon: #8d8f93; --arena: #d9c7a1; --amarillo: #f2b632;
  --panel: rgba(38, 38, 38, 0.97); --borde: rgba(255, 255, 255, 0.12);
  --titulos: 'Montserrat', 'Archivo', system-ui, sans-serif; --texto: 'Familjen Grotesk', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #262626; color: var(--tiza); font-family: var(--texto); overscroll-behavior: none; }
body { position: fixed; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
#app { position: absolute; inset: 0; overflow: hidden; }
#lienzo { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ── controles ── */
#controles .ctl {
  position: absolute; border: 0; border-radius: 18px; padding: 0; display: grid; place-items: center;
  background: linear-gradient(180deg, #3a3c41, #232428); box-shadow: 0 4px 0 #0c0c0e, inset 0 1px 0 rgba(255,255,255,0.18);
  touch-action: none; cursor: pointer; transition: transform 0.05s, box-shadow 0.05s;
}
#controles .ctl svg { width: 52%; height: 52%; fill: none; stroke: var(--tiza); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
#controles .ctl.rojo { background: linear-gradient(180deg, var(--rojo-claro), var(--rojo)); box-shadow: 0 4px 0 var(--rojo-oscuro), inset 0 1px 0 rgba(255,255,255,0.25); }
#controles .ctl.girar { background: linear-gradient(180deg, #ffd36b, var(--amarillo)); box-shadow: 0 4px 0 #9a6c0c, inset 0 1px 0 rgba(255,255,255,0.4); }
#controles .ctl.girar svg { stroke: #2a1d05; }
#controles .ctl.apretado { transform: translateY(3px); box-shadow: 0 1px 0 #0c0c0e; }
.btn-icono { position: absolute; width: 38px; height: 30px; border-radius: 12px; border: 1px solid var(--borde); background: rgba(0,0,0,0.35); display: grid; place-items: center; cursor: pointer; }
.btn-icono svg { width: 20px; height: 20px; stroke: var(--tiza); stroke-width: 2.6; stroke-linecap: round; fill: none; }

/* ── pantallas ── */
.pantalla { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom)); text-align: center; overflow-y: auto; touch-action: pan-y; }
#portada { justify-content: center; gap: 12px; isolation: isolate; }
/* la calle REAL (foto del Drive de Matercon, sin personas) abajo, fundida con el rojo de arriba */
#portada::before { content: ""; position: absolute; inset: 42% 0 0 0; z-index: -1; background: url("assets/marca/calle-azcuenaga.jpg") center top / cover no-repeat;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 38%); mask-image: linear-gradient(to bottom, transparent, #000 38%); opacity: 0.5; }
#portada::after { content: ""; position: absolute; inset: 42% 0 0 0; z-index: -1; background: linear-gradient(to bottom, rgba(38,38,38,0), rgba(38,38,38,0.55)); }
.credito-foto { position: absolute; right: 10px; bottom: calc(6px + env(safe-area-inset-bottom)); margin: 0; font-size: 10px; color: rgba(243,239,230,0.55); }
.producto { display: flex; align-items: center; gap: 10px; max-width: 360px; }
.producto-foto { flex: none; margin: 0; width: 74px; text-align: center; }
.producto-foto img { width: 100%; height: auto; filter: drop-shadow(0 6px 8px rgba(0,0,0,0.5)); transform: rotate(-8deg); }
.producto-foto figcaption { font-size: 10.5px; font-weight: 600; color: var(--arena); margin-top: 2px; }
.producto .reglas { margin: 0; }
#portada .aviso { margin-top: 14px; }
.logo-portada { width: min(78vw, 330px); height: auto; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4)); margin-bottom: 4px; }
.titulo { margin: 4px 0 0; font-family: var(--titulos); font-weight: 900; line-height: 0.88; text-transform: uppercase; letter-spacing: -0.01em; }
.titulo .t1 { display: block; font-size: clamp(44px, 14vw, 68px); color: var(--blanco); text-shadow: 0 4px 0 var(--rojo-oscuro); }
.titulo .t2 { display: block; font-size: clamp(44px, 14vw, 68px); color: var(--amarillo); text-shadow: 0 4px 0 #6e4b06; }
.bajada { margin: 4px 0; max-width: 340px; font-size: 16px; line-height: 1.35; color: var(--tiza); }
.reglas { list-style: none; margin: 2px 0 6px; padding: 10px 14px; display: grid; gap: 7px; text-align: left; font-size: 14px; line-height: 1.3;
  background: rgba(0,0,0,0.38); border: 1px solid var(--borde); border-radius: 14px; max-width: 340px; }
.reglas li { display: flex; align-items: center; gap: 10px; }
.ico { flex: none; width: 26px; height: 18px; border-radius: 3px; background-size: cover; }
.ico-cuadra { background: repeating-linear-gradient(90deg, #a9aaa6 0 5px, #c9b48a 5px 6.5px); }
.ico-manzana { background: repeating-linear-gradient(0deg, #b8141d 0 3.5px, #c9b48a 3.5px 4.5px); }
.ico-calle { background: linear-gradient(90deg, #bdbab2 0 3px, #6e543a 3px 23px, #bdbab2 23px); }
.btn-rojo { border: 0; border-radius: 16px; padding: 14px 28px; font-family: var(--titulos); font-weight: 900; font-size: 20px; text-transform: uppercase; letter-spacing: 0.02em;
  color: var(--blanco); background: linear-gradient(180deg, var(--rojo-claro), var(--rojo)); box-shadow: 0 5px 0 var(--rojo-oscuro), 0 10px 24px rgba(0,0,0,0.35); cursor: pointer; }
.btn-rojo:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--rojo-oscuro); }
.btn-rojo.grande { font-size: 26px; padding: 16px 40px; }
.btn-rojo.chico { font-size: 16px; padding: 11px 22px; }
.btn-rojo[disabled] { opacity: 0.6; }
.btn-chico { border: 1px solid var(--borde); border-radius: 12px; padding: 10px 16px; background: rgba(255,255,255,0.08); font-weight: 600; font-size: 15px; cursor: pointer; }
.fila-botones { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.cta-portada { margin: 2px 0 0; max-width: 330px; font-size: 14px; font-weight: 600; color: var(--amarillo); }
.aviso { margin: auto 0 0; max-width: 340px; font-size: 11px; line-height: 1.35; color: rgba(243,239,230,0.75); text-shadow: 0 1px 2px rgba(0,0,0,0.8); }

.panel { background: var(--panel); justify-content: flex-start; }
.panel h2 { margin: 6px 0 2px; font-family: var(--titulos); font-weight: 900; font-size: 30px; text-transform: uppercase; color: var(--blanco); line-height: 1; }
#pausa, #pantalla-ranking { justify-content: center; }
.logo-fin { width: 170px; height: auto; margin-top: 2px; }
.fin-calle { margin: 0; font-size: 14px; color: var(--arena); }
.fin-numeros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; max-width: 360px; }
.fin-numeros div { background: rgba(255,255,255,0.06); border: 1px solid var(--borde); border-radius: 12px; padding: 8px 4px; display: flex; flex-direction: column; }
.fin-numeros .n { font-family: var(--titulos); font-weight: 900; font-size: 24px; color: var(--blanco); }
.fin-numeros .l { font-size: 11px; color: rgba(243,239,230,0.7); }

/* ── formulario del final (cta.js) ── */
.fin-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 7px; text-align: left; }
.ff-titulo { margin: 4px 0 0; font-family: var(--titulos); font-weight: 800; font-size: 17px; color: var(--amarillo); text-align: center; }
.ff-label { font-size: 13px; font-weight: 600; }
.ff-nota { font-weight: 400; color: rgba(243,239,230,0.6); font-size: 12px; }
.fin-form input[type=text], .fin-form input:not([type]), .fin-form input[name=contacto], .fin-form input[name=nombre] {
  width: 100%; border: 1px solid rgba(255,255,255,0.22); border-radius: 12px; padding: 12px; font: inherit; font-size: 16px; color: var(--blanco); background: rgba(255,255,255,0.08); }
.fin-form input:focus { outline: 2px solid var(--amarillo); outline-offset: 1px; }
.cta-caja { border-radius: 14px; padding: 10px 12px; background: linear-gradient(180deg, rgba(190,10,20,0.35), rgba(190,10,20,0.15)); border: 1px solid rgba(226,50,59,0.55); }
.cta-titulo { margin: 0; font-family: var(--titulos); font-weight: 900; font-size: 16px; color: var(--blanco); text-transform: uppercase; }
.cta-texto { margin: 3px 0 0; font-size: 14px; line-height: 1.3; }
.cta-voto { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ff-obra { border: 0; padding: 0; margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ff-obra legend { font-size: 13px; font-weight: 600; margin-bottom: 5px; padding: 0; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 8px 13px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.25); font-size: 14px; background: rgba(255,255,255,0.05); }
.chip input:checked + span { background: var(--amarillo); color: #2a1d05; border-color: var(--amarillo); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--blanco); }
.ff-consent { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; line-height: 1.35; color: rgba(243,239,230,0.85); cursor: pointer; }
.ff-consent input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--rojo); }
.ff-consent a, .ff-bases a, .ff-privacidad a, .fin-resultado a:not(.btn-wa) { color: var(--amarillo); }
.ff-error { margin: 0; padding: 8px 10px; border-radius: 10px; background: rgba(242,182,50,0.15); color: var(--amarillo); font-size: 13px; }
.ff-bases { margin: 0; text-align: center; font-size: 12px; }
#ff-enviar { margin-top: 4px; }

.fin-resultado { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.res-pos { margin: 0; font-family: var(--titulos); font-weight: 800; font-size: 18px; color: var(--amarillo); }
.res-ok, .res-aviso { margin: 0; font-size: 14px; }
.res-aviso { color: var(--amarillo); }
.res-codigo { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px; border-radius: 16px;
  background: repeating-linear-gradient(45deg, #fff8e6 0 12px, #fff3d6 12px 24px); color: var(--grafito); border: 3px dashed var(--rojo); }
.rc-k { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--rojo); }
.rc-cod { font-family: var(--titulos); font-weight: 900; font-size: 36px; letter-spacing: 0.06em; }
.rc-d { font-size: 13px; line-height: 1.3; text-align: center; }
.rc-cap { font-size: 11px; color: #6b6b6b; }
.cta-caja .btn-wa { margin-top: 9px; font-size: 15px; padding: 11px 16px; }
.btn-wa { display: inline-block; padding: 13px 20px; border-radius: 14px; background: #1faa53; color: #fff; text-decoration: none; font-weight: 600; font-size: 16px; box-shadow: 0 4px 0 #0f6b33; }
.res-votos { width: 100%; text-align: left; font-size: 13px; }
.res-votos p { margin: 0 0 6px; }
.rv { display: grid; grid-template-columns: 96px 1fr 34px; gap: 8px; align-items: center; margin: 3px 0; }
.rv-b { height: 10px; border-radius: 6px; background: rgba(255,255,255,0.1); overflow: hidden; }
.rv-b i { display: block; height: 100%; background: var(--amarillo); }
.rv-v { text-align: right; }

/* ── ranking ── */
.rk { width: 100%; max-width: 380px; }
.rk-pestanas { display: flex; gap: 6px; justify-content: center; margin-bottom: 6px; }
.rk-pestana { border: 1px solid var(--borde); background: transparent; border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer; }
.rk-pestana.activa { background: var(--rojo); border-color: var(--rojo); color: #fff; font-weight: 600; }
.rk-lista { list-style: none; margin: 0; padding: 0; text-align: left; }
.rk-lista li { display: grid; grid-template-columns: 26px 1fr auto 70px; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; font-size: 14px; }
.rk-lista li:nth-child(odd) { background: rgba(255,255,255,0.05); }
.rk-lista li.yo { background: rgba(242,182,50,0.25); outline: 1px solid var(--amarillo); }
.rk-pos { font-family: var(--titulos); font-weight: 900; color: var(--amarillo); }
.rk-nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-cuadras { font-size: 12px; color: rgba(243,239,230,0.65); }
.rk-pts { text-align: right; font-family: var(--titulos); font-weight: 800; }
.rk-vacio, .rk-nota { font-size: 13px; color: rgba(243,239,230,0.7); margin: 6px 0; }
