/* =====================================================================
   THE ARTILLERY · Portal
   Sistema visual tomado del HQ v2: Geist, tokens de marca TikTok,
   superficies planas con borde de 1px, nada de sombras de diapositiva.
   Mobile first: el teléfono es el caso normal, no el reducido.
   ===================================================================== */

@font-face {
  font-family: 'Geist';
  src: url('/assets/fonts/Geist-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/assets/fonts/GeistMono-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  --bg: #07070A;
  --bg-soft: #0D0D12;
  --surface: #121218;
  --surface-2: #18181F;
  --surface-3: #20202A;
  --surface-inset: #0A0A0E;
  --text: #F4F4F7;
  --text-2: #A6A6B4;
  --text-3: #71717F;
  --border: #242430;
  --border-strong: #38384A;
  --grid-line: #20202A;

  --brand: #FE2C55;
  --brand-hover: #FF5C7A;
  --brand-ink: #FF6E88;
  --brand-soft: rgba(254, 44, 85, .16);
  --on-brand: #FFFFFF;

  --accent: #25F4EE;
  --accent-ink: #5CF8F4;
  --accent-soft: rgba(37, 244, 238, .14);
  --on-accent: #042B29;

  --good: #3FC07F;
  --good-soft: rgba(63, 192, 127, .16);
  --warning: #E0AC1F;
  --warning-soft: rgba(224, 172, 31, .16);
  --critical: #FF5A5A;
  --critical-soft: rgba(255, 90, 90, .16);

  /* acentos tomados de las landings de ARTILLERY */
  --g-brand: linear-gradient(120deg, var(--accent) 0%, #7FE9F4 35%, var(--brand) 100%);
  --g-cta: linear-gradient(135deg, #FF3D62 0%, #FE2C55 45%, #C9153C 100%);
  --g-night: linear-gradient(135deg, #17102B 0%, #0B0B12 55%, #2A0B18 100%);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --sidebar: 248px;
  --topbar: 56px;
  --maxw: 1320px;

  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'JetBrains Mono', Menlo, Consolas, monospace;

  color-scheme: dark;
}

[data-theme='light'] {
  --bg: #F4F4F7;
  --bg-soft: #E9E9F0;
  --surface: #FFFFFF;
  --surface-2: #F8F8FB;
  --surface-3: #EFEFF4;
  --surface-inset: #F2F2F7;
  --text: #0C0C11;
  --text-2: #4F4F5E;
  --text-3: #7E7E8E;
  --border: #E3E3EC;
  --border-strong: #C7C7D5;
  --grid-line: #E3E3EC;
  --brand-hover: #D81843;
  --brand-ink: #BC0F38;
  --brand-soft: #FFE7EC;
  --accent: #0FA9A4;
  --accent-ink: #07807B;
  --accent-soft: #DFFBFA;
  color-scheme: light;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body { overscroll-behavior-y: none; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.02em; }
p { margin: 0; }

.mono { font-family: var(--mono); }
.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }

.ic-svg {
  width: 18px; height: 18px;
  flex: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.ic-20 { width: 20px; height: 20px; }
.ic-16 { width: 16px; height: 16px; }
.ic-28 { width: 28px; height: 28px; stroke-width: 1.5; }

/* =====================================================================
   Estructura
   ===================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100dvh;
}

/* ---------- barra lateral ---------- */
.side {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: 14px 10px 10px;
  gap: 2px;
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 16px;
}
.side-brand img { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.side-brand .bn { font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.side-brand .bs {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--text-3);
}
.side-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; padding-bottom: 8px; }
.side-nav::-webkit-scrollbar { width: 6px; }
.side-nav::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }

.side-group {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--text-3);
  padding: 16px 10px 6px;
}
.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px;
  position: relative;
  transition: background .12s, color .12s;
}
.side-link:hover { background: var(--surface); color: var(--text); }
.side-link.on { background: var(--surface-2); color: var(--text); font-weight: 500; }
.side-link.on::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.side-link .badge { margin-left: auto; }

.side-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px; margin-top: auto;
  border-top: 1px solid var(--border);
}
.side-user .av { width: 30px; height: 30px; border-radius: 50%; }
.side-user .nm { font-size: 13px; font-weight: 500; line-height: 1.2; }
.side-user .rl {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-3);
}
.side-user .out { margin-left: auto; color: var(--text-3); background: none; border: 0; cursor: pointer; padding: 6px; border-radius: 8px; }
.side-user .out:hover { color: var(--brand); background: var(--surface); }

.av {
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2);
  font-size: 12px; font-weight: 600; object-fit: cover;
}

