:root {
  --negro: #020101;
  --gris: #1b1b1d;
  --gris-2: #2a2a2e;
  --texto: #f5f5f5;
  --texto-suave: #a9a9b0;
  --rojo: #e53935;
  --rojo-oscuro: #b71c1c;
  --verde: #1a9c4a;
  --amarillo: #ffb300;
  --radio: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--negro);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
[hidden] { display: none !important; }
button, input { font: inherit; }

.boton {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; min-height: 52px; padding: 12px 20px;
  border: 0; border-radius: 999px; font-weight: 700; font-size: 17px;
  text-decoration: none; cursor: pointer; color: #fff; background: var(--gris-2);
}
.boton--rojo { background: var(--rojo); }
.boton--verde { background: var(--verde); }
.boton--claro { background: transparent; border: 2px solid var(--texto-suave); color: var(--texto); }
.boton--chico { width: auto; min-height: 36px; padding: 6px 14px; font-size: 14px; background: var(--rojo); }
.boton:active { transform: scale(.98); }

.error { color: #ff8a80; margin: 0; font-size: 15px; }

/* --- Entrada --- */
.pantalla { min-height: 100dvh; }
.entrada, .aviso {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  max-width: 440px; margin: 0 auto; text-align: center;
}
.entrada__logo { width: 220px; max-width: 70%; }
.entrada__titulo { margin: 0; font-size: 28px; }
.entrada__texto, .entrada__nota { margin: 0; color: var(--texto-suave); }
.entrada__nota { font-size: 14px; }
.entrada__forma { display: grid; gap: 14px; width: 100%; text-align: left; }
.entrada__forma label { display: grid; gap: 6px; font-weight: 600; font-size: 15px; }
.entrada__forma input {
  width: 100%; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--gris-2);
  background: var(--gris); color: var(--texto); font-size: 17px;
}
.entrada__forma input:focus { outline: 2px solid var(--rojo); border-color: transparent; }
.aviso__texto { font-size: 18px; margin: 0; }

