/* ==========================================================================
   EXPEDIENTE · sistema visual
   Papel, tinta, sello y sala de situación. Sin degradados genéricos.
   ========================================================================== */

:root {
  --paper: #f2eee3;
  --paper-2: #e9e2d0;
  --panel: #fbf8ef;
  --panel-2: #f6f1e2;
  --ink: #1c1a17;
  --ink-2: #3b382f;
  --muted: #655f4e;
  --line: #d3cab5;
  --line-strong: #1c1a17;
  --accent: #c23f18;
  --accent-bright: #d9481f;
  --accent-soft: rgba(194, 63, 24, 0.12);
  --blue: #1f5c8b;
  --blue-soft: rgba(31, 92, 139, 0.12);
  --green: #2b7355;
  --green-soft: rgba(43, 115, 85, 0.13);
  --gold: #b8862a;
  --gold-soft: rgba(184, 134, 42, 0.16);
  --danger: #a8281d;
  --danger-soft: rgba(168, 40, 29, 0.12);
  --shadow: 4px 4px 0 rgba(28, 26, 23, 0.92);
  --shadow-sm: 2px 2px 0 rgba(28, 26, 23, 0.9);
  --radius: 3px;
  --font-display: "Petrona", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Archivo", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  --topbar-h: 70px;
  --rail-w: 218px;
}