/* ---------- barra superior ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }

.top {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.top .crumb {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-3); min-width: 0;
}
.top .crumb b { color: var(--text); font-weight: 600; }
.top .crumb .sep { opacity: .5; }
.top .crumb .desc {
  color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.top .spacer { flex: 1; }
.burger { display: none; background: none; border: 0; color: var(--text-2); padding: 6px; border-radius: 8px; cursor: pointer; }

.langs { display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 2px; }
.langs button {
  background: none; border: 0; cursor: pointer;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  padding: 4px 8px; border-radius: 7px; color: var(--text-3);
}
.langs button.on { background: var(--surface-3); color: var(--text); }

.icon-btn {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; color: var(--text-2); cursor: pointer;
  transition: color .12s, border-color .12s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }

/* ---------- contenido ---------- */
.page {
  width: 100%; max-width: var(--maxw);
  margin: 0 auto; padding: 22px 16px 96px;
  display: flex; flex-direction: column; gap: 20px;
}
.page-head { display: flex; flex-direction: column; gap: 5px; }
.page-head h1 { font-size: clamp(25px, 3.4vw, 34px); line-height: 1.12; }
.page-head p { color: var(--text-2); font-size: 14px; max-width: 70ch; }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* ---------- tarjetas ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15px; }
.card-head p { font-size: 12.5px; color: var(--text-3); }
.card-num {
  display: grid; place-items: center;
  width: 20px; height: 20px; flex: none;
  border: 1px solid var(--border-strong); border-radius: 6px;
  font-family: var(--mono); font-size: 10px; color: var(--text-3);
}

.kpi { display: flex; flex-direction: column; gap: 5px; }
.kpi .lb { display: flex; align-items: center; gap: 6px; }
.kpi .vl { font-size: 27px; font-weight: 650; letter-spacing: -.03em; line-height: 1.1; }
.kpi .vl.brand { color: var(--brand); }
.kpi .sb { font-size: 11.5px; color: var(--text-3); }

.bar { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--brand); transition: width .4s cubic-bezier(.2,.8,.2,1); }
.bar.accent > i { background: var(--accent); }
.bar.good > i { background: var(--good); }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  transition: background .12s, border-color .12s, opacity .12s;
  min-height: 38px;
}
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-brand { background: var(--g-cta); border-color: transparent; color: #fff; font-weight: 600; }
.btn-brand:hover { filter: brightness(1.08); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-accent:hover { filter: brightness(1.08); }
.btn-ghost { background: none; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--critical); border-color: var(--border); }
.btn-danger:hover { background: var(--critical-soft); border-color: var(--critical); }
.btn-sm { padding: 6px 11px; min-height: 32px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-google { background: var(--surface-2); }
.btn-google svg { width: 18px; height: 18px; }

.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.seg button {
  background: none; border: 0; cursor: pointer;
  padding: 6px 13px; border-radius: 8px;
  font-size: 12.5px; color: var(--text-3);
  white-space: nowrap;
}
.seg button.on { background: var(--surface-3); color: var(--text); font-weight: 500; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid transparent;
}
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.crit { background: var(--critical-soft); color: var(--critical); }

/* ---------- formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color .12s;
  min-height: 42px;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--border-strong); outline: none; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.field .hint { font-size: 11.5px; color: var(--text-3); }
.field .err { font-size: 12px; color: var(--critical); display: flex; align-items: center; gap: 6px; }

/* ---------- listas / tablas ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item .t { font-size: 14px; font-weight: 500; }
.list-item .s { font-size: 12px; color: var(--text-3); }
.list-item .idx {
  display: grid; place-items: center; flex: none;
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--surface-3); color: var(--text-3);
  font-family: var(--mono); font-size: 11px;
}
.list-item .idx.done { background: var(--good-soft); color: var(--good); }

.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 520px; }
table.tbl th {
  text-align: left; padding: 10px 14px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-3); font-weight: 400;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tr.me { background: var(--brand-soft); }
table.tbl tr.me:hover { background: var(--brand-soft); }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 48px 20px; text-align: center; color: var(--text-3);
}
.empty .ic-svg { width: 30px; height: 30px; stroke-width: 1.4; opacity: .6; }
.empty h4 { font-size: 14.5px; color: var(--text-2); font-weight: 500; }
.empty p { font-size: 12.5px; max-width: 42ch; }

/* ---------- esqueleto ---------- */
.sk { background: var(--surface-3); border-radius: 8px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .45 } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none } * { transition: none !important } }

/* ---------- cuenta regresiva ---------- */
.countdown {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.cd-cell {
  min-width: 62px; padding: 10px 12px;
  background: var(--surface-inset);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  text-align: center;
}
.cd-cell b { display: block; font-size: 23px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.cd-cell span { font-family: var(--mono); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }

.hero-live {
  position: relative; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background:
    radial-gradient(1200px 300px at 0% 0%, var(--brand-soft), transparent 60%),
    radial-gradient(900px 300px at 100% 100%, var(--accent-soft), transparent 60%),
    var(--surface);
  padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.hero-live::after {
  content: ''; position: absolute; inset: 0 0 auto; height: 2px;
  background: var(--g-brand); opacity: .9;
}
[data-theme='dark'] .hero-live { background: var(--g-night); }

/* marca con el degradado de las landings */
.gradient-text {
  background: var(--g-brand);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.live-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand); box-shadow: 0 0 0 0 var(--brand-soft);
  animation: ping 1.8s ease-out infinite;
}
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(254,44,85,.5) }
  70% { box-shadow: 0 0 0 7px rgba(254,44,85,0) }
  100% { box-shadow: 0 0 0 0 rgba(254,44,85,0) }
}

