:root {
  --paper: #f7f9f6;
  --surface: #ffffff;
  --ink: #23262b;
  --ink-soft: #5c636b;
  --rule: #d5dcd6;
  --form: #0f6b5c;
  --form-tint: #e3f1ec;
  --pen: #c2263a;
  --pen-tint: #fbe9eb;
  --amber: #8f5b00;
  --amber-tint: #fbf0d9;
  --violet: #4a4fa3;
  --violet-tint: #ecedf8;

  --ui: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --reading: "Literata", Georgia, serif;
  --code: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15181a;
    --surface: #1d2124;
    --ink: #e8ebe8;
    --ink-soft: #a1a9a6;
    --rule: #343b3d;
    --form: #5cc9b0;
    --form-tint: #17332d;
    --pen: #ff7a88;
    --pen-tint: #3a1d22;
    --amber: #e5b25a;
    --amber-tint: #33290f;
    --violet: #a9adf2;
    --violet-tint: #23254a;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 1rem;
  line-height: 1.45;
}

h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

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

/* ---------- Top: title, score, filters, domains ---------- */

.top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 30rem);
  gap: 2rem 3rem;
  max-width: 76rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 2rem;
  border-bottom: 2px solid var(--ink);
}

.top h1 {
  font-size: 1.75rem;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.score {
  margin-top: 0.75rem;
  font-size: 1.125rem;
}

.score strong {
  font-weight: 750;
}

.note {
  margin-top: 0.25rem;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.75rem;
  margin-top: 1.25rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

button.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--violet);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.filter {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1.5px solid var(--ink);
  border-radius: 1.2rem;
  overflow: hidden;
}

.filter button {
  padding: 0.4rem 0.8rem;
  border: 0;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 550;
}

.filter button + button {
  border-left: 1.5px solid var(--ink);
}

.filter button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

.domains h2 {
  font-size: 0.9375rem;
  font-weight: 650;
  margin-bottom: 0.5rem;
}

.domain {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.15rem 0.75rem;
  align-items: center;
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 0;
  border-top: 1px solid var(--rule);
  background: transparent;
  text-align: left;
  font-size: 0.875rem;
}

.domain[aria-pressed="true"] {
  background: var(--form-tint);
}

.domain-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.domain-count {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 18.75rem minmax(0, 1fr);
  gap: 3rem;
  max-width: 76rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
  align-items: start;
}

.layout.wide-sheet {
  grid-template-columns: 21.5rem minmax(0, 1fr);
}

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

.rail {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 1rem 0.75rem 1rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--form);
  border-radius: 4px;
}

.rail summary {
  font-weight: 700;
  color: var(--form);
  cursor: pointer;
}

.legend {
  display: flex;
  gap: 1rem;
  margin: 0.5rem 0 0.75rem;
  color: var(--ink-soft);
  font-size: 0.8125rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.sheet {
  columns: 2;
  column-gap: 0.75rem;
  column-rule: 1px solid var(--rule);
}

.sheet li {
  break-inside: avoid;
}

.row {
  display: grid;
  grid-template-columns: 1.35rem auto 0.8rem;
  gap: 0.3rem;
  justify-content: start;
  align-items: center;
  padding: 0.2rem 0.25rem;
  border-radius: 3px;
  color: inherit;
  text-decoration: none;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.row:hover {
  background: var(--form-tint);
}

.row[aria-current="true"] {
  background: var(--form-tint);
  box-shadow: inset 0 0 0 1.5px var(--ink);
}

.row .num {
  text-align: right;
  font-weight: 600;
}

.bubbles {
  display: inline-flex;
  gap: 3px;
}

.b {
  display: inline-grid;
  place-items: center;
  width: 1.05rem;
  height: 1.05rem;
  border: 1px solid var(--form);
  border-radius: 50%;
  color: var(--form);
  font-size: 0.5625rem;
  font-style: normal;
  font-weight: 600;
  line-height: 1;
}

.b.correct {
  border-width: 2.5px;
}

.b.picked {
  background: var(--ink);
  border-color: var(--ink);
  color: transparent;
}

.b.picked.correct {
  background: var(--form);
  border-color: var(--form);
}

.mark {
  font-weight: 800;
  color: var(--pen);
}

.mark.ok {
  color: var(--form);
}

/* ---------- Question ---------- */

#question {
  max-width: 44rem;
  min-width: 0;
}

#question:focus {
  outline: none;
}

.q-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1rem;
}

