/* ==========================================================================
   Noos — hoja de estilos
   Índice: 1. Tokens · 2. Base · 3. Cabecera · 4. Componentes · 5. Bienvenida
           6. Pruebas · 7. Tareas cronometradas · 8. Informe · 9. Diálogo
           10. Responsive · 11. Movimiento reducido · 12. Impresión
   ========================================================================== */

/* 1. Tokens --------------------------------------------------------------- */
:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1c2330;
  --border: rgba(240, 246, 252, 0.10);
  --border-strong: rgba(240, 246, 252, 0.22);
  --text: #e6edf3;
  --muted: #a3adb9;          /* 7,6:1 sobre --surface */
  --indigo: #6366f1;
  --violet: #8b5cf6;
  --pink: #ec4899;
  --accent-soft: #c7d2fe;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --grad: linear-gradient(120deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  /* Variante más profunda para fondos con texto blanco (contraste AA) */
  --grad-deep: linear-gradient(120deg, #4f46e5 0%, #7c3aed 50%, #be185d 100%);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, "Inter", "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
}

/* 2. Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(99, 102, 241, 0.16), transparent 60%),
    radial-gradient(800px 480px at 95% 0%, rgba(236, 72, 153, 0.10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: 1.4rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
li { margin-bottom: 0.35em; }
a { color: var(--accent-soft); }
code { font-family: var(--mono); font-size: 0.9em; background: rgba(255, 255, 255, 0.07); padding: 0.1em 0.4em; border-radius: 6px; }
svg { display: block; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.svg-defs { position: absolute; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: 8px; transition: top 0.2s var(--ease); }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 3px solid #a5b4fc; outline-offset: 3px; border-radius: 6px; }
main:focus, h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

main {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}
.view { animation: view-in 0.28s var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } }

.footer { padding: 18px 20px 28px; text-align: center; color: var(--muted); font-size: 0.82rem; }
.footer p { max-width: 720px; margin: 0 auto; }

/* 3. Cabecera -------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(13, 17, 23, 0.78);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1040px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 28px; height: 28px; }
.brand-name { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.global-progress { flex: 1; min-width: 0; }
.gp-label { font-size: 0.75rem; color: var(--muted); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }

/* 4. Componentes ----------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, rgba(28, 35, 48, 0.82), rgba(22, 27, 34, 0.82));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card > :last-child { margin-bottom: 0; }
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-title svg { width: 20px; height: 20px; flex: none; color: var(--violet); }
.card-title h2, .card-title h3 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid2 > .card { margin-bottom: 0; min-width: 0; }
.grid2 { margin-bottom: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 650; color: var(--text);
  padding: 12px 22px; min-height: 46px;
  border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface-2); cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background-color 0.2s var(--ease), border-color 0.2s var(--ease), opacity 0.2s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover:not(:disabled) { transform: translateY(-1px); border-color: rgba(165, 180, 252, 0.6); background: #232c3b; }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--grad-deep); border-color: transparent; color: #fff; box-shadow: 0 8px 22px rgba(124, 58, 237, 0.35); }
.btn.primary:hover:not(:disabled) { background: var(--grad-deep); box-shadow: 0 12px 28px rgba(124, 58, 237, 0.5); filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 12px; min-height: 36px; font-size: 0.85rem; border-radius: 10px; }
.btn.danger:hover:not(:disabled) { border-color: var(--bad); color: #fecaca; }
.btn kbd { font-family: var(--mono); font-size: 0.75em; padding: 1px 6px; border-radius: 5px; background: rgba(255, 255, 255, 0.16); }

.bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.09); overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--grad); transition: width 0.5s var(--ease); }

.badge {
  display: inline-flex; align-items: center; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 3px 9px; border-radius: 99px; color: #e0e7ff;
  background: rgba(99, 102, 241, 0.22); border: 1px solid rgba(129, 140, 248, 0.45);
}
.chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 12px; border-radius: 99px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); font-size: 0.85rem; }
.chip b { color: var(--accent-soft); }

.callout { border-radius: var(--radius-sm); padding: 14px 16px; margin: 0 0 1em; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.04); font-size: 0.94rem; }
.callout.warn { border-color: rgba(251, 191, 36, 0.45); background: rgba(251, 191, 36, 0.08); }
.callout.info { border-color: rgba(129, 140, 248, 0.45); background: rgba(99, 102, 241, 0.10); }
.callout > :last-child { margin-bottom: 0; }

.table-wrap { overflow-x: auto; margin: 0 0 1em; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 650; }
tbody th { font-weight: 600; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: #232c3b; border: 1px solid var(--border-strong); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); max-width: min(92vw, 520px); animation: view-in 0.3s var(--ease) both; }
.toast.error { border-color: var(--bad); }

/* 5. Bienvenida ------------------------------------------------------------ */
.hero { padding: 26px 0 18px; }
.eyebrow { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-soft); margin-bottom: 12px; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 1.1rem; color: #c9d1d9; max-width: 62ch; }
.factor-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 4px; padding: 0; list-style: none; }
.factor-chips li { margin: 0; }
.consent { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: 12px; cursor: pointer; transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease); }
.consent:hover { border-color: rgba(165, 180, 252, 0.6); background: rgba(255, 255, 255, 0.03); }
.consent input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--violet); flex: none; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; align-items: center; }
.history-list { list-style: none; padding: 0; margin: 0 0 14px; }
.history-item { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); margin: 0; }
.history-item:last-child { border-bottom: 0; }
.history-item .h-main { flex: 1; min-width: 0; }
.history-item .h-date { font-size: 0.82rem; color: var(--muted); }
.history-item .h-iq { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* 6. Pruebas --------------------------------------------------------------- */
.stage { max-width: 820px; margin-left: auto; margin-right: auto; position: relative; }
.stage-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.stage-head h2 { margin: 0; font-size: 1.2rem; }
.item-count { margin-left: auto; color: var(--muted); font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.timer { display: flex; align-items: center; gap: 10px; margin: 10px 0 18px; }
.timer .bar { flex: 1; height: 4px; }
.timer .bar > span { background: var(--accent-soft); transition: width 0.2s linear, background-color 0.3s; }
.timer.low .bar > span { background: var(--warn); }
.timer-txt { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); min-width: 3.2em; text-align: right; }
.timer.low .timer-txt { color: var(--warn); }
.prompt { font-size: 1.05rem; font-weight: 600; margin-bottom: 16px; }
.stem { font-size: 1.2rem; font-weight: 600; margin-bottom: 18px; }
.stem em { font-style: normal; color: var(--accent-soft); }
.premises { margin: 0 0 14px; padding: 14px 18px; border-left: 3px solid var(--violet); background: rgba(255, 255, 255, 0.04); border-radius: 0 10px 10px 0; font-size: 1.08rem; }
.premises p { margin: 0 0 0.3em; }
.stage-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }

