:root {
  --fondo: #eef5ec;
  --fondo-agua: #dcebdf;
  --superficie: #ffffff;
  --texto: #15291e;
  --texto-suave: #4a6152;
  --borde: #c3d6c7;
  --hoja: #24854b;
  --hoja-oscura: #1f7a43;
  --hoja-apagada: #b9c9bd;
  --sobre-hoja: #ffffff;
  --estrella: #e8a317;
  --estrella-texto: #8a5a00;
  --error: #b3261e;
  --foco: #0b5cad;
  --sombra: 0 1px 2px rgb(21 41 30 / 0.08), 0 6px 18px rgb(21 41 30 / 0.08);
  --radio: 14px;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --redonda: ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0c1a14;
    --fondo-agua: #10251c;
    --superficie: #152d22;
    --texto: #e5f1e8;
    --texto-suave: #a5bfae;
    --borde: #2a4a3a;
    --hoja: #3cb46c;
    --hoja-oscura: #5fd08b;
    --hoja-apagada: #2c4236;
    --sobre-hoja: #06140d;
    --estrella: #f5b937;
    --estrella-texto: #f5c45a;
    --error: #ff8a80;
    --foco: #8cc8ff;
    --sombra: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 1rem/1.55 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--texto);
  background:
    radial-gradient(ellipse 80% 50% at 15% 0%, var(--fondo-agua), transparent 70%),
    radial-gradient(ellipse 60% 40% at 100% 30%, var(--fondo-agua), transparent 70%),
    var(--fondo);
  background-attachment: fixed;
}

h1, h2, h3 { font-family: var(--redonda); line-height: 1.2; margin: 0 0 .5rem; }
a { color: var(--hoja-oscura); }
:focus-visible { outline: 3px solid var(--foco); outline-offset: 3px; border-radius: 6px; }

.saltar { position: absolute; left: -999px; top: 0; padding: .75rem 1rem; background: var(--superficie); z-index: 2; }
.saltar:focus { left: 1rem; }

.cabecera {
  display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between;
  max-width: 60rem; width: 100%; margin: 0 auto; padding: 1rem;
}
.marca { display: flex; align-items: baseline; gap: .5rem; }
.logo { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--texto); font: 700 1.25rem var(--redonda); min-height: 44px; }
.logo svg { width: 28px; height: 28px; fill: var(--hoja); }
.de { color: var(--texto-suave); font-size: .875rem; }

.nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; }
.nav a, .enlace {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 .75rem;
  color: var(--texto); text-decoration: none; border-radius: 999px; font: inherit; font-weight: 600;
  background: none; border: 0; cursor: pointer;
}
@media (max-width: 24rem) { .nav a, .enlace { padding: 0 .55rem; } .contador { padding: 0 .6rem; margin-right: 0; } }
.nav a:hover, .enlace:hover { background: var(--superficie); }
.nav a[aria-current="page"] { background: var(--superficie); box-shadow: var(--sombra); }
.contador {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 36px; padding: 0 .8rem; margin-right: .25rem;
  border-radius: 999px; background: var(--superficie); box-shadow: var(--sombra); font-weight: 700; font-variant-numeric: tabular-nums;
}
.contador:empty { display: none; }
.contador svg { width: 18px; height: 18px; fill: var(--estrella); }
.contador .practica { font-weight: 400; font-size: .8rem; opacity: .85; }

.principal { flex: 1; width: 100%; max-width: 60rem; margin: 0 auto; padding: 0 1rem 2rem; }
.principal:focus, [tabindex="-1"]:focus { outline: none; }

.portada { text-align: center; margin: 1rem 0 1.75rem; }
.portada h1 { font-size: clamp(2.2rem, 8vw, 3.6rem); letter-spacing: -.02em; }
.portada h1 em { font-style: normal; color: var(--hoja); }
.portada p { margin: 0 auto; max-width: 34rem; color: var(--texto-suave); font-size: 1.1rem; }

.tarjeta { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); padding: 1.25rem; }

/* Calendario */
.charca {
  list-style: none; margin: 0; padding: 1rem;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem;
  border-radius: 28px;
  background: radial-gradient(circle at 30% 20%, rgb(255 255 255 / .35), transparent 60%), var(--fondo-agua);
  border: 1px solid var(--borde);
}
@media (min-width: 40rem) { .charca { grid-template-columns: repeat(6, 1fr); gap: 1rem; padding: 1.5rem; } }