/* ---------- lección ---------- */
.player {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  background: var(--surface-inset);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.player iframe, .player video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player .ph { position: absolute; inset: 0; display: grid; place-items: center; gap: 8px; color: var(--text-3); text-align: center; padding: 20px; }

.prose { font-size: 14.5px; line-height: 1.7; color: var(--text-2); }
.prose h2, .prose h3 { color: var(--text); margin: 22px 0 8px; font-size: 16px; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 20px; }
.prose li { margin: 4px 0; }
.prose a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.prose code { font-family: var(--mono); font-size: .9em; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }

/* ---------- login ---------- */
.auth {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.auth-art {
  position: relative; overflow: hidden;
  padding: 40px;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(800px 420px at 20% 10%, rgba(254,44,85,.18), transparent 60%),
    radial-gradient(700px 400px at 90% 90%, rgba(37,244,238,.10), transparent 60%),
    var(--g-night);
  border-right: 1px solid var(--border);
}
.auth-art::after {
  content: ''; position: absolute; inset: auto 0 0; height: 2px; background: var(--g-brand);
}
.auth-art .mark { display: flex; align-items: center; gap: 10px; }
.auth-art .mark img { width: 34px; height: 34px; border-radius: 9px; }
.auth-art h2 { font-size: clamp(26px, 3vw, 38px); line-height: 1.1; max-width: 16ch; }
.auth-art .pts { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.auth-art .pt { display: flex; gap: 11px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); }
.auth-art .pt i {
  display: grid; place-items: center; flex: none;
  width: 22px; height: 22px; border-radius: 7px;
  background: var(--surface); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 10px; font-style: normal; color: var(--text-3);
}
.auth-form {
  display: flex; flex-direction: column; justify-content: center;
  padding: 40px; gap: 18px;
}
.auth-box { width: 100%; max-width: 380px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.auth-sep { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 11.5px; }
.auth-sep::before, .auth-sep::after { content: ''; height: 1px; flex: 1; background: var(--border); }

/* ---------- avisos flotantes ---------- */
.toasts { position: fixed; z-index: 90; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; max-width: 360px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: 13px;
  animation: slide .22s cubic-bezier(.2,.8,.2,1);
}
.toast.good { border-color: var(--good); }
.toast.bad { border-color: var(--critical); }
@keyframes slide { from { opacity: 0; transform: translateY(8px) } }

/* ---------- modal ---------- */
.modal-bg {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,.6); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 16px;
}
.modal {
  width: 100%; max-width: 520px; max-height: 88dvh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
}
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; flex: 1; }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- barra inferior (móvil) ---------- */
.tabbar { display: none; }

/* =====================================================================
   Móvil
   ===================================================================== */
@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }

  .side {
    position: fixed; z-index: 60; top: 0; left: 0;
    width: min(290px, 86vw); height: 100dvh;
    transform: translateX(-102%);
    transition: transform .22s cubic-bezier(.2,.8,.2,1);
    box-shadow: 0 0 0 100vmax rgba(0,0,0,0);
  }
  body.drawer .side { transform: none; }
  body.drawer::after {
    content: ''; position: fixed; inset: 0; z-index: 55;
    background: rgba(0,0,0,.55); backdrop-filter: blur(2px);
  }
  .burger { display: grid; place-items: center; }
  .top .crumb .desc, .top .crumb .sep, .top .crumb .lvl { display: none; }

  .page { padding: 18px 14px 110px; gap: 16px; }
  .page-head h1 { font-size: 24px; }

  .tabbar {
    position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    background: color-mix(in srgb, var(--bg-soft) 94%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 2px; border-radius: 10px;
    color: var(--text-3); font-size: 10px;
  }
  .tabbar a.on { color: var(--brand); }
  .tabbar a .ic-svg { width: 21px; height: 21px; }

  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-form { padding: 28px 18px; min-height: 100dvh; }
  .auth-box { max-width: 420px; }

  .toasts { left: 14px; right: 14px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }

  .modal { max-width: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal-foot .btn { flex: 1; }

  .kpi .vl { font-size: 23px; }
  .card { padding: 14px; }
  .cd-cell { flex: 1; min-width: 0; }
}

@media (max-width: 420px) {
  .seg { width: 100%; }
  .seg button { flex: 1; padding: 7px 6px; }
  .cd-cell b { font-size: 20px; }
}

/* el modo claro necesita un pelo más de contorno */
[data-theme='light'] .card,
[data-theme='light'] .btn { box-shadow: 0 1px 2px rgba(16, 16, 32, .04); }

/* ---------- calendario semanal ---------- */
.cal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cal-top .eyebrow { white-space: nowrap; }

.cal-chips { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 8px; border-bottom: 1px solid var(--border); }
.cal-chips button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: 1px solid transparent; border-radius: 10px;
  padding: 7px 2px; cursor: pointer; color: var(--text-3);
}
.cal-chips button span { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; }
.cal-chips button b { font-size: 15px; font-weight: 600; color: var(--text-2); }
.cal-chips button.hoy b { color: var(--brand); }
.cal-chips button.on { background: var(--surface-3); border-color: var(--border); }
.cal-chips button.on b, .cal-chips button.on span { color: var(--text); }