/* --- Live --- */
.live { display: flex; flex-direction: column; height: 100dvh; }
.live__video { position: relative; flex: 0 0 auto; height: 52dvh; background: #000; }
.live__video video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.live__esperando {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center;
  color: var(--texto-suave); pointer-events: none;
}
.live__barra {
  position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px;
}
.etiqueta { border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 800; color: #fff; background: rgba(0,0,0,.55); border: 0; }
.etiqueta--vivo { background: var(--rojo); letter-spacing: .05em; }
.etiqueta--boton { cursor: pointer; font-weight: 600; }
.live__brillo { position: absolute; inset: 0; background: #fff; opacity: 0; animation: brillo .45s ease-out; pointer-events: none; }
@keyframes brillo { 0% { opacity: .8; } 100% { opacity: 0; } }

.live__accion { display: flex; gap: 8px; padding: 10px 12px; background: var(--negro); }
.quiero {
  flex: 1; min-height: 62px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--rojo); color: #fff; font-size: 24px; font-weight: 900; letter-spacing: .02em;
  box-shadow: 0 6px 20px rgba(229, 57, 53, .35);
}
.quiero:active:not(:disabled) { transform: scale(.98); background: var(--rojo-oscuro); }
.quiero:disabled { cursor: default; box-shadow: none; }
.quiero--bloqueado { background: var(--gris-2); font-size: 17px; font-weight: 700; }
.quiero--espera { background: var(--amarillo); color: #1b1b1d; font-size: 18px; box-shadow: none; }
.quiero--mia { background: var(--verde); font-size: 19px; box-shadow: none; }
.cancelar {
  flex: 0 0 auto; min-width: 118px; border-radius: 16px; border: 2px solid #ff8a80; background: transparent;
  color: #ff8a80; font-weight: 800; font-size: 15px; cursor: pointer;
}

.pestanas { display: flex; border-bottom: 1px solid var(--gris-2); }
.pestana {
  flex: 1; padding: 12px; background: none; border: 0; color: var(--texto-suave); font-weight: 700;
  border-bottom: 3px solid transparent; cursor: pointer;
}
.pestana.activa { color: var(--texto); border-bottom-color: var(--rojo); }
.contador { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--rojo); color: #fff; font-size: 13px; margin-left: 4px; }

.panel { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.chat__lista { list-style: none; margin: 0; padding: 10px 12px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.chat__lista li { line-height: 1.35; overflow-wrap: anywhere; }
.chat__nombre { font-weight: 800; color: #ffcdd2; margin-right: 6px; }
.chat__lista li.mio .chat__nombre { color: #a5d6a7; }
.chat__vacio { color: var(--texto-suave); text-align: center; margin-top: 20px; }
.chat__forma { display: flex; gap: 8px; padding: 8px 12px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--gris-2); }
.chat__forma input { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 999px; border: 1px solid var(--gris-2); background: var(--gris); color: var(--texto); font-size: 16px; }
.chat__forma .boton { width: auto; min-height: 46px; padding: 8px 18px; font-size: 15px; }

.carrito { overflow-y: auto; padding: 12px 12px max(12px, env(safe-area-inset-bottom)); gap: 12px; }
.carrito__resumen {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--gris); border-radius: var(--radio); padding: 14px 16px;
}
.carrito__resumen strong { font-size: 24px; }
.carrito__resumen span { color: var(--texto-suave); font-size: 14px; }
.carrito__prendas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.prenda { position: relative; border-radius: 12px; overflow: hidden; background: var(--gris); }
.prenda img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; background: var(--gris-2); }
.prenda__info { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; background: rgba(0,0,0,.65); font-size: 12px; font-weight: 700; display: flex; justify-content: space-between; }
.prenda--pagada { outline: 3px solid var(--verde); }
.prenda--liberada { opacity: .45; }
.carrito__vacio { color: var(--texto-suave); text-align: center; grid-column: 1 / -1; margin: 16px 0; }

/* --- Pago --- */
.pago { max-width: 560px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); display: grid; gap: 14px; align-content: start; }
.pago__encabezado { text-align: center; }
.pago__logo { width: 150px; }
.pago__encabezado h1 { font-size: 22px; margin: 8px 0 0; }
.reloj { text-align: center; background: var(--gris); border-radius: var(--radio); padding: 16px; }
.reloj p { margin: 0; color: var(--texto-suave); }
.reloj__tiempo { display: block; font-size: 46px; font-variant-numeric: tabular-nums; margin: 4px 0; }
.reloj--urgente .reloj__tiempo { color: #ff8a80; }
.reloj__nota { font-size: 14px; }
.pago__pagado { text-align: center; background: rgba(26, 156, 74, .18); border: 1px solid var(--verde); border-radius: var(--radio); padding: 16px; }
.pago__pagado strong { font-size: 22px; color: #a5d6a7; }
.pago__pagado p { margin: 6px 0 0; }
.pago__datos { background: var(--gris); border-radius: var(--radio); padding: 14px 16px; }
.pago__datos h2, .pago__liberadas h2 { font-size: 17px; margin: 0 0 8px; }
.pago__datos pre { margin: 0; white-space: pre-wrap; font-family: inherit; font-size: 16px; line-height: 1.45; user-select: all; }
.pago__liberadas p { color: var(--texto-suave); margin: 0 0 10px; font-size: 14px; }

/* --- Avisos --- */
.mensaje {
  position: fixed; left: 50%; top: max(16px, env(safe-area-inset-top)); transform: translateX(-50%);
  background: #fff; color: #111; padding: 12px 18px; border-radius: 999px; z-index: 50; font-weight: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); max-width: calc(100% - 32px); text-align: center;
}
.mensaje--exito { background: var(--verde); color: #fff; }
.mensaje--error { background: #ff8a80; color: #111; }
.instalar {
  position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 40;
  display: flex; align-items: center; gap: 10px; background: var(--gris); border: 1px solid var(--gris-2);
  border-radius: 16px; padding: 10px 12px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.instalar span { flex: 1; }
.instalar__cerrar { background: none; border: 0; color: var(--texto-suave); font-size: 24px; cursor: pointer; padding: 0 4px; }

@media (min-width: 900px) {
  .live { display: grid; grid-template-columns: minmax(360px, 460px) 1fr; grid-template-rows: auto auto auto 1fr; max-width: 1100px; margin: 0 auto; }
  .live__video { grid-row: 1 / 3; height: calc(100dvh - 82px); }
  .live__accion { grid-column: 1; grid-row: 3; }
  .pestanas { grid-column: 2; grid-row: 1; }
  .panel { grid-column: 2; grid-row: 2 / 5; }
}
