/* ==========================================================================
   PRODUCTOS NOTABLES · Estación Orbital de Álgebra
   Design tokens + core styles
   ========================================================================== */

:root{
  /* --- color: deep space --- */
  --void:        #05060f;
  --void-2:      #0a0e1f;
  --void-3:      #10152c;
  --panel:       rgba(16, 21, 44, 0.55);
  --panel-solid: #10152c;
  --border-soft: rgba(148, 163, 224, 0.16);
  --border-glow: rgba(124, 58, 237, 0.45);

  /* --- color: nebula accents --- */
  --nebula-violet:  #7c3aed;
  --nebula-magenta: #ec4899;
  --stellar-cyan:   #22d3ee;
  --solar-gold:     #fbbf24;
  --success:        #34d399;
  --danger:          #fb7185;

  /* --- text --- */
  --text-primary: #e8ecf7;
  --text-muted:   #9aa3c0;
  --text-faint:   #5c6489;

  /* --- typography --- */
  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body:    'Inter', 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* --- geometry --- */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --offcanvas-width: 500px;
  --navbar-h: 76px;

  /* --- motion --- */
  --ease-out: cubic-bezier(.19,1,.22,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --t-fast: 180ms;
  --t-med: 320ms;
  --t-slow: 560ms;

  color-scheme: dark;
}

[data-theme="light"]{
  --void:        #eef0fb;
  --void-2:      #e3e7fa;
  --void-3:      #d8ddf5;
  --panel:       rgba(255, 255, 255, 0.6);
  --panel-solid: #ffffff;
  --border-soft: rgba(60, 70, 140, 0.16);
  --border-glow: rgba(124, 58, 237, 0.35);
  --text-primary: #1a1e33;
  --text-muted:   #4b5278;
  --text-faint:   #8790b3;
  color-scheme: light;
}

/* ===================== RESET ===================== */
*, *::before, *::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin: 0;
  background: var(--void);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--t-med) var(--ease-out), color var(--t-med) var(--ease-out);
}
h1,h2,h3,h4{ font-family: var(--font-display); margin: 0 0 .5em; letter-spacing: .01em; }
p{ margin: 0 0 1em; color: var(--text-muted); }
button{ font-family: inherit; }
img{ max-width: 100%; display: block; }
::selection{ background: var(--nebula-violet); color: #fff; }

a.skip-link{
  position: absolute; left: -999px; top: 0; z-index: 999;
  background: var(--nebula-violet); color: #fff; padding: .6em 1em; border-radius: var(--radius-sm);
}
a.skip-link:focus{ left: 1em; top: 1em; }

/* visible focus ring everywhere, WCAG 2.2 */
:focus-visible{
  outline: 2px solid var(--stellar-cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ===================== BACKGROUND LAYERS ===================== */
.bg-layer{ position: fixed; inset: 0; z-index: -3; pointer-events: none; }
.bg-layer--stars{ z-index: -3; }
.bg-layer--nebula{ z-index: -2; overflow: hidden; }
.bg-layer--grid{
  z-index: -1;
  background-image:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 0%, transparent 70%);
  opacity: .35;
}
.nebula{
  position: absolute; border-radius: 50%;
  filter: blur(70px); opacity: .35; mix-blend-mode: screen;
}
.nebula--1{ width: 46vw; height: 46vw; top: -12vw; left: -10vw; background: radial-gradient(circle, var(--nebula-violet), transparent 70%); }
.nebula--2{ width: 40vw; height: 40vw; top: 30vh; right: -14vw; background: radial-gradient(circle, var(--nebula-magenta), transparent 70%); }
.nebula--3{ width: 34vw; height: 34vw; bottom: -14vw; left: 20vw; background: radial-gradient(circle, var(--stellar-cyan), transparent 70%); }

/* ===================== GLASSMORPHISM ===================== */
.glass{
  background: var(--panel);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--border-soft);
  box-shadow: 0 8px 32px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.04);
}

/* corner-notch "HUD" panel shape used for signature console panels */
.console-panel{
  position: relative;
  padding: 2rem;
  border-radius: var(--radius-lg);
  clip-path: polygon(0 18px, 18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%);
  margin-bottom: 1.5rem;
}
.console-panel__title{
  font-size: 1.3rem;
  color: var(--text-primary);
  display: flex; align-items: center; gap: .6em;
}
.console-panel__title::before{
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--stellar-cyan); box-shadow: 0 0 10px var(--stellar-cyan);
  display: inline-block;
}