.cal-scroll { max-height: min(62dvh, 620px); overflow: auto; overscroll-behavior: contain; }
.cal-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.cal-scroll::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }

.cal-head {
  display: grid; position: sticky; top: 0; z-index: 3;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.cal-head .d { display: flex; flex-direction: column; gap: 1px; padding: 8px 4px; text-align: center; border-left: 1px solid var(--grid-line); }
.cal-head .d i { font-style: normal; font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; color: var(--text-3); }
.cal-head .d b { font-size: 16px; font-weight: 600; }
.cal-head .d.today b { color: var(--brand); }

.cal-body { display: grid; position: relative; }
.cal-gutter i {
  display: block; height: 48px; font-style: normal;
  font-family: var(--mono); font-size: 10px; color: var(--text-3);
  text-align: right; padding-right: 8px; transform: translateY(-5px);
}
.cal-col { position: relative; border-left: 1px solid var(--grid-line); }
.cal-col.today { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.cal-col .slot { display: block; height: 48px; border-bottom: 1px solid var(--grid-line); }

.cal-now { position: absolute; left: 0; right: 0; height: 1px; background: var(--brand); z-index: 2; }
.cal-now::before { content: ''; position: absolute; left: -3px; top: -3px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }

.cal-ev {
  position: absolute; left: 4px; right: 4px; z-index: 1;
  display: flex; flex-direction: column; gap: 1px;
  padding: 5px 7px; border-radius: 8px; overflow: hidden;
  background: var(--brand-soft); border: 1px solid var(--brand);
}
.cal-ev:hover { filter: brightness(1.12); }
.cal-ev b { font-size: 11.5px; font-weight: 600; line-height: 1.25; }
.cal-ev span { font-family: var(--mono); font-size: 10px; color: var(--text-2); }

@media (max-width: 720px) {
  .cal-top strong { order: -1; width: 100%; }
  .cal-top .eyebrow { display: none; }
}

/* ---------- wins ---------- */
.wins-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

.win {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .14s, transform .14s;
}
.win:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.win.top { border-color: var(--brand); }
.win.top::before { content: ''; height: 2px; background: var(--g-brand); }

.win-media {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 10;
  background: var(--surface-inset); border: 0; padding: 0; cursor: pointer; overflow: hidden;
}
.win-media img { width: 100%; height: 100%; object-fit: cover; }
.win-media .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); }
.win-media .play {
  position: absolute; inset: 0; margin: auto; width: 46px; height: 46px;
  display: grid; place-items: center; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; backdrop-filter: blur(3px);
  border: 1px solid rgba(255, 255, 255, .28);
}
.win:hover .win-media .play { background: var(--brand); border-color: var(--brand); }
.win-media .count, .win-media .src {
  position: absolute; bottom: 8px; display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px; font-family: var(--mono); font-size: 10px;
  background: rgba(0, 0, 0, .6); color: #fff; backdrop-filter: blur(3px);
}
.win-media .count { right: 8px; }
.win-media .src { left: 8px; text-transform: uppercase; letter-spacing: .08em; }

.win-body { display: flex; flex-direction: column; gap: 8px; padding: 14px; flex: 1; }
.win-body h3 { font-size: 15.5px; line-height: 1.3; }
.win-body p {
  font-size: 13.5px; color: var(--text-2); line-height: 1.55; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.win-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.win-foot .who { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); }
.win-foot .mono { font-size: 11px; }
.win-admin { display: flex; gap: 4px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 2px; }

.winrow-media {
  position: relative; flex: none; width: 104px; height: 70px; border-radius: 10px;
  overflow: hidden; background: var(--surface-inset); border: 1px solid var(--border);
}
.winrow-media img { width: 100%; height: 100%; object-fit: cover; }
.winrow-media .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); }
.winrow-media .play {
  position: absolute; inset: 0; margin: auto; width: 28px; height: 28px;
  display: grid; place-items: center; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff;
}
.winrow-media .count, .winrow-media .src { display: none; }

/* lightbox */
.modal.lb { max-width: 820px; }
.modal.lb .modal-body { gap: 16px; }
.lb-photos { display: flex; flex-direction: column; gap: 10px; }
.lb-photos img { width: 100%; border-radius: 10px; }

/* subida de fotos */
.drop {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 18px; cursor: pointer; text-align: center;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-inset); color: var(--text-2); font-size: 13.5px;
  transition: border-color .12s, color .12s;
}
.drop:hover { border-color: var(--brand); color: var(--text); }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs:empty { display: none; }
.thumb {
  position: relative; width: 74px; height: 74px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-inset);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.up img { opacity: .4; }
