:root {
  --fondo: #0E1110;
  --superficie: #171B19;
  --linea: #2A302D;
  --texto: #E8ECE9;
  --apagado: #9AA59F;
  --acento: #FF5A36;
  --acento-hover: #FF7A5C;
  --titulos: 'Chakra Petch', sans-serif;
  --cuerpo: 'IBM Plex Sans', sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--cuerpo);
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(40px, env(safe-area-inset-top)) 24px max(32px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 28px;
}

h1, h2 { margin: 0; font-family: var(--titulos); font-weight: 700; line-height: 1.1; }
h1 { font-size: 34px; }
h2 { font-size: 18px; font-weight: 600; }
p { margin: 0; line-height: 1.45; }
a { color: var(--acento); }
a:hover { color: var(--acento-hover); }

.apagado { color: var(--apagado); }
.etiqueta { font-family: var(--mono); font-size: 13px; letter-spacing: 0.12em; color: var(--acento); }
.marca { font-family: var(--titulos); font-weight: 700; font-size: 18px; letter-spacing: 0.08em; }
.pila { display: flex; flex-direction: column; gap: 12px; }
.pila-chica { display: flex; flex-direction: column; gap: 6px; }
.fila { display: flex; align-items: center; gap: 12px; }
.entre { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.empuja { margin-top: auto; }

/* Botones */
.boton {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 20px; border-radius: 14px; border: 0;
  font: 600 17px var(--cuerpo); text-decoration: none; cursor: pointer;
  background: var(--acento); color: var(--fondo);
}
.boton:hover { background: var(--acento-hover); color: var(--fondo); }
.boton:disabled { background: var(--linea); color: var(--apagado); cursor: not-allowed; }
.boton.claro { background: var(--texto); }
.boton.secundario { background: transparent; color: var(--texto); border: 1px solid var(--linea); min-height: 48px; font-size: 15px; font-weight: 500; }
.boton.secundario:hover { border-color: var(--apagado); }
.boton-icono {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; border: 1px solid var(--linea);
  background: var(--superficie); color: var(--texto); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.enlace { background: none; border: 0; padding: 8px 0; color: var(--apagado); font: 500 15px var(--cuerpo); text-decoration: underline; cursor: pointer; }

/* Formularios */
label.campo { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 500; color: var(--apagado); }
input[type=text], input[type=number] {
  height: 54px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--linea);
  background: var(--superficie); color: var(--texto); font: 17px var(--cuerpo); width: 100%;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
input.codigo { height: 72px; font: 500 34px var(--mono); letter-spacing: 0.5em; text-align: center; text-transform: uppercase; padding-left: 0.5em; }
.error { color: var(--acento); font-size: 15px; }

/* Tarjetas */
.tarjeta { background: var(--superficie); border: 1px solid var(--linea); border-radius: 18px; padding: 20px; }
.tarjeta-grande {
  display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
  min-height: 170px; padding: 24px; border-radius: 20px; text-decoration: none;
  background: var(--superficie); border: 1px solid var(--linea); color: var(--texto);
}
.tarjeta-grande.principal { background: var(--acento); border-color: var(--acento); color: var(--fondo); }
.tarjeta-grande:hover { color: inherit; border-color: var(--apagado); }
.tarjeta-grande .titulo { font-family: var(--titulos); font-weight: 700; font-size: 26px; }

/* Personajes */
svg.personaje { border-radius: 50%; display: block; flex-shrink: 0; }
.rejilla-personajes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; justify-items: center; }
.opcion-personaje {
  width: 74px; height: 74px; padding: 0; border-radius: 50%; border: 3px solid var(--linea);
  background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.opcion-personaje[aria-pressed=true] { border-color: var(--acento); }

/* Opciones de duración */
.opcion {
  min-height: 72px; padding: 0 20px; border-radius: 14px; border: 2px solid var(--linea);
  background: var(--superficie); color: var(--texto); display: flex; align-items: center; justify-content: space-between;
  text-align: left; font-family: inherit; cursor: pointer;
}
.opcion[aria-pressed=true] { border-color: var(--acento); }
.opcion .titulo { font-family: var(--titulos); font-weight: 600; font-size: 20px; }
.opcion .punto { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--linea); }
.opcion[aria-pressed=true] .punto { border: 7px solid var(--acento); }

/* Sala */
.codigo-grande { font: 500 34px var(--mono); letter-spacing: 0.3em; color: var(--acento); }
.persona { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.persona .nombre { flex: 1; font-weight: 500; font-size: 16px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.solicitud { padding: 10px 12px; border-radius: 14px; background: var(--superficie); border: 1px solid var(--acento); }
.insignia { font: 500 12px var(--mono); letter-spacing: 0.08em; color: var(--acento); }
.boton-chico { height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--linea); background: transparent; color: var(--apagado); font: 14px var(--cuerpo); cursor: pointer; }
.aceptar { background: var(--acento); border-color: var(--acento); }
.girando { animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

/* Aviso flotante */
.aviso {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
  background: var(--texto); color: var(--fondo); font-weight: 500; z-index: 10;
}

@media (prefers-reduced-motion: reduce) { .girando { animation: none; } }
