/* =====================================================================
   Tema GuardiaOpo: sobrio y moderno. Verde institucional profundo, acento dorado apagado,
   tipografía Inter (sin la rotulación de BomberOpo), esquinas más rectas y animaciones contenidas.
   --rojo sigue siendo el color principal del motor (ahora verde); --error es el rojo de fallos.
   Va después de estilo.css (el del motor) y lo sobrescribe.
   ===================================================================== */
:root {
  --fondo: #f4f5f2; --fondo-2: #e9ece6; --panel: #ffffff; --borde: #d8ddd5;
  --texto: #121a16; --suave: #56625b;
  --rojo: #1f4d36; --rojo-oscuro: #143625; --oro: #b3913f; --ambar: #b7811a;
  --verde: #17784a; --verde-suave: #e2f1e8; --error: #b42318; --rojo-suave: #fbeae8; --agua: #2f6f8f;
  --sombra: 0 1px 2px rgba(10, 30, 20, .05), 0 4px 16px rgba(10, 30, 20, .05);
  --radio: 12px;
  --titulo: Inter, system-ui, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fondo: #0d1210; --fondo-2: #141b17; --panel: #171f1b; --borde: #28332d;
    --texto: #e8eee9; --suave: #9ba89f; --rojo: #4f9a72; --rojo-oscuro: #2f6b4b; --oro: #cfae5c;
    --verde: #5cc48c; --verde-suave: #143122; --error: #f0705f; --rojo-suave: #3a1714;
  }
}
:root[data-theme="dark"] {
  --fondo: #0d1210; --fondo-2: #141b17; --panel: #171f1b; --borde: #28332d;
  --texto: #e8eee9; --suave: #9ba89f; --rojo: #4f9a72; --rojo-oscuro: #2f6b4b; --oro: #cfae5c;
  --verde: #5cc48c; --verde-suave: #143122; --error: #f0705f; --rojo-suave: #3a1714;
}
h1, h2, h3 { font-weight: 800; letter-spacing: -.022em; line-height: 1.12; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.25rem, 2.4vw, 1.6rem); }
h3 { font-size: 1.08rem; letter-spacing: -.01em; }

