:root {
  color-scheme: light;
  --orange: #F08013;
  --orange-ink: #A85500;
  --gray: #4D4E4F;
  --ink: #232426;
  --muted: #66686B;
  --bg: #F6F5F3;
  --surface: #FFFFFF;
  --surface-2: #F2F1EE;
  --line: #E2E0DC;
  --flask-empty: #E6E3DE;
  --ok: #1E7A4F;
  --ok-bg: #E2F3EA;
  --bad: #B3332B;
  --bad-bg: #FBE6E4;
  --on-orange: #1B1B1C;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --orange-ink: #FFA24A;
    --ink: #ECEDEF;
    --muted: #A5A7AB;
    --bg: #17181A;
    --surface: #222326;
    --surface-2: #2B2C30;
    --line: #37383C;
    --flask-empty: #3A3B40;
    --ok: #5CC995;
    --ok-bg: #1C3A2C;
    --bad: #FF7B71;
    --bad-bg: #42211F;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.5 Figtree, "Segoe UI", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3 { font-family: Outfit, "Segoe UI", Arial, sans-serif; margin: 0; line-height: 1.1; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
[hidden] { display: none !important; }

.bar, .wrap, .foot { width: 100%; max-width: 1080px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 22px; padding-bottom: 22px; }
.bar img { height: 40px; width: auto; display: block; }
.bar-tag { color: var(--muted); font-size: 14px; font-weight: 600; }
.wrap { flex: 1; padding-top: 12px; padding-bottom: 40px; }
.foot { color: var(--muted); font-size: 13.5px; padding-bottom: 28px; text-align: center; }
.muted { color: var(--muted); }

/* El matraz del logo de CLQ como indicador que se llena */
.flask { position: relative; aspect-ratio: 434 / 428; background: var(--flask-empty); overflow: hidden;
  -webkit-mask: url("flask-mask.png") center / contain no-repeat; mask: url("flask-mask.png") center / contain no-repeat; }
.flask-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0%;
  background: linear-gradient(180deg, #FF9E45 0, var(--orange) 18px);
  transition: height .7s cubic-bezier(.2, .8, .2, 1), background-color .3s; }
.flask-fill.ok { background: linear-gradient(180deg, #47B884 0, var(--ok) 18px); }
.flask-lg { width: 120px; margin-bottom: 28px; }

/* Registro */
.intro { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; padding-top: 24px; }
.intro h1 { font-size: clamp(38px, 5.4vw, 62px); font-weight: 700; letter-spacing: -.02em; }
.intro h1 em { font-style: normal; color: var(--orange-ink); }
.lead { font-size: 20px; color: var(--muted); margin: 18px 0 26px; max-width: 34ch; }
.facts { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px 28px; color: var(--muted); }
.facts b { font-family: Outfit, Arial, sans-serif; font-size: 22px; color: var(--ink); margin-right: 4px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 32px; }
.reg h2 { font-size: 26px; font-weight: 700; }
.reg > .muted { margin: 6px 0 22px; font-size: 15.5px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.field input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink); }
.field input:focus { outline: none; border-color: var(--orange); background: var(--surface); }
.field input[aria-invalid="true"] { border-color: var(--bad); }
.err { color: var(--bad); font-size: 14px; margin: 5px 0 0; min-height: 0; }
.err:empty { display: none; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--muted); margin: 18px 0 4px; line-height: 1.45; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--orange); flex: none; }

.btn { border: 0; border-radius: 999px; padding: 14px 28px; font-weight: 600; font-size: 17px; background: var(--orange); color: var(--on-orange); margin-top: 18px; }
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .55; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost:hover { border-color: var(--orange); filter: none; }

/* Prueba */
.quiz { display: grid; grid-template-columns: 200px 1fr; gap: 44px; align-items: start; padding-top: 12px; }
.side { position: sticky; top: 24px; }
.side .flask { width: 150px; }
.side .count { font-family: Outfit, Arial, sans-serif; font-weight: 700; font-size: 22px; margin: 20px 0 2px; }
.side .who { color: var(--muted); font-size: 15px; margin: 0 0 16px; overflow-wrap: anywhere; }
.dots { display: grid; grid-template-columns: repeat(6, 18px); gap: 7px; }
.dots i { width: 18px; height: 18px; border-radius: 5px; background: var(--flask-empty); }
.dots i.ok { background: var(--ok); }
.dots i.bad { background: var(--bad); }
.dots i.now { background: var(--orange); }