[data-theme="dark"] {
  --paper: #14161a;
  --paper-2: #101216;
  --panel: #1b1e24;
  --panel-2: #20242b;
  --ink: #eee7d7;
  --ink-2: #d4ccba;
  --muted: #9b9484;
  --line: #343943;
  --line-strong: #eee7d7;
  --accent: #ff6b3d;
  --accent-bright: #ff7d55;
  --accent-soft: rgba(255, 107, 61, 0.14);
  --blue: #6cb2e0;
  --blue-soft: rgba(108, 178, 224, 0.14);
  --green: #63c295;
  --green-soft: rgba(99, 194, 149, 0.14);
  --gold: #e0b44a;
  --gold-soft: rgba(224, 180, 74, 0.16);
  --danger: #ff8a7a;
  --danger-soft: rgba(255, 138, 122, 0.14);
  --shadow: 4px 4px 0 rgba(0, 0, 0, 0.75);
  --shadow-sm: 2px 2px 0 rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(28, 26, 23, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, transparent 0 49px, rgba(28, 26, 23, 0.035) 49px 50px);
  background-size: 4px 4px, 50px 100%;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

[data-theme="dark"] body {
  background-image:
    radial-gradient(rgba(238, 231, 215, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, transparent 0 49px, rgba(238, 231, 215, 0.03) 49px 50px);
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
ul, ol { margin: 0; padding: 0; }
li { list-style: none; }
svg { display: block; flex: none; }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.skip {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  border: 2px solid var(--ink);
  transform: translateY(-160%);
  transition: transform 0.15s ease;
}
.skip:focus { transform: translateY(0); }

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.small { font-size: 13px; }
.muted { color: var(--muted); }
.link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1.5px solid currentColor;
  padding-bottom: 1px;
}
.link:hover { color: var(--accent); }

.tag {
  display: inline-block;
  padding: 3px 8px;
  border: 1.5px solid var(--line-strong);
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1.5px solid var(--line);
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: 11.5px;
  white-space: nowrap;
}

/* ---------- topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--topbar-h);
  padding: 0 clamp(14px, 2.5vw, 30px);
  background: var(--paper);
  border-bottom: 2px solid var(--line-strong);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.brand__mark { color: var(--ink); }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text strong {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.18em;
}
.brand__text small {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.topbar__mid { margin-left: auto; }

.exswitch {
  display: flex;
  border: 2px solid var(--line-strong);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.exswitch__btn {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-right: 1.5px solid var(--line);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.exswitch__btn:last-child { border-right: 0; }
.exswitch__btn:hover { background: var(--panel-2); }
.exswitch__btn.is-on {
  background: var(--ink);
  color: var(--paper);
}
.exswitch__dot {
  width: 8px;
  height: 8px;
  border: 1.5px solid currentColor;
  background: transparent;
}
.exswitch__dot--cti { background: var(--accent); border-color: var(--accent); }
.exswitch__dot--redes { background: var(--blue); border-color: var(--blue); }
.exswitch__dot--mixto {
  background: linear-gradient(135deg, var(--accent) 0 50%, var(--blue) 50% 100%);
}

.topbar__right { display: flex; align-items: center; gap: 10px; }
.topstats { display: flex; align-items: center; gap: 8px; }
.topstats__item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 38px;
  padding: 0 10px;
  border: 1.5px solid var(--line);
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: 12px;
}
.topstats__item:hover { border-color: var(--line-strong); }
.topstats__level { gap: 6px; }
.topstats__xp {
  display: block;
  width: 44px;
  height: 4px;
  background: var(--line);
  overflow: hidden;
}
.topstats__xp i { display: block; height: 100%; background: var(--accent); }

.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1.5px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}
.iconbtn:hover { border-color: var(--line-strong); background: var(--panel-2); }
.iconbtn--top { border: 1.5px solid var(--line); }

/* ---------- shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-h));
}

.rail {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 22px 14px 18px;
  border-right: 1.5px solid var(--line);
  background: color-mix(in srgb, var(--paper) 82%, var(--panel));
  overflow-y: auto;
}

.rail__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px 16px;
  margin-bottom: 8px;
  border-bottom: 1.5px dashed var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.rail__item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 0 12px;
  border: 1.5px solid transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.rail__item:hover { background: var(--panel-2); border-color: var(--line); }
.rail__item.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.rail__foot {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 16px 10px 0;
  border-top: 1.5px dashed var(--line);
}
.rail__stamp {
  display: inline-block;
  padding: 5px 7px;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.15;
  letter-spacing: 0.14em;
  text-align: center;
  transform: rotate(-5deg);
}

main {
  min-width: 0;
  padding: clamp(18px, 3vw, 38px) clamp(16px, 3vw, 42px) 70px;
  outline: none;
}

.view {
  max-width: 1320px;
  margin: 0 auto;
  animation: viewIn 0.32s ease both;
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 17px;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  text-align: center;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: var(--shadow); }
.btn:active { transform: translate(1px, 1px); box-shadow: none; }
.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--shadow-sm);
}
.btn--primary {
  background: var(--accent);
  border-color: var(--line-strong);
  color: #fffaf2;
}
[data-theme="dark"] .btn--primary { color: #14161a; }
.btn--primary:hover { background: var(--accent-bright); }
.btn--ghost { background: var(--panel); }
.btn--ghost:hover { background: var(--panel-2); }
.btn--quiet {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
}
.btn--quiet:hover { color: var(--ink); background: var(--panel-2); box-shadow: none; transform: none; }
.btn--danger { background: var(--danger); color: #fffaf2; }
[data-theme="dark"] .btn--danger { color: #14161a; }
.btn--tiny { min-height: 34px; padding: 0 11px; font-size: 11px; }
.btn--big { min-height: 54px; padding: 0 24px; font-size: 13px; }
.btn--block { width: 100%; }

/* ---------- page head ---------- */

.pagehead {
  margin-bottom: 26px;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.pagehead--row {
  max-width: none;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.pagehead--row > div:first-child {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  flex: 1 1 420px;
}
.pagehead--row > div:not(:first-child) { flex: none; }
.pagehead h1 {
  order: 1;
  margin: 0 0 2px;
  font-size: clamp(34px, 5vw, 54px);
  letter-spacing: -0.025em;
}
.pagehead .kicker { order: 2; margin-bottom: 10px; }
.pagehead p { order: 3; color: var(--muted); max-width: 62ch; }

/* ---------- hero ---------- */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: clamp(20px, 4vw, 48px);
  align-items: center;
  padding: clamp(24px, 4vw, 46px);
  margin-bottom: 22px;
  background: var(--panel);
  border: 2px solid var(--line-strong);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero::after {
  content: "EN ESTUDIO";
  position: absolute;
  top: 20px;
  right: 18px;
  padding: 5px 9px;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  transform: rotate(6deg);
  opacity: 0.85;
  pointer-events: none;
}
.hero__main h1 {
  margin: 12px 0 14px;
  font-size: clamp(38px, 6vw, 66px);
  line-height: 0.98;
  letter-spacing: -0.03em;
}
.hero__main h1 .hero__accent {
  color: var(--accent);
}
.hero__sub {
  max-width: 58ch;
  color: var(--ink-2);
  font-size: 16.5px;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0 18px;
}
.hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.hero__side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-left: clamp(0px, 2vw, 24px);
  border-left: 1.5px dashed var(--line);
}
.hero__date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero__sidefoot {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
}
.hero__sidefoot strong { display: block; font-size: 14px; color: var(--ink); }

/* ---------- ring / bar / stats ---------- */

.ring { position: relative; width: var(--size, 128px); height: var(--size, 128px); flex: none; }
.ring svg { width: 100%; height: 100%; }
.ring__label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
}
.ring__label strong {
  font-family: var(--font-display);
  font-size: calc(var(--size, 128px) * 0.23);
  font-weight: 600;
}
.ring__label strong span { font-size: 0.55em; }
.ring__label small {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.bar {
  height: 7px;
  background: var(--line);
  overflow: hidden;
  border: 1px solid var(--line);
}
.bar i { display: block; height: 100%; transition: width 0.5s ease; }

.statbox {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1.5px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.statbox__label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.statbox__value {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 600;
  line-height: 1;
}
.statbox__sub { font-size: 11.5px; color: var(--muted); }

.statsrow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

/* ---------- panels ---------- */

.panel {
  background: var(--panel);
  border: 2px solid var(--line-strong);
  box-shadow: var(--shadow);
  min-width: 0;
}
.panel__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1.5px solid var(--line);
  flex-wrap: wrap;
}
.panel__head > div {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  min-width: 0;
}
.panel__head .kicker { order: 2; }
.panel__head h2 { order: 1; font-size: 22px; }
.panel__body { padding: 18px; }

.homegrid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.homegrid--bottom { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.homeside { display: flex; flex-direction: column; gap: 16px; }
.examgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }

/* ---------- topic rows ---------- */

.topicgroup + .topicgroup { margin-top: 24px; }
.topicgroup__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding-bottom: 7px;
  border-bottom: 1.5px dashed var(--line);
}
.topicgroup__head strong { font-family: var(--font-display); font-size: 18px; }
.topicgroup__head .link { margin-left: auto; }

.topicrows { display: flex; flex-direction: column; }
.topicrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 6px 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.topicrow:last-child { border-bottom: 0; }
.topicrow__main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.topicrow__num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 2px 4px;
  flex: none;
}
.topicrow__name { min-width: 0; }
.topicrow__name a {
  display: block;
  font-weight: 600;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topicrow__name a:hover { color: var(--accent); }
.topicrow__name small { display: block; font-size: 11px; color: var(--muted); }
.topicrow__pct {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  color: var(--ink-2);
}
.topicrow__bar { grid-column: 1; }
.topicrow__bar .bar { height: 5px; }
.topicrow__actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 7px;
  padding-left: 33px;
}
.topicrows.is-compact .topicrow { grid-template-columns: minmax(0, 1fr) 90px; }

/* ---------- exam card ---------- */

.examcard {
  padding: 18px;
  background: var(--panel);
  border: 2px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.examcard__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.examcard__head h3 { margin-top: 4px; font-size: 25px; }
.examcard__tag { margin: 10px 0 12px; color: var(--muted); font-size: 14px; }
.examcard__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
}
.examcard__foot { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }

/* ---------- plan / focus / machete ---------- */

.plan { display: flex; flex-direction: column; gap: 2px; }
.plan__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
}
.plan__item:last-child { border-bottom: 0; }
.plan__item:hover { background: var(--panel-2); }
.plan__ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--line-strong);
  flex: none;
}
.plan__item strong { display: block; font-size: 14px; }
.plan__item small { display: block; color: var(--muted); font-size: 11.5px; }
.plan__item > div { min-width: 0; }
.plan__state {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  flex: none;
}
.plan__item.is-done .plan__ico { border-color: var(--green); color: var(--green); }
.plan__item.is-done .plan__state { color: var(--green); }

