/* La Verbena: interfaz limpia y nítida encima de la plaza pixelada. Colores de bombilla: amarillo, rosa y cian. */
:root {
  --fondo: #0b0716; --tinta: #fbf4ff; --suave: #d8cfee; --apagado: #a99fc8;
  --rosa: #ff3e8a; --amarillo: #ffd23f; --cian: #7df9ff; --verde: #4cff8f; --naranja: #ff8a2e;
  --panel: rgba(14, 9, 30, .82); --borde: rgba(255, 210, 63, .28);
  --corte: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  color-scheme: dark;
}
html, body { height: 100%; overflow: hidden; background: var(--fondo); color: var(--tinta); -webkit-tap-highlight-color: transparent; }
a { color: var(--cian); }
[hidden] { display: none !important; }
.mono { font-family: var(--f-mono); letter-spacing: .06em; }
kbd { font-family: var(--f-mono); font-size: .72em; padding: 0 4px; border: 1px solid currentColor; border-radius: 3px; opacity: .65; margin-right: 6px; }
.enlace { background: none; border: 0; padding: 0; color: var(--cian); text-decoration: underline; cursor: pointer; font: inherit; }

#lienzo { position: fixed; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; cursor: grab; touch-action: none; outline: none; }
#lienzo:active { cursor: grabbing; }

/* ───── carga y portada */
.carga { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px; background: var(--fondo); transition: opacity .6s; z-index: 40; }
.carga.fuera { opacity: 0; pointer-events: none; }
.logo { margin: 0; font-weight: 900; font-stretch: 125%; font-size: clamp(44px, 9vw, 92px); letter-spacing: .02em; line-height: 1; text-shadow: 0 0 18px rgba(255, 210, 63, .45); }
.logo span, .titulo span, .marca b { color: var(--amarillo); }
.carga-barra { width: min(320px, 70vw); height: 4px; background: rgba(255,255,255,.1); overflow: hidden; }
.carga-barra i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--amarillo), var(--rosa)); transition: width .25s; }
.carga .mono { margin: 0; font-size: 12px; color: var(--apagado); }