.topic { color: var(--orange-ink); font-weight: 600; margin: 0 0 10px; }
.q h2 { font-size: clamp(22px, 3vw, 29px); font-weight: 500; margin-bottom: 24px; line-height: 1.2; }
.opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.opt { width: 100%; text-align: left; display: flex; gap: 14px; align-items: flex-start; background: var(--surface-2); color: var(--ink);
  border: 1.5px solid transparent; border-radius: 14px; padding: 14px 16px; transition: border-color .15s, background-color .15s; }
.opt:hover:not(:disabled) { border-color: var(--orange); }
.opt:disabled { cursor: default; }
.opt .k { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 600; font-size: 14px;
  background: var(--surface); border: 1.5px solid var(--line); }
.opt.correct { background: var(--ok-bg); border-color: var(--ok); }
.opt.correct .k { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.wrong { background: var(--bad-bg); border-color: var(--bad); }
.opt.wrong .k { background: var(--bad); border-color: var(--bad); color: #fff; }
.opt.dim { opacity: .55; }
.hint { color: var(--muted); font-size: 14px; margin: 14px 0 0; }
.fb { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.fb h3 { font-size: 20px; margin-bottom: 6px; }
.fb.ok h3 { color: var(--ok); }
.fb.bad h3 { color: var(--bad); }
.fb p { margin: 0; }
.actions { display: flex; justify-content: flex-end; }

/* Resultado */
.result { display: grid; grid-template-columns: auto 1fr; gap: 36px; align-items: center; }
.result .flask { width: 190px; }
.score { font-family: Outfit, Arial, sans-serif; font-weight: 700; font-size: 64px; line-height: 1; }
.score small { font-size: 20px; color: var(--muted); font-weight: 500; margin-left: 8px; }
.result h2 { font-size: clamp(24px, 3.4vw, 32px); margin: 10px 0 8px; }
.result p { margin: 0; }
.status { display: inline-flex; align-items: center; gap: 10px; margin-top: 18px; padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 15px; background: var(--surface-2); }
.status::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.status.sending::before { background: var(--orange); animation: pulse 1s infinite alternate; }
.status.sent { background: var(--ok-bg); color: var(--ok); }
.status.sent::before { background: var(--ok); }
.status.failed { background: var(--bad-bg); color: var(--bad); }
.status.failed::before { background: var(--bad); }
@keyframes pulse { to { opacity: .3; } }
.retry { margin-top: 10px; }
.review { margin-top: 30px; }
.review h3 { font-size: 19px; margin-bottom: 12px; }
.review ol { margin: 0; padding-left: 22px; display: grid; gap: 12px; }
.review li span { display: block; color: var(--muted); font-size: 15px; }
.help { margin-top: 26px; background: var(--surface-2); border-radius: 14px; padding: 16px 18px; font-size: 15.5px; }
.help b { color: var(--orange-ink); }
.row { display: flex; flex-wrap: wrap; gap: 12px; }
#ts { margin-top: 12px; }

@media (max-width: 820px) {
  .intro { grid-template-columns: 1fr; gap: 28px; padding-top: 4px; }
  .flask-lg { width: 84px; margin-bottom: 18px; }
  .lead { font-size: 18px; }
  .quiz { grid-template-columns: 1fr; gap: 18px; }
  .side { position: static; display: grid; grid-template-columns: 56px 1fr; gap: 6px 16px; align-items: center; }
  .side .flask { width: 56px; grid-row: span 2; }
  .side .count { margin: 0; font-size: 19px; }
  .side .who { margin: 0; }
  .dots { grid-column: 1 / -1; grid-template-columns: repeat(12, 1fr); gap: 5px; margin-top: 6px; }
  .dots i { width: auto; height: 8px; border-radius: 4px; }
  .card { padding: 22px 20px; border-radius: 18px; }
  .result { grid-template-columns: 1fr; gap: 18px; justify-items: start; }
  .result .flask { width: 110px; }
  .score { font-size: 52px; }
  .bar-tag { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Administración */
.admin-login { max-width: 460px; margin: 40px auto 0; }
.admin-login h2 { font-size: 26px; }
.admin-login > .muted { margin: 6px 0 20px; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-head .btn { margin-top: 0; }
.admin-title { font-size: 34px; }
.admin-head .muted { margin: 6px 0 0; }
.table-wrap { padding: 0; overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: 15px; }
.tabla th, .tabla td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tabla th { font-weight: 600; color: var(--muted); background: var(--surface-2); }
.tabla tr:last-child td { border-bottom: 0; }
.t-ok { color: var(--ok); font-weight: 600; }
.t-bad { color: var(--bad); font-weight: 600; }