/* ===================== NAVBAR ===================== */
.navbar{ position: fixed; top: 14px; left: 0; right: 0; z-index: 100; display: flex; justify-content: center; padding: 0 16px; }
.navbar__inner{
  width: 100%; max-width: 1320px;
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1rem; border-radius: 999px;
  height: var(--navbar-h);
}
.navbar__brand{ display: flex; align-items: center; gap: .7rem; margin-right: auto; }
.navbar__logo{ width: 40px; height: 40px; color: var(--stellar-cyan); flex-shrink: 0; }
.navbar__logo svg{ width: 100%; height: 100%; animation: spin-slow 18s linear infinite; }
.navbar__title{ display: flex; flex-direction: column; line-height: 1.15; }
.navbar__title-main{ font-family: var(--font-display); font-weight: 700; font-size: .95rem; letter-spacing: .06em; }
.navbar__title-sub{ font-size: .7rem; color: var(--text-faint); font-family: var(--font-mono); }

.navbar__nav{ display: flex; gap: .25rem; }
.navbar__link{
  background: transparent; border: none; color: var(--text-muted);
  padding: .55rem 1rem; border-radius: 999px; font-size: .88rem; cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
  white-space: nowrap;
}
.navbar__link:hover{ color: var(--text-primary); background: rgba(255,255,255,.06); }
.navbar__link.is-active{ color: var(--void); background: var(--stellar-cyan); font-weight: 600; }

.navbar__actions{ display: flex; align-items: center; gap: .3rem; }
.navbar__icon-btn{
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid transparent;
  background: transparent; color: var(--text-muted); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--t-fast);
  flex-shrink: 0;
}
.navbar__icon-btn:hover{ color: var(--text-primary); background: rgba(255,255,255,.07); border-color: var(--border-soft); }
.navbar__icon-btn .icon{ width: 20px; height: 20px; }
.navbar__icon-btn--mobile{ display: none; }
[data-theme="light"] .icon--moon{ display: none !important; }
[data-theme="light"] .icon--sun{ display: inline-block !important; }
[data-theme="dark"] .icon--sun{ display: none; }

