:root {
  --naranja: #1075f5;
  --verde: #22c55e;
  --rojo: #ff5050;
  --celeste: #78dcff;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  margin: 0;
}

/* El navegador oculta [hidden] con `display: none`, pero cualquier regla
   propia que defina `display` tiene mas prioridad y lo anula. */
[hidden] {
  display: none !important;
}

body {
  background: #0b0d10;
  color: #f5f5f5;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

#escena {
  position: relative;
  width: 100vw;
  height: 100dvh;
  display: grid;
  place-items: center;
}

video {
  display: none;
}

canvas {
  max-width: 100%;
  max-height: 100dvh;
  object-fit: contain;
}

/* ---------- Panel ---------- */

#panel {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0.75rem;
  pointer-events: none;
}

.marcador {
  display: flex;
  gap: 1.5rem;
  background: var(--naranja);
  padding: 0.5rem 1rem 0.7rem;
  border-radius: 0 0 0.6rem 0;
}

.campo {
  display: flex;
  flex-direction: column;
}

.etiqueta {
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: #08243f;
  font-weight: 700;
}

.campo strong {
  font-size: 2rem;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

#panel p {
  margin-top: 0.5rem;
  text-shadow: 0 1px 3px #000, 0 0 6px #000;
  font-size: 0.95rem;
}

#ejercicio-activo {
  font-weight: 600;
}

#vista {
  color: var(--celeste);
  font-size: 0.85rem;
}

#aviso {
  color: var(--rojo);
  font-weight: 600;
  max-width: 22rem;
}

/* ---------- Controles ---------- */

#controles {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.6rem;
}

button {
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: #1c2128;
  border: 1px solid #3a424d;
  border-radius: 0.5rem;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
}

button:hover {
  background: #262d36;
}

/* ---------- Portada y menú ---------- */

#portada,
#menu {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 8, 11, 0.82);
  backdrop-filter: blur(3px);
  padding: 1.5rem;
  text-align: center;
}

#portada h1 {
  font-size: clamp(1.5rem, 5vw, 2.2rem);
}

#portada p {
  max-width: 32rem;
  margin: 1rem auto;
  color: #c3c9d2;
  line-height: 1.5;
}

#btn-empezar {
  background: var(--naranja);
  border-color: transparent;
  padding: 0.8rem 1.6rem;
  font-size: 1.05rem;
}

#estado-carga {
  min-height: 1.4rem;
  font-size: 0.9rem;
}

.tarjeta {
  background: #10141a;
  border: 2px solid var(--naranja);
  border-radius: 0.8rem;
  padding: 1.5rem;
  min-width: min(26rem, 90vw);
  text-align: left;
}

.tarjeta h2 {
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

#lista-ejercicios {
  list-style: none;
  padding: 0;
  margin-bottom: 1rem;
}

#lista-ejercicios button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.6rem 0.5rem;
  border-radius: 0.4rem;
  display: flex;
  gap: 0.9rem;
  align-items: baseline;
}

#lista-ejercicios button:hover {
  background: #1c2128;
}

#lista-ejercicios .numero {
  color: #8b95a3;
  font-variant-numeric: tabular-nums;
}

#lista-ejercicios .como {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: #96a7b8;
  margin-top: 0.15rem;
}

#lista-ejercicios .activo {
  color: var(--verde);
}

.ajuste {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0.5rem;
  font-size: 0.9rem;
}

.ajuste select {
  font: inherit;
  color: #fff;
  background: #1c2128;
  border: 1px solid #3a424d;
  border-radius: 0.4rem;
  padding: 0.35rem 0.5rem;
}

.ajuste input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--naranja);
}

.nota {
  font-size: 0.75rem;
  color: #96a7b8;
  line-height: 1.45;
  margin: 0.4rem 0.5rem 1rem;
}

.tarjeta h2 + .ajuste {
  margin-top: -0.4rem;
}

#lista-ejercicios .activo .numero {
  color: var(--verde);
}

@media (max-width: 700px) {
  .campo strong {
    font-size: 1.6rem;
  }
  #panel p {
    font-size: 0.85rem;
  }
}