.opts { display: grid; gap: 10px; }
.opts.textual { grid-template-columns: 1fr; }
.opts.textual.two { grid-template-columns: 1fr 1fr; }
.opts.visual { grid-template-columns: repeat(3, 1fr); }
.opts.visual.cols-4 { grid-template-columns: repeat(4, 1fr); }
.opt {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  font: inherit; color: var(--text); text-align: left;
  padding: 12px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.035); border: 1.5px solid var(--border-strong);
  cursor: pointer;
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), background-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.opt:hover:not(:disabled) { border-color: #a5b4fc; background: rgba(129, 140, 248, 0.10); transform: translateY(-1px); }
.opt.selected { border-color: #a5b4fc; background: rgba(99, 102, 241, 0.24); box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.28); }
.opt.correct { border-color: var(--ok); background: rgba(74, 222, 128, 0.12); }
.opt:disabled { cursor: default; opacity: 1; }
.opt-key { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; font-size: 0.78rem; font-weight: 700; color: var(--muted); background: rgba(255, 255, 255, 0.07); }
.opt.selected .opt-key { background: #6366f1; color: #fff; }
.opt.correct .opt-key { background: #15803d; color: #fff; }
.opts.visual .opt { flex-direction: column; padding: 10px; gap: 6px; }
.opts.visual .opt-key { position: absolute; top: 8px; left: 8px; }
.opts.visual .opt-body { width: 100%; max-width: 120px; }
.opt-body svg { width: 100%; height: auto; }

.mx-wrap { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 26px; align-items: center; }
.mx-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--border); border-radius: 14px; }
.mx-cell { aspect-ratio: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; display: grid; place-items: center; }
.mx-cell svg { width: 100%; height: 100%; }
.mx-missing { font-size: 2rem; font-weight: 800; color: var(--violet); border: 2px dashed rgba(139, 92, 246, 0.7); background: rgba(139, 92, 246, 0.08); }
.fig { stroke: #e6edf3; stroke-linejoin: round; stroke-linecap: round; }

.rot-wrap { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 26px; align-items: center; }
.rot-target { text-align: center; }
.rot-target .rot-box { background: rgba(0, 0, 0, 0.28); border: 1px solid var(--border); border-radius: 14px; padding: 8px; }
.rot-target figcaption { font-size: 0.8rem; color: var(--muted); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.08em; }
figure { margin: 0; }
.poly { fill: #818cf8; stroke: #0d1117; stroke-width: 1.5; }

.series { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.series-chip { min-width: 58px; padding: 12px 14px; text-align: center; font-family: var(--mono); font-size: 1.3rem; font-weight: 600; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; }
.series-chip.q { color: #c4b5fd; border: 2px dashed rgba(139, 92, 246, 0.7); background: rgba(139, 92, 246, 0.08); }
.field { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.field label { font-weight: 600; }
.num-input {
  font: inherit; font-family: var(--mono); font-size: 1.3rem; color: var(--text);
  width: 190px; max-width: 100%; padding: 10px 14px; border-radius: 12px;
  background: var(--bg); border: 1.5px solid var(--border-strong);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.num-input:focus { outline: none; border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.3); }
.unit { color: var(--muted); }

.intro-lead { font-size: 1.05rem; color: #c9d1d9; }
.steps { padding-left: 1.2em; }
.example { border: 1px dashed var(--border-strong); border-radius: 14px; padding: 16px; margin: 0 0 18px; background: rgba(0, 0, 0, 0.18); }
.example-label { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ok); margin-bottom: 10px; }
.example .explain { margin: 12px 0 0; font-size: 0.94rem; color: #c9d1d9; }
.example .mx-wrap { grid-template-columns: minmax(0, 200px) minmax(0, 1fr); }
.example .rot-wrap { grid-template-columns: minmax(0, 140px) minmax(0, 1fr); }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.pause-overlay {
  border-radius: var(--radius-sm); border: 1px dashed var(--border-strong);
  background: rgba(0, 0, 0, 0.2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 48px 24px;
}

/* 7. Tareas cronometradas -------------------------------------------------- */
.task { text-align: center; }
.task .stage-head { text-align: left; }
.nb-stim, .digit-stim {
  width: 170px; height: 170px; margin: 18px auto; display: grid; place-items: center;
  font-size: 5rem; font-weight: 800; font-family: var(--mono);
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 24px;
}
.nb-stim.flash { border-color: #a5b4fc; box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.3); }
.big-btn { min-width: 240px; min-height: 60px; font-size: 1.05rem; touch-action: manipulation; }
.feedback { min-height: 1.8em; margin: 12px 0 0; font-weight: 600; }
.feedback.ok { color: var(--ok); }
.feedback.bad { color: var(--bad); }
.rt-pad {
  width: 210px; height: 210px; margin: 20px auto; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.1rem; font-weight: 700; color: var(--muted);
  background: var(--bg); border: 2px solid var(--border-strong);
  cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation;
  font-family: inherit;
}
.rt-pad.go { background: var(--grad-deep); color: #fff; border-color: transparent; box-shadow: 0 0 60px rgba(139, 92, 246, 0.55); }
.rt-pad svg { width: 110px; height: 110px; }
.rt-choices { display: flex; gap: 14px; justify-content: center; }
.rt-choices .btn { min-width: 130px; min-height: 60px; touch-action: manipulation; }
.pair-show { font-size: clamp(1.6rem, 5vw, 2.4rem); font-weight: 800; margin: 44px 0; min-height: 1.4em; }
.pair-show .dash { color: var(--violet); margin: 0 0.4em; }
.dots { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); }
.dots i.on { background: var(--violet); }

/* 8. Informe --------------------------------------------------------------- */
.demo-banner { border-color: rgba(251, 191, 36, 0.5); background: rgba(251, 191, 36, 0.08); }
.iq-hero { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.iq-figure { text-align: center; min-width: 190px; }
.iq-big { font-size: clamp(4rem, 12vw, 6rem); font-weight: 800; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.iq-caption { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 6px; }
.iq-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.scale { position: relative; height: 46px; margin-top: 16px; }
.scale-track { position: absolute; left: 0; right: 0; top: 14px; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.09); }
.scale-ci { position: absolute; top: 14px; height: 8px; border-radius: 99px; background: var(--grad); opacity: 0.55; animation: fade-in 0.8s 0.3s var(--ease) both; }
.scale-mark { position: absolute; top: 7px; width: 4px; height: 22px; margin-left: -2px; border-radius: 3px; background: #fff; animation: fade-in 0.8s 0.5s var(--ease) both; }
.scale-ticks { position: absolute; left: 0; right: 0; top: 30px; font-size: 0.7rem; color: var(--muted); }
.scale-ticks span { position: absolute; transform: translateX(-50%); font-variant-numeric: tabular-nums; }
@keyframes fade-in { from { opacity: 0; } }

.radar { width: 100%; max-width: 400px; margin: 0 auto; }
.radar .ring { fill: none; stroke: rgba(255, 255, 255, 0.10); }
.radar .ring.mid { stroke: rgba(255, 255, 255, 0.34); stroke-dasharray: 4 4; }
.radar .axis { stroke: rgba(255, 255, 255, 0.10); }
.radar .area { fill: rgba(139, 92, 246, 0.28); stroke: url(#grad-accent); stroke-width: 2.5; stroke-linejoin: round; transform-origin: 200px 190px; animation: radar-in 1s 0.15s var(--ease) both; }
.radar .pt { fill: #fff; stroke: #8b5cf6; stroke-width: 2; animation: fade-in 0.5s 0.9s both; }
.radar text { fill: var(--text); font-size: 12px; font-weight: 600; }
.radar text.sub { fill: var(--muted); font-size: 11px; font-weight: 500; }
.radar text.tick { fill: var(--muted); font-size: 9px; font-weight: 500; }
@keyframes radar-in { from { transform: scale(0); opacity: 0; } }

.pbars { display: grid; gap: 12px; }
.pbar-row { display: grid; grid-template-columns: 200px 1fr 52px; gap: 12px; align-items: center; }
.pbar-label { font-size: 0.9rem; }
.pbar-label small { display: block; color: var(--muted); font-size: 0.76rem; }
.pbar { position: relative; height: 14px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); }
.pbar::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: rgba(255, 255, 255, 0.35); }
.pbar > span { display: block; height: 100%; width: var(--w); min-width: 6px; border-radius: inherit; background: var(--grad); animation: grow 1s var(--ease) both; animation-delay: var(--d, 0s); }
@keyframes grow { from { width: 0; } }
.pbar-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.axis-note { font-size: 0.78rem; color: var(--muted); margin-top: 12px; }

.sw-list { list-style: none; padding: 0; margin: 0 0 1em; }
.sw-list li { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--border); margin: 0; }
.sw-list li:last-child { border-bottom: 0; }
.tag-up, .tag-down { flex: none; font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.tag-up { color: #bbf7d0; background: rgba(74, 222, 128, 0.14); border: 1px solid rgba(74, 222, 128, 0.4); }
.tag-down { color: #fde68a; background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.4); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin: 0 0 1em; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.verdict { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--border-strong); margin-bottom: 12px; }
.verdict.v0 { color: #bbf7d0; border-color: rgba(74, 222, 128, 0.45); }
.verdict.v1 { color: #fde68a; border-color: rgba(251, 191, 36, 0.45); }
.verdict.v2 { color: #fecaca; border-color: rgba(248, 113, 113, 0.5); }
.recs h3 { margin-top: 1.2em; }
.recs h3:first-of-type { margin-top: 0; }
.export-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* 9. Diálogo --------------------------------------------------------------- */
dialog {
  width: min(860px, 94vw); max-height: 88vh; padding: 0; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
dialog[open] { display: flex; flex-direction: column; animation: view-in 0.3s var(--ease) both; }
dialog::backdrop { background: rgba(1, 4, 9, 0.72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.dlg-head h2 { margin: 0; }
.dlg-body { padding: 20px 22px 26px; overflow-y: auto; }
.prose h3 { margin-top: 1.5em; color: var(--accent-soft); }
.prose h3:first-child { margin-top: 0; }
.prose { font-size: 0.96rem; }
.refs { font-size: 0.86rem; color: var(--muted); }

/* 10. Responsive ----------------------------------------------------------- */
@media (max-width: 760px) {
  main { padding: 18px 14px 36px; }
  .card { padding: 18px; }
  .grid2 { grid-template-columns: 1fr; }
  .mx-wrap, .rot-wrap, .example .mx-wrap, .example .rot-wrap { grid-template-columns: 1fr; justify-items: center; gap: 18px; }
  .mx-grid { width: min(100%, 280px); }
  .example .mx-grid { width: min(100%, 200px); }
  .rot-target { width: 170px; }
  .opts.visual, .opts.visual.cols-4 { width: 100%; }
  .opts.visual.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .opts.textual.two { grid-template-columns: 1fr; }
  .iq-hero { grid-template-columns: 1fr; gap: 16px; }
  .pbar-row { grid-template-columns: 1fr 44px; }
  .pbar-label { grid-column: 1 / -1; }
  .topbar-inner { gap: 10px; padding: 8px 14px; }
  .topbar-actions .btn span { display: none; }
  .brand-name { display: none; }
  .stage-foot .btn { flex: 1; }
}

/* 11. Movimiento reducido -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* 12. Impresión ------------------------------------------------------------ */
@media print {
  body { background: #fff; color: #000; }
  .topbar, .footer, .export-row, .no-print { display: none !important; }
  .card { box-shadow: none; border-color: #bbb; background: #fff; break-inside: avoid; }
  .muted, .pbar-label small { color: #444; }
}
