/* =========================================================
   TRIGONOMETRÍA INTERACTIVA — Hoja de estilos
   ========================================================= */
:root {
  --primary: #0ea5e9;
  --primary-dark: #0369a1;
  --secondary: #8b5cf6;
  --accent: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-code: #0f172a;
  --text: #0f172a;
  --text-soft: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08);
  --shadow: 0 10px 30px -8px rgba(15, 23, 42, .15);
  --shadow-lg: 0 25px 50px -12px rgba(15, 23, 42, .25);
  --radius: 12px;
  --radius-lg: 20px;
  --gradient: linear-gradient(135deg, #0ea5e9 0%, #8b5cf6 100%);
  --gradient-soft: linear-gradient(135deg, rgba(14,165,233,.1) 0%, rgba(139,92,246,.1) 100%);
  --transition: .25s cubic-bezier(.4, 0, .2, 1);
  --container: 1180px;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0b1220;
  --bg-card: #111a2e;
  --bg-code: #030712;
  --text: #f1f5f9;
  --text-soft: #cbd5e1;
  --text-muted: #64748b;
  --border: #1e293b;
  --shadow: 0 10px 30px -8px rgba(0, 0, 0, .5);
  --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, .6);
  --gradient-soft: linear-gradient(135deg, rgba(14,165,233,.15) 0%, rgba(139,92,246,.15) 100%);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background var(--transition), color var(--transition);
}
img, svg, canvas { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul, ol { padding-left: 1.5rem; }
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 0 0 0.7em;
}
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); margin-top: 2.5rem; }
h3 { font-size: 1.35rem; margin-top: 2rem; }
h4 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
code, kbd, pre {
  font-family: var(--font-mono);
  font-size: .92em;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.25rem;
}
.container-narrow { max-width: 860px; margin: 0 auto; padding: 0 1.25rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* =========================================================
   Navegación
   ========================================================= */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: all var(--transition);
}
[data-theme="dark"] .navbar { background: rgba(11, 18, 32, .85); }
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 70px;
}
.logo {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text);
}
.logo-mark {
  width: 38px; height: 38px;
  background: var(--gradient);
  border-radius: 10px;
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  box-shadow: 0 6px 14px -4px var(--primary);
}
.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.nav-links a {
  color: var(--text-soft);
  font-weight: 500;
  font-size: .95rem;
  padding: .4rem 0;
  position: relative;
  transition: color var(--transition);
}
.nav-links a:hover, .nav-links a.active {
  color: var(--primary);
}
.nav-links a.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--gradient);
  border-radius: 2px;
}
.nav-actions {
  display: flex; align-items: center; gap: .5rem;
}
.theme-toggle {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 1.1rem;
  transition: all var(--transition);
}
.theme-toggle:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline; }
.hamburger {
  display: none;
  flex-direction: column; gap: 5px;
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  border-radius: 8px;
}
.hamburger span {
  width: 22px; height: 2.5px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition);
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* =========================================================
   Hero
   ========================================================= */
.hero {
  padding: 4rem 0 3rem;
  background: var(--gradient-soft);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
  opacity: .35;
}
.hero-inner { position: relative; z-index: 1; }
.page-title {
  font-size: clamp(2rem, 4vw, 3.2rem);
  margin-bottom: .6rem;
}
.page-subtitle {
  color: var(--text-soft);
  font-size: 1.1rem;
  max-width: 700px;
  margin: 0 auto 0 0;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .85rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 1rem;
}

/* =========================================================
   Secciones
   ========================================================= */
section { padding: 3rem 0; }
.section-head {
  margin-bottom: 2rem;
  text-align: center;
}
.section-tag {
  display: inline-block;
  background: var(--gradient-soft);
  color: var(--primary);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: .3rem .9rem;
  border-radius: 100px;
  margin-bottom: .8rem;
}
.section-title { margin: 0 0 .6rem; }
.section-subtitle {
  color: var(--text-soft);
  max-width: 680px;
  margin: 0 auto;
}