.focuslist { display: flex; flex-direction: column; gap: 3px; }
.focusitem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 6px;
  border-bottom: 1px solid var(--line);
}
.focusitem:last-child { border-bottom: 0; }
.focusitem:hover { background: var(--panel-2); }
.focusitem__exam {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 5px;
  border: 1px solid var(--line);
  color: var(--muted);
  flex: none;
}
.focusitem > div { flex: 1; min-width: 0; }
.focusitem strong { display: block; font-size: 13.5px; margin-bottom: 4px; }
.focusitem__pct { font-family: var(--font-mono); font-size: 12px; flex: none; }

.panel--machete { background: var(--panel-2); }
.machete__text {
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.35;
  margin-bottom: 12px;
}

/* ---------- wrong list / streak ---------- */

.wronglist li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.wronglist li:last-child { border-bottom: 0; }
.wronglist__tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.wronglist p { margin-top: 3px; font-size: 14px; }

.strip { display: flex; gap: 6px; justify-content: space-between; margin-bottom: 14px; }
.strip__day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 2px;
  border: 1.5px solid var(--line);
  background: var(--panel);
}
.strip__day span { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.strip__day i {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--line);
  font-style: normal;
}
.strip__day small { font-family: var(--font-mono); font-size: 11px; color: var(--muted); min-height: 12px; }
.strip__day.is-on { border-color: var(--green); background: var(--green-soft); }
.strip__day.is-on i { border-color: var(--green); color: var(--green); }

/* ---------- setup ---------- */

.setup {
  background: var(--panel);
  border: 2px solid var(--line-strong);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 30px);
  max-width: 820px;
}
.setup__field { margin-bottom: 22px; }
.setup__field .kicker { margin-bottom: 8px; display: block; }

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  border: 2px solid var(--line-strong);
  background: var(--panel-2);
  box-shadow: var(--shadow-sm);
}
.seg {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-right: 1.5px solid var(--line);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.seg:last-child { border-right: 0; }
.seg:hover { background: var(--panel); }
.seg.is-on { background: var(--ink); color: var(--paper); }
.segmented--sm .seg { min-height: 36px; padding: 0 11px; font-size: 11px; }

.select {
  width: 100%;
  max-width: 520px;
  min-height: 46px;
  padding: 0 12px;
  border: 2px solid var(--line-strong);
  background: var(--panel);
  border-radius: 0;
  font-size: 14px;
}

.setup__summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 26px 0 20px;
  padding: 14px 0;
  border-top: 1.5px dashed var(--line);
  border-bottom: 1.5px dashed var(--line);
}
.setup__summary > div {
  flex: 1;
  min-width: 90px;
  display: flex;
  flex-direction: column;
}
.setup__summary strong { font-family: var(--font-display); font-size: 26px; line-height: 1; }
.setup__summary span {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}
.setup__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.setup__hint {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--muted);
}
.setup__hint svg { margin-top: 2px; }

/* ---------- question card ---------- */

.qcard {
  background: var(--panel);
  border: 2px solid var(--line-strong);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 30px);
  position: relative;
}
.qcard::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--accent);
}
.qcard__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.qcard__meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.qcard__tools { display: flex; align-items: center; gap: 10px; }
.qcard__q {
  font-size: clamp(21px, 2.6vw, 29px);
  line-height: 1.25;
  margin-bottom: 22px;
  max-width: 60ch;
}
.flagmark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--gold);
}

.options { display: flex; flex-direction: column; gap: 9px; }
.option {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 58px;
  padding: 10px 15px;
  border: 2px solid var(--line-strong);
  background: var(--panel);
  text-align: left;
  font-size: 15px;
  line-height: 1.35;
  transition: background 0.12s ease, transform 0.1s ease;
}
.option:hover:not(:disabled) { background: var(--panel-2); transform: translateX(2px); }
.option:disabled { cursor: default; opacity: 1; }
.option__key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: none;
  border: 1.5px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}
.option__text { flex: 1; }
.option__mark { color: var(--green); flex: none; }
.option.is-selected { border-color: var(--blue); background: var(--blue-soft); }
.option.is-selected .option__key { border-color: var(--blue); color: var(--blue); }
.option.is-correct { border-color: var(--green); background: var(--green-soft); }
.option.is-correct .option__key { border-color: var(--green); color: var(--green); }
.option.is-wrong { border-color: var(--danger); background: var(--danger-soft); }
.option.is-wrong .option__key { border-color: var(--danger); color: var(--danger); }
.option.is-wrong .option__mark { color: var(--danger); }