.thumb.up i {
  position: absolute; inset: 0; margin: auto; width: 18px; height: 18px;
  border: 2px solid var(--border-strong); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }
.thumb button {
  position: absolute; top: 4px; right: 4px; display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%; cursor: pointer;
  background: rgba(0, 0, 0, .65); color: #fff; border: 0;
}
.thumb button:hover { background: var(--critical); }

.vok, .vbad { display: flex; align-items: center; gap: 7px; font-size: 12.5px; margin-top: 7px; }
.vok { color: var(--good); }
.vbad { color: var(--critical); }

@media (max-width: 600px) {
  .wins-grid { grid-template-columns: 1fr; }
  .winrow-media { width: 84px; height: 58px; }
}

/* ---------- ranking · la arena ---------- */
:root {
  --rank-1: #FE2C55; --rank-2: #25F4EE; --rank-3: #A066DA;
  --rank-4: #17A072; --rank-5: #E0AC1F; --rank-6: #5091E5;
}

.arena-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 18px 16px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); position: relative; overflow: hidden;
  background:
    radial-gradient(900px 240px at 0% 0%, var(--brand-soft), transparent 62%),
    radial-gradient(700px 240px at 100% 100%, var(--accent-soft), transparent 62%),
    var(--g-night);
}
[data-theme='light'] .arena-head { background: radial-gradient(900px 240px at 0% 0%, var(--brand-soft), transparent 62%), var(--surface); }
.arena-head::after { content: ''; position: absolute; inset: auto 0 0; height: 2px; background: var(--g-brand); }
.arena-head h1 { font-size: clamp(21px, 3vw, 31px); letter-spacing: -.02em; }
.arena-head .sub { display: flex; align-items: center; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.arena-head .live {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--brand-ink);
}

.arena-kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.akpi {
  display: flex; flex-direction: column; gap: 4px; padding: 13px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.akpi b { font-size: 23px; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; }
.akpi .sb { font-size: 11.5px; color: var(--text-3); }
.akpi.hot { border-color: var(--brand); background: linear-gradient(180deg, var(--brand-soft), transparent 70%), var(--surface); }
.akpi.hot b { color: var(--brand-ink); font-size: 18px; }

.sec-title {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--text); margin-bottom: 12px;
}
.sec-title span { font-size: 10.5px; letter-spacing: .06em; text-transform: none; color: var(--text-3); font-family: var(--sans); }

/* podio */
.arena { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 10px; align-items: stretch; }
.arena .vs {
  align-self: center; font-family: var(--mono); font-size: 13px; letter-spacing: .1em;
  color: var(--text-3); font-weight: 600;
}
.pod {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 14px 14px; text-align: center; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--c) 45%, var(--border));
  border-radius: var(--radius);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 13%, transparent), transparent 55%), var(--surface);
}
.pod.p1 { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 30%, transparent); }
.pod-top { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.pod-top .tag {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c);
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
}
.pod-top .medal { font-size: 17px; color: var(--c); }
.pod-face { margin-top: 2px; }
.pod-face .av { border: 2px solid var(--c); object-fit: cover; }
.pod h3 { font-size: 15px; letter-spacing: -.01em; margin-top: 4px; }
.pod-n { font-size: 30px; font-weight: 700; letter-spacing: -.03em; color: var(--c); line-height: 1.1; }
.pod-sub { font-size: 11.5px; color: var(--text-3); }
.pod-tbl { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 11.5px; }
.pod-tbl td { padding: 4px 2px; border-top: 1px solid var(--border); color: var(--text-2); text-align: left; }
.pod-tbl td:nth-child(2) { text-align: center; color: var(--text-3); width: 34px; }
.pod-tbl td:last-child { text-align: right; color: var(--c); width: 46px; }
.pod-bar { display: block; width: 100%; height: 3px; margin-top: 12px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.pod-bar i { display: block; height: 100%; background: var(--c); }
.pod.p1 .pod-bar i { width: 100% } .pod.p2 .pod-bar i { width: 72% } .pod.p3 .pod-bar i { width: 48% }

/* carrera de puntos */
.race { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.race-row { display: flex; align-items: center; gap: 9px; }
.race-row .n { font-family: var(--mono); font-size: 11px; color: var(--text-3); width: 16px; }
.race-row .bar2 {
  position: relative; flex: 1; height: 24px; border-radius: 6px;
  background: var(--surface-3); overflow: hidden; display: flex; align-items: center;
}
.race-row .bar2 i { position: absolute; inset: 0 auto 0 0; display: block; opacity: .85; }
.race-row .bar2 b { position: relative; font-size: 12px; font-weight: 600; padding: 0 9px; color: #fff; mix-blend-mode: normal; }
[data-theme='light'] .race-row .bar2 b { color: #0C0C11; }
.race-row .v { font-size: 12.5px; width: 56px; text-align: right; }
.race-row.me .bar2 { outline: 1px solid var(--brand); outline-offset: 1px; }

.pts-legend { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.pts-legend .pl { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-2); }
.pts-legend .pl .ic { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); }
.pts-legend .pl b { margin-left: auto; color: var(--brand-ink); font-size: 12.5px; }
.totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.totals div { text-align: center; }
.totals b { display: block; font-size: 17px; font-weight: 650; }
.totals span { font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }

/* tabla leaderboard */
.lb-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.lb-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 20%, transparent), transparent 70%);
  border-bottom: 1px solid var(--border); color: var(--text);
}
.lb-head span:last-child { color: var(--brand-ink); letter-spacing: .06em; }
.lb-tbl td { vertical-align: middle; }
.lb-tbl .pos { font-family: var(--mono); font-size: 13px; color: var(--text-3); }
.lb-tbl .pos.medal { font-weight: 700; }
.lb-tbl .pos.m1 { color: var(--rank-1); } .lb-tbl .pos.m2 { color: var(--rank-2); } .lb-tbl .pos.m3 { color: var(--rank-3); }