/* =========================================================
   Tarjetas
   ========================================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card h3 { margin-top: 0; }
.card-icon {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  background: var(--gradient-soft);
  color: var(--primary);
  border-radius: 12px;
  font-size: 1.3rem;
  margin-bottom: 1rem;
}
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.2rem;
}

/* Cajas de teoría/cita/nota */
.callout {
  position: relative;
  padding: 1.2rem 1.4rem 1.2rem 3.2rem;
  border-radius: var(--radius);
  margin: 1.5rem 0;
  font-size: .96rem;
  border-left: 4px solid var(--primary);
  background: var(--gradient-soft);
}
.callout::before {
  content: '❖';
  position: absolute;
  top: 1.1rem; left: 1.1rem;
  font-size: 1.2rem;
  color: var(--primary);
}
.callout.definicion::before { content: '📐'; }
.callout.teorema { border-left-color: var(--secondary); }
.callout.teorema::before { content: '△'; color: var(--secondary); }
.callout.nota { border-left-color: var(--warn); }
.callout.nota::before { content: '✦'; color: var(--warn); }
.callout.ejemplo { border-left-color: var(--accent); }
.callout.ejemplo::before { content: '➜'; color: var(--accent); }
.callout.advertencia { border-left-color: var(--danger); }
.callout.advertencia::before { content: '⚠'; color: var(--danger); }
.callout h4 { margin: 0 0 .4rem; font-family: var(--font-sans); font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); }
.callout p:last-child { margin: 0; }

/* Cita */
blockquote.cita, .cita {
  position: relative;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.6;
  padding: 1.5rem 1.5rem 1.5rem 3rem;
  margin: 2rem 0;
  border-left: 4px solid var(--secondary);
  background: var(--bg-card);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--text-soft);
}
blockquote.cita::before {
  content: '“';
  position: absolute;
  top: -.5rem; left: .8rem;
  font-size: 4rem;
  color: var(--secondary);
  font-family: var(--font-serif);
  line-height: 1;
  opacity: .4;
}
blockquote.cita footer {
  font-size: .85rem;
  font-style: normal;
  color: var(--text-muted);
  margin-top: .8rem;
  display: block;
}
blockquote.cita footer strong { color: var(--text); }

/* Fórmula (display) */
.formula {
  display: block;
  text-align: center;
  padding: 1.1rem 1rem;
  margin: 1.2rem 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--text);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.formula strong { color: var(--primary); }
.formula-label {
  display: inline-block;
  background: var(--gradient);
  color: #fff;
  font-size: .75rem;
  padding: .2rem .6rem;
  border-radius: 100px;
  margin-right: .5rem;
  font-family: var(--font-sans);
  font-weight: 600;
}

/* =========================================================
   Calculadoras y herramientas interactivas
   ========================================================= */
.tool {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow);
}
.tool-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}
.tool-head h3 { margin: 0; }
.tool-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.tool-controls {
  display: flex;
  flex-direction: column;
  gap: .9rem;
}
.field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.field label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-soft);
}
.field input, .field select {
  padding: .65rem .8rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  font-size: .95rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field input:focus, .field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14,165,233,.15);
}
.field small { color: var(--text-muted); font-size: .78rem; }