.fill__row { display: flex; gap: 9px; flex-wrap: wrap; }
.fill label {
  display: block;
  margin-bottom: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.fill input {
  flex: 1;
  min-width: 220px;
  min-height: 50px;
  padding: 0 14px;
  border: 2px solid var(--line-strong);
  background: var(--panel);
  font-size: 16px;
}
.fill__hint { margin-top: 8px; font-size: 12px; color: var(--muted); }

.feedback {
  margin-top: 20px;
  padding: 15px 17px;
  border: 2px solid var(--line-strong);
  border-left-width: 7px;
  background: var(--panel-2);
}
.feedback.is-ok { border-left-color: var(--green); background: var(--green-soft); }
.feedback.is-bad { border-left-color: var(--danger); background: var(--danger-soft); }
.feedback__head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.feedback__head strong { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.feedback.is-ok .feedback__head { color: var(--green); }
.feedback.is-bad .feedback__head { color: var(--danger); }
.feedback__answer { margin-bottom: 6px; font-size: 14.5px; }
.feedback__why { color: var(--ink-2); font-size: 14.5px; }
.feedback__actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.feedback__timeout {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--danger);
  margin-bottom: 6px;
}

.keyhint {
  margin-top: 14px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--muted);
}

/* ---------- sprint ---------- */

.sprintbar, .exambar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 20px;
  background: var(--paper);
  border: 2px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.sprintbar__left, .exambar__left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.sprintbar__left strong, .exambar__left strong { display: block; font-size: 14px; }
.sprintbar__right, .exambar__right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sprintbar__bar, .exambar__bar { flex-basis: 100%; }
.sprintbar__bar .bar, .exambar__bar .bar { height: 5px; }
.sprintbar__bar > i {
  display: block;
  height: 5px;
  background: var(--accent);
  transition: width 0.35s ease;
}
.combo {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: 1.5px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}
.combo.is-hot { border-color: var(--gold); background: var(--gold-soft); color: var(--ink); }
.chip--timer { border-color: var(--line-strong); font-weight: 600; }
.qtimer { height: 4px; background: var(--line); margin-bottom: 8px; }
.qtimer i { display: block; height: 100%; background: var(--blue); transition: width 0.1s linear; }
.sprintwrap { max-width: 900px; margin: 0 auto; }

/* ---------- results ---------- */

.resultgrid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}
.resultcard {
  background: var(--panel);
  border: 2px solid var(--line-strong);
  box-shadow: var(--shadow);
  padding: 22px;
}
.resultcard:not(.resultcard--list) {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.resultcard__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; width: 100%; }
.resultcard__stats .statbox { padding: 10px; box-shadow: none; }
.resultcard__stats .statbox__value { font-size: 20px; }
.resultcard__stats .statbox__label { font-size: 8.5px; }
.resultcard h2 { font-size: 23px; margin-bottom: 12px; }
.resultcard--list { min-height: 100%; }

.misslist li { padding: 11px 0; border-bottom: 1px solid var(--line); }
.misslist li:last-child { border-bottom: 0; }
.misslist p { margin: 5px 0 3px; font-size: 14px; font-weight: 500; }
.misslist small { color: var(--muted); font-size: 12.5px; }

.resultactions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 4px; }
.resultactions--inline { margin-top: 16px; }

/* ---------- flashcards ---------- */