/* ===================== OFFCANVAS ===================== */
.offcanvas-backdrop{
  position: fixed; inset: 0; z-index: 200; background: rgba(2,3,10,.55);
  opacity: 0; transition: opacity var(--t-med) var(--ease-out);
}
.offcanvas-backdrop.is-visible{ opacity: 1; }
.offcanvas{
  position: fixed; top: 0; bottom: 0; width: min(var(--offcanvas-width), 92vw);
  z-index: 201; display: flex; flex-direction: column;
  transition: transform var(--t-slow) var(--ease-out);
}
.offcanvas--left{ left: 0; transform: translateX(-105%); border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.offcanvas--right{ right: 0; transform: translateX(105%); border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
.offcanvas.is-open{ transform: translateX(0); }
.offcanvas__header{ display: flex; align-items: center; justify-content: space-between; padding: 1.4rem 1.6rem; border-bottom: 1px solid var(--border-soft); }
.offcanvas__title{ font-size: 1.15rem; margin: 0; }
.offcanvas__close{ width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border-soft); background: transparent; color: var(--text-muted); cursor: pointer; display:flex; align-items:center; justify-content:center; }
.offcanvas__close .icon{ width: 18px; height: 18px; }
.offcanvas__close:hover{ color: var(--danger); border-color: var(--danger); }
.offcanvas__body{ padding: 1.6rem; overflow-y: auto; flex: 1; }
.offcanvas__body h3{ font-size: .95rem; color: var(--stellar-cyan); text-transform: uppercase; letter-spacing: .06em; margin-top: 1.6rem; }
.offcanvas__body ul{ padding-left: 1.2rem; color: var(--text-muted); }
.offcanvas__body li{ margin-bottom: .5rem; }
.oc-nav-btn{
  display: block; width: 100%; text-align: left; background: transparent; border: none;
  color: var(--text-muted); padding: .55rem .3rem; cursor: pointer; border-radius: var(--radius-sm);
  font-size: .92rem; transition: all var(--t-fast);
}
.oc-nav-btn:hover{ color: var(--text-primary); background: rgba(255,255,255,.06); padding-left: .7rem; }
.oc-formula{ font-family: var(--font-mono); background: rgba(255,255,255,.04); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: .8rem 1rem; margin: .5rem 0; color: var(--stellar-cyan); }
.oc-tip{ border-left: 3px solid var(--solar-gold); padding: .6rem 1rem; background: rgba(251,191,36,.08); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: .8rem 0; font-size: .9rem; color: var(--text-muted); }

/* ===================== MAIN / VIEWS ===================== */
.main{ position: relative; z-index: 1; max-width: 1320px; margin: 0 auto; padding: calc(var(--navbar-h) + 40px) 24px 100px; }
.view{ display: none; }
.view.is-active{ display: block; animation: view-in var(--t-slow) var(--ease-out); }
.view__title{ font-size: clamp(1.8rem, 3vw, 2.4rem); margin-bottom: .3rem; }
.view__lede{ color: var(--text-muted); margin-bottom: 2rem; }

/* ===================== HERO ===================== */
.hero{ padding: 3rem 0 4rem; max-width: 760px; }
.hero__eyebrow{ font-family: var(--font-mono); font-size: .78rem; letter-spacing: .12em; color: var(--stellar-cyan); margin-bottom: 1rem; }
.hero__title{ font-size: clamp(2.6rem, 6vw, 4.6rem); line-height: 1.05; margin-bottom: 1rem; }
.text-glow{ color: var(--nebula-magenta); text-shadow: 0 0 30px rgba(236,72,153,.6), 0 0 70px rgba(124,58,237,.4); }
.hero__subtitle{ font-size: 1.1rem; max-width: 620px; }
.hero__actions{ display: flex; gap: 1rem; margin-top: 1.5rem; flex-wrap: wrap; }

.btn{
  display: inline-flex; align-items: center; gap: .5em;
  font-family: var(--font-display); font-weight: 600; font-size: .95rem;
  padding: .85rem 1.6rem; border-radius: 999px; cursor: pointer; border: 1px solid transparent;
  transition: transform var(--t-fast) var(--ease-spring), box-shadow var(--t-fast), background var(--t-fast);
}
.btn .icon{ width: 18px; height: 18px; }
.btn:hover{ transform: translateY(-2px); }
.btn:active{ transform: translateY(0px) scale(.98); }
.btn--primary{ background: linear-gradient(135deg, var(--nebula-violet), var(--nebula-magenta)); color: #fff; box-shadow: 0 8px 24px rgba(124,58,237,.4); }
.btn--primary:hover{ box-shadow: 0 12px 32px rgba(236,72,153,.5); }
.btn--ghost{ background: transparent; border-color: var(--border-soft); color: var(--text-primary); }
.btn--ghost:hover{ border-color: var(--stellar-cyan); color: var(--stellar-cyan); }
.btn--danger{ background: transparent; border-color: var(--danger); color: var(--danger); }
.btn:disabled{ opacity: .45; cursor: not-allowed; transform: none; }

/* ===================== STAT STRIP ===================== */
.stat-strip{ display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 3.5rem; }
.stat-card{ padding: 1.4rem 1.2rem; border-radius: var(--radius-md); text-align: center; }
.stat-card__value{ display: block; font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; color: var(--stellar-cyan); }
.stat-card__label{ font-size: .82rem; color: var(--text-muted); }

.section-heading{ font-size: 1.4rem; margin-bottom: 1.4rem; }

/* ===================== ORBIT MAP ===================== */
.orbit-map{ position: relative; min-height: 480px; display: flex; align-items: center; justify-content: center; }
.orbit-ring{ position: absolute; border: 1px dashed var(--border-soft); border-radius: 50%; }
.orbit-node{
  position: absolute; width: 168px; padding: 1rem; border-radius: var(--radius-md);
  text-align: center; cursor: pointer; transform: translate(-50%,-50%);
  transition: transform var(--t-med) var(--ease-spring), box-shadow var(--t-med);
}
.orbit-node:hover{ transform: translate(-50%,-50%) scale(1.08); box-shadow: 0 0 30px var(--border-glow); }
.orbit-node__icon{ font-size: 1.6rem; margin-bottom: .4rem; }
.orbit-node__title{ font-size: .82rem; font-weight: 600; color: var(--text-primary); }
.orbit-node__formula{ font-family: var(--font-mono); font-size: .72rem; color: var(--stellar-cyan); margin-top: .3rem; }
.orbit-center{
  position: absolute; width: 120px; height: 120px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: radial-gradient(circle, var(--nebula-violet), var(--void-2) 70%);
  box-shadow: 0 0 50px rgba(124,58,237,.6);
  font-family: var(--font-display); font-weight: 700; font-size: .85rem; color: #fff;
}

/* ===================== TABS ===================== */
.tabs__list{ display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.6rem; border-bottom: 1px solid var(--border-soft); padding-bottom: 1rem; }
.tabs__tab{
  background: transparent; border: 1px solid var(--border-soft); color: var(--text-muted);
  padding: .6rem 1.1rem; border-radius: 999px; font-size: .85rem; cursor: pointer; transition: all var(--t-fast);
}
.tabs__tab:hover{ color: var(--text-primary); border-color: var(--stellar-cyan); }
.tabs__tab.is-active{ background: var(--stellar-cyan); color: var(--void); border-color: var(--stellar-cyan); font-weight: 600; }
.tabs__panel{ display: none; }
.tabs__panel.is-active{ display: block; animation: fade-slide-up var(--t-med) var(--ease-out); }

.theory-block{ display: grid; grid-template-columns: 1.3fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.theory-block__text h3{ color: var(--stellar-cyan); font-size: 1.1rem; margin-top: 1.4rem; }
.theory-visual{ border-radius: var(--radius-lg); padding: 1.6rem; }
.formula-display{
  font-family: var(--font-mono); font-size: 1.3rem; text-align: center; color: var(--solar-gold);
  padding: 1.6rem; border-radius: var(--radius-md); background: rgba(251,191,36,.06); border: 1px solid rgba(251,191,36,.25);
  margin: 1rem 0;
}
.callout{ border-radius: var(--radius-md); padding: 1.1rem 1.3rem; margin: 1rem 0; font-size: .92rem; }
.callout--error{ background: rgba(251,113,133,.08); border-left: 3px solid var(--danger); color: var(--text-muted); }
.callout--tip{ background: rgba(52,211,153,.08); border-left: 3px solid var(--success); color: var(--text-muted); }
.nested-tabs{ display: flex; gap: .4rem; margin: 1rem 0; }
.nested-tabs__tab{ background: rgba(255,255,255,.05); border: 1px solid var(--border-soft); color: var(--text-muted); border-radius: var(--radius-sm); padding: .4rem .8rem; font-size: .8rem; cursor: pointer; }
.nested-tabs__tab.is-active{ background: var(--nebula-violet); color: #fff; border-color: var(--nebula-violet); }

/* ===================== EXERCISES ===================== */
.exercise-toolbar{ margin-bottom: 1.6rem; max-width: 320px; }
.field{ display: flex; flex-direction: column; gap: .4rem; }
.field__label{ font-size: .8rem; color: var(--text-muted); }
.field__input{
  background: rgba(255,255,255,.04); border: 1px solid var(--border-soft); color: var(--text-primary);
  padding: .7rem 1rem; border-radius: var(--radius-sm); font-family: var(--font-body); font-size: .95rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field__input:focus{ border-color: var(--stellar-cyan); box-shadow: 0 0 0 3px rgba(34,211,238,.15); outline: none; }
.exercise-list{ display: flex; flex-direction: column; gap: 1rem; }
.exercise-card{ padding: 1.4rem 1.6rem; border-radius: var(--radius-md); }
.exercise-card__head{ display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.exercise-card__statement{ font-family: var(--font-mono); font-size: 1.05rem; color: var(--text-primary); }
.exercise-card__tag{ font-size: .72rem; padding: .25rem .6rem; border-radius: 999px; background: rgba(124,58,237,.2); color: #c4b5fd; }
.exercise-card__toggle{ color: var(--stellar-cyan); background: none; border: none; cursor: pointer; font-size: .85rem; }
.exercise-card__steps{ margin-top: 1.2rem; padding-top: 1.2rem; border-top: 1px solid var(--border-soft); display: none; }
.exercise-card.is-open .exercise-card__steps{ display: block; animation: fade-slide-up var(--t-med) var(--ease-out); }
.step-row{ display: flex; gap: 1rem; padding: .7rem 0; }
.step-row__num{ flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--nebula-violet); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; }
.step-row__content{ font-family: var(--font-mono); font-size: .95rem; color: var(--text-primary); }
.step-row__note{ font-family: var(--font-body); font-size: .82rem; color: var(--text-muted); margin-top: .2rem; }
.exercise-card__result{ margin-top: 1rem; font-family: var(--font-mono); color: var(--success); font-size: 1.05rem; }

/* ===================== QUIZ ===================== */
.quiz-stage{ max-width: 900px; margin: 0 auto; }
.form-grid{ display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin: 1.5rem 0 2rem; }
.quiz-hud{ display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.2rem; }
.quiz-hud__progress{ flex: 1; }
#quiz-progress-text{ font-family: var(--font-mono); font-size: .85rem; color: var(--text-muted); }
.progress-bar{ height: 6px; border-radius: 999px; background: rgba(255,255,255,.08); margin-top: .4rem; overflow: hidden; }
.progress-bar__fill{ height: 100%; background: linear-gradient(90deg, var(--nebula-violet), var(--stellar-cyan)); border-radius: 999px; transition: width var(--t-med) var(--ease-out); }
.quiz-hud__timer{
  font-family: var(--font-mono); font-size: 1.4rem; font-weight: 700; color: var(--stellar-cyan);
  width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--stellar-cyan);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.quiz-hud__timer.is-low{ color: var(--danger); border-color: var(--danger); animation: pulse-warn 1s infinite; }
.question-card__statement{ font-size: 1.25rem; margin-bottom: 1.6rem; color: var(--text-primary); }
.options-grid{ display: grid; gap: .8rem; }
.option-btn{
  display: flex; align-items: center; gap: .9rem; text-align: left;
  background: rgba(255,255,255,.03); border: 1px solid var(--border-soft); color: var(--text-primary);
  padding: 1rem 1.2rem; border-radius: var(--radius-md); cursor: pointer; font-size: 1rem; font-family: var(--font-mono);
  transition: all var(--t-fast);
}
.option-btn:hover{ border-color: var(--stellar-cyan); background: rgba(34,211,238,.06); }
.option-btn__letter{ width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: center; font-size: .8rem; flex-shrink: 0; }
.option-btn.is-correct{ border-color: var(--success); background: rgba(52,211,153,.1); }
.option-btn.is-correct .option-btn__letter{ background: var(--success); color: var(--void); border-color: var(--success); }
.option-btn.is-incorrect{ border-color: var(--danger); background: rgba(251,113,133,.1); }
.option-btn.is-incorrect .option-btn__letter{ background: var(--danger); color: var(--void); border-color: var(--danger); }
.option-btn:disabled{ cursor: default; }

/* ===================== DASHBOARD ===================== */
.dashboard{ display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; }
.dashboard__grade{ grid-column: 1 / -1; text-align: center; padding: 2.5rem; border-radius: var(--radius-lg); }
.dashboard__grade-value{ font-family: var(--font-display); font-size: 4.5rem; font-weight: 700; }
.dashboard__grade-level{ font-family: var(--font-mono); letter-spacing: .08em; text-transform: uppercase; font-size: .9rem; margin-top: .4rem; }
.dashboard__metric{ padding: 1.4rem; border-radius: var(--radius-md); text-align: center; }
.dashboard__metric-value{ font-size: 1.8rem; font-family: var(--font-display); font-weight: 700; }
.dashboard__metric-label{ font-size: .8rem; color: var(--text-muted); }
.dashboard__chart{ grid-column: 1 / -1; padding: 1.6rem; border-radius: var(--radius-lg); display: flex; align-items: center; gap: 2rem; flex-wrap: wrap; }
.dashboard__actions{ grid-column: 1 / -1; display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; margin-top: .5rem; }

.donut{ width: 160px; height: 160px; flex-shrink: 0; }
.legend{ display: flex; flex-direction: column; gap: .6rem; }
.legend__item{ display: flex; align-items: center; gap: .6rem; font-size: .9rem; color: var(--text-muted); }
.legend__dot{ width: 12px; height: 12px; border-radius: 50%; }

/* ===================== REVIEW ===================== */
.review-list{ display: flex; flex-direction: column; gap: 1rem; }
.review-item{ padding: 1.4rem 1.6rem; border-radius: var(--radius-md); }
.review-item__head{ display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.review-item__status{ font-size: .75rem; padding: .3rem .7rem; border-radius: 999px; font-weight: 700; flex-shrink: 0; }
.review-item__status.correct{ background: rgba(52,211,153,.15); color: var(--success); }
.review-item__status.incorrect{ background: rgba(251,113,133,.15); color: var(--danger); }
.review-item__row{ margin-top: .6rem; font-size: .92rem; }
.review-item__row b{ color: var(--text-primary); }

/* ===================== RESULTS HISTORY ===================== */
.results-history{ display: flex; flex-direction: column; gap: .8rem; }
.history-row{ display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr auto; gap: 1rem; align-items: center; padding: 1rem 1.4rem; border-radius: var(--radius-md); }
.history-row__name{ font-weight: 600; }
.history-row__meta{ font-size: .82rem; color: var(--text-muted); }
.history-row__grade{ font-family: var(--font-mono); font-weight: 700; font-size: 1.1rem; }
.empty-state{ text-align: center; padding: 3rem; color: var(--text-faint); }

/* ===================== HELP ===================== */
.help-grid{ display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.help-grid h3{ color: var(--stellar-cyan); font-size: 1.05rem; }

/* ===================== MODAL ===================== */
.modal-backdrop{ position: fixed; inset: 0; z-index: 300; background: rgba(2,3,10,.65); opacity: 0; transition: opacity var(--t-med); }
.modal-backdrop.is-visible{ opacity: 1; }
.modal{
  position: fixed; top: 50%; left: 50%; z-index: 301; width: min(560px, 90vw); max-height: 85vh; overflow-y: auto;
  border-radius: var(--radius-lg); padding: 2rem;
  transform: translate(-50%, -50%) scale(.9); opacity: 0;
  transition: transform var(--t-med) var(--ease-spring), opacity var(--t-med);
}
.modal.is-visible{ transform: translate(-50%, -50%) scale(1); opacity: 1; }
.modal__header{ display: flex; align-items: center; gap: 1rem; margin-bottom: 1.2rem; }
.modal__badge{ width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.modal__badge.correct{ background: rgba(52,211,153,.15); color: var(--success); }
.modal__badge.incorrect{ background: rgba(251,113,133,.15); color: var(--danger); }
.modal__title{ flex: 1; font-size: 1.2rem; margin: 0; }
.modal__close{ background: transparent; border: none; color: var(--text-muted); cursor: pointer; width: 32px; height: 32px; }
.modal__body p{ margin-bottom: .8rem; }
.modal__body h4{ font-size: .9rem; color: var(--stellar-cyan); margin: 1rem 0 .3rem; text-transform: uppercase; letter-spacing: .04em; }
.modal__footer{ margin-top: 1.4rem; text-align: right; }

/* ===================== TOAST ===================== */
.toast-container{ position: fixed; bottom: 24px; right: 24px; z-index: 400; display: flex; flex-direction: column; gap: .6rem; }
.toast{ padding: .9rem 1.3rem; border-radius: var(--radius-sm); font-size: .88rem; box-shadow: 0 8px 24px rgba(0,0,0,.4); }

/* ===================== LOADER ===================== */
.loader{ position: fixed; inset: 0; z-index: 1000; background: var(--void); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2rem; transition: opacity var(--t-slow), visibility var(--t-slow); }
.loader.is-hidden{ opacity: 0; visibility: hidden; pointer-events: none; }
.loader__orbit{ position: relative; width: 140px; height: 140px; }
.loader__core{ position: absolute; top: 50%; left: 50%; width: 20px; height: 20px; border-radius: 50%; background: var(--stellar-cyan); box-shadow: 0 0 30px var(--stellar-cyan); transform: translate(-50%,-50%); }
.loader__ring{ position: absolute; inset: 0; border: 1px solid var(--border-soft); border-top-color: var(--nebula-violet); border-radius: 50%; }
.loader__ring--1{ animation: spin 1.4s linear infinite; }
.loader__ring--2{ inset: 20px; animation: spin 2s linear infinite reverse; border-top-color: var(--nebula-magenta); }
.loader__ring--3{ inset: 40px; animation: spin 1.1s linear infinite; border-top-color: var(--solar-gold); }
.loader__label{ font-family: var(--font-mono); font-size: .8rem; letter-spacing: .1em; color: var(--text-muted); }

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar{ width: 10px; }
::-webkit-scrollbar-track{ background: transparent; }
::-webkit-scrollbar-thumb{ background: var(--border-soft); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover{ background: var(--nebula-violet); }

/* reduced motion */
@media (prefers-reduced-motion: reduce){
  *{ animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