@media (max-width: 860px) {
  .arena { grid-template-columns: 1fr; }
  .arena .vs { display: none; }
  .arena-head { padding: 16px 14px; }
  .totals { grid-template-columns: repeat(2, 1fr); }
}

/* =================================================================
   MOVIMIENTO
   Nada se queda fijo: cada bloque entra cuando llega a pantalla,
   las filas caen escalonadas y las barras crecen hasta su valor.
   ================================================================= */
@media (prefers-reduced-motion: no-preference) {
  .rv {
    opacity: 0;
    transform: translateY(16px) scale(.988);
    will-change: opacity, transform;
  }
  .rv-in {
    opacity: 1;
    transform: none;
    transition:
      opacity .5s cubic-bezier(.22,.8,.26,1) calc(var(--rv-i, 0) * 55ms),
      transform .6s cubic-bezier(.22,.8,.26,1) calc(var(--rv-i, 0) * 55ms);
  }

  /* filas internas: entran una detrás de otra cuando se abre su bloque */
  .rv-in .race-row,
  .rv-in .pl,
  .rv-in .totals > div,
  .rv-in .lb-tbl tbody tr,
  .rv-in .pod-tbl tr {
    animation: rowIn .46s cubic-bezier(.22,.8,.26,1) both;
    animation-delay: calc(var(--i, 0) * 45ms + 90ms);
  }
  @keyframes rowIn {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: none; }
  }

  /* barras: siempre crecen desde cero */
  .bar i, .bar2 i, .pod-bar i {
    transition: width .95s cubic-bezier(.22,.8,.26,1) .2s;
  }

  .akpi, .pod, .race-row, .lb-tbl tbody tr {
    transition: transform .25s ease, border-color .25s ease, background .25s ease;
  }
  .akpi:hover { transform: translateY(-2px); }
  .pod:hover  { transform: translateY(-4px); }
  .race-row:hover, .lb-tbl tbody tr:hover { transform: translateX(3px); }

  [data-rp-reload].spin svg { animation: spin .7s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
}

/* Portada generada del win: ninguna tarjeta queda con el hueco vacío */
.win-cover {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  background:
    radial-gradient(120% 95% at 20% 0%, color-mix(in srgb, var(--c1) 48%, transparent) 0%, transparent 64%),
    linear-gradient(150deg, color-mix(in srgb, var(--c2) 85%, #000) 0%, var(--bg) 82%);
  overflow: hidden;
}
.win-cover::after {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 136px; height: 136px; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--c1) 38%, transparent);
  opacity: .55; transition: transform .5s ease;
}
.win-cover .wc-kick {
  position: absolute; top: 12px; left: 14px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--c1);
}
.win-cover .wc-ring {
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 16px; letter-spacing: .04em;
  color: var(--text-1);
  border: 1px solid color-mix(in srgb, var(--c1) 55%, transparent);
  background: color-mix(in srgb, var(--c2) 45%, transparent);
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--c1) 9%, transparent);
}
.win-cover .wc-who {
  font-size: 12.5px; font-weight: 550;
  color: color-mix(in srgb, var(--c1) 30%, var(--text-2));
  max-width: 86%; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.win:hover .win-cover::after { transform: scale(1.14); }

/* =================================================================
   MÓDULOS — misma anatomía que los wins: portada, cuerpo y pie
   ================================================================= */
a.win.mod { color: inherit; text-decoration: none; }
.win.mod:hover { border-color: var(--brand); transform: translateY(-2px); }
.win.mod.ok { border-color: color-mix(in srgb, var(--good) 45%, var(--border)); }
.win.mod.locked { cursor: not-allowed; }
.win.mod.locked:hover { transform: none; border-color: var(--border); }
.win.mod.locked .win-body h3, .win.mod.locked .win-body p { color: var(--text-3); }

.mod-cover {
  position: relative; aspect-ratio: 16 / 10;
  display: flex; align-items: center; justify-content: center;
}
.mod-cover.off { filter: grayscale(.85); opacity: .5; }

.mod-n {
  font-family: var(--mono); font-size: 54px; font-weight: 500;
  letter-spacing: -.02em; line-height: 1;
  color: color-mix(in srgb, var(--c1) 92%, #fff);
  text-shadow: 0 2px 24px color-mix(in srgb, var(--c1) 45%, transparent);
}
.mod-ln {
  position: absolute; bottom: 12px; left: 14px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-3);
}
.mod-state {
  position: absolute; top: 10px; right: 12px;
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--c1) 35%, transparent);
  background: color-mix(in srgb, var(--c2) 45%, transparent);
  color: color-mix(in srgb, var(--c1) 40%, var(--text-1));
}
.mod-state.done { border-color: var(--good); color: var(--good); }
.mod-state.lock { color: var(--text-3); border-color: var(--border); background: var(--surface); }
.mod-lock {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--text-1); background: color-mix(in srgb, #000 42%, transparent);
}
.win.mod .win-body .bar { margin-top: 2px; }