.cardwrap { max-width: 760px; margin: 0 auto; }
.flipcard {
  perspective: 1600px;
  min-height: 360px;
  cursor: pointer;
  margin-bottom: 18px;
}
.flipcard__inner {
  position: relative;
  width: 100%;
  min-height: 360px;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.flipcard.is-flipped .flipcard__inner { transform: rotateY(180deg); }
.flipcard__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: clamp(24px, 5vw, 48px);
  text-align: center;
  background: var(--panel);
  border: 2px solid var(--line-strong);
  box-shadow: var(--shadow);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.flipcard__front::after {
  content: "FICHA";
  position: absolute;
  top: 16px;
  left: 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--muted);
}
.flipcard__back { transform: rotateY(180deg); background: var(--panel-2); border-left: 7px solid var(--accent); }
.flipcard__q {
  font-family: var(--font-display);
  font-size: clamp(24px, 3.4vw, 36px);
  line-height: 1.2;
  max-width: 24ch;
}
.flipcard__back p { font-size: clamp(16px, 1.8vw, 19px); line-height: 1.55; max-width: 52ch; }
.flipcard__hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.cardgrades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 4px; }
.cardgrades--hidden { display: flex; justify-content: center; }
.grade {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 64px;
  padding: 10px 12px;
  border: 2px solid var(--line-strong);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  text-align: left;
}
.grade:hover { transform: translate(-1px, -1px); box-shadow: var(--shadow); }
.grade strong { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.grade small { font-size: 11px; color: var(--muted); }
.grade--again { border-left: 6px solid var(--danger); }
.grade--good { border-left: 6px solid var(--blue); }
.grade--easy { border-left: 6px solid var(--green); }

/* ---------- games ---------- */

.gamegrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.gamecard {
  position: relative;
  padding: 24px;
  background: var(--panel);
  border: 2px solid var(--line-strong);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.gamecard__num {
  position: absolute;
  top: 16px;
  right: 18px;
  font-family: var(--font-display);
  font-size: 42px;
  color: var(--muted);
  line-height: 1;
}
.gamecard h2 { font-size: 32px; }
.gamecard p { color: var(--muted); font-size: 14.5px; max-width: 44ch; }
.gamecard__best {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 9px 0;
  margin: 4px 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  width: 100%;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.gamecard__best span { display: inline-flex; align-items: center; gap: 5px; }
.gamecard__best strong { color: var(--ink); }
.gamewrap { max-width: 900px; margin: 0 auto; }
.matchprompt {
  padding: 24px;
  margin-bottom: 16px;
  background: var(--panel);
  border: 2px solid var(--line-strong);
  border-left: 7px solid var(--blue);
  box-shadow: var(--shadow);
}
.matchprompt p {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: clamp(21px, 2.8vw, 29px);
  line-height: 1.3;
}
.matchoptions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.matchopt {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 62px;
  padding: 10px 14px;
  border: 2px solid var(--line-strong);
  background: var(--panel);
  text-align: left;
  font-size: 14.5px;
}
.matchopt:hover:not(:disabled) { background: var(--panel-2); }
.matchopt.is-correct { border-color: var(--green); background: var(--green-soft); }
.matchopt.is-wrong { border-color: var(--danger); background: var(--danger-soft); }
.gametimebar { height: 5px; background: var(--line); }
.gametimebar i { display: block; height: 100%; background: var(--gold); transition: width 0.1s linear; }
.orderhint {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 14px;
  font-size: 13.5px;
  color: var(--muted);
}
.orderlist { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.orderlist li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 14px;
  border: 2px dashed var(--line);
  background: var(--panel-2);
  font-size: 14.5px;
}
.orderlist li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  flex: none;
}
.orderlist li em { color: var(--muted); font-style: normal; font-size: 12.5px; }
.orderlist li.is-filled { border-style: solid; border-color: var(--line-strong); background: var(--panel); }
.orderlist li.is-filled span { border-color: var(--green); color: var(--green); }
.orderpool { display: flex; flex-wrap: wrap; gap: 8px; }
.orderchip {
  min-height: 44px;
  padding: 8px 14px;
  border: 2px solid var(--line-strong);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  font-size: 13.5px;
  text-align: left;
}
.orderchip:hover:not(:disabled) { background: var(--panel-2); transform: translateY(-1px); }
.orderchip.is-used { opacity: 0.25; box-shadow: none; }
.orderchip.is-shake { border-color: var(--danger); background: var(--danger-soft); animation: shake 0.36s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.orderreview { counter-reset: ord; }
.orderreview li {
  counter-increment: ord;
  padding: 7px 0 7px 34px;
  border-bottom: 1px solid var(--line);
  position: relative;
  font-size: 14px;
}
.orderreview li::before {
  content: counter(ord);
  position: absolute;
  left: 0;
  top: 7px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ---------- exam simulator ---------- */

.exambar__timer {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 2px solid var(--line-strong);
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
}
.exambar__timer.is-danger { border-color: var(--danger); color: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.examlayout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 16px; align-items: start; }
.examwrap { min-width: 0; }
.examnav { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.examsheet {
  position: sticky;
  top: calc(var(--topbar-h) + 96px);
  padding: 16px;
  background: var(--panel);
  border: 2px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.navgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin: 11px 0 13px; }
.navdot {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  min-height: 34px;
  border: 1.5px solid var(--line);
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: 11px;
}
.navdot:hover { border-color: var(--line-strong); }
.navdot.is-done { background: var(--blue-soft); border-color: var(--blue); }
.navdot.is-flag { border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold-soft); }
.navdot.is-current { outline: 2px solid var(--line-strong); outline-offset: 1px; background: var(--ink); color: var(--paper); }
.examsheet__legend {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
}
.examsheet__legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border: 1.5px solid var(--line-strong); display: inline-block; }
.dot--done { background: var(--blue); border-color: var(--blue); }
.dot--current { background: var(--ink); border-color: var(--ink); }
.dot--flag { border-color: var(--gold); background: var(--gold-soft); }

.reviewpanel { margin-bottom: 16px; }
.reviewitem { border: 1.5px solid var(--line); margin-bottom: 7px; background: var(--panel); }
.reviewitem[open] { border-color: var(--line-strong); }
.reviewitem summary {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  cursor: pointer;
  list-style: none;
}
.reviewitem summary::-webkit-details-marker { display: none; }
.reviewitem__num { font-family: var(--font-mono); font-size: 11px; color: var(--muted); flex: none; }
.reviewitem__q { flex: 1; font-size: 13.5px; }
.reviewitem__state { flex: none; }
.reviewitem.is-ok .reviewitem__state { color: var(--green); }
.reviewitem.is-bad .reviewitem__state { color: var(--danger); }
.reviewitem__body { padding: 0 14px 13px 36px; }
.reviewitem__line { font-size: 13px; margin-bottom: 5px; }
.reviewitem__why { font-size: 13px; color: var(--muted); margin-top: 7px; }
.topicbreakdown { display: flex; flex-direction: column; gap: 10px; }
.topicbreakdown__row > div {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.topicbreakdown__row strong { font-size: 13px; }
.topicbreakdown__row span:last-child { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

/* ---------- library ---------- */

.libtabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--line-strong);
  overflow-x: auto;
}
.libtab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.libtab:hover { color: var(--ink); background: var(--panel-2); }
.libtab.is-on { color: var(--ink); border-bottom-color: var(--accent); }

.library { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 22px; align-items: start; }
.libindex {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  padding: 14px;
  background: var(--panel);
  border: 2px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - var(--topbar-h) - 32px);
  overflow-y: auto;
}
.libindex__list { margin-top: 10px; display: flex; flex-direction: column; }
.libindex__item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
}
.libindex__item:last-child { border-bottom: 0; }
.libindex__item > span { font-family: var(--font-mono); font-size: 11px; color: var(--muted); flex: none; }
.libindex__item > div { flex: 1; min-width: 0; }
.libindex__item strong { display: block; font-size: 12.5px; line-height: 1.25; margin-bottom: 4px; }
.libindex__item small { font-family: var(--font-mono); font-size: 11px; color: var(--muted); flex: none; }
.libindex__item .bar { height: 3px; }
.libindex__item:hover { background: var(--panel-2); }
.libindex__item.is-on { background: var(--ink); color: var(--paper); }
.libindex__item.is-on > span, .libindex__item.is-on small { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.libindex__item.is-on .bar { background: color-mix(in srgb, var(--paper) 25%, transparent); }
.libcontent { min-width: 0; }
.libcontent__meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }

/* ---------- sheet ---------- */

.sheet {
  background: var(--panel);
  border: 2px solid var(--line-strong);
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 44px);
}
.sheet__head {
  border-bottom: 2px solid var(--line-strong);
  padding-bottom: 20px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.sheet__head h1 { order: 1; margin: 0 0 2px; font-size: clamp(30px, 4vw, 44px); letter-spacing: -0.02em; }
.sheet__head .kicker { order: 2; margin-bottom: 12px; }
.sheet__lead { order: 3; font-size: 17px; color: var(--ink-2); max-width: 66ch; }
.sheet__section { margin-bottom: 26px; }
.sheet__section h2 {
  font-size: 24px;
  margin-bottom: 10px;
  padding-left: 12px;
  border-left: 4px solid var(--accent);
  line-height: 1.2;
}
.sheet__section p { max-width: 74ch; margin-bottom: 10px; }
.sheet__section ul { display: flex; flex-direction: column; gap: 7px; max-width: 76ch; }
.sheet__section li {
  position: relative;
  padding-left: 18px;
  font-size: 15px;
}
.sheet__section li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 7px;
  height: 7px;
  background: var(--accent);
}
.table-wrap { overflow-x: auto; margin: 12px 0; border: 1.5px solid var(--line-strong); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 460px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  background: var(--panel-2);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--line-strong);
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel-2); }