/* Cabecera */
.cabecera { border-bottom: 1px solid var(--borde); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--oro) 55%, transparent); }
.marca-escudo { width: 26px; height: 30px; flex: none; }
.marca-texto { font-family: var(--titulo); font-weight: 800; font-size: 1.35rem; letter-spacing: -.03em; color: var(--texto); }
.marca-texto b { color: var(--rojo); font-weight: 800; }
.marca-sub { letter-spacing: .1em; font-size: .66rem; }
.menu a { border-radius: 8px; font-weight: 600; }
.menu a.activo { background: var(--rojo); color: #fff; }
.boton-premium { background: var(--oro); color: #fff; box-shadow: none; border-radius: 8px; font-weight: 700; letter-spacing: .01em; }
.icono { border-radius: 10px; }
.buscador { border-radius: 10px; }

/* Piezas comunes */
.boton { border-radius: 10px; font-weight: 700; letter-spacing: -.005em; }
.boton.rojo { background: var(--rojo); box-shadow: none; }
.boton.rojo:hover { background: var(--rojo-oscuro); filter: none; }
.boton.claro:hover { border-color: color-mix(in srgb, var(--rojo) 45%, var(--borde)); }
.chip { border-radius: 6px; letter-spacing: .01em; }
.chip.rojo { background: var(--rojo-suave); color: var(--error); }
.filtros button, a.filtro, .selector { border-radius: 8px; }
.filtros button.activo { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.cargando { display: block; width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%; border: 3px solid var(--borde); border-top-color: var(--rojo); animation: girar .8s linear infinite; }

/* Inicio */
.hero { border-radius: 16px; padding: 30px 28px; border-top: 3px solid var(--oro); background:
  repeating-linear-gradient(135deg, rgba(255,255,255,.028) 0 1px, transparent 1px 22px),
  radial-gradient(circle at 88% 12%, rgba(207,174,92,.16) 0, transparent 42%),
  linear-gradient(140deg, #1a4430 0%, #0f2a1e 72%); }
.hero h1 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); max-width: 22ch; }
.hero p { color: #d3e3d9; }
.hero .boton.rojo { background: #fff; color: #10281d; box-shadow: none; }
.hero .boton.rojo:hover { background: #f1efe6; }
.hero .boton.claro { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.28); color: #fff; }
.chip-hero { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.18); }
.chip-gratis { background: color-mix(in srgb, var(--oro) 85%, #000); color: #fff; border-color: transparent; }
.aviso-prep { background: rgba(0,0,0,.22); }
.insignia { width: 100%; max-width: 250px; justify-self: center; }
.insignia-arco { transition: stroke-dasharray .8s ease; }
.rango { background: rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; }
.rango-nombre { font-family: var(--titulo); font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; }
.rango small { color: #bfd3c6; }
.barra-xp > i { background: linear-gradient(90deg, #b3913f, #e2c67c); }
.cuenta span { background: rgba(0,0,0,.2); color: #d3e3d9; border-radius: 8px; }
.cuenta b { font-family: var(--titulo); font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
.cifra { border-top: 3px solid var(--rojo); }
.cifra b { font-family: var(--titulo); font-weight: 800; font-size: 1.8rem; letter-spacing: -.03em; color: var(--texto); }
.accesos { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); margin: 18px 0 6px; }
.acceso-tarjeta { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--texto); background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px; box-shadow: var(--sombra); transition: transform .12s ease, border-color .12s ease; }
.acceso-tarjeta:hover { transform: translateY(-2px); border-color: var(--rojo); }
.acceso-tarjeta b { display: block; font-size: 1rem; letter-spacing: -.01em; }
.acceso-tarjeta small { color: var(--suave); font-size: .84rem; line-height: 1.35; display: block; margin-top: 2px; }
.acceso-icono { flex: none; width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-size: 1.3rem; background: color-mix(in srgb, var(--rojo) 10%, var(--panel)); }
.lista-entrena { display: grid; gap: 8px; }
.lista-entrena .boton { justify-content: flex-start; }

/* Mapa del temario */
.foco { border-radius: 8px; font-size: 1rem; font-weight: 800; color: var(--rojo); }
.foco .num { font-size: .7rem; color: var(--suave); }
.foco.controlado { background: color-mix(in srgb, var(--oro) 14%, var(--panel)); color: color-mix(in srgb, var(--oro) 70%, var(--texto)); }
.foco.apagado { background: var(--rojo); color: #fff; border-color: var(--rojo); }
.foco.apagado .num { color: rgba(255,255,255,.7); }
.leyenda .punto { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; border: 1px solid var(--borde); }
.leyenda .p-pend { background: var(--panel); }
.leyenda .p-curso { background: color-mix(in srgb, var(--oro) 30%, var(--panel)); }
.leyenda .p-dom { background: var(--rojo); border-color: var(--rojo); }

/* Temario y tema */
.tarjeta-tema .emoji { font-size: 1.4rem; width: 40px; height: 40px; display: grid; place-items: center; background: var(--fondo-2); border-radius: 10px; flex: none; }
.tema-cab .emoji-grande { font-size: 2.2rem; width: 64px; height: 64px; display: grid; place-items: center; background: var(--fondo-2); border-radius: 14px; filter: none; }
.claves li { border-left: 3px solid var(--rojo); border-radius: 8px; }
.nota-caja.truco { background: color-mix(in srgb, var(--oro) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--oro) 45%, var(--borde)); }
.nota-caja.curiosidad { background: color-mix(in srgb, var(--agua) 8%, var(--panel)); border: 1px solid color-mix(in srgb, var(--agua) 35%, var(--borde)); }
.indice a { border-radius: 8px; }
.video-marco .play { background: rgba(0,0,0,.72); border-radius: 12px; }

/* Test */
.opcion { border-width: 1.5px; border-radius: 10px; }
.opcion .letra { border-radius: 6px; }
.opcion.mal { border-color: var(--error); background: var(--rojo-suave); }
.opcion.mal .letra { background: var(--error); }
.progreso > i { background: var(--rojo); }
.combo { color: var(--oro); font-size: .9rem; }
.combo.caliente { animation: none; }
.reloj { font-family: var(--titulo); font-weight: 800; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.reloj.poco { background: var(--error); animation: none; }
.vidas { display: inline-flex; gap: 5px; }
.vida { width: 12px; height: 12px; border-radius: 50%; background: var(--rojo); display: inline-block; }
.vida.gastada { background: var(--borde); }
.resultado .nota { font-family: var(--titulo); font-weight: 800; letter-spacing: -.04em; font-size: clamp(3.4rem, 10vw, 5.5rem); color: var(--error); }
.resultado .nota.apto { color: var(--verde); }
.repaso .item.mal { border-left-color: var(--error); }
.veredicto.no-apto, .plazo.urgente { color: var(--error); }
.medidor > i { background: linear-gradient(90deg, var(--error), var(--oro) 50%, var(--verde)); }
.sexo button.activo { background: var(--rojo); }
.total-fisicas b { font-family: var(--titulo); font-weight: 800; font-size: 2rem; }

/* Psicotécnicos */
.hero-psico { grid-template-columns: 1fr; margin-top: 8px; }
.hero-psico h2 { color: #fff; }
.contrarreloj .progreso.tiempo > i { background: linear-gradient(90deg, var(--error), var(--oro) 30%, var(--rojo) 60%); transition: width .1s linear; }
.marcador-cr b { font-family: var(--titulo); font-weight: 800; font-size: 1.4rem; color: var(--rojo); margin-right: 3px; }
.enunciado-psico { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.rejilla-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .rejilla-2 { grid-template-columns: 1fr; } }

/* Premium y candados */
.hero-premium { background: radial-gradient(circle at 85% 20%, rgba(207,174,92,.22) 0, transparent 45%), linear-gradient(140deg, #1a4430, #0f2a1e 75%); }
.hero-premium p { color: #d3e3d9; }
.plan { border-radius: 12px; }
.plan .precio { font-family: var(--titulo); font-weight: 800; letter-spacing: -.03em; font-size: 2.2rem; color: #1f4d36; }
.plan.destacado { outline: 2px solid var(--oro); }
.plan .chip { background: #f5eedb; color: #6b5317; }
.hero .plan .boton.rojo { background: #1f4d36; color: #fff; box-shadow: none; }
.candado-icono { animation: none; font-size: 2.6rem; }
.estado-premium { background: color-mix(in srgb, var(--oro) 14%, var(--panel)); color: var(--texto); }
.lluvia span { color: var(--oro); font-size: 1.2rem; }
.salpicadura { color: var(--oro); font-size: 1rem; }
@keyframes girar { to { transform: rotate(360deg); } }
@media (max-width: 860px) {
  .menu { grid-template-columns: repeat(3, 1fr); }
  .insignia { max-width: 170px; order: -1; }
  .hero { padding: 22px 18px; }
}

/* Sellos de lo oficial y documentos */
.sellos { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.sellos li { position: relative; padding-left: 26px; color: #e6efe9; font-size: .93rem; }
.sellos li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 18px; height: 18px; border-radius: 5px; background: var(--oro); color: #10281d; font-weight: 800; font-size: .75rem; display: grid; place-items: center; }
.sellos a { color: #fff; }
.lista-oficial { display: grid; gap: 8px; }
.doc-oficial { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--texto); background: var(--panel); border: 1px solid var(--borde); border-radius: 10px; padding: 12px 14px; }
.doc-oficial:hover { border-color: var(--rojo); }
.doc-oficial > span:nth-child(2) { flex: 1; font-weight: 600; }
.doc-icono { flex: none; font-size: .68rem; font-weight: 800; letter-spacing: .05em; color: #fff; background: var(--rojo); border-radius: 5px; padding: 3px 6px; }

/* Simulacros con formato oficial */
.panel-oficial { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 18px; border-left: 4px solid var(--oro); }
.panel-oficial > div { flex: 1 1 320px; }
.panel-oficial h2 { margin: 6px 0 4px; }
.chip-oficial { background: color-mix(in srgb, var(--oro) 18%, var(--panel)); color: color-mix(in srgb, var(--oro) 65%, var(--texto)); border-color: transparent; }

/* Exámenes oficiales: ortografía y gramática */
.examen-anio { font-size: .85rem !important; font-weight: 800; color: var(--rojo); }
.frases { display: grid; gap: 10px; margin-top: 12px; }
.frase p { margin: 6px 0 0; line-height: 2.1; font-size: 1.05rem; }
.palabra { border: 0; border-bottom: 2px solid var(--texto); background: var(--fondo-2); border-radius: 4px 4px 0 0; padding: 1px 6px; cursor: pointer; font: inherit; font-weight: 600; }
.palabra.marcada { background: var(--rojo); color: #fff; border-bottom-color: var(--rojo-oscuro); }
.palabra.ok { outline: 2px solid var(--verde); }
.palabra.error { outline: 2px solid var(--error); }
.palabra.con-falta { text-decoration: line-through; text-decoration-color: var(--error); }
.frase-marcable { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; cursor: pointer; font: inherit; color: var(--texto); }
.frase-marcable span:nth-child(2) { flex: 1; }
.frase-marcable .casilla { flex: none; width: 26px; height: 26px; border: 2px solid var(--borde); border-radius: 6px; display: grid; place-items: center; font-weight: 800; color: #fff; }
.frase-marcable.marcada .casilla { background: var(--rojo); border-color: var(--rojo); }
.frase-marcable.ok { border-color: var(--verde); }
.frase-marcable.error { border-color: var(--error); background: var(--rojo-suave); }
.resultado-mini { font-size: 1.05rem; border-left: 4px solid var(--error); }
.resultado-mini.apto { border-left-color: var(--verde); }
.resultado-mini b { font-weight: 800; }

/* Iconos de línea */
.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.menu a { display: inline-flex; align-items: center; gap: 6px; }
.menu a .ico { width: 17px; height: 17px; opacity: .85; }
.buscador .ico { width: 17px; height: 17px; color: var(--suave); }
.acceso-icono { color: var(--rojo); }
.acceso-icono .ico { width: 22px; height: 22px; }
.lista-entrena .boton .ico { color: var(--rojo); width: 18px; height: 18px; }

/* Temario por bloques (inicio) */
.bloques { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); margin-top: 10px; }
.bloque { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px 14px 10px; box-shadow: var(--sombra); align-self: start; }
.bloque-cab { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.bloque-cab b { font-size: .92rem; letter-spacing: -.01em; }
.bloque-cab span { font-size: .8rem; font-weight: 700; color: var(--suave); font-variant-numeric: tabular-nums; }
.bloque-barra { height: 4px; border-radius: 99px; background: var(--fondo-2); overflow: hidden; margin: 8px 0 8px; }
.bloque-barra i { display: block; height: 100%; background: var(--oro); transition: width .6s ease; }
.tema-fila { position: relative; display: flex; gap: 10px; align-items: center; padding: 8px 8px; margin: 0 -6px; border-radius: 8px; text-decoration: none; color: var(--texto); overflow: hidden; }
.tema-fila:hover { background: var(--fondo-2); }
.tema-num { flex: none; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: .75rem; font-weight: 800; background: var(--fondo-2); color: var(--suave); font-variant-numeric: tabular-nums; }
.tema-fila.controlado .tema-num { background: color-mix(in srgb, var(--oro) 22%, var(--panel)); color: color-mix(in srgb, var(--oro) 70%, var(--texto)); }
.tema-fila.apagado .tema-num { background: var(--rojo); color: #fff; }
.tema-fila.sin-datos { opacity: .55; }
.tema-tit { flex: 1; min-width: 0; font-size: .88rem; font-weight: 500; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tema-pct { flex: none; font-size: .75rem; font-weight: 700; color: var(--suave); font-variant-numeric: tabular-nums; }
.tema-barra { position: absolute; left: 6px; bottom: 2px; height: 2px; border-radius: 2px; background: color-mix(in srgb, var(--rojo) 55%, transparent); max-width: calc(100% - 12px); }
@media (max-width: 860px) { .menu a { flex-direction: column; gap: 2px; } .menu a .ico { width: 20px; height: 20px; } }

.ritmo { display: flex; gap: 8px; align-items: center; background: rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 8px 12px; font-size: .9rem; max-width: 520px; }
.ritmo .ico { color: #d4b25e; }
.ritmo b { color: #fff; }

/* Móvil: el texto del hero no se sale de la tarjeta */
.hero > div { min-width: 0; }
.hero .chip { white-space: normal; line-height: 1.35; }
.hero h1 { overflow-wrap: anywhere; }
@media (max-width: 860px) {
  .insignia { max-width: 132px; }
  .hero h1 { font-size: 1.6rem; }
  .accesos { grid-template-columns: 1fr 1fr; }
  .acceso-tarjeta { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
}
@media (max-width: 380px) { .accesos { grid-template-columns: 1fr; } .acceso-tarjeta { flex-direction: row; } }

.nota-caja .emoji { color: var(--oro); }
.nota-caja .emoji .ico { width: 24px; height: 24px; }
.migas a { color: var(--suave); }

/* Cabecera del tema: sin el emoji suelto encima del título */
.tema-cab .emoji-grande { display: none; }

/* Calculadora de nota final */
.nota-calc { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 16px; }
.nota-calc h2 { font-size: 1.1rem; margin: 0 0 6px; }
.nota-calc .campos { display: grid; gap: 10px; }
.nota-calc label { display: grid; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--suave); }
.nota-calc input, .nota-calc select { font: inherit; font-size: 1rem; padding: 10px 12px; border: 1px solid var(--borde); border-radius: 10px; background: var(--panel); color: var(--texto); min-width: 0; }
.nota-calc .calc-linea { margin: 10px 0 0; min-height: 1.4em; }
.nota-calc .malo { color: var(--error); }
.total-nota { margin-top: 18px; display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.total-nota b { font-family: var(--titulo); font-weight: 800; font-size: 2rem; line-height: 1.1; }
.nota-calc .dos { grid-template-columns: 1fr 1fr; }
.nota-calc h3.sub { font-size: .95rem; margin: 12px 0 6px; }
.nota-calc h2 small, .nota-calc h3 small { font-weight: 500; font-size: .8rem; }
.nota-calc .marca-check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; color: var(--texto); }
.nota-calc .marca-check input { width: 18px; height: 18px; margin-top: 2px; flex: none; padding: 0; }

/* Frecuencia en los exámenes oficiales */
.en-examen { margin: 6px 0 0; font-size: .92rem; color: var(--suave); max-width: 70ch; }
.en-examen b { color: var(--texto); }
.tema-examen { font-size: .72rem; color: var(--suave); white-space: nowrap; margin-left: 6px; font-variant-numeric: tabular-nums; }
.ranking-temas { display: grid; gap: 4px; margin-top: 10px; }
.ranking-fila { display: grid; grid-template-columns: 2.2em minmax(0, 1fr) minmax(60px, 28%) 2.6em; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 8px; color: var(--texto); text-decoration: none; }
.ranking-fila:hover { background: var(--fondo-2); }
.ranking-num { font-weight: 800; color: var(--suave); text-align: right; }
.ranking-tit { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.ranking-barra { height: 8px; background: var(--fondo-2); border-radius: 99px; overflow: hidden; }
.ranking-barra i { display: block; height: 100%; background: var(--oro); border-radius: 99px; }
.ranking-fila b { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .ranking-fila { grid-template-columns: 1.8em minmax(0, 1fr) 2.6em; } .ranking-barra { display: none; } }

/* Vehículo del inicio: ruedas, luces, carretera y salida al empezar el servicio */
.hero-lado { display: grid; gap: 6px; justify-items: center; align-content: center; min-width: 0; }
.vehiculo { width: 100%; max-width: 330px; overflow: visible; filter: drop-shadow(0 10px 14px rgba(0,0,0,.3)); }
.vehiculo .coche { animation: suspension 1.3s ease-in-out infinite alternate; }
.vehiculo .rueda { transform-box: fill-box; transform-origin: center; animation: girar .9s linear infinite; }
.vehiculo .carril { animation: carril .7s linear infinite; }
.vehiculo .baliza-a { animation: baliza .8s infinite; }
.vehiculo .baliza-b { animation: baliza .8s infinite .4s; }
.vehiculo .haz { animation: haz 2.4s ease-in-out infinite; }
@keyframes carril { to { stroke-dashoffset: -42; } }
@keyframes suspension { from { transform: translateY(0); } to { transform: translateY(1.6px); } }
@keyframes haz { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes salir { 0% { transform: translateX(0); } 20% { transform: translateX(-10px); } 100% { transform: translateX(520px); } }
.hero.en-marcha .vehiculo .coche { animation: salir .9s cubic-bezier(.55, 0, .85, .35) forwards; }
.hero.en-marcha .vehiculo .carril { animation-duration: .18s; }
.hero.en-marcha .vehiculo .rueda { animation-duration: .2s; }
@media (max-width: 860px) { .hero-lado { order: -1; } .vehiculo { max-width: 230px; } }
@media (prefers-reduced-motion: reduce) { .vehiculo * { animation: none !important; } }

/* Oferta de lanzamiento en las tarjetas de Premium */
.plan .precio-antes { font-size: .55em; font-weight: 600; color: var(--suave); text-decoration-thickness: 2px; margin-right: 4px; }
.plan .chip-oferta { justify-self: start; background: var(--oro); color: #fff; border-color: transparent; font-weight: 700; }
.aviso-lanzamiento { border: 1px solid color-mix(in srgb, var(--oro) 60%, transparent); }