/* =================================================================
   INICIO — la llama, el siguiente paso y el mini tablero
   ================================================================= */

/* ---------- la racha arde según los días seguidos ---------- */
.flame-box {
  position: relative; width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
}
.flame-box svg { width: 27px; height: 27px; overflow: visible; }
.flame-box .fl-out { fill: var(--brand); transform-origin: 50% 100%; }
.flame-box .fl-in  { fill: #FFC24A; transform-origin: 50% 100%; }
.flame-box .fl-halo {
  position: absolute; width: 38px; height: 38px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 40%, transparent) 0%, transparent 68%);
  opacity: 0;
}
/* apagada: sin racha, sin fuego */
.flame-box[data-lvl="0"] .fl-out { fill: var(--surface-3); }
.flame-box[data-lvl="0"] .fl-in  { fill: var(--border-strong); }

@media (prefers-reduced-motion: no-preference) {
  .flame-box[data-lvl="1"] .fl-out { animation: flick 2.6s ease-in-out infinite; }
  .flame-box[data-lvl="1"] .fl-in  { animation: flick 2.2s ease-in-out infinite reverse; }
  .flame-box[data-lvl="2"] .fl-out { animation: flick 1.7s ease-in-out infinite; }
  .flame-box[data-lvl="2"] .fl-in  { animation: flick 1.3s ease-in-out infinite reverse; }
  .flame-box[data-lvl="2"] .fl-halo { opacity: .5; animation: breathe 2.4s ease-in-out infinite; }
  .flame-box[data-lvl="3"] .fl-out { animation: flick 1.05s ease-in-out infinite; }
  .flame-box[data-lvl="3"] .fl-in  { animation: flick .8s ease-in-out infinite reverse; }
  .flame-box[data-lvl="3"] .fl-halo { opacity: .9; animation: breathe 1.4s ease-in-out infinite; }
  .flame-box[data-lvl="3"] svg { filter: drop-shadow(0 0 7px color-mix(in srgb, var(--brand) 60%, transparent)); }
}
@keyframes flick {
  0%, 100% { transform: scaleY(1) scaleX(1) translateY(0) rotate(0deg); }
  20%      { transform: scaleY(1.09) scaleX(.95) translateY(-1px) rotate(-1.5deg); }
  45%      { transform: scaleY(.94) scaleX(1.04) translateY(.4px) rotate(1deg); }
  70%      { transform: scaleY(1.06) scaleX(.97) translateY(-.6px) rotate(1.5deg); }
}
@keyframes breathe {
  0%, 100% { transform: scale(.88); }
  50%      { transform: scale(1.12); }
}

/* ---------- barras con un brillo que recorre ---------- */
.bar > i { position: relative; overflow: hidden; }
@media (prefers-reduced-motion: no-preference) {
  .bar > i::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.3) 50%, transparent 100%);
    transform: translateX(-120%);
    animation: sheen 3.6s ease-in-out infinite;
    animation-delay: calc(var(--i, 0) * .25s + 1.1s);
  }
}
@keyframes sheen {
  0%        { transform: translateX(-120%); }
  45%, 100% { transform: translateX(220%); }
}

/* ---------- tarjeta del siguiente paso ---------- */
.step-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.step-phase {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent-ink);
}
.step-title { font-size: 19px; line-height: 1.25; }
.step-ic {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border-radius: 50%; color: var(--brand);
  border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent);
  background: color-mix(in srgb, var(--brand) 10%, transparent);
}
.step-dots { display: flex; gap: 5px; margin-top: 14px; }
.step-dots i {
  flex: 1; height: 5px; border-radius: 4px; background: var(--surface-3);
}
.step-dots i.on { background: var(--brand); }
@media (prefers-reduced-motion: no-preference) {
  .step-dots i.on { animation: dotIn .4s cubic-bezier(.22,.8,.26,1) both; animation-delay: calc(var(--i) * 70ms); }
}
@keyframes dotIn { from { transform: scaleX(.2); opacity: 0; } to { transform: none; opacity: 1; } }

.step-last { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.step-back {
  display: flex; align-items: center; gap: 8px; margin-top: 7px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); text-decoration: none; font-size: 13px;
  transition: border-color .14s, background .14s;
}
.step-back:hover { border-color: var(--brand); background: var(--surface-3); }
.step-back svg { color: var(--good); flex: none; }
.step-back .sl-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-back .sl-d { font-size: 11px; color: var(--text-3); flex: none; }