.note {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 14px 0;
  padding: 13px 15px;
  border: 1.5px solid var(--line-strong);
  border-left-width: 6px;
  background: var(--panel-2);
}
.note strong { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.note p { font-size: 14px; margin: 0; }
.note--warn { border-left-color: var(--gold); background: var(--gold-soft); }
.note--warn strong { color: var(--gold); }
.note--info { border-left-color: var(--blue); background: var(--blue-soft); }
.note--info strong { color: var(--blue); }

.mnemonic {
  margin-top: 26px;
  padding: 18px;
  background: var(--panel-2);
  border: 2px dashed var(--line-strong);
}
.mnemonic .kicker { margin-bottom: 7px; }
.mnemonic p { font-family: var(--font-display); font-size: 19px; line-height: 1.4; }
.sheet__foot { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 26px; padding-top: 18px; border-top: 1.5px dashed var(--line); }
.sheetnav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- glossary / machete ---------- */

.glossary__bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.searchbox {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 240px;
  max-width: 520px;
  min-height: 48px;
  padding: 0 13px;
  border: 2px solid var(--line-strong);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.searchbox input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 15px;
}
.searchbox__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--line);
  background: var(--panel-2);
}
.glosslist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.glossitem {
  padding: 14px 16px;
  background: var(--panel);
  border: 1.5px solid var(--line-strong);
  border-top: 4px solid var(--blue);
}
.glossitem header { display: flex; justify-content: space-between; gap: 9px; align-items: flex-start; margin-bottom: 5px; }
.glossitem h3 { font-size: 18px; }
.glossitem p { font-size: 13.5px; color: var(--ink-2); }

.machete__intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 18px;
  margin-bottom: 16px;
  background: var(--panel);
  border: 2px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.machete__intro h2 { margin: 5px 0 6px; font-size: 28px; }
.machete__intro p { color: var(--muted); font-size: 14px; max-width: 62ch; }
.machete__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cheat {
  position: relative;
  padding: 18px;
  background: var(--panel);
  border: 1.5px solid var(--line-strong);
  border-top: 5px solid var(--accent);
}
.cheat:nth-child(3n) { border-top-color: var(--blue); }
.cheat:nth-child(4n) { border-top-color: var(--gold); }
.cheat__num { position: absolute; top: 12px; right: 14px; font-family: var(--font-mono); font-size: 11px; color: var(--line); }
.cheat h3 { font-size: 20px; margin-bottom: 9px; padding-right: 26px; }
.cheat ul { display: flex; flex-direction: column; gap: 6px; }
.cheat li { position: relative; padding-left: 14px; font-size: 13px; line-height: 1.45; }
.cheat li::before { content: "—"; position: absolute; left: 0; color: var(--accent); }

/* ---------- progress ---------- */

.progresshero {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.progresshero__level {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px;
  background: var(--panel);
  border: 2px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.progresshero__level strong { display: block; font-family: var(--font-display); font-size: 26px; line-height: 1.1; }
.progresshero__level small { color: var(--muted); font-size: 12px; }
.progresshero__stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.progressgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }

.weekchart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  height: 150px;
  padding-top: 14px;
}
.weekchart__col { display: flex; flex-direction: column; align-items: center; gap: 5px; flex: 1; height: 100%; justify-content: flex-end; }
.weekchart__val { font-family: var(--font-mono); font-size: 11px; color: var(--muted); min-height: 14px; }
.weekchart__track {
  width: 100%;
  max-width: 38px;
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.weekchart__track i { display: block; width: 100%; background: var(--line); transition: height 0.4s ease; }
.weekchart__track i.is-on { background: var(--accent); }
.weekchart__day { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

.badges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1.5px dashed var(--line);
  background: var(--panel-2);
}
.badge.is-earned { border-style: solid; border-color: var(--line-strong); background: var(--panel); }
.badge:not(.is-earned) strong { color: var(--muted); }
.badge__ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--line);
  flex: none;
}
.badge.is-earned .badge__ico { border-color: var(--accent); color: var(--accent); }
.badge strong { display: block; font-size: 12.5px; line-height: 1.2; }
.badge small { display: block; font-size: 11px; color: var(--muted); line-height: 1.3; }
.badge__date, .badge__lock { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--muted); flex: none; }