.q-head h2 {
  font-size: 1.5rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.verdict {
  font-weight: 700;
  color: var(--pen);
}

.verdict.ok {
  color: var(--form);
}

.verdict.open {
  color: var(--ink-soft);
}

.choose-hint {
  margin-top: 1.5rem;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.choose-hint + .options {
  margin-top: 0.6rem;
}

/* Unanswered option in practice mode: the whole row is the button. */
.option.is-open {
  display: block;
  padding: 0;
}

.choose {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 0 0.75rem;
  align-items: start;
  width: 100%;
  padding: 1.1rem 0.75rem 1.1rem 0.5rem;
  border: 0;
  background: transparent;
  text-align: left;
}

.choose:hover {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}

.choose:hover .letter,
.choose:has(input:checked) .letter {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

label.choose {
  cursor: pointer;
}

.choose:has(input:checked) {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}

.choose:has(input:focus-visible) {
  outline: 3px solid var(--violet);
  outline-offset: -3px;
}

/* Multi-answer questions use square letters, like tick boxes. */
label.choose .letter {
  border-radius: 5px;
}

.check {
  margin-top: 1.25rem;
  padding: 0.6rem 1.25rem;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 650;
}

.check:disabled {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--rule);
  cursor: default;
}

.q-domain {
  margin-top: 0.15rem;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.prompt {
  margin-top: 1.25rem;
  font-family: var(--reading);
  font-size: 1.1875rem;
  line-height: 1.55;
}

.options {
  margin-top: 1.75rem;
  border-bottom: 1px solid var(--rule);
}

.option {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 0 0.75rem;
  padding: 1.1rem 0.75rem 1.1rem 0.5rem;
  border-top: 1px solid var(--rule);
  border-left: 4px solid transparent;
}

.option.is-correct {
  border-left-color: var(--form);
  background: var(--form-tint);
}

.option.is-picked-wrong {
  border-left-color: var(--pen);
  background: var(--pen-tint);
}

.letter {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1.5px solid var(--ink-soft);
  border-radius: 50%;
  font-weight: 700;
}

.is-correct .letter {
  border: 3px solid var(--form);
  color: var(--form);
}

.is-picked .letter {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.is-picked.is-correct .letter {
  background: var(--form);
  border-color: var(--form);
}

.option-text {
  font-weight: 600;
  font-size: 1.0625rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.tag {
  padding: 0.1rem 0.55rem;
  border-radius: 3px;
  font-size: 0.8125rem;
  font-weight: 650;
}

.tag.t-correct {
  background: var(--form);
  color: var(--surface);
}

.tag.t-picked {
  background: var(--ink);
  color: var(--paper);
}

.tag.t-pen {
  background: var(--pen-tint);
  color: var(--pen);
  box-shadow: inset 0 0 0 1px var(--pen);
}

.tag.t-amber {
  background: var(--amber-tint);
  color: var(--amber);
  box-shadow: inset 0 0 0 1px var(--amber);
}

.tag.t-violet {
  background: var(--violet-tint);
  color: var(--violet);
  box-shadow: inset 0 0 0 1px var(--violet);
}

.why {
  margin-top: 0.6rem;
}

/* Texto de la fuente: enunciados, opciones y explicaciones. */
.rich {
  font-family: var(--reading);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.rich > * + * {
  margin-top: 0.7em;
}

.rich ul,
.rich ol {
  padding-left: 1.25rem;
}

.rich ul {
  list-style: disc;
}

.rich ol {
  list-style: decimal;
}

.rich li + li {
  margin-top: 0.45em;
}

.rich img {
  display: block;
  max-width: 100%;
  height: auto;
}

.rich a {
  color: var(--violet);
}

.rich code {
  padding: 0.05em 0.3em;
  border-radius: 3px;
  background: color-mix(in srgb, var(--ink) 9%, transparent);
  font-family: var(--code);
  font-size: 0.875em;
}

.rich pre {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  background: color-mix(in srgb, var(--ink) 9%, transparent);
  overflow-x: auto;
}

.rich pre code {
  padding: 0;
  background: none;
}

.option-text.rich {
  font-family: var(--ui);
  line-height: 1.4;
}

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

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 2px solid var(--ink);
}

.pager button {
  padding: 0.55rem 1.1rem;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  font-weight: 650;
}

.pager button:hover:not(:disabled) {
  background: var(--ink);
  color: var(--paper);
}

.pager button:disabled {
  opacity: 0.35;
  cursor: default;
}

.pager-hint {
  align-self: center;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.empty {
  font-size: 1.0625rem;
}

/* ---------- Small screens ---------- */

@media (max-width: 56rem) {
  .top {
    grid-template-columns: minmax(0, 1fr);
    padding: 1.5rem 1rem;
  }

  .top h1 {
    font-size: 1.375rem;
  }

  .layout,
  .layout.wide-sheet {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    padding: 1.25rem 1rem 4rem;
  }

  .rail {
    position: static;
    max-height: none;
  }

  .sheet {
    columns: 7.25rem;
  }

  .wide-sheet .sheet {
    columns: 8.75rem;
  }

  .pager-hint {
    display: none;
  }
}

/* ---------- Añadidos sobre la base de PMLE ---------- */

[hidden] {
  display: none !important;
}

.crumbs {
  margin-bottom: 1.25rem;
}

.crumbs a {
  color: var(--ink-soft);
  font-weight: 600;
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.eyebrow {
  margin-bottom: 0.3rem;
  color: var(--form);
  font-size: 0.875rem;
  font-weight: 650;
}

/* Barra de progreso: aciertos, fallos y sin responder. */
.bar {
  display: flex;
  height: 0.45rem;
  border-radius: 999px;
  overflow: hidden;
  background: var(--rule);
}

.bar i.ok {
  background: var(--form);
}

.bar i.ko {
  background: var(--pen);
  opacity: 0.6;
}

.domain .bar {
  grid-column: 1 / -1;
}

.domains ul {
  max-height: 19rem;
  overflow-y: auto;
}

/* ---------- Portada ---------- */

.catalog-top {
  grid-template-columns: minmax(0, 1fr);
}

.catalog {
  max-width: 76rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

.cert + .cert {
  margin-top: 2.5rem;
}

.cert h2 {
  margin-bottom: 0.9rem;
  font-size: 1.125rem;
  font-weight: 700;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 1rem;
}

.card {
  display: grid;
  gap: 0.4rem;
  height: 100%;
  padding: 1.1rem 1.25rem 1.2rem;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

.card:hover {
  border-color: var(--form);
  box-shadow: 4px 4px 0 var(--form);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 750;
  line-height: 1.2;
}

.card-meta,
.card-progress {
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.card .bar {
  margin-top: 0.5rem;
}

/* ---------- Pregunta respondida: discrepancia, votos y discusión ---------- */

.dispute {
  margin-top: 1.5rem;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--amber);
  background: var(--amber-tint);
  font-size: 0.9375rem;
}

.dispute + .options {
  margin-top: 1rem;
}

.tag.t-plain {
  color: var(--ink-soft);
  box-shadow: inset 0 0 0 1px var(--ink-soft);
}

.section {
  margin-top: 2.25rem;
}

.section h3 {
  margin-bottom: 0.6rem;
  font-size: 1.125rem;
  font-weight: 750;
}

.vote {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr) 9.5rem;
  gap: 0.75rem;
  align-items: center;
  padding: 0.3rem 0;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.vote-letters {
  font-weight: 700;
}

.vote-track {
  height: 0.6rem;
  border-radius: 999px;
  background: var(--rule);
  overflow: hidden;
}

.vote-track i {
  display: block;
  height: 100%;
  background: var(--violet);
}

.vote-count {
  color: var(--ink-soft);
  text-align: right;
}

.discussion {
  margin-top: 2.25rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.discussion summary {
  padding: 0.85rem 0;
  font-size: 1.125rem;
  font-weight: 750;
  cursor: pointer;
}

.comment {
  margin-left: calc(var(--depth, 0) * 1.5rem);
  padding: 0.8rem 0;
  border-top: 1px solid var(--rule);
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.6rem;
  color: var(--ink-soft);
  font-size: 0.8125rem;
}

.comment-meta strong {
  color: var(--ink);
  font-size: 0.875rem;
}

.upvotes {
  font-variant-numeric: tabular-nums;
}

.comment-text {
  margin-top: 0.35rem;
  font-family: var(--reading);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 56rem) {
  .catalog {
    padding: 1.25rem 1rem 4rem;
  }

  .vote {
    grid-template-columns: 2.5rem minmax(0, 1fr);
  }

  .vote-count {
    grid-column: 2;
    text-align: left;
  }

  .comment {
    margin-left: calc(var(--depth, 0) * 0.75rem);
  }
}

/* ---------- Razonamiento destacado ---------- */

.featured-note {
  margin-bottom: 0.4rem;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.featured .comments {
  padding: 0 1rem;
  border-left: 4px solid var(--violet);
  background: var(--violet-tint);
}

.featured .comment:first-child {
  border-top: 0;
}