.step-quick { display: flex; gap: 7px; margin-top: 10px; flex-wrap: wrap; }
.step-quick a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-2); font-size: 12px; text-decoration: none;
  transition: color .14s, border-color .14s;
}
.step-quick a:hover { color: var(--text-1); border-color: var(--border-strong); }

/* ---------- mini tablero ---------- */
.rm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.rm-pos b {
  display: block; font-size: 34px; font-weight: 650; line-height: 1;
  letter-spacing: -.02em; color: var(--brand);
}
.rm-pos span { display: block; margin-top: 4px; font-size: 12.5px; color: var(--text-3); }
.rm-pts { text-align: right; flex: none; }
.rm-pts b { display: block; font-family: var(--mono); font-size: 19px; color: var(--text-1); }
.rm-pts span { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--text-3); }
.rm-bar { display: flex; align-items: center; gap: 9px; margin-top: 12px; }
.rm-bar .bar { flex: 1; }
.rm-bar .mono { font-size: 11px; width: 34px; text-align: right; }
.rm-lead {
  display: flex; align-items: center; gap: 9px; margin-top: 12px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: 13px;
}
.rm-lead .eyebrow { flex: none; }
.rm-lead b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-lead .mono { font-size: 11.5px; flex: none; }
.rm-lead.me { border-color: var(--brand); }

/* icono dentro del cuadrito de número de tarjeta */
.card-num .num-ic, .num-ic { display: grid; place-items: center; color: var(--text-2); }
.card-num:has(.num-ic) { width: 26px; height: 26px; }

/* =================================================================
   EL AULA — lecciones a la izquierda, video al centro
   ================================================================= */
.aula { display: flex; flex-direction: column; gap: 18px; }

.aula-top { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.aula-head h1 { font-size: clamp(22px, 3vw, 30px); line-height: 1.15; margin-top: 4px; }
.aula-head p { color: var(--text-2); font-size: 14px; margin-top: 6px; max-width: 70ch; }
.aula-prog {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}

.aula-body { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }

/* ---------- lista de lecciones ---------- */
.aula-side {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
  position: sticky; top: 16px;
}
.side-head {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 13px 14px; background: var(--surface-2);
  border: 0; border-bottom: 1px solid var(--border);
  color: var(--text-2); cursor: default; text-align: left;
}
.side-head .side-n { margin-left: auto; font-size: 11.5px; color: var(--text-3); }
.side-head svg { display: none; color: var(--text-3); transition: transform .2s ease; }
.side-list { max-height: calc(100vh - 220px); overflow-y: auto; }

.lx-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 12px 14px; background: none; border: 0; cursor: pointer;
  border-left: 2px solid transparent; text-align: left;
  color: var(--text); transition: background .14s, border-color .14s;
}
.lx-item + .lx-item { border-top: 1px solid var(--border); }
.lx-item:hover { background: var(--surface-2); }
.lx-item.on { background: var(--surface-3); border-left-color: var(--brand); }
.lx-item .idx {
  display: grid; place-items: center; width: 24px; height: 24px; flex: none;
  border-radius: 50%; border: 1px solid var(--border-strong);
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
}
.lx-item.done .idx { border-color: var(--good); color: var(--good); }
.lx-item.on .idx { border-color: var(--brand); color: var(--brand); }
.lx-t { flex: 1; min-width: 0; }
.lx-t b { display: block; font-size: 13.5px; font-weight: 550; line-height: 1.3; }
.lx-t span { display: block; margin-top: 2px; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }
.lx-now { color: var(--brand); flex: none; }

/* ---------- panel de la lección ---------- */
.aula-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.lx-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.lx-head h2 { font-size: 20px; line-height: 1.25; margin-top: 4px; }
.player.hidden { display: none; }
.lx-do { display: flex; gap: 9px; align-items: center; }
.lx-do .btn-block { flex: 1; }
.btn-ok {
  border-color: var(--good);
  color: var(--good);
  background: color-mix(in srgb, var(--good) 12%, transparent);
}
.lx-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

@media (max-width: 900px) {
  .aula-body { grid-template-columns: 1fr; }
  .aula-side { position: static; }
  .side-head { cursor: pointer; }
  .side-head svg { display: block; }
  .aula-side.open .side-head svg { transform: rotate(180deg); }
  .side-list { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
  .aula-side.open .side-list { max-height: 70vh; overflow-y: auto; }
  .lx-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .lx-head .btn { align-self: flex-start; }
  .lx-do { flex-direction: column; align-items: stretch; }
  .lx-nav .btn { flex: 1; }
}

/* El aula: ajustes finos */
.aula-main .player:has(.ph) { aspect-ratio: auto; min-height: 0; }
.aula-main .player .ph { padding: 34px 16px; gap: 10px; }
.aula-side { top: 72px; align-self: start; }
@media (max-width: 900px) { .aula-side { top: auto; } }