.attempts { display: flex; flex-direction: column; gap: 2px; }
.attempt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 7px;
  border-bottom: 1px solid var(--line);
}
.attempt:last-child { border-bottom: 0; }
.attempt__date { font-family: var(--font-mono); font-size: 11px; color: var(--muted); width: 48px; flex: none; }
.attempt > div { flex: 1; min-width: 0; }
.attempt strong { display: block; font-size: 13px; }
.attempt small { font-size: 11px; color: var(--muted); }
.attempt__pct { font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.attempt__tag {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  padding: 3px 6px;
  border: 1px solid currentColor;
  flex: none;
}
.attempt.is-pass .attempt__pct, .attempt.is-pass .attempt__tag { color: var(--green); }
.attempt.is-fail .attempt__pct, .attempt.is-fail .attempt__tag { color: var(--danger); }

.databox__actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

/* ---------- empty ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 42px 20px;
  text-align: center;
  border: 1.5px dashed var(--line);
  background: var(--panel-2);
}
.empty__ico { color: var(--line); }
.empty h3 { font-size: 23px; }
.empty p { color: var(--muted); max-width: 48ch; font-size: 14px; }
.empty .btn { margin-top: 8px; }

/* ---------- modal / toasts ---------- */

.modalback {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(20, 18, 15, 0.62);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.16s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: clamp(20px, 3vw, 32px);
  background: var(--panel);
  border: 2px solid var(--line-strong);
  box-shadow: 8px 8px 0 rgba(20, 18, 15, 0.55);
  animation: modalIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.modal--wide { width: min(680px, 100%); }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--line);
  background: var(--panel);
}
.modal__close:hover { border-color: var(--line-strong); background: var(--panel-2); }
.modal__title { font-size: clamp(26px, 4vw, 34px); margin: 7px 0 10px; padding-right: 40px; }
.modal__text { color: var(--muted); font-size: 14.5px; margin-bottom: 18px; }
.modal__actions { display: flex; flex-wrap: wrap; gap: 9px; justify-content: flex-end; margin-top: 20px; }

.settings__group {
  padding: 15px 0;
  border-top: 1.5px dashed var(--line);
}
.settings__group > .kicker { display: block; margin-bottom: 8px; }
.settings__toggles { display: flex; flex-direction: column; gap: 10px; }
.field { display: block; margin-bottom: 11px; }
.field span {
  display: block;
  margin-bottom: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input {
  width: 100%;
  min-height: 46px;
  padding: 0 11px;
  border: 2px solid var(--line-strong);
  background: var(--panel);
  font-size: 14px;
}
.switch {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  cursor: pointer;
}
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__ui {
  position: relative;
  flex: none;
  width: 44px;
  height: 25px;
  margin-top: 2px;
  border: 2px solid var(--line-strong);
  background: var(--panel-2);
  transition: background 0.15s ease;
}
.switch__ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  background: var(--ink);
  transition: transform 0.15s ease;
}
.switch input:checked + .switch__ui { background: var(--accent-soft); border-color: var(--accent); }
.switch input:checked + .switch__ui::after { transform: translateX(19px); background: var(--accent); }
.switch input:focus-visible + .switch__ui { outline: 3px solid var(--blue); outline-offset: 2px; }
.switch strong { display: block; font-size: 13.5px; }
.switch small { display: block; font-size: 11.5px; color: var(--muted); }
.settings__danger { border-top-color: var(--danger); }

.intro__steps { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 6px; }
.intro__steps li { display: flex; gap: 12px; align-items: flex-start; }
.intro__steps li > span {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 6px;
  border: 1.5px solid var(--line-strong);
  flex: none;
}
.intro__steps strong { display: block; font-size: 14px; }
.intro__steps small { display: block; font-size: 12px; color: var(--muted); }

#toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  transform: translateX(-50%);
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-mono);
  font-size: 11.5px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  text-align: center;
}
.toast.is-in { opacity: 1; transform: none; }
.toast--badge { background: var(--gold); border-color: var(--ink); color: #1c1a17; }
.toast--info { background: var(--blue); border-color: var(--ink); color: #fffaf2; }

.burst { position: fixed; inset: 0; pointer-events: none; z-index: 130; }
.burst i {
  position: absolute;
  left: 50%;
  top: 55%;
  width: 8px;
  height: 8px;
  animation: burstOut 0.9s ease-out forwards;
}
@keyframes burstOut {
  from { transform: translate(0, 0) rotate(0); opacity: 1; }
  to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; }
}

/* ---------- footer ---------- */

.footer {
  border-top: 2px solid var(--line-strong);
  background: var(--paper-2);
  padding: 26px clamp(16px, 3vw, 42px) 30px;
}
.footer__inner { max-width: 1320px; margin: 0 auto; display: flex; flex-direction: column; gap: 6px; }
.footer p { font-size: 12px; color: var(--muted); }
.footer strong { color: var(--ink); font-family: var(--font-mono); letter-spacing: 0.1em; font-size: 11px; }
.footer__small { max-width: 70ch; }
.footer__sign {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}

.tabbar { display: none; }

/* ---------- responsive ---------- */

@media (max-width: 1120px) {
  :root { --rail-w: 0px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  main { padding-bottom: 96px; }
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    display: flex;
    justify-content: space-around;
    gap: 2px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--paper);
    border-top: 2px solid var(--line-strong);
  }
  .tabbar__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 58px;
    min-height: 52px;
    padding: 4px 6px;
    font-family: var(--font-mono);
    font-size: 8.5px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    border: 1.5px solid transparent;
  }
  .tabbar__item.is-on { color: var(--ink); border-color: var(--line-strong); background: var(--panel); }
  .footer { padding-bottom: 86px; }
}

