@import url('https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@62..125,400..900&display=swap');

:root {
  --red: #C8102E;
  --red-dark: #8E0A1F;
  --red-tint: #FDECEE;
  --red-line: #F2B8C0;
  --black: #000000;
  --ink: #1A1A1A;
  --ink-2: #4A4A4F;
  --ink-3: #7A7A82;
  --line: #E6E6E9;
  --line-2: #D4D4D8;
  --surface: #F4F4F5;
  --white: #FFFFFF;
  --green: #15803D;
  --green-tint: #E8F6EE;
  --green-line: #A7DDBC;
  --grey-fill: #9CA3AF;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 8px 28px -12px rgba(0, 0, 0, .12);
  --qfs: 17px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--white); font-size: 15.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 2.5px solid var(--red); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0 0 .35em; line-height: 1.15; color: var(--black); letter-spacing: -.01em; }
h1 { font-size: 1.85rem; font-weight: 800; }
h2 { font-size: 1.22rem; font-weight: 750; }
h3 { font-size: 1.04rem; font-weight: 700; }
p { margin: 0 0 .8em; }
.muted { color: var(--ink-3); }
.small { font-size: .87rem; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.icon { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: -4px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ============ barra superior ============ */
.topbar { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.topbar-inner { max-width: 1260px; margin: 0 auto; height: 66px; padding: 0 22px; display: flex; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--black); font-weight: 800; font-size: 1.02rem; white-space: nowrap; min-width: 40px; }
.brand:hover { text-decoration: none; }
.brand img { height: 38px; max-width: 160px; object-fit: contain; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--red); display: grid; place-items: center; color: #fff; }
.nav { display: flex; gap: 2px; flex: 1; }
.nav a { color: var(--ink-2); font-weight: 600; font-size: .94rem; padding: 21px 12px; border-bottom: 3px solid transparent; }
.nav a:hover { color: var(--black); text-decoration: none; }
.nav a.active { color: var(--black); border-bottom-color: var(--red); }
.top-right { display: flex; align-items: center; gap: 10px; }
.lang-select { appearance: none; border: 1px solid var(--line-2); border-radius: 999px; padding: 7px 30px 7px 12px; font-weight: 600; font-size: .88rem; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center; cursor: pointer; color: var(--ink); }
.user-menu { position: relative; }
.user-btn { white-space: nowrap; display: flex; align-items: center; gap: 9px; border: 0; background: none; cursor: pointer; padding: 4px; border-radius: 999px; font-weight: 600; color: var(--ink); }
.user-btn:hover { background: var(--surface); }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); min-width: 220px; padding: 6px; z-index: 40; }
.dropdown a, .dropdown button { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 10px 12px; border-radius: 8px; color: var(--ink); background: none; border: 0; font-size: .94rem; cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface); text-decoration: none; }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 6px; color: var(--black); }