.range-wrap {
  display: flex;
  gap: .8rem;
  align-items: center;
}
.range-wrap input[type="range"] { flex: 1; accent-color: var(--primary); }
.range-value {
  min-width: 64px;
  padding: .25rem .55rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: .85rem;
  text-align: right;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .7rem 1.2rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  transition: all var(--transition);
  border: 2px solid transparent;
  font-family: var(--font-sans);
}
.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 6px 18px -6px var(--primary);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -6px var(--primary); }
.btn-outline { border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { color: var(--text-soft); }
.btn-ghost:hover { color: var(--primary); background: var(--gradient-soft); }
.btn-block { width: 100%; }
.btn-sm { padding: .4rem .85rem; font-size: .82rem; }

/* Resultados */
.results {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: .92rem;
  white-space: pre-wrap;
  max-height: 400px;
  overflow-y: auto;
}
.results strong { color: var(--primary); }
.result-row {
  display: flex;
  justify-content: space-between;
  padding: .35rem 0;
  border-bottom: 1px dashed var(--border);
}
.result-row:last-child { border-bottom: none; }
.result-label { color: var(--text-muted); }
.result-value { color: var(--primary); font-weight: 700; }

/* Lienzo / SVG */
.canvas-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem;
  position: relative;
  min-height: 320px;
}
.canvas-wrap canvas, .canvas-wrap svg {
  width: 100%;
  height: auto;
  cursor: grab;
}
.canvas-wrap canvas:active, .canvas-wrap svg:active { cursor: grabbing; }
.canvas-hint {
  position: absolute;
  bottom: .5rem; right: .7rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: .25rem .7rem;
  font-size: .75rem;
  color: var(--text-muted);
}

/* Pestañas */
.tabs {
  display: flex;
  gap: .35rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: .35rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}
.tab {
  padding: .55rem 1.1rem;
  border-radius: 100px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-soft);
  transition: all var(--transition);
}
.tab.active {
  background: var(--gradient);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.tab:not(.active):hover { color: var(--primary); }

/* =========================================================
   Tablas
   ========================================================= */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.2rem 0;
  box-shadow: var(--shadow-sm);
}
th, td {
  padding: .75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  background: var(--gradient-soft);
  color: var(--primary);
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gradient-soft); }
.table-wrap { overflow-x: auto; }

/* =========================================================
   Quiz
   ========================================================= */