.nenufar {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; min-height: 44px;
  text-decoration: none; color: var(--sobre-hoja); font: 800 clamp(1.1rem, 4vw, 1.5rem) var(--redonda);
  font-variant-numeric: tabular-nums;
}
.nenufar::before {
  content: ''; position: absolute; inset: 4%; border-radius: 50%; background: var(--hoja);
  -webkit-mask: conic-gradient(from var(--giro, 120deg) at 66% 66%, transparent 0 34deg, #000 0);
  mask: conic-gradient(from var(--giro, 120deg) at 66% 66%, transparent 0 34deg, #000 0);
  box-shadow: inset 0 -6px 0 rgb(0 0 0 / .12);
  transition: transform .2s ease;
}
.nenufar > * { position: relative; }
.charca li:nth-child(3n+1) { --giro: 100deg; }
.charca li:nth-child(3n+2) { --giro: 140deg; }
a.nenufar:hover::before { transform: scale(1.06) rotate(10deg); }
a.nenufar:focus-visible { border-radius: 50%; }
.nenufar.hoy::before { background: var(--hoja-oscura); }
.nenufar.hoy { animation: flotar 3.2s ease-in-out infinite; }
.nenufar .marca-estado { position: absolute; right: 4%; top: 2%; width: 38%; height: 38%; }
.nenufar.resuelto .marca-estado { fill: var(--estrella); filter: drop-shadow(0 1px 1px rgb(0 0 0 / .3)); }
.nenufar.bloqueado, .nenufar.cerrado, .nenufar.vacio { color: var(--texto); }
.nenufar.bloqueado::before, .nenufar.vacio::before { background: var(--hoja-apagada); box-shadow: none; }
.nenufar.bloqueado .marca-estado { fill: var(--texto-suave); width: 30%; height: 30%; right: 8%; top: 6%; }
.nenufar.cerrado::before { background: transparent; border: 2px dashed var(--hoja-apagada); }

.leyenda { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem 1.25rem; margin: 1rem 0 0; padding: 0; list-style: none; color: var(--texto-suave); font-size: .9rem; }
.leyenda li::before { content: ''; display: inline-block; width: .8em; height: .8em; border-radius: 50%; margin-right: .4em; vertical-align: -.05em; background: var(--hoja); }
.leyenda .l-resuelto::before { background: var(--estrella); }
.leyenda .l-bloqueado::before { background: var(--hoja-apagada); }

/* Acceso */
.acceso { max-width: 30rem; margin: 0 auto 2rem; }
.acceso h2 { font-size: 1.4rem; }
.campo { display: grid; gap: .3rem; margin-bottom: 1rem; }
.campo label { font-weight: 600; }
.campo .opcional { font-weight: 400; color: var(--texto-suave); }
input[type="email"], input[type="text"], textarea {
  font: inherit; min-height: 48px; width: 100%; padding: .6rem .8rem;
  color: var(--texto); background: var(--fondo); border: 2px solid var(--borde); border-radius: 10px;
}
input:focus-visible { border-color: var(--foco); outline-offset: 1px; }
.casilla { display: flex; gap: .6rem; align-items: flex-start; margin-bottom: 1rem; min-height: 44px; cursor: pointer; }
.casilla input { width: 22px; height: 22px; margin: .15rem 0 0; flex: none; accent-color: var(--hoja); }
.privacidad { font-size: .875rem; color: var(--texto-suave); margin: 0 0 1rem; }
.privacidad p { margin: 0 0 .4rem; }
.privacidad ul { margin: 0 0 .4rem; padding-left: 1.2rem; }

.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 48px; padding: 0 1.3rem; border-radius: 999px; border: 2px solid transparent;
  font: 700 1rem var(--redonda); cursor: pointer; text-decoration: none;
  background: var(--hoja-oscura); color: var(--superficie);
}
@media (prefers-color-scheme: dark) { .boton { color: var(--sobre-hoja); } }
.boton:hover { filter: brightness(1.08); }
.boton[disabled] { opacity: .6; cursor: progress; }
.boton.secundario { background: transparent; color: var(--texto); border-color: var(--borde); min-height: 44px; padding: 0 1rem; }
.boton.secundario:hover { background: var(--fondo-agua); }
.boton.ancho { width: 100%; }

.mensaje { margin: 1rem 0 0; padding: .9rem 1rem; border-radius: 10px; background: var(--fondo-agua); }
.mensaje:empty { display: none; }
.mensaje.error { color: var(--error); background: transparent; border: 2px solid currentColor; }
.dev { display: inline-block; margin-top: .5rem; font-size: .9rem; }

/* Reto */
.volver { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; text-decoration: none; }
.eyebrow { margin: 0; color: var(--hoja-oscura); font: 700 .85rem var(--redonda); letter-spacing: .08em; text-transform: uppercase; }
.reto h2 { font-size: clamp(1.6rem, 5vw, 2.2rem); margin-bottom: 1rem; }
.reto-rejilla { display: grid; gap: 1rem; }
@media (min-width: 52rem) { .reto-rejilla { grid-template-columns: 1.1fr 1fr; align-items: start; } }
.enunciado p, .enunciado ul, .enunciado ol { margin: 0 0 .8rem; }
.enunciado :last-child { margin-bottom: 0; }
code { font-family: var(--mono); font-size: .9em; background: var(--fondo-agua); padding: .1em .35em; border-radius: 5px; overflow-wrap: anywhere; }
pre { margin: 0 0 .8rem; padding: .8rem; border-radius: 10px; background: var(--fondo-agua); overflow: auto; }
pre code { background: none; padding: 0; }
.input-cabecera { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.input-cabecera h3 { margin: 0; font-size: 1.1rem; }
.acciones { display: flex; gap: .5rem; }
.input-usuario { max-height: 18rem; font: .9rem/1.45 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.respuesta { margin-top: 1rem; }
.respuesta .campo { margin-bottom: .75rem; }
textarea { min-height: 10rem; resize: vertical; font-family: var(--mono); font-size: .9rem; }
.ayuda { margin: 0; font-size: .875rem; color: var(--texto-suave); }
.ya-resuelto { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--estrella-texto); }
.ya-resuelto svg { width: 28px; height: 28px; fill: var(--estrella); }

.exito { text-align: center; }
.exito .gran-estrella { width: 84px; height: 84px; fill: var(--estrella); filter: drop-shadow(0 4px 10px rgb(232 163 23 / .45)); animation: salto .9s cubic-bezier(.3, 1.6, .5, 1) both; }
.exito h3 { font-size: 1.6rem; margin-top: .25rem; }
.curso { margin-top: 1rem; text-align: left; border-left: 6px solid var(--hoja); }
.curso p { margin: 0 0 .75rem; }

/* Premios */
.premios h2 { font-size: clamp(1.6rem, 5vw, 2.2rem); }
.progreso { height: 14px; border-radius: 999px; background: var(--fondo-agua); border: 1px solid var(--borde); overflow: hidden; margin: .5rem 0 1.5rem; }
.progreso span { display: block; height: 100%; background: linear-gradient(90deg, var(--hoja), var(--estrella)); border-radius: inherit; }
.tramos { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
@media (min-width: 40rem) { .tramos { grid-template-columns: repeat(2, 1fr); } }
.tramo { display: grid; gap: .5rem; align-content: start; }
.tramo.bloqueado { background: transparent; box-shadow: none; border-style: dashed; }
.tramo .umbral { display: inline-flex; align-items: center; gap: .3rem; font: 800 1.1rem var(--redonda); color: var(--estrella-texto); }
.tramo .umbral svg { width: 20px; height: 20px; fill: var(--estrella); }
.tramo h3 { font-size: 1.2rem; margin: 0; }
.tramo .estado { margin: 0; color: var(--texto-suave); }
.cupon { font: 700 1.3rem var(--mono); letter-spacing: .08em; padding: .4rem .7rem; border: 2px dashed var(--estrella); border-radius: 8px; display: inline-block; overflow-wrap: anywhere; user-select: all; }
.fila-cupon { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0; }
.bloque-cupon p { margin: .4rem 0; }
.copiado { font-size: .875rem; color: var(--texto-suave); }

/* Rankings y perfil */
.pestanas { display: flex; gap: .4rem; flex-wrap: wrap; margin: 0 0 1rem; }
.pestana { display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem; border-radius: 999px; border: 2px solid var(--borde); color: var(--texto); font-weight: 700; text-decoration: none; }
.pestana[aria-current="page"] { background: var(--hoja-oscura); border-color: var(--hoja-oscura); color: var(--superficie); }
.tabla-envoltorio { overflow-x: auto; padding: .5rem; }
.ranking { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ranking caption { text-align: left; font-weight: 700; padding: .5rem; }
.ranking th, .ranking td { padding: .5rem; text-align: left; border-bottom: 1px solid var(--borde); }
.ranking thead th { color: var(--texto-suave); font-size: .875rem; }
.ranking .num { text-align: right; white-space: nowrap; }
.ranking tr.yo { background: var(--fondo-agua); font-weight: 700; }
.tu { margin-left: .5rem; padding: .05rem .5rem; border-radius: 999px; background: var(--estrella); color: #15291e; font-size: .75rem; }
.perfil { max-width: 36rem; }
.perfil .acciones { flex-wrap: wrap; }

.pie { max-width: 60rem; width: 100%; margin: 0 auto; padding: 1.5rem 1rem 2rem; color: var(--texto-suave); font-size: .875rem; text-align: center; }
.pie p { margin: .25rem 0; }
.aviso { text-align: center; padding: 1rem; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@keyframes flotar { 50% { transform: translateY(-4px); } }
@keyframes salto { from { transform: scale(.2) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
