:root {
  --fondo: #16131c;
  --panel: #221d2b;
  --texto: #ece6f5;
  --suave: #a79fb5;
  --acento: #e0a43a;
  --acento-oscuro: #b37f24;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--fondo);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body { overscroll-behavior: none; }

[hidden] { display: none !important; }

#inicio {
  max-width: 34rem;
  margin: 0 auto;
  padding: max(1.5rem, env(safe-area-inset-top)) 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

h1 {
  margin: 0.5rem 0 0;
  font-size: 2.2rem;
  letter-spacing: 0.02em;
  text-align: center;
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--suave);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

section {
  background: var(--panel);
  border-radius: 0.75rem;
  padding: 1rem 1.1rem;
}

button, select {
  font: inherit;
  color: inherit;
  min-height: 2.75rem;
  border-radius: 0.5rem;
  border: 1px solid #3a3346;
  background: #2c2637;
  padding: 0.5rem 1rem;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled { opacity: 0.5; cursor: default; }

button.principal {
  font-size: 1.5rem;
  font-weight: 700;
  min-height: 4rem;
  background: var(--acento);
  border-color: var(--acento-oscuro);
  color: #1b1408;
}

.fila {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
}

.fila select { margin-left: auto; }

.fila input[type="checkbox"] { width: 1.4rem; height: 1.4rem; accent-color: var(--acento); }

small { color: var(--suave); }

.botones { display: flex; flex-wrap: wrap; gap: 0.75rem; }

#mensaje { margin: 0.75rem 0 0; min-height: 1.2em; color: var(--suave); }
#mensaje.error { color: #ff8f8f; }

#juego {
  position: fixed;
  inset: 0;
  background: #000;
}

#escenario, #escenario > * {
  width: 100%;
  height: 100%;
  display: block;
}

#btn-atras {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  font-size: 1.25rem;
  border-radius: 50%;
  background: rgba(40, 34, 50, 0.45);
  border-color: rgba(255, 255, 255, 0.25);
  opacity: 0.6;
  z-index: 2;
}

/* Con banda lateral suficiente: centrado en ella, fuera del lienzo 4:3. */
#btn-atras.en-banda {
  left: calc(var(--banda) / 2);
  transform: translate(-50%, -50%);
  width: 3rem;
  height: 3rem;
  font-size: 1.5rem;
  opacity: 1;
}

#girar {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--fondo);
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  font-size: 1.25rem;
}

/* Teléfono en vertical mientras se juega: aviso para girarlo. */
@media (orientation: portrait) and (max-width: 600px) {
  body.jugando #girar { display: flex; }
}

#fps {
  position: fixed;
  right: 0.25rem;
  bottom: 0.25rem;
  z-index: 20;
  padding: 0.15rem 0.4rem;
  font: 12px/1.3 ui-monospace, monospace;
  background: rgba(0, 0, 0, 0.6);
  color: #9f9;
  pointer-events: none;
  white-space: pre;
}