.quiz-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  box-shadow: var(--shadow);
  max-width: 760px;
  margin: 0 auto;
}
.quiz-progress {
  height: 8px;
  background: var(--bg);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.quiz-progress-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 100px;
  transition: width .4s ease;
}
.quiz-meta {
  display: flex;
  justify-content: space-between;
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.quiz-enunciado {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}
.quiz-opciones {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-bottom: 1.5rem;
}
.quiz-option {
  text-align: left;
  padding: .9rem 1.1rem;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius);
  font-size: .95rem;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: .8rem;
}
.quiz-option:hover:not(:disabled) { border-color: var(--primary); }
.quiz-option .letra {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--gradient-soft);
  color: var(--primary);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: .8rem;
  flex-shrink: 0;
}
.quiz-option.correct { border-color: var(--accent); background: rgba(16,185,129,.1); }
.quiz-option.correct .letra { background: var(--accent); color: #fff; }
.quiz-option.incorrect { border-color: var(--danger); background: rgba(239,68,68,.1); }
.quiz-option.incorrect .letra { background: var(--danger); color: #fff; }
.quiz-option:disabled { cursor: not-allowed; opacity: .75; }
.quiz-feedback {
  padding: 1rem;
  border-radius: var(--radius);
  font-size: .92rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--accent);
  background: rgba(16,185,129,.08);
}
.quiz-feedback.bad {
  border-left-color: var(--danger);
  background: rgba(239,68,68,.08);
}
.quiz-controls {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

/* Resultado final quiz */
.quiz-final {
  text-align: center;
  padding: 2rem;
}
.quiz-final .score {
  font-size: 4rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: var(--font-serif);
}
.quiz-final .label { color: var(--text-muted); font-size: .9rem; }

/* =========================================================
   Referencias
   ========================================================= */
.ref-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.5rem;
  padding: .7rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ref-filters input[type="search"] {
  flex: 1;
  min-width: 200px;
  padding: .55rem .8rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  font-size: .9rem;
}
.ref-list {
  display: flex;
  flex-direction: column;
  gap: .8rem;
}
.ref-item {
  padding: 1.2rem 1.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.ref-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.ref-item.hidden { display: none; }
.ref-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
}
.ref-tipo {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  background: var(--gradient-soft);
  color: var(--primary);
  padding: .2rem .6rem;
  border-radius: 100px;
  font-weight: 600;
}
.ref-cita {
  font-size: .95rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: .6rem;
}
.ref-temas {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .5rem;
}
.ref-temas span {
  font-size: .75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: .15rem .55rem;
  border-radius: 100px;
  color: var(--text-muted);
}

/* =========================================================
   Footer
   ========================================================= */
.footer {
  background: var(--bg-code);
  color: #cbd5e1;
  padding: 3rem 0 1.5rem;
  margin-top: 4rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer h4 {
  font-family: var(--font-sans);
  font-size: .9rem;
  color: #fff;
  margin: 0 0 .8rem;
}
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer ul li { margin-bottom: .5rem; }
.footer ul a { color: #94a3b8; font-size: .88rem; }
.footer ul a:hover { color: #fff; }
.footer-brand p { color: #94a3b8; font-size: .88rem; margin: 1rem 0; max-width: 320px; }
.footer-bar {
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .85rem;
  color: #64748b;
  text-align: center;
}

/* =========================================================
   Varios
   ========================================================= */
.tag {
  display: inline-block;
  padding: .15rem .6rem;
  font-size: .75rem;
  font-weight: 600;
  border-radius: 100px;
}
.tag.facil { background: rgba(16,185,129,.15); color: #059669; }
.tag.medio { background: rgba(245,158,11,.15); color: #d97706; }
.tag.dificil { background: rgba(239,68,68,.15); color: #dc2626; }
[data-theme="dark"] .tag.facil { color: #34d399; }
[data-theme="dark"] .tag.medio { color: #fbbf24; }
[data-theme="dark"] .tag.dificil { color: #f87171; }

.vertex-list {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  max-height: 200px;
  overflow-y: auto;
  padding: .5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: .85rem;
}
.vertex-list .vertex-row {
  display: flex;
  gap: .5rem;
  align-items: center;
  padding: .3rem .5rem;
  border-radius: 6px;
}
.vertex-list .vertex-row:hover { background: var(--gradient-soft); }
.vertex-list .remove {
  margin-left: auto;
  color: var(--danger);
  cursor: pointer;
  font-weight: bold;
  padding: 0 .4rem;
}

.anchor-nav {
  position: sticky;
  top: 80px;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.anchor-nav h4 {
  font-family: var(--font-sans);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: var(--text-muted);
  margin: 0 0 .8rem;
}
.anchor-nav ul { list-style: none; padding: 0; margin: 0; }
.anchor-nav li { margin: .2rem 0; }
.anchor-nav a {
  display: block;
  padding: .35rem .7rem;
  border-radius: 8px;
  font-size: .85rem;
  color: var(--text-soft);
  border-left: 2px solid transparent;
  transition: all var(--transition);
}
.anchor-nav a:hover, .anchor-nav a.active {
  color: var(--primary);
  background: var(--gradient-soft);
  border-left-color: var(--primary);
}

.two-col {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
}

/* Toasts */
.toast-container {
  position: fixed;
  top: 1rem; right: 1rem;
  z-index: 200;
  display: flex; flex-direction: column; gap: .5rem;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: .85rem 1.1rem;
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  font-size: .9rem;
  animation: toastIn .3s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}
.toast.success { border-left-color: var(--accent); }
.toast.error { border-left-color: var(--danger); }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 900px) {
  .tool-body { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .anchor-nav { position: static; max-height: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .nav-links {
    position: fixed;
    top: 70px; left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    background: var(--bg-card);
    padding: 1.3rem;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateY(-120%);
    transition: transform var(--transition);
    gap: .6rem;
  }
  .nav-links.open { transform: translateY(0); }
  .nav-links a { width: 100%; padding: .6rem 0; }
  .hamburger { display: flex; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* Accesibilidad */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* Impresión limpia */
@media print {
  .navbar, .footer, .tool, .toast-container, .anchor-nav { display: none; }
  body { background: #fff; color: #000; }
}
