:root{
  --bg:#F7F5FF; --surface:#FFFFFF; --surface-2:#F0ECFF;
  --text:#17132B; --text-dim:#635E7D;
  --accent:#6C4CF1; --accent-strong:#4B2FCF; --accent-soft:#EDE8FF;
  --accent2:#FF4D8D; --accent3:#00C2A8;
  --grad:linear-gradient(135deg,#6C4CF1 0%,#B84CF1 55%,#FF4D8D 100%);
  --hint:#9A5B00; --hint-bg:#FFF3D6; --hint-border:#FFD37A;
  --good:#0A8F6A; --good-bg:#DDF8EE; --good-border:#7FE0BC;
  --border:#E3DDF7; --shadow: 0 1px 2px rgba(60,30,140,.06), 0 10px 30px rgba(108,76,241,.10);
  --radius:18px;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0D0B1A; --surface:#17142B; --surface-2:#211D3D;
    --text:#F1EEFF; --text-dim:#A29DC2;
    --accent:#9D86FF; --accent-strong:#C6B8FF; --accent-soft:#251F4D;
    --accent2:#FF6FA5; --accent3:#2EE6C5;
    --grad:linear-gradient(135deg,#7C5CFF 0%,#C55CFF 55%,#FF5C9A 100%);
    --hint:#FFC55C; --hint-bg:#302410; --hint-border:#6B531F;
    --good:#3EE2A8; --good-bg:#0C2B22; --good-border:#1E6B50;
    --border:#2C2750; --shadow:0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
    --radius:18px;
    color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --bg:#0D0B1A; --surface:#17142B; --surface-2:#211D3D;
    --text:#F1EEFF; --text-dim:#A29DC2;
    --accent:#9D86FF; --accent-strong:#C6B8FF; --accent-soft:#251F4D;
    --accent2:#FF6FA5; --accent3:#2EE6C5;
    --grad:linear-gradient(135deg,#7C5CFF 0%,#C55CFF 55%,#FF5C9A 100%);
    --hint:#FFC55C; --hint-bg:#302410; --hint-border:#6B531F;
    --good:#3EE2A8; --good-bg:#0C2B22; --good-border:#1E6B50;
    --border:#2C2750; --shadow:0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
    --radius:18px;
    color-scheme:dark;
}
*{box-sizing:border-box;}
html,body{ margin:0; }
body{
  background:var(--bg); color:var(--text);
  font-family:"Inter", -apple-system, "Segoe UI", sans-serif;
  background-image:radial-gradient(60rem 30rem at 85% -10%, color-mix(in srgb,var(--accent) 16%,transparent), transparent 60%), radial-gradient(45rem 25rem at -10% 5%, color-mix(in srgb,var(--accent2) 12%,transparent), transparent 60%);
  background-repeat:no-repeat; background-attachment:fixed;
  line-height:1.55;
  padding-inline:16px;
}
h1,h2,h3,.display{ letter-spacing:-.02em; font-family:"Space Grotesk", "Inter", sans-serif; color:var(--text); text-wrap:balance; }
.math{ font-family:"JetBrains Mono", ui-monospace, monospace; }
a{ color:var(--accent-strong); }
.wrap{ max-width:760px; margin:0 auto; }

/* ---- Site-wide top nav (course chrome) ---- */
.site-nav{
  max-width:760px; margin:0 auto; padding-block:14px 0;
  display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;
}
.site-nav .brand{
  font-family:"Space Grotesk", "Inter", sans-serif; font-weight:700; font-size:15.5px; color:var(--text);
  text-decoration:none; display:flex; align-items:center; gap:8px;
}
.site-nav .brand .dot{ width:12px; height:12px; border-radius:4px; background:var(--grad); flex:none; transform:rotate(45deg); }
.site-nav .crumbs{ font-size:13px; color:var(--text-dim); }
.site-nav .crumbs a{ color:var(--text-dim); text-decoration:none; }
.site-nav .crumbs a:hover{ color:var(--accent-strong); }
.site-nav .crumbs a[href="examenes.html"]{ font-weight:600; color:var(--accent-strong); background:var(--accent-soft); padding:5px 11px; border-radius:999px; }

/* header */
header.top{
  position:sticky; top:env(safe-area-inset-top, 0px);
  background:color-mix(in srgb,var(--bg) 82%,transparent); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px);
  padding-block:16px 10px;
  z-index:20;
  border-bottom:1px solid var(--border);
  margin-bottom:20px;
}
.eyebrow{ display:inline-block; font-size:11.5px; letter-spacing:.07em; text-transform:uppercase; color:var(--accent-strong); background:var(--accent-soft); padding:4px 10px; border-radius:999px; font-weight:700; margin-bottom:10px; }
header.top h1{ font-size:28px; font-weight:700; margin:0 0 4px; }
header.top p.sub{ color:var(--text-dim); margin:0 0 14px; font-size:14.5px; }

.progress-row{ display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.progress-track{ flex:1; height:10px; border-radius:999px; background:var(--surface-2); overflow:hidden; border:1px solid var(--border); }
.progress-fill{ height:100%; background:var(--grad); border-radius:999px; width:0%; transition:width .5s cubic-bezier(.3,1.4,.5,1); }
.progress-label{ font-size:12.5px; font-weight:600; color:var(--text-dim); white-space:nowrap; font-variant-numeric:tabular-nums; }

nav.tabs{ display:flex; gap:6px; flex-wrap:wrap; }
nav.tabs button{
  font-family:inherit; font-size:13px; font-weight:600; color:var(--text-dim);
  background:var(--surface-2); border:1px solid var(--border); border-radius:999px;
  padding:7px 14px; cursor:pointer; transition:transform .15s ease;
}
nav.tabs button:hover{ transform:translateY(-1px); color:var(--accent-strong); }
nav.tabs button[aria-selected="true"]{ background:var(--grad); color:#fff; border-color:transparent; box-shadow:0 6px 16px rgba(108,76,241,.35); }
nav.tabs button .count{ opacity:.75; font-weight:500; }

.downloads{ display:flex; gap:8px; margin:2px 0 14px; flex-wrap:wrap; }
.downloads a{
  font-size:12.5px; font-weight:600; text-decoration:none; color:var(--accent-strong);
  background:var(--accent-soft); border:1px solid var(--border); border-radius:8px; padding:6px 10px;
  display:inline-flex; align-items:center; gap:6px;
}

/* theory accordion */
.theory{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); margin-bottom:22px; box-shadow:var(--shadow); }
.theory > summary{ list-style:none; cursor:pointer; padding:14px 16px; display:flex; align-items:center; justify-content:space-between; font-weight:700; gap:10px; }
.theory > summary::-webkit-details-marker{ display:none; }
.theory > summary .chev{ transition:transform .2s ease; color:var(--text-dim); flex:none; }
.theory[open] > summary .chev{ transform:rotate(90deg); }
.theory-body{ padding:0 16px 16px; border-top:1px solid var(--border); }
.theory-body h4{ margin:14px 0 6px; font-size:13.5px; color:var(--accent-strong); font-family:inherit; }
.theory-body ul{ margin:0 0 8px; padding-left:18px; }
.theory-body li{ margin-bottom:5px; font-size:14px; line-height:1.5; }

/* section title */
.section-title{ display:flex; align-items:baseline; gap:10px; margin:26px 0 4px; }
.section-title h2{ font-size:20px; margin:0; }
.section-title span{ color:var(--text-dim); font-size:13.5px; }
.section-intro{ color:var(--text-dim); font-size:14px; margin:0 0 16px; line-height:1.55; }

/* exercise panel */
.panel{ display:none; } .panel.active{ display:block; }

/* card */
.card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:14px 16px 16px; margin-bottom:12px; box-shadow:var(--shadow); }
.card{ transition:transform .18s ease, box-shadow .18s ease; }
.card:hover{ transform:translateY(-2px); }
.card.done{ border-color:var(--good-border); box-shadow:0 0 0 3px color-mix(in srgb,var(--good) 14%,transparent), var(--shadow); }
.card-head{ display:flex; align-items:flex-start; gap:10px; }
.letter{ flex:none; min-width:28px; height:28px; padding:0 6px; border-radius:10px; background:var(--grad); color:#fff; font-weight:700; font-size:12.5px; display:flex; align-items:center; justify-content:center; font-family:"Space Grotesk", sans-serif; }
.card.done .letter{ background:var(--good); color:#fff; }
.statement{ flex:1; padding-top:2px; }
.statement .math{ font-size:14.5px; }
.check-wrap{ flex:none; display:flex; align-items:center; padding-top:4px; }
.check-wrap input{ width:22px; height:22px; accent-color:var(--good); cursor:pointer; }
.card-actions{ display:flex; gap:8px; margin-top:12px; flex-wrap:wrap; }
.card-actions button{ font-family:inherit; font-size:13px; font-weight:600; border-radius:999px; padding:8px 15px; cursor:pointer; border:1px solid var(--border); background:var(--surface-2); color:var(--text); transition:transform .12s ease, filter .12s; }
.card-actions button:hover{ transform:translateY(-1px); filter:brightness(1.05); }
.card-actions button:active{ transform:scale(.97); }
.card-actions button.hint-btn{ color:var(--hint); border-color:var(--hint-border); background:var(--hint-bg); }
.card-actions button.sol-btn{ color:var(--accent-strong); border-color:var(--accent); background:var(--accent-soft); }
.reveal{ margin-top:10px; border-radius:14px; animation:pop .25s ease; padding:11px 13px; font-size:14px; line-height:1.6; }
.reveal.hint{ background:var(--hint-bg); border:1px solid var(--hint-border); color:var(--text); }
.reveal.hint .tag{ color:var(--hint); font-weight:700; font-size:12px; text-transform:uppercase; letter-spacing:.04em; display:block; margin-bottom:4px; }
.reveal.sol{ background:var(--accent-soft); border:1px solid var(--border); color:var(--text); }
.reveal.sol .tag{ color:var(--accent-strong); font-weight:700; font-size:12px; text-transform:uppercase; letter-spacing:.04em; display:block; margin-bottom:6px; }
.reveal ol{ margin:0; padding-left:18px; } .reveal ol li{ margin-bottom:7px; }
.reveal .answer{ margin-top:8px; padding-top:8px; border-top:1px dashed var(--border); font-family:"JetBrains Mono", monospace; font-weight:600; color:var(--good); }
[hidden]{ display:none !important; }
@keyframes pop{ from{ opacity:0; transform:translateY(-6px);} to{ opacity:1; transform:none;} }
:focus-visible{ outline:3px solid var(--accent2); outline-offset:2px; border-radius:6px; }

footer{ color:var(--text-dim); font-size:12.5px; text-align:center; margin:34px 0 24px; line-height:1.6; }

/* prev/next module footer nav */
.module-nav{ display:flex; justify-content:space-between; gap:10px; margin:30px 0 10px; flex-wrap:wrap; }
.module-nav a{
  flex:1; min-width:150px; text-decoration:none; color:var(--text); background:var(--surface);
  border:1px solid var(--border); border-radius:var(--radius); padding:12px 14px; box-shadow:var(--shadow);
}
.module-nav a .mn-label{ display:block; font-size:11.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--text-dim); margin-bottom:3px; }
.module-nav a .mn-title{ font-family:"Space Grotesk", sans-serif; font-weight:600; font-size:14.5px; }
.module-nav a.next{ text-align:right; }
.module-nav a{ transition:transform .15s ease, border-color .15s; }
.module-nav a:hover{ transform:translateY(-3px); border-color:var(--accent); }

/* ============ COURSE HOME (index.html) ============ */
.hero{ max-width:760px; margin:26px auto 6px; }
.hero .eyebrow{ margin-bottom:8px; }
.hero h1{ font-size:clamp(34px,7vw,52px); line-height:1.05; font-weight:700; margin:0 0 14px; background:var(--grad); -webkit-background-clip:text; background-clip:text; color:transparent; }
.hero .chips{ display:flex; flex-wrap:wrap; gap:8px; margin:0 0 22px; }
.hero .chips span{ font-size:13px; font-weight:600; background:var(--surface); border:1px solid var(--border); padding:6px 12px; border-radius:999px; box-shadow:var(--shadow); }
.hero p.lead{ color:var(--text-dim); font-size:16.5px; line-height:1.6; max-width:60ch; margin:0 0 22px; }

.overall{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:16px 18px; margin-bottom:26px; box-shadow:var(--shadow);
  display:flex; align-items:center; gap:16px; flex-wrap:wrap;
}
.overall .ring{ flex:none; }
.overall .ring-text{ flex:1; min-width:180px; }
.overall .ring-text .big{ font-family:"Space Grotesk", sans-serif; font-size:22px; font-weight:600; }
.overall .ring-text .small{ color:var(--text-dim); font-size:13px; }

.modules{ display:flex; flex-direction:column; gap:14px; margin-bottom:30px; }
.module-card{
  display:block; text-decoration:none; color:var(--text);
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:18px 20px; box-shadow:var(--shadow); position:relative; overflow:hidden;
}
.module-card::before{
  content:""; position:absolute; left:0; top:0; bottom:0; width:6px; background:var(--grad);
}
.module-card .mc-top{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:6px; }
.module-card{ transition:transform .2s ease, box-shadow .2s ease; }
.module-card:hover{ transform:translateY(-4px); box-shadow:0 18px 40px rgba(108,76,241,.22); }
.module-card .mc-num{ font-size:12px; letter-spacing:.06em; text-transform:uppercase; color:var(--accent-strong); font-weight:700; }
.module-card .mc-status{ font-size:12px; color:var(--text-dim); font-variant-numeric:tabular-nums; }
.module-card h3{ margin:0 0 6px; font-size:21px; }
.module-card p{ margin:0 0 12px; color:var(--text-dim); font-size:14px; line-height:1.5; }
.module-card .mc-track{ height:6px; border-radius:999px; background:var(--surface-2); overflow:hidden; border:1px solid var(--border); }
.module-card .mc-fill{ height:100%; background:var(--grad); border-radius:999px; transition:width .6s ease; }
.module-card.complete::before{ background:var(--good); }
.module-card.complete .mc-fill{ background:var(--good); }
.module-card.complete .mc-status::after{ content:" 🎉"; }

.resources{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px 18px; margin-bottom:30px; box-shadow:var(--shadow); }
.resources h3{ font-size:15px; margin:0 0 10px; }
.resources ul{ margin:0; padding-left:18px; font-size:14px; line-height:1.9; }

/* ---- Repaso en vídeo (module pages) ---- */
.videos{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px 18px; margin-bottom:22px; box-shadow:var(--shadow); }
.videos h3{ font-size:15px; margin:0 0 4px; }
.videos .videos-note{ color:var(--text-dim); font-size:13px; margin:0 0 12px; line-height:1.5; }
.video-list{ display:flex; flex-direction:column; gap:8px; }
.video-list a{
  display:flex; align-items:center; gap:10px; text-decoration:none; color:var(--text);
  background:var(--surface-2); border:1px solid var(--border); border-radius:10px; padding:9px 12px;
  font-size:13.5px;
}
.video-list a{ transition:transform .15s ease, border-color .15s; }
.video-list a:hover{ border-color:var(--accent2); transform:translateX(4px); }
.video-list a .yt-ico{ flex:none; width:22px; height:16px; border-radius:5px; background:#FF2D55; color:#fff; display:flex; align-items:center; justify-content:center; font-size:9px; font-weight:700; }
.video-list a .v-title{ flex:1; }
.video-list a .v-tag{ flex:none; font-size:11px; color:var(--text-dim); }
.videos .videos-missing{ margin-top:10px; font-size:12.5px; color:var(--text-dim); font-style:italic; }

/* ---- Exámenes page ---- */
.exam-table{ width:100%; border-collapse:collapse; font-size:13.5px; margin-bottom:10px; }
.exam-table th{ text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-dim); padding:8px 10px; border-bottom:1px solid var(--border); }
.exam-table td{ padding:10px; border-bottom:1px solid var(--border); vertical-align:top; }
.exam-table tr:last-child td{ border-bottom:none; }
.exam-table .yr{ font-family:"Space Grotesk", sans-serif; font-weight:600; white-space:nowrap; }
.exam-table .tag{ display:inline-block; font-size:11px; padding:2px 7px; border-radius:6px; background:var(--accent-soft); color:var(--accent-strong); margin-right:4px; margin-bottom:4px; }
.exam-table .doclinks{ display:flex; flex-wrap:wrap; gap:6px; }
.exam-table .doclinks a{
  text-decoration:none; font-weight:600; font-size:12.5px; padding:5px 9px; border-radius:7px; border:1px solid var(--border);
}
.exam-table .doclinks a.sol{ color:var(--good); border-color:var(--good-border); background:var(--good-bg); }
.exam-table .doclinks a.enun{ color:var(--accent-strong); border-color:var(--border); background:var(--accent-soft); }
.exam-table .note{ display:block; color:var(--text-dim); font-size:12px; margin-top:3px; }
.exam-group-title{ margin:26px 0 8px; font-size:16px; }
.exam-group-title:first-of-type{ margin-top:6px; }

/* ---- Celebración ---- */
.confetti{ position:fixed; top:0; width:9px; height:14px; z-index:100; pointer-events:none; animation:fall 1.4s ease-in forwards; }
@keyframes fall{ to{ transform:translateY(105vh) rotate(720deg); opacity:.2; } }
.toast{ position:fixed; left:50%; bottom:24px; transform:translateX(-50%); background:var(--grad); color:#fff; font-weight:700; padding:12px 20px; border-radius:999px; box-shadow:0 12px 30px rgba(108,76,241,.4); z-index:101; animation:pop .25s ease; }
@media (prefers-reduced-motion: reduce){ *{ animation:none !important; transition:none !important; } }

/* phone width */
@media (max-width: 480px){
  .hero h1{ font-size:26px; }
  .module-nav a.next{ text-align:left; }
  .exam-table{ font-size:12.5px; }
}