/* avatar */
.avatar { border-radius: 50%; background: var(--black); color: #fff; display: inline-grid; place-items: center; font-weight: 800; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ============ estructura ============ */
.page { max-width: 1260px; margin: 0 auto; padding: 30px 22px 70px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }
.back { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; font-size: .9rem; color: var(--ink-2); margin-bottom: 8px; }
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; }
.panel.raised { box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { margin: 0; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ============ botones y formularios ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: .93rem; padding: 11px 20px; border-radius: 12px; border: 1.5px solid transparent; cursor: pointer; background: var(--red); color: #fff; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; text-decoration: none; }
.btn:hover { background: var(--red-dark); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-black { background: var(--black); }
.btn-black:hover { background: #2B2B2B; }
.btn-ghost { background: var(--white); color: var(--black); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface); border-color: var(--ink-3); }
.btn-danger { background: var(--white); color: var(--red); border-color: var(--red-line); }
.btn-danger:hover { background: var(--red-tint); }
.btn-sm { padding: 7px 12px; font-size: .84rem; border-radius: 9px; }
.btn-lg { padding: 15px 26px; font-size: 1rem; border-radius: 14px; }
.btn-block { width: 100%; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; display: inline-grid; place-items: center; cursor: pointer; color: var(--black); }
.icon-btn:hover { background: var(--surface); }
label { display: block; font-weight: 650; font-size: .88rem; color: var(--ink-2); margin-bottom: 6px; }
.field { margin-bottom: 15px; }
.hint { font-size: .82rem; color: var(--ink-3); margin-top: 5px; font-weight: 400; }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=date], input[type=time], select, textarea {
  width: 100%; font-size: .95rem; color: var(--ink); background: #fff; border: 1.5px solid var(--line-2); border-radius: 11px; padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--black); box-shadow: 0 0 0 3px rgba(200, 16, 46, .15); }
textarea { resize: vertical; min-height: 80px; }
.alert { padding: 12px 14px; border-radius: 12px; font-size: .92rem; margin-bottom: 14px; border: 1px solid; }
.alert-error { background: var(--red-tint); color: var(--red-dark); border-color: var(--red-line); }
.alert-ok { background: var(--green-tint); color: #0E5A2B; border-color: var(--green-line); }
.alert-info { background: var(--surface); color: var(--ink-2); border-color: var(--line-2); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .76rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface); color: var(--ink-2); white-space: nowrap; }
.badge-red { background: var(--red-tint); color: var(--red); }
.badge-green { background: var(--green-tint); color: var(--green); }
.badge-black { background: var(--black); color: #fff; }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--surface); border-radius: 12px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: none; font-weight: 650; font-size: .9rem; padding: 8px 15px; border-radius: 9px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--black); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* tablas */
.table-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .8rem; color: var(--ink-3); font-weight: 650; padding: 9px 10px; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #FAFAFA; }

.bar { height: 8px; background: var(--surface); border-radius: 999px; overflow: hidden; display: flex; }
.bar > span { display: block; height: 100%; }
.bar .g { background: var(--green); } .bar .r { background: var(--red); } .bar .k { background: var(--black); }
.empty { text-align: center; padding: 34px 20px; color: var(--ink-3); }
.empty .icon { width: 34px; height: 34px; color: var(--line-2); margin-bottom: 6px; }

/* estadísticas */
.stat { border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; background: #fff; }
.stat-label { font-size: .84rem; color: var(--ink-3); font-weight: 600; }
.stat-value { font-size: 1.9rem; font-weight: 800; line-height: 1.15; margin-top: 3px; font-variant-numeric: tabular-nums; color: var(--black); }
.stat-value.green { color: var(--green); } .stat-value.red { color: var(--red); }
.stat-sub { font-size: .83rem; color: var(--ink-3); margin-top: 2px; }

/* ============ inicio ============ */
.hero { background: var(--red); color: #fff; position: relative; }
.hero-inner { max-width: 1260px; margin: 0 auto; padding: 38px 22px 58px; display: flex; align-items: center; gap: 28px; }
.hero .avatar { width: 96px; height: 96px; font-size: 2rem; box-shadow: 0 0 0 4px rgba(255, 255, 255, .9); background: var(--black); }
.hero-hello { font-size: 1rem; opacity: .9; margin: 0; }
.hero-name { font-size: clamp(1.6rem, 4vw, 2.6rem); font-weight: 850; letter-spacing: .01em; text-transform: uppercase; line-height: 1.05; margin: 2px 0 10px; color: #fff; }
.hero-badge { display: inline-block; background: rgba(0, 0, 0, .28); color: #fff; font-weight: 700; font-size: .78rem; padding: 4px 11px; border-radius: 999px; }
.brand-box { margin-left: auto; width: 250px; height: 116px; background: #fff; border-radius: 16px; display: grid; place-items: center; padding: 14px; flex: none; color: var(--black); font-weight: 850; font-size: 1.3rem; text-align: center; }
.brand-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
/* marca de "punto de espera" de pista: dos líneas continuas y dos discontinuas */
.holdshort { position: absolute; left: 0; right: 0; bottom: 14px; height: 20px; pointer-events: none;
  background:
    linear-gradient(#fff, #fff) 0 0 / 100% 3px no-repeat,
    linear-gradient(#fff, #fff) 0 6px / 100% 3px no-repeat,
    repeating-linear-gradient(90deg, #fff 0 28px, transparent 28px 46px) 0 12px / 100% 3px no-repeat,
    repeating-linear-gradient(90deg, #fff 0 28px, transparent 28px 46px) 0 17px / 100% 3px no-repeat;
  opacity: .55; }
.home-body { position: relative; }

/* gráfico de barras de tests */
.bars { display: flex; align-items: flex-end; gap: 12px; height: 230px; padding-top: 22px; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; text-decoration: none; color: inherit; }
.bars .col:hover { text-decoration: none; }
.bars .val { max-width: 100%; overflow: hidden; font-weight: 750; font-size: .82rem; margin-bottom: 6px; font-variant-numeric: tabular-nums; color: var(--black); }
.bars .track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bars .fill { width: 100%; border-radius: 10px 10px 4px 4px; min-height: 6px; transition: filter .15s; }
.bars .col:hover .fill { filter: brightness(1.1); }
.bars .fill.ok { background: var(--green); } .bars .fill.ko { background: var(--red); }
.bars .lab { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: .74rem; color: var(--ink-3); text-align: center; margin-top: 8px; line-height: 1.3; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .84rem; color: var(--ink-2); font-weight: 600; justify-content: center; margin-top: 14px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.legend .lg { background: var(--green); } .legend .lr { background: var(--red); } .legend .lk { background: var(--grey-fill); } .legend .lw { border: 1.5px solid var(--line-2); background: #fff; }

/* tipos de test */
.choice { display: flex; align-items: center; gap: 16px; padding: 16px; border: 1.5px solid var(--line); border-radius: var(--r-md); color: var(--ink); background: #fff; cursor: pointer; width: 100%; text-align: left; font-size: 1rem; transition: border-color .15s; }
.choice + .choice { margin-top: 10px; }
.choice:hover { border-color: var(--black); text-decoration: none; }
.choice .ic { width: 50px; height: 50px; border-radius: 13px; display: grid; place-items: center; background: var(--red-tint); color: var(--red); flex: none; }
.choice .ic .icon { width: 25px; height: 25px; }
.choice.dark .ic { background: var(--black); color: #fff; }
.choice b { display: block; color: var(--black); font-size: 1.02rem; }
.choice span.d { color: var(--ink-3); font-size: .86rem; }
.choice .go { margin-left: auto; color: var(--ink-3); }

/* tarjetas de módulos */
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; margin: 22px 0; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 24px 14px 20px; text-align: center; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.tile:hover { transform: translateY(-2px); border-color: var(--red-line); text-decoration: none; }
.tile .ic { width: 70px; height: 70px; border-radius: 20px; background: var(--red-tint); color: var(--red); display: grid; place-items: center; margin: 0 auto 14px; }
.tile .ic .icon { width: 32px; height: 32px; }
.tile b { display: block; font-size: 1.12rem; font-weight: 800; color: var(--black); }
.tile span { font-size: .82rem; color: var(--ink-3); display: block; margin-top: 4px; line-height: 1.35; }

/* calendario */
.cal { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 24px; }
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-head h3 { margin: 0 auto 0 0; font-size: 1.12rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { text-align: center; font-size: .78rem; color: var(--ink-3); font-weight: 650; padding: 4px 0; }
.cal-day { min-height: 68px; border-radius: 10px; background: var(--surface); border: 1.5px solid transparent; padding: 6px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 3px; color: var(--ink); font-size: .85rem; }
.cal-day:hover { border-color: var(--line-2); }
.cal-day.out { background: transparent; color: var(--line-2); }
.cal-day.today .d { background: var(--black); color: #fff; }
.cal-day.sel { border-color: var(--red); background: #fff; }
.cal-day .d { font-weight: 700; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .82rem; }
.cal-day .ev { font-size: .7rem; background: var(--red); color: #fff; border-radius: 5px; padding: 1px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.cal-day .more { font-size: .7rem; color: var(--ink-3); font-weight: 600; }
.ev-list { display: grid; gap: 10px; }
.ev-item { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; align-items: flex-start; background: #fff; }
.ev-date { width: 50px; text-align: center; flex: none; border-radius: 10px; background: var(--red); color: #fff; padding: 5px 0; line-height: 1.1; }
.ev-date b { display: block; font-size: 1.25rem; font-weight: 800; }
.ev-date span { font-size: .7rem; text-transform: capitalize; }
.ev-item h4 { margin: 0 0 2px; font-size: .95rem; }
.ev-item p { margin: 0; font-size: .84rem; color: var(--ink-3); white-space: pre-line; }

/* ============ temario ============ */
.bloque { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: #fff; }
.bloque + .bloque { margin-top: 16px; }
.bloque-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; background: var(--black); color: #fff; }
.bloque-head h2 { color: #fff; margin: 0; font-size: 1.1rem; }
.bloque-head .n { width: 34px; height: 34px; border-radius: 9px; background: var(--red); display: grid; place-items: center; font-weight: 800; }
.tema { display: flex; align-items: center; gap: 14px; padding: 16px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.tema:first-of-type { border-top: 0; }
.tema .t { flex: 1; min-width: 200px; }
.tema .t b { color: var(--black); font-size: 1rem; }
.tema .t .small { display: block; margin-top: 2px; }
.tema .prog { width: 160px; }
.reader { max-width: 760px; margin: 0 auto; font-size: var(--qfs); line-height: 1.75; color: var(--ink); }
.reader p { margin: 0 0 1em; }
.reader h3 { margin: 1.6em 0 .6em; font-size: 1.2em; }
.reader-tools { position: sticky; top: 66px; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px); z-index: 5; border-bottom: 1px solid var(--line); padding: 10px 0; margin-bottom: 26px; }

/* ============ test (HUD) ============ */
body.in-test .topbar { display: none; }
body.in-test .page { max-width: 1280px; padding-top: 18px; }
.hud-top { display: grid; grid-template-columns: 230px minmax(0, 1fr) auto auto; gap: 14px; margin-bottom: 14px; }
.hud-box { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 18px; display: flex; align-items: center; min-height: 72px; box-shadow: var(--shadow); }
.hud-brand { justify-content: center; font-weight: 850; color: var(--black); }
.hud-brand img { max-height: 48px; max-width: 100%; object-fit: contain; }
.hud-info { flex-direction: column; align-items: flex-start; justify-content: center; font-size: .95rem; line-height: 1.45; min-width: 0; }
.hud-info div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hud-info b { color: var(--black); }
.hud-clock { font-size: 1.65rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .04em; color: var(--black); justify-content: center; gap: 10px; }
.hud-clock .icon { color: var(--red); }
.hud-clock.done { color: var(--ink-3); }
.hud-tools { gap: 8px; }
.q-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px 30px 24px; box-shadow: var(--shadow); }
.q-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 22px; }
.q-text { font-size: calc(var(--qfs) * 1.18); font-weight: 700; color: var(--black); line-height: 1.45; flex: 1; }
.q-num { color: var(--red); }
.speak { border: 0; background: none; cursor: pointer; color: var(--ink-3); padding: 6px; border-radius: 8px; flex: none; }
.speak:hover, .speak.on { color: var(--red); background: var(--red-tint); }
.speak .icon { width: 22px; height: 22px; }
.opts { display: grid; gap: 12px; }
.opt { display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 14px 14px 14px 16px; cursor: pointer; font-size: var(--qfs); color: var(--ink); transition: border-color .12s, background .12s; }
.opt:hover:not(.locked) { border-color: var(--black); }
.opt .l { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; font-weight: 800; color: var(--ink-2); flex: none; font-size: .98rem; background: #fff; }
.opt .tx { flex: 1; }
.opt.locked { cursor: default; }
.opt.sel { border-color: var(--black); background: var(--surface); }
.opt.sel .l { background: var(--black); border-color: var(--black); color: #fff; }
.opt.correct { border-color: var(--green); background: var(--green-tint); }
.opt.correct .l { background: var(--green); border-color: var(--green); color: #fff; }
.opt.wrong { border-color: var(--red); background: var(--red-tint); }
.opt.wrong .l { background: var(--red); border-color: var(--red); color: #fff; }
.opt.dim { opacity: .5; }
.feedback { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; padding: 14px 16px; border-radius: 14px; font-weight: 700; }
.feedback.ok { background: var(--green-tint); color: #0E5A2B; }
.feedback.ko { background: var(--red-tint); color: var(--red-dark); }
.feedback.blank { background: var(--surface); color: var(--ink-2); }
.why { margin-top: 12px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; animation: fadein .18s ease; font-size: calc(var(--qfs) * .92); }
.why-sec { padding: 16px 18px; }
.why-sec + .why-sec { border-top: 1px solid var(--line); }
.why h4 { font-size: .86rem; color: var(--ink-3); margin: 0 0 6px; }
.fragment { margin: 0; padding: 12px 16px; border-left: 4px solid var(--red); background: var(--surface); border-radius: 0 10px 10px 0; font-style: italic; color: var(--ink-2); }
.q-nav { display: grid; grid-template-columns: 64px 64px 1fr; gap: 12px; margin-top: 24px; }
.q-nav .icon-btn { width: 100%; height: 54px; border-radius: 12px; }
.q-nav .finish { height: 54px; border-radius: 12px; font-size: .96rem; font-weight: 800; letter-spacing: .02em; }
.qpanel { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 22px; margin-top: 16px; box-shadow: var(--shadow); }
.qpanel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.qpanel-head h3 { margin: 0 auto 0 0; display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.pill { border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: .82rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.pill.red { background: var(--red-tint); border-color: var(--red-line); color: var(--red); }
.qprog { height: 8px; background: var(--surface); border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.qprog span { display: block; height: 100%; background: var(--red); border-radius: 999px; transition: width .2s; }
.qgrid { display: flex; flex-wrap: wrap; gap: 8px; }
.qcell { width: 46px; height: 42px; border-radius: 10px; border: 1.5px solid var(--line-2); background: #fff; font-weight: 700; font-size: .88rem; color: var(--ink); cursor: pointer; font-variant-numeric: tabular-nums; }
.qcell:hover { border-color: var(--black); }
.qcell.ok { background: var(--green-tint); border-color: var(--green-line); color: var(--green); }
.qcell.ko { background: var(--red-tint); border-color: var(--red-line); color: var(--red); }
.qcell.filled { background: var(--grey-fill); border-color: var(--grey-fill); color: #fff; }
.qcell.cur { border-color: var(--black); box-shadow: 0 0 0 2px var(--black); }
.qpanel-foot { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.qpanel-foot .legend { margin: 0; justify-content: flex-start; }
.fontctl { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: .84rem; font-weight: 650; color: var(--ink-2); }
.fontctl button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line-2); background: #fff; cursor: pointer; font-weight: 800; font-size: 1rem; }
.fontctl b { width: 26px; text-align: center; color: var(--black); }
@keyframes fadein { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ============ resultado ============ */
.result { max-width: 1000px; margin: 0 auto; }
.result-card { background: #fff; border: 1px solid var(--line); border-radius: 28px; padding: 40px 34px 34px; text-align: center; box-shadow: var(--shadow); }
.result-badge { width: 128px; height: 128px; border-radius: 50%; margin: 0 auto 18px; display: grid; place-items: center; position: relative; background: var(--black); color: #fff; }
.result-badge .icon { width: 56px; height: 56px; }
.result-badge .mini { position: absolute; right: -2px; bottom: 4px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 4px solid #fff; color: #fff; }
.result-badge .mini .icon { width: 20px; height: 20px; }
.result.ok .result-badge .mini { background: var(--green); }
.result.ko .result-badge .mini { background: var(--red); }
.result-title { font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 850; margin: 0; line-height: 1.1; }
.result-sub { font-size: clamp(2rem, 5.5vw, 3.2rem); font-weight: 900; margin: 4px 0 12px; line-height: 1.05; }
.result.ok .result-title, .result.ok .result-sub { color: var(--green); }
.result.ko .result-title, .result.ko .result-sub { color: var(--red); }
.result.neutral .result-title { color: var(--black); }
.result-msg { color: var(--ink-2); max-width: 620px; margin: 0 auto 8px; }
.result-meta { display: flex; justify-content: center; gap: 26px; flex-wrap: wrap; margin: 10px 0 24px; font-weight: 700; color: var(--ink-2); }
.result-meta b { color: var(--black); font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.rstat { border-radius: 999px; padding: 14px 20px; border: 1.5px solid; display: flex; flex-direction: column; align-items: center; }
.rstat span { font-size: .8rem; font-weight: 750; }
.rstat b { font-size: 1.7rem; font-weight: 850; display: flex; align-items: center; gap: 8px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.rstat.n { background: var(--surface); border-color: var(--line-2); color: var(--ink-2); }
.rstat.n b { color: var(--black); }
.rstat.g { background: var(--green-tint); border-color: var(--green-line); color: var(--green); }
.rstat.r { background: var(--red-tint); border-color: var(--red-line); color: var(--red); }
.result-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.result-actions .btn { border-radius: 999px; padding: 15px; font-weight: 800; }
.rtable td.q { max-width: 420px; }
.res-ic { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; }
.res-ic.ok { background: var(--green); } .res-ic.ko { background: var(--red); } .res-ic.na { background: var(--line-2); }
.res-ic .icon { width: 15px; height: 15px; }
tr.exp td { background: #FAFAFA; }

/* ============ ranking ============ */
.period { display: flex; align-items: center; gap: 14px; background: var(--black); color: #fff; border-radius: var(--r-lg); padding: 16px 22px; margin-bottom: 20px; flex-wrap: wrap; }
.period b { color: #fff; }
.period .cd { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.15rem; }
.rank-col h2 { display: flex; align-items: center; gap: 10px; }
.rank-col h2 .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--red-tint); color: var(--red); }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.rank-row:first-of-type { border-top: 0; }
.rank-row.me { background: var(--red-tint); margin: 0 -12px; padding: 11px 12px; border-radius: 12px; border-top-color: transparent; }
.pos { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .88rem; background: var(--surface); color: var(--ink-2); flex: none; }
.pos.p1 { background: var(--red); color: #fff; } .pos.p2 { background: var(--black); color: #fff; } .pos.p3 { background: var(--grey-fill); color: #fff; }
.rank-row .who { flex: 1; min-width: 0; }
.rank-row .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--black); }
.rank-row .who span { font-size: .8rem; color: var(--ink-3); }
.rank-row .score { font-weight: 850; font-size: 1.15rem; font-variant-numeric: tabular-nums; color: var(--black); display: flex; align-items: center; gap: 4px; }
.flame { color: var(--red); width: 24px; height: 24px; }

/* perfil */
.profile-photo { width: 150px; height: 150px; font-size: 3rem; margin: 0 auto 14px; display: grid; }

/* admin */
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tabs a { padding: 11px 16px; color: var(--ink-3); font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -1.5px; white-space: nowrap; }
.tabs a:hover { color: var(--black); text-decoration: none; }
.tabs a.on { color: var(--black); border-bottom-color: var(--red); }
.drop { border: 2px dashed var(--line-2); border-radius: 14px; padding: 24px; text-align: center; cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--red); background: var(--red-tint); }
.drop .icon { width: 30px; height: 30px; color: var(--red); }
.admin-tema { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 22px; border-top: 1px solid var(--line); }
.model-opt { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--line-2); border-radius: 14px; padding: 14px 16px; cursor: pointer; font-weight: 400; color: var(--ink); margin: 0; }
.model-opt.on { border-color: var(--red); background: var(--red-tint); }
.model-opt input { margin-top: 4px; accent-color: var(--red); }
.model-opt b { display: block; color: var(--black); }
.qa-item { border-bottom: 1px solid var(--line); padding: 14px 0; }
.qa-item.off { opacity: .45; }
.qa-item ol { margin: 6px 0; padding-left: 22px; font-size: .92rem; }
.qa-item li.c { color: var(--green); font-weight: 700; }
.user-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.user-head .avatar { width: 84px; height: 84px; font-size: 1.8rem; }
.actions-grid { display: flex; flex-wrap: wrap; gap: 8px; }

/* modal y avisos */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: grid; place-items: center; z-index: 60; padding: 16px; animation: fadein .15s; }
.modal { background: #fff; border-radius: var(--r-lg); padding: 26px; width: 100%; max-width: 460px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); max-height: calc(100vh - 32px); overflow-y: auto; }
.modal h3 { margin-bottom: 14px; font-size: 1.15rem; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--black); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 70; font-weight: 600; animation: fadein .2s; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.toast.err { background: var(--red); }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(0, 0, 0, .15); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: -4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ acceso ============ */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-side { background: var(--red); color: #fff; padding: 46px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side h1 { color: #fff; font-size: clamp(1.8rem, 3.2vw, 2.7rem); font-weight: 850; max-width: 13em; line-height: 1.08; }
.auth-side p { color: rgba(255, 255, 255, .88); max-width: 32em; }
.auth-side .holdshort { bottom: 120px; }
.auth-brand { display: flex; align-items: center; gap: 12px; font-weight: 850; font-size: 1.1rem; }
.auth-brand .box { background: #fff; border-radius: 12px; padding: 8px 12px; min-width: 52px; min-height: 52px; display: grid; place-items: center; color: var(--red); }
.auth-brand img { max-height: 40px; max-width: 160px; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h2 { font-size: 1.6rem; font-weight: 800; }

/* ============ responsive ============ */
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav a { padding: 21px 8px; font-size: .9rem; }
}
@media (max-width: 980px) {
  .split, .cal { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: minmax(0, 1fr); }
  .hud-top { grid-template-columns: 1fr auto; }
  .hud-brand { display: none; }
  .hud-tools { grid-column: 1 / -1; justify-content: flex-end; min-height: 0; padding: 8px 12px; }
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 66px; left: 0; right: 0; background: #fff; flex-direction: column; padding: 8px 14px 14px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav a { padding: 12px 6px; border-bottom: 0; border-left: 3px solid transparent; }
  .nav a.active { border-left-color: var(--red); }
}
@media (max-width: 760px) {
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .bars.many { gap: 3px; }
  .bars.many .val, .bars.many .lab { display: none; }
  .bars.many .fill { border-radius: 4px 4px 2px 2px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile { padding: 18px 10px 16px; }
  .tile .ic { width: 56px; height: 56px; }
  .hero-inner { flex-direction: column; align-items: flex-start; gap: 16px; padding-bottom: 54px; }
  .hero .avatar { width: 76px; height: 76px; font-size: 1.6rem; }
  .brand-box { display: none; }
  .page { padding: 20px 14px 56px; }
  .panel { padding: 18px; border-radius: 16px; }
  .table-wrap { margin: 0 -18px; padding: 0 18px; }
  .q-card { padding: 20px 16px; }
  .opt .l { width: 38px; height: 38px; }
  .q-nav { grid-template-columns: 54px 54px 1fr; }
  .hud-clock { font-size: 1.3rem; }
  .hud-info { font-size: .85rem; }
  .result-stats, .result-actions { grid-template-columns: 1fr; }
  .result-card { padding: 30px 18px; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 26px 22px 40px; }
  .auth-side .foot { display: none; }
  .auth-side .holdshort { bottom: 10px; }
  .user-btn .uname { display: none; }
  .bars { gap: 6px; height: 190px; }
  .bars .lab .tp { display: none; }
  .bars .val { font-size: .7rem; }
  .cal-day { min-height: 46px; }
  .cal-day .ev { display: none; }
  .cal-day.has::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--red); margin: 0 auto; }
  .topbar-inner { padding: 0 14px; gap: 10px; }
  .fontctl { margin-left: 0; }
  h1 { font-size: 1.5rem; }
}

/* ============ v2.1 ============ */
/* selector de idioma animado */
.lang-toggle { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; flex: none; }
.lang-toggle button { position: relative; z-index: 1; display: flex; align-items: center; gap: 7px; border: 0; background: none; cursor: pointer; font-weight: 750; font-size: .82rem; letter-spacing: .03em; padding: 6px 12px; border-radius: 999px; color: var(--ink-2); transition: color .25s; }
.lang-toggle button:hover .flag { transform: scale(1.12) rotate(-3deg); }
.lang-toggle .flag { width: 22px; height: 15px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.12); transition: transform .25s cubic-bezier(.34,1.56,.64,1); flex: none; }
.lang-toggle .lt-thumb { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 999px; background: var(--red); box-shadow: 0 2px 8px rgba(200,16,46,.35); transition: transform .35s cubic-bezier(.34,1.56,.64,1); }
.lang-toggle.en .lt-thumb { transform: translateX(100%); }
.lang-toggle:not(.en) button[data-l="es"], .lang-toggle.en button[data-l="en"] { color: #fff; }
/* ojo de contraseña */
.pw-wrap { position: relative; display: block; flex: 1; }
.pw-wrap input { padding-right: 46px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--ink-3); display: grid; place-items: center; }
.pw-eye:hover { color: var(--black); background: var(--surface); }
/* PDF del temario */
.pdf-frame { width: 100%; height: calc(100vh - 230px); min-height: 520px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); display: block; }
.reader-tools .row { max-width: none; }
.btn.on { background: var(--red-dark); }
@media (max-width: 760px) { .lang-toggle button { padding: 6px 9px; font-size: .78rem; } .pdf-frame { height: 70vh; min-height: 0; } }

/* ============ v2.2 ============ */
.contact-box { border-color: var(--red-line); }
.contact-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); margin-top: 10px; }
.contact-row:hover { border-color: var(--black); text-decoration: none; }
.contact-row .ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--surface); color: var(--black); flex: none; }
.contact-row b { display: block; color: var(--black); word-break: break-all; }
.contact-row.urgent { background: var(--red); border-color: var(--red); color: #fff; }
.contact-row.urgent .ic { background: rgba(255,255,255,.2); color: #fff; }
.contact-row.urgent b, .contact-row.urgent .small { color: #fff; }
.contact-row.urgent:hover { background: var(--red-dark); }
.bloque-head .n .icon { width: 18px; height: 18px; }
ol.pick li { cursor: pointer; border-radius: 6px; padding: 2px 6px; }
ol.pick li:hover { background: var(--surface); }

/* ============ v2.3 ============ */
.q-img { margin: -6px 0 22px; text-align: center; }
.q-img img { max-width: 100%; max-height: 420px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: zoom-in; }
.q-img figcaption { font-size: .78rem; color: var(--ink-3); margin-top: 6px; }
.q-thumb { width: 46px; height: 46px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; vertical-align: middle; cursor: zoom-in; background: #fff; }
.q-thumb.lg { width: 140px; height: 100px; }
.lightbox { cursor: zoom-out; }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 12px; background: #fff; box-shadow: 0 24px 60px rgba(0,0,0,.4); }
.privacy-text h1 { font-size: 1.4rem; }
.privacy-text h3 { margin: 1.2em 0 .4em; font-size: 1rem; }
.privacy-text p, .privacy-text li { color: var(--ink-2); font-size: .95rem; }
.privacy-text ul { padding-left: 20px; margin: 0 0 .8em; }
.privacy-scroll { max-height: 55vh; overflow-y: auto; margin-bottom: 16px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; color: var(--ink); margin: 0 0 16px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--red); flex: none; }

/* ============ v2.4: subida de varios temas y arrastrar para ordenar ============ */
.up-queue { display: grid; gap: 10px; margin-top: 14px; }
.up-queue:empty { display: none; }
.up-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; }
.up-item.err { border-color: var(--red-line); background: var(--red-tint); }
.up-item.ok { border-color: var(--green-line); }
.up-item-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.up-item-head > .icon { width: 18px; height: 18px; flex: none; color: var(--ink-3); }
.up-name { font-weight: 650; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.up-item-fields { display: grid; gap: 8px; margin-top: 8px; }
.up-item-fields label { font-size: .8rem; margin-bottom: 3px; }
.up-item-fields input { padding: 7px 10px; font-size: .9rem; }
.drag-handle { display: inline-grid; place-items: center; width: 26px; height: 32px; border-radius: 8px; cursor: grab; color: var(--ink-3); flex: none;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.drag-handle .icon { width: 18px; height: 18px; pointer-events: none; }
.drag-handle:hover { background: var(--surface); color: var(--black); }
.bloque-head .drag-handle { color: rgba(255, 255, 255, .65); margin-right: -8px; }
.bloque-head .drag-handle:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.admin-tema.dnd { grid-template-columns: auto minmax(0, 1fr) auto; }
#tlist [hidden] { display: none !important; }
#tlist.sorting, #tlist.sorting * { cursor: grabbing !important; }
#tlist.sorting { user-select: none; -webkit-user-select: none; }
#tlist.sorting-bloque section[data-group] > .admin-tema { display: none; } /* al mover bloques se pliegan */
#tlist.sorting-tema section[data-group] { outline: 2px dashed var(--line-2); outline-offset: -1px; }
#tlist .dragging { opacity: .55; }
#tlist .admin-tema.dragging { background: var(--red-tint); opacity: .8; }
@media (max-width: 560px) { .admin-tema.dnd { grid-template-columns: auto minmax(0, 1fr); } .admin-tema.dnd > .row { grid-column: 1 / -1; } }