.portada { position: fixed; inset: 0; display: flex; align-items: flex-end; padding: clamp(18px, 6vw, 76px); background: linear-gradient(90deg, rgba(11,7,22,.88) 0%, rgba(11,7,22,.45) 42%, rgba(11,7,22,0) 66%), linear-gradient(0deg, rgba(11,7,22,.75), rgba(11,7,22,0) 48%); transition: opacity .5s; z-index: 30; }
.portada.fuera { opacity: 0; pointer-events: none; }
.portada-txt { max-width: 640px; }
.kicker { margin: 0; font-size: 12px; color: var(--amarillo); }
.titulo { margin: 8px 0 14px; font-weight: 900; font-stretch: 125%; font-size: clamp(60px, 11vw, 140px); line-height: .84; letter-spacing: -.01em; text-shadow: 0 0 30px rgba(255, 62, 138, .55), 0 4px 0 rgba(0,0,0,.35); }
.titulo span { display: inline-block; animation: bombilla 3.2s steps(1) infinite; }
@keyframes bombilla { 0%, 86%, 100% { opacity: 1; } 88% { opacity: .35; } 90% { opacity: 1; } 92% { opacity: .5; } }
.sub { margin: 0 0 16px; font-size: clamp(16px, 2vw, 20px); color: var(--suave); max-width: 34em; }
.quien { margin: 0 0 20px; color: var(--suave); }
.quien b { color: var(--tinta); }
.entrar { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 15px 28px 13px 24px; border: 0; background: var(--amarillo); color: #1a0f00; cursor: pointer; clip-path: var(--corte); transition: transform .12s, background .12s; }
.entrar span { font-weight: 900; font-stretch: 125%; font-size: clamp(24px, 3.6vw, 36px); letter-spacing: .04em; line-height: 1; }
.entrar small { font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; opacity: .8; }
.entrar:hover { background: #ffe066; transform: translateX(4px); }
.nota { margin: 18px 0 0; font-size: 12px; color: var(--apagado); }

/* ───── HUD */
.hud { position: fixed; left: 0; right: 0; top: 0; z-index: 12; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: max(10px, env(safe-area-inset-top)) clamp(10px, 2.5vw, 24px) 10px; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-izq { display: flex; align-items: center; gap: 12px; }
.volver { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 10px 0 6px; background: var(--panel); border: 1px solid var(--borde); color: var(--tinta); text-decoration: none; font-weight: 700; font-size: 14px; clip-path: var(--corte); backdrop-filter: blur(6px); }
.volver:hover { color: var(--amarillo); }
.marca { font-weight: 900; font-stretch: 125%; font-size: 20px; letter-spacing: .03em; text-shadow: 0 2px 8px rgba(0,0,0,.7); }
.suena { display: inline-flex; align-items: center; gap: 6px; max-width: 42vw; padding: 6px 12px; background: var(--panel); border: 1px solid var(--borde); color: var(--amarillo); font-size: 13px; font-weight: 700; clip-path: var(--corte); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suena span { overflow: hidden; text-overflow: ellipsis; }
.hud-der { display: flex; align-items: center; gap: 6px; }
.gente-n { padding: 0 8px; font-size: 12px; color: var(--suave); text-shadow: 0 1px 3px #000; white-space: nowrap; }
.hud-btn { height: 38px; min-width: 38px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--panel); border: 1px solid var(--borde); color: var(--tinta); cursor: pointer; backdrop-filter: blur(6px); clip-path: var(--corte); font-weight: 700; }
.hud-btn:hover { border-color: var(--amarillo); color: var(--amarillo); }
.hud-btn.ancho { gap: 7px; }
.hud-btn[aria-pressed="false"] .ondas { display: none; }
.b-voz[aria-pressed="false"] { color: var(--tinta); }
.b-voz.activo { background: #1f6b3f; border-color: var(--verde); color: #fff; }
.b-voz.habla { box-shadow: 0 0 0 2px var(--verde), 0 0 12px var(--verde); }
.hud-btn[aria-pressed="false"] { color: var(--apagado); }

/* ───── nombres y bocadillos encima de la gente */
.etiquetas { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.et3d { position: absolute; left: 0; top: 0; transform-origin: 0 0; display: flex; flex-direction: column; align-items: center; gap: 6px; white-space: nowrap; will-change: transform; }
.et3d b { padding: 2px 9px 2px 7px; background: rgba(14,9,30,.8); border-left: 4px solid var(--c); font-weight: 800; font-size: 15px; text-shadow: 0 1px 2px #000; }
.et3d.npc b { background: rgba(14,9,30,.55); font-size: 12px; font-weight: 700; letter-spacing: .03em; border-left-width: 2px; color: var(--suave); }
.et3d.sin-nombre b { display: none; }
.et3d.dueno b::after { content: ' · DUEÑO'; font: 700 10px var(--f-mono); color: var(--amarillo); }
.et3d.yo b { display: none; }
.et3d.voz b::before { content: ''; display: inline-block; width: 7px; height: 11px; margin-right: 6px; border-radius: 4px; background: var(--verde); vertical-align: -1px; box-shadow: 0 0 6px var(--verde); }
.et3d.habla b { box-shadow: 0 0 0 2px var(--verde), 0 0 14px var(--verde); }
.et3d .bocadillo { margin: 0; max-width: 250px; white-space: normal; padding: 7px 11px; background: #fffaf0; color: #1a0f22; font-weight: 700; font-size: 15px; line-height: 1.25; border-radius: 12px; position: relative; text-align: center; box-shadow: 0 3px 10px rgba(0,0,0,.4); }
.et3d .bocadillo::after { content: ''; position: absolute; left: 50%; bottom: -8px; margin-left: -8px; border: 8px solid transparent; border-bottom: 0; border-top-color: #fffaf0; }
.et3d.npc .bocadillo, .et3d.sin-nombre .bocadillo { background: #fff3c4; }
.et3d.npc .bocadillo::after, .et3d.sin-nombre .bocadillo::after { border-top-color: #fff3c4; }

/* ───── aviso y evento */
.aviso { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 14; padding: 9px 16px; background: var(--amarillo); color: #1a0f00; font-weight: 800; transition: opacity .5s; clip-path: var(--corte); max-width: calc(100% - 24px); text-align: center; }
.aviso.fuera { opacity: 0; pointer-events: none; }
.evento { position: fixed; top: 108px; left: 50%; transform: translateX(-50%); z-index: 13; width: min(520px, calc(100% - 24px)); padding: 14px 18px; background: var(--panel); border-top: 4px solid var(--rosa); backdrop-filter: blur(8px); clip-path: var(--corte); text-align: center; animation: entra .3s cubic-bezier(.2,1.3,.4,1); }
.evento p { margin: 0; color: var(--suave); }
.evento .mono { font-size: 11px; color: var(--rosa); }
.evento h2 { margin: 4px 0; font-weight: 900; font-stretch: 125%; font-size: clamp(24px, 4vw, 34px); line-height: 1; text-transform: uppercase; }
.evento .botones { justify-content: center; }

/* ───── tarjeta de lo que tienes delante */
.tarjeta { position: fixed; left: 50%; bottom: clamp(16px, 4vh, 34px); transform: translateX(-50%); z-index: 11; width: min(540px, calc(100% - 24px)); padding: 16px 20px 16px 22px; background: var(--panel); border-left: 4px solid var(--c, var(--amarillo)); backdrop-filter: blur(10px); clip-path: var(--corte); animation: entra .22s cubic-bezier(.2,1.3,.4,1); }
.tarjeta.fuera { animation: sale .18s forwards; }
@keyframes entra { from { opacity: 0; transform: translate(-50%, 16px); } }
@keyframes sale { to { opacity: 0; transform: translate(-50%, 12px); } }
.tarjeta .kicker { color: var(--c, var(--amarillo)); }
.tarjeta h2 { margin: 3px 0 5px; font-weight: 900; font-stretch: 125%; font-size: clamp(24px, 3.6vw, 34px); line-height: .98; text-transform: uppercase; }
.frase { margin: 0; color: var(--suave); }
.botones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn { display: inline-flex; align-items: center; height: 42px; padding: 0 16px; border: 0; background: rgba(255,255,255,.09); color: var(--tinta); font-weight: 900; font-stretch: 112%; letter-spacing: .03em; text-decoration: none; cursor: pointer; clip-path: var(--corte); transition: transform .1s, filter .1s; }
.btn:hover { transform: translateY(-2px); filter: brightness(1.15); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.primario { background: var(--c, var(--amarillo)); color: #140a1e; }
.btn.rosa { background: var(--rosa); color: #fff; }
.btn.sec { background: rgba(255,255,255,.09); }
.btn kbd { margin: 0 0 0 8px; }

/* ───── charla, gestos, caras */
.charla { position: fixed; left: clamp(10px, 2.5vw, 24px); bottom: 62px; z-index: 10; width: min(360px, calc(100% - 24px)); pointer-events: none; }
.charla ol { list-style: none; margin: 0 0 6px; padding: 0; max-height: 190px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; font-size: 14px; text-shadow: 0 1px 2px #000, 0 0 6px #000; }
.charla li { animation: linea 8s forwards; }
.charla:focus-within li, .charla.abierta li { animation: none; opacity: 1; }
@keyframes linea { 0%, 85% { opacity: 1; } 100% { opacity: .35; } }
.charla li.sis { color: #ffe9a8; font-size: 12px; font-family: var(--f-mono); }
.charla li b { font-weight: 800; margin-right: 4px; }
.charla form { pointer-events: auto; }
.charla input { width: 100%; height: 38px; padding: 0 12px; background: rgba(14,9,30,.72); border: 1px solid var(--borde); color: var(--tinta); font-size: 15px; outline: none; clip-path: var(--corte); }
.charla input:focus { border-color: var(--amarillo); background: rgba(14,9,30,.94); }
.gestos { position: fixed; left: clamp(10px, 2.5vw, 24px); bottom: 16px; z-index: 10; display: flex; gap: 5px; flex-wrap: wrap; }
.gestos button { height: 36px; padding: 0 10px; background: var(--panel); border: 1px solid var(--borde); color: var(--tinta); cursor: pointer; font-weight: 700; font-size: 13px; clip-path: var(--corte); backdrop-filter: blur(6px); }
.gestos button:hover, .gestos button[aria-expanded="true"] { border-color: var(--amarillo); color: var(--amarillo); }
.caras { position: fixed; left: clamp(10px, 2.5vw, 24px); bottom: 58px; z-index: 11; display: flex; gap: 4px; padding: 6px; background: var(--panel); clip-path: var(--corte); }
.caras button { width: 38px; height: 38px; padding: 2px; background: #1c1436; border: 1px solid var(--borde); cursor: pointer; }
.caras canvas { width: 32px; height: 32px; image-rendering: pixelated; }
.b-charla { position: fixed; left: 18px; bottom: 152px; z-index: 10; height: 44px; padding: 0 16px; background: var(--panel); border: 1px solid var(--borde); color: var(--tinta); font-weight: 800; clip-path: var(--corte); }

.palanca { position: fixed; left: 18px; bottom: 18px; width: 124px; height: 124px; border-radius: 50%; border: 1px solid var(--borde); background: rgba(14,9,30,.4); z-index: 10; touch-action: none; display: grid; place-items: center; }
.palanca i { width: 50px; height: 50px; border-radius: 50%; background: rgba(255,210,63,.35); border: 1px solid var(--amarillo); }
.b-correr { position: fixed; left: 150px; bottom: 26px; z-index: 10; height: 44px; padding: 0 14px; background: var(--panel); border: 1px solid var(--borde); color: var(--tinta); font-weight: 800; clip-path: var(--corte); }
.b-correr[aria-pressed="true"] { background: var(--amarillo); color: #1a0f00; }

/* ───── autos de choque: el marcador de la ronda */
.choque-hud { position: fixed; top: 62px; right: clamp(10px, 2.5vw, 24px); z-index: 11; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding: 10px 12px; background: var(--panel); border-right: 4px solid var(--rosa); clip-path: var(--corte); }
.choque-hud p { margin: 0; font-size: 11px; font-weight: 700; }
.choque-hud b { font-weight: 900; font-stretch: 125%; font-size: 22px; line-height: 1; }
.choque-hud .btn { height: 32px; padding: 0 10px; font-size: 12px; }

/* ───── minijuegos de las casetas */
.mini { position: fixed; top: 62px; right: clamp(10px, 2.5vw, 24px); z-index: 11; width: min(300px, calc(100% - 20px)); display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; background: var(--panel); border-right: 4px solid var(--verde); clip-path: var(--corte); }
.mini-toro { border-right-color: var(--naranja); }
.mini p { margin: 0; font-size: 12px; color: var(--suave); }
.mini .mono { font-size: 11px; color: var(--amarillo); }
.mini-grande { font-weight: 900; font-stretch: 125%; font-size: 30px; line-height: 1; }
.corchos { letter-spacing: .12em; color: #e8c890 !important; font-size: 16px !important; }
.mini .btn { height: 34px; font-size: 12px; align-self: flex-start; }
.mira-tiro { position: fixed; left: -14px; top: -14px; width: 28px; height: 28px; border: 2px solid #fff; border-radius: 50%; z-index: 9; pointer-events: none; mix-blend-mode: difference; }
.mira-tiro::after { content: ''; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; background: #fff; border-radius: 50%; }
.equilibrio { position: relative; height: 16px; background: linear-gradient(90deg, #c2311f 0 12%, rgba(255,255,255,.12) 12% 88%, #c2311f 88%); }
.equilibrio i { position: absolute; top: -3px; left: 50%; width: 8px; height: 22px; margin-left: -4px; background: var(--amarillo); transition: background .1s; }
.equilibrio i.peligro { background: #ff4a4a; }
.botones-toro { position: fixed; left: 0; right: 0; bottom: 18px; z-index: 11; display: flex; justify-content: space-between; padding: 0 18px; pointer-events: none; }
.botones-toro .btn { pointer-events: auto; width: 96px; height: 76px; font-size: 30px; justify-content: center; touch-action: none; user-select: none; }

/* ───── paneles */
.panel { position: fixed; z-index: 25; padding: 16px 18px; background: var(--panel); backdrop-filter: blur(12px); clip-path: var(--corte); display: flex; flex-direction: column; gap: 10px; }
.panel-der { right: clamp(10px, 2.5vw, 24px); top: 62px; bottom: 16px; width: min(400px, calc(100% - 20px)); border-left: 3px solid var(--amarillo); }
.panel-centro { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100% - 20px)); max-height: calc(100% - 40px); border-top: 3px solid var(--amarillo); overflow: auto; }
.panel-cab { display: flex; justify-content: space-between; align-items: center; }
.panel h2 { margin: 0; font-weight: 900; font-stretch: 125%; font-size: 24px; text-transform: uppercase; }
.panel p { margin: 0; color: var(--suave); font-size: 14px; }
.cerrar { width: 36px; height: 36px; background: rgba(255,255,255,.08); border: 0; color: var(--tinta); font-size: 22px; line-height: 1; cursor: pointer; }
.v-pestanas { display: flex; gap: 4px; }
.v-pestanas button { flex: 1; height: 34px; background: rgba(255,255,255,.06); border: 0; border-bottom: 2px solid transparent; color: var(--suave); font-weight: 800; cursor: pointer; font-size: 13px; }
.v-pestanas button[aria-selected="true"] { color: var(--amarillo); border-bottom-color: var(--amarillo); background: rgba(255,210,63,.08); }
.v-cuerpo { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 4px; }
.grupo h3 { margin: 0 0 6px; font: 700 11px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--amarillo); }
.fila { display: flex; flex-wrap: wrap; gap: 6px; }
.fila button { min-height: 32px; padding: 0 10px; background: #1c1436; border: 1px solid rgba(255,255,255,.12); color: var(--tinta); cursor: pointer; font-size: 13px; font-weight: 700; }
.fila button[aria-pressed="true"] { border-color: var(--amarillo); background: #33244e; }
.fila .muestra { width: 32px; padding: 0; }
.fila .muestra[aria-pressed="true"] { outline: 2px solid #fff; outline-offset: 2px; }
.fila button:disabled { opacity: .35; cursor: default; }
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo input { height: 42px; padding: 0 12px; background: #000; color: #fff; border: 1px solid rgba(255,255,255,.2); font: 700 16px var(--f-texto); outline: none; }
.campo input:focus { border-color: var(--amarillo); }
.campo small { color: var(--apagado); }
.error { color: #ff8a9a !important; font-weight: 700; }
.premios { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.premio { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px; background: #1c1436; border: 1px solid rgba(255,255,255,.12); color: var(--tinta); cursor: pointer; text-align: left; }
.premio[aria-pressed="true"] { border-color: var(--amarillo); background: #33244e; }
.premio b { font-size: 13px; line-height: 1.15; }
.premio span { font: 11px var(--f-mono); color: var(--apagado); }
.vacio { padding: 14px; background: rgba(255,255,255,.04); color: var(--suave); font-size: 14px; }
.pr-cuerpo { display: flex; flex-direction: column; gap: 12px; }
.pr-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pr-lista li { display: flex; gap: 12px; align-items: baseline; padding: 8px 10px; background: rgba(255,255,255,.04); border-left: 3px solid var(--c, var(--amarillo)); }
.pr-lista li b { font-family: var(--f-mono); color: var(--amarillo); min-width: 3.6em; }
.pr-lista li.ahora { background: rgba(255,210,63,.1); }
.teclas { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.teclas dt { font-family: var(--f-mono); color: var(--amarillo); font-size: 13px; }
.teclas dd { margin: 0; }
.pie { font-size: 12px !important; }
.fallo { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; padding: 20px; background: var(--fondo); z-index: 50; }

@media (max-width: 760px) {
  .hud-btn.ancho span { display: none; }
  .hud-btn { height: 36px; padding: 0 9px; }
  .marca, .gente-n { display: none; }
  .volver span { display: none; }
  .suena { max-width: 36vw; font-size: 11px; padding: 5px 8px; }
  .tarjeta { bottom: 152px; padding: 12px 14px; }
  .charla { bottom: 206px; width: min(270px, 64vw); }
  .charla ol { max-height: 110px; font-size: 13px; }
  .charla form { display: none; }
  .charla.abierta form { display: block; }
  .gestos { left: auto; right: 10px; bottom: 16px; flex-direction: column; align-items: flex-end; }
  .gestos button { height: 34px; font-size: 12px; }
  .gestos kbd { display: none; }
  .caras { left: auto; right: 10px; bottom: 236px; flex-wrap: wrap; width: 176px; }
  .panel-der { top: auto; height: 62vh; left: 8px; right: 8px; width: auto; }
  .evento { top: 96px; padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) { .titulo span, .tarjeta, .evento { animation: none; } .charla li { animation: none; } }