@media (max-width: 980px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero__side {
    flex-direction: row;
    justify-content: flex-start;
    padding-left: 0;
    padding-top: 18px;
    border-left: 0;
    border-top: 1.5px dashed var(--line);
  }
  .hero::after { display: none; }
  .homegrid, .homegrid--bottom, .progressgrid { grid-template-columns: minmax(0, 1fr); }
  .examgrid { grid-template-columns: minmax(0, 1fr); }
  .resultgrid { grid-template-columns: minmax(0, 1fr); }
  .library { grid-template-columns: minmax(0, 1fr); }
  .libindex { position: static; max-height: 280px; }
  .libindex__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
  .examlayout { grid-template-columns: minmax(0, 1fr); }
  .examsheet { position: static; }
  .progresshero { grid-template-columns: minmax(0, 1fr); }
  .glosslist { grid-template-columns: minmax(0, 1fr); }
  .machete__grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  :root { --topbar-h: 62px; }
  .topbar { gap: 8px; padding: 0 12px; }
  .brand__text small { display: none; }
  .brand__text strong { font-size: 13px; letter-spacing: 0.13em; }
  .brand__mark svg { width: 26px; height: 26px; }
  .exswitch__btn { padding: 0 9px; min-height: 34px; font-size: 11px; }
  .exswitch__dot { width: 6px; height: 6px; }
  .topstats__item { padding: 0 7px; height: 34px; font-size: 11px; }
  .topstats__xp { display: none; }
  .iconbtn--top { width: 36px; height: 36px; }
  .statsrow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { padding: 20px 18px; }
  .hero__main h1 { font-size: clamp(34px, 9vw, 46px); }
  .hero__sub { font-size: 15px; }
  .hero__actions .btn { flex: 1; }
  .pagehead h1 { font-size: 34px; }
  .setup { padding: 18px; }
  .seg { padding: 0 12px; font-size: 11px; min-height: 40px; }
  .qcard { padding: 18px 16px 18px 20px; }
  .option { min-height: 56px; font-size: 14.5px; padding: 10px 12px; }
  .resultcard { padding: 16px; }
  .resultcard__stats { grid-template-columns: minmax(0, 1fr); }
  .cardgrades { grid-template-columns: minmax(0, 1fr); }
  .matchoptions { grid-template-columns: minmax(0, 1fr); }
  .gamegrid { grid-template-columns: minmax(0, 1fr); }
  .flipcard, .flipcard__inner { min-height: 320px; }
  .progresshero__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .badges { grid-template-columns: minmax(0, 1fr); }
  .libindex__list { grid-template-columns: minmax(0, 1fr); }
  .sprintbar, .exambar { padding: 9px 11px; gap: 8px; }
  .sprintbar__left strong, .exambar__left strong { font-size: 12px; }
  .exambar__timer { font-size: 15px; padding: 6px 10px; }
  .exambar__right .btn { min-height: 38px; }
  .navgrid { grid-template-columns: repeat(8, 1fr); }
  .sheet { padding: 18px 15px; }
  .sheet__section h2 { font-size: 21px; }
  table { font-size: 12.5px; }
  .table--2 { min-width: 0; }
  th, td { padding: 7px 9px; }
  .footer { padding: 20px 14px 84px; }
  .modal { padding: 20px 16px; }
}

@media (max-width: 480px) {
  .brand__text { display: none; }
  .exswitch__btn { padding: 0 7px; }
  .topstats__item[title="Racha de días"] { display: none; }
  .hero__side { flex-direction: column; align-items: stretch; }
  .hero__side .ring { align-self: center; }
  .cta-extra { display: none; }
  .hero__chips .chip { font-size: 11px; padding: 5px 8px; }
  .statsrow { gap: 7px; }
  .statbox { padding: 11px; }
  .statbox__value { font-size: 22px; }
  .segmented { width: 100%; }
  .seg { flex: 1; padding: 0 8px; }
  .setup__actions .btn { width: 100%; }
  .resultactions .btn { width: 100%; }
  .navgrid { grid-template-columns: repeat(6, 1fr); }
  .libtabs { margin-left: -16px; margin-right: -16px; padding-left: 8px; }
  .libtab { padding: 0 10px; font-size: 11px; gap: 0; }
  .libtab svg { display: none; }
}

/* ---------- accessibility / motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
.no-motion *, .no-motion *::before, .no-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

/* ---------- print ---------- */

@media print {
  @page { margin: 14mm; }
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
  }
  .topbar, .rail, .tabbar, .footer, .libtabs, .libindex, .libcontent__meta,
  .sheet__foot, .sheetnav, .machete__intro .btn, #toasts, .modalback,
  .pagehead, .skip, .exswitch, .topstats { display: none !important; }
  .shell { display: block; }
  main { padding: 0; }
  .view { max-width: none; animation: none; }
  .library { display: block; }
  .sheet, .machete, .cheat, .glossitem, .panel {
    box-shadow: none !important;
    border: 1px solid #999 !important;
    background: #fff !important;
    break-inside: avoid;
  }
  .sheet { padding: 0; border: 0 !important; }
  .sheet__head h1 { font-size: 24pt; }
  .sheet__section h2 { font-size: 14pt; border-left-color: #000; }
  .sheet__section { break-inside: avoid; }
  .table-wrap { overflow: visible; border: 1px solid #999; }
  table { min-width: 0; font-size: 9pt; }
  th { background: #eee !important; }
  .note, .mnemonic { background: #f4f4f4 !important; }
  .machete__grid { display: block; }
  .cheat { margin-bottom: 8mm; page-break-inside: avoid; }
  a { text-decoration: none; color: #000; }
}
