/* ==========================================================================
   Finance Knowledge Base — Clifton Economics theme
   Dark is the Clifton Economics palette; light is the shared warm-paper theme.
   The same pair is used by the revision site, and the visitor's choice is
   stored under one key on the shared origin, so it follows them between them.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Brand */
  --accent:        #5b8dee;
  --accent-soft:   #1e2a45;
  --accent-text:   #7aaef5;

  /* Surfaces */
  --bg:            #0f1117;
  --surface:       #181c27;
  --surface-2:     #1e2333;
  --border:        #2a3048;
  --border-strong: #3a4258;

  /* Text */
  --text:          #e8ecf4;
  --text-muted:    #8d96b0;
  --text-faint:    #7a839e;

  /* Callout tints */
  --basics-bg:     #1e2333;
  --basics-edge:   #2a3048;
  --example-bg:    #1a2d4a;
  --example-edge:  #3a5a8a;
  --interview-bg:  #2e1e0f;
  --interview-edge:#6a5433;
  --flag-bg:       #2a1010;
  --flag-edge:     #6d4640;
  --personal-bg:   #0d2a1a;
  --personal-edge: #2a5a3a;

  /* Type */
  --font-ui: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: Charter, "Bitstream Charter", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Metrics */
  --measure: 68ch;
  --radius: 6px;
  --sidebar-w: 15.5rem;
  --toc-w: 13rem;
}

:root[data-theme="light"] {
  color-scheme: light;
  --accent:        #1d4e5f;
  --accent-soft:   #e3eef1;
  --accent-text:   #143b48;
  --bg:            #fbfaf8;
  --surface:       #ffffff;
  --surface-2:     #f4f2ee;
  --border:        #e2ded7;
  --border-strong: #cfc9c0;
  --text:          #1f1d1a;
  --text-muted:    #5f594f;
  --text-faint:    #736c64;
  --basics-bg:     #f4f2ee;
  --basics-edge:   #cfc9c0;
  --example-bg:    #eaf0f6;
  --example-edge:  #b4c6da;
  --interview-bg:  #faf3e6;
  --interview-edge:#ddc290;
  --flag-bg:       #fbeeec;
  --flag-edge:     #dfb3aa;
  --personal-bg:   #eef4ee;
  --personal-edge: #b8cdb8;
}

:root[data-theme="dark"] { color-scheme: dark; }

/* --------------------------------------------------------------------------
   Reset and base
   -------------------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
}

img { max-width: 100%; height: auto; }

a { color: var(--accent-text); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

.skip {
  position: absolute; left: -9999px;
  /* white on the dark-theme accent only reached 3.2:1, and this link exists
     for keyboard users, so it uses the accent tint pair instead */
  background: var(--accent-soft); color: var(--accent-text);
  border: 1px solid var(--accent);
  padding: .5rem .9rem; border-radius: var(--radius); z-index: 100;
}
.skip:focus { left: .5rem; top: .5rem; }

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-ui);
}

.brand {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 600; font-size: .95rem; letter-spacing: -0.01em;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.brand-mark { width: 2.1rem; height: 1.35rem; display: block; flex: none; color: var(--text); }
.brand-mark .deck { fill: currentColor; }
.brand-mark .cables { stroke: var(--accent); }

.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

.ghost-btn {
  font: inherit; font-size: .82rem;
  padding: .35rem .7rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.ghost-btn:hover { color: var(--text); border-color: var(--border-strong); }

.nav-btn { display: none; }

/* Search */
.search { position: relative; }
#search-input {
  font: inherit; font-size: .85rem;
  width: 12rem; padding: .35rem .65rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
#search-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.search-results {
  position: absolute; right: 0; top: calc(100% + .4rem);
  width: min(26rem, 80vw); max-height: 60vh; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,0,0,.14);
  padding: .35rem;
}
.search-results a {
  display: block; padding: .5rem .6rem; border-radius: 4px;
  text-decoration: none; color: var(--text);
}
.search-results a:hover, .search-results a:focus { background: var(--surface-2); }
.search-results strong { display: block; font-size: .9rem; font-family: var(--font-ui); }
.search-results span { display: block; font-size: .8rem; color: var(--text-muted); }
.search-empty { padding: .6rem; font-size: .85rem; color: var(--text-muted); }

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

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  gap: 2.5rem;
  max-width: 84rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  align-items: start;
}

@media (max-width: 68rem) {
  .shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 48rem) {
  .shell { grid-template-columns: minmax(0, 1fr); padding-top: 1rem; }
  .sidebar { display: none; }
  .sidebar.open { display: block; }
  .nav-btn { display: inline-block; flex: 0 0 auto; }
  .topbar-tools .ghost-btn { display: none; }
  .topbar { gap: .6rem; padding: .6rem .85rem; }
  .topbar-tools { min-width: 0; }
  #search-input { width: 100%; min-width: 5rem; }
  .search { min-width: 0; flex: 1 1 auto; }
}

@media (max-width: 30rem) {
  .brand-text { display: none; }
}

/* Sidebar */
.sidebar {
  position: sticky; top: 4.5rem;
  max-height: calc(100vh - 6rem); overflow-y: auto;
  font-family: var(--font-ui); font-size: .875rem;
  line-height: 1.45;
}
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: block; padding: .28rem .5rem; border-radius: 4px;
  color: var(--text-muted); text-decoration: none;
}
.nav-list a:hover { color: var(--text); background: var(--surface-2); }
.nav-list a.current {
  color: var(--accent-text); background: var(--accent-soft); font-weight: 600;
}
.nav-depth-0 > li > a { color: var(--text); font-weight: 600; margin-top: .5rem; }
.nav-depth-1 { margin-left: .55rem; border-left: 1px solid var(--border); padding-left: .35rem; }
.nav-depth-2 { margin-left: .55rem; border-left: 1px solid var(--border); padding-left: .35rem; }
.nav-depth-1 > li > a, .nav-depth-2 > li > a { font-weight: 400; font-size: .84rem; }
.nav-extra { margin-top: 1.25rem; padding-top: .75rem; border-top: 1px solid var(--border); }

.personal-badge {
  margin-top: 1.5rem; padding: .5rem .6rem;
  font-size: .75rem; font-family: var(--font-ui);
  color: var(--text-muted);
  background: var(--personal-bg);
  border: 1px dashed var(--personal-edge);
  border-radius: var(--radius);
}

/* Table of contents */
.toc {
  position: sticky; top: 4.5rem;
  max-height: calc(100vh - 6rem); overflow-y: auto;
  font-family: var(--font-ui); font-size: .8rem; line-height: 1.4;
}
.toc-title {
  margin: 0 0 .5rem; font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint);
}
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li ul { margin-left: .7rem; }
.toc a {
  display: block; padding: .2rem 0; color: var(--text-muted); text-decoration: none;
  border-left: 2px solid transparent; padding-left: .6rem; margin-left: -0.6rem;
}
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--accent-text); border-left-color: var(--accent); }

/* --------------------------------------------------------------------------
   Page content
   -------------------------------------------------------------------------- */

main { min-width: 0; }

.crumbs {
  font-family: var(--font-ui); font-size: .78rem; color: var(--text-faint);
  margin-bottom: 1.25rem;
}
.crumbs a { color: var(--text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.crumbs span[aria-hidden] { margin: 0 .4rem; }

.page { max-width: var(--measure); }

.page-head { margin-bottom: 2rem; }
.eyebrow {
  font-family: var(--font-ui); font-size: .74rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent-text); margin: 0 0 .5rem;
}
h1 {
  font-family: var(--font-ui); font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.3rem);
  line-height: 1.15; letter-spacing: -0.02em; font-weight: 650;
  margin: 0 0 .6rem;
}
.lede {
  font-size: 1.15rem; line-height: 1.5; color: var(--text-muted);
  margin: 0 0 .75rem;
}
.meta-line {
  font-family: var(--font-ui); font-size: .78rem; color: var(--text-faint); margin: 0;
}

h2 {
  font-family: var(--font-ui); font-size: 1.35rem; font-weight: 620;
  letter-spacing: -0.01em; line-height: 1.25;
  margin: 2.75rem 0 .85rem; padding-top: .9rem;
  border-top: 1px solid var(--border);
}
h3 {
  font-family: var(--font-ui); font-size: 1.06rem; font-weight: 620;
  margin: 1.9rem 0 .55rem; line-height: 1.3;
}
h4 {
  font-family: var(--font-ui); font-size: .95rem; font-weight: 620;
  margin: 1.4rem 0 .4rem; color: var(--text-muted);
}

p { margin: 0 0 1.05rem; }
ul, ol { margin: 0 0 1.15rem; padding-left: 1.3rem; }
li { margin-bottom: .4rem; }
li > ul, li > ol { margin-top: .4rem; margin-bottom: .4rem; }

strong { font-weight: 650; }

blockquote {
  margin: 1.4rem 0; padding: .1rem 0 .1rem 1.1rem;
  border-left: 3px solid var(--border-strong);
  color: var(--text-muted); font-style: italic;
}

hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

code {
  font-family: var(--font-mono); font-size: .875em;
  background: var(--surface-2); padding: .1em .35em; border-radius: 3px;
}
pre {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .9rem 1rem;
  overflow-x: auto; font-size: .85rem; line-height: 1.5;
}
pre code { background: none; padding: 0; }

/* Tables scroll rather than pushing the page sideways */
.page table {
  width: 100%; border-collapse: collapse;
  font-family: var(--font-ui); font-size: .87rem;
  margin: 0 0 1.3rem;
}
.page table th, .page table td {
  text-align: left; padding: .5rem .65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.page table th {
  font-weight: 620; color: var(--text-muted);
  border-bottom: 1px solid var(--border-strong);
  font-size: .8rem; text-transform: uppercase; letter-spacing: .04em;
}
.page table tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; margin-bottom: 1.3rem; }
.table-scroll table { margin-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Glossary links in body text */
a.gloss {
  color: inherit;
  text-decoration: underline dotted var(--border-strong);
  text-underline-offset: 3px;
  cursor: help;
}
a.gloss:hover { color: var(--accent-text); text-decoration-color: var(--accent); }

/* --------------------------------------------------------------------------
   Callouts
   -------------------------------------------------------------------------- */

.callout {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--surface);
  padding: .9rem 1.1rem;
}
.callout-title, .callout > summary {
  font-family: var(--font-ui); font-size: .75rem; font-weight: 650;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted);
  margin: 0 0 .6rem;
}
.callout-body > :last-child { margin-bottom: 0; }
.callout-body > :first-child { margin-top: 0; }

.callout-basics   { background: var(--basics-bg);   border-color: var(--basics-edge); }
.callout-example  { background: var(--example-bg);  border-color: var(--example-edge); }
.callout-interview{ background: var(--interview-bg);border-color: var(--interview-edge); }
.callout-flag     { background: var(--flag-bg);     border-color: var(--flag-edge); }
.callout-personal { background: var(--personal-bg); border-color: var(--personal-edge);
                    border-left-style: dashed; }

details.callout { padding: .9rem 1.1rem; }
details.callout > summary {
  cursor: pointer; list-style: none; margin-bottom: 0;
  display: flex; align-items: center; gap: .45rem;
}
details.callout > summary::-webkit-details-marker { display: none; }
details.callout > summary::before {
  content: "▾"; font-size: .7em; transition: transform .15s ease;
}
details.callout:not([open]) > summary::before { transform: rotate(-90deg); }
details.callout[open] > summary { margin-bottom: .6rem; }
details.callout:not([open]) > summary { color: var(--text-faint); }

/* --------------------------------------------------------------------------
   Cards, tags, sources
   -------------------------------------------------------------------------- */

.child-grid-wrap h2 { margin-bottom: 1.1rem; }
.child-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: .9rem; margin-bottom: 2rem;
}
.card {
  display: block; padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none; color: var(--text);
  transition: border-color .12s ease, transform .12s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card h3 {
  margin: 0 0 .35rem; font-size: .98rem; font-weight: 620;
  color: var(--accent-text);
}
.card p {
  margin: 0; font-size: .87rem; line-height: 1.45; color: var(--text-muted);
  font-family: var(--font-ui);
}

.tag {
  display: inline-block; margin-top: .55rem;
  font-family: var(--font-ui); font-size: .68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  padding: .15rem .45rem; border-radius: 3px;
}
.tag-stub { background: var(--surface-2); color: var(--text-faint); border: 1px solid var(--border); }

.sources { margin-top: 3rem; }
.sources h2 { font-size: 1rem; }
.sources ol { font-family: var(--font-ui); font-size: .84rem; color: var(--text-muted); }
.sources li { margin-bottom: .5rem; }

/* Glossary page */
.glossary { margin: 0; }
.glossary-item {
  padding: 1rem 0; border-bottom: 1px solid var(--border);
  scroll-margin-top: 5rem;
}
.glossary dt {
  font-family: var(--font-ui); font-weight: 620; font-size: 1rem;
  margin-bottom: .3rem;
}
.glossary dd { margin: 0; }
.glossary dd p { margin: 0 0 .4rem; }
.also, .seen-in {
  font-family: var(--font-ui); font-size: .78rem; color: var(--text-faint); font-weight: 400;
}
.glossary-item:target { background: var(--accent-soft); border-radius: var(--radius); padding-left: .7rem; }

.sitefoot {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.5rem 2.5rem;
  font-family: var(--font-ui); font-size: .78rem; color: var(--text-faint);
  text-align: center;
}
.sitefoot p { margin: 0; }

/* --------------------------------------------------------------------------
   Print: revision-friendly
   -------------------------------------------------------------------------- */

@media print {
  .topbar, .sidebar, .toc, .sitefoot, .crumbs { display: none !important; }
  .shell { display: block; max-width: none; padding: 0; }
  .page { max-width: none; }
  body { font-size: 10.5pt; background: #fff; color: #000; }
  details.callout[open] > summary::before, details.callout > summary::before { content: ""; }
  details.callout { border: 1px solid #999; }
  details:not([open]) > *:not(summary) { display: revert !important; }
  a { color: #000; text-decoration: none; }
  a.gloss { text-decoration: none; }
  h2 { page-break-after: avoid; }
  table, .callout { page-break-inside: avoid; }
}

/* --------------------------------------------------------------------------
   Pay blocks, rendered from content/comp.yml
   -------------------------------------------------------------------------- */

.comp-block {
  margin: 1.6rem 0;
  padding: 1rem 1.1rem .6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius);
}
.comp-title {
  font-family: var(--font-ui); font-size: .75rem; font-weight: 650;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); margin: 0 0 .7rem;
}
.comp-block .table-scroll { margin-bottom: .8rem; }
.comp-note, .comp-source {
  font-family: var(--font-ui); font-size: .78rem; line-height: 1.45;
  color: var(--text-muted); margin: 0 0 .6rem;
}
.comp-source { color: var(--text-faint); }
.comp-block-nodata { border-left-style: dashed; }
.comp-block-nodata .comp-note { color: var(--text-muted); margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Inline "test yourself" prompts, injected at the end of each covered section
   -------------------------------------------------------------------------- */

.callout-testme {
  background: var(--surface);
  border-color: var(--border);
  border-left-color: var(--accent);
}
.callout-testme > summary { color: var(--accent-text); }
.testme-list { margin: 0 0 .8rem; padding-left: 1.3rem; font-family: var(--font-ui); font-size: .88rem; }
.testme-list li { margin-bottom: .45rem; }
.testme-link { margin: 0; font-family: var(--font-ui); font-size: .82rem; }

/* --------------------------------------------------------------------------
   Practice deck
   -------------------------------------------------------------------------- */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.deck { font-family: var(--font-ui); margin: 1.5rem 0 3rem; }

.deck-bar {
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: center;
  justify-content: space-between; margin-bottom: 1rem;
}
.deck-modes { display: flex; gap: .3rem; }
.mode-btn {
  font: inherit; font-size: .82rem; padding: .35rem .8rem;
  color: var(--text-muted); background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
.mode-btn:hover { color: var(--text); border-color: var(--border-strong); }
.mode-btn.active {
  color: var(--accent-text); background: var(--accent-soft);
  border-color: var(--accent); font-weight: 600;
}
#type-filter {
  font: inherit; font-size: .82rem; padding: .35rem .5rem;
  color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius);
}

.deck-progress { margin-bottom: 1.25rem; }
.deck-progress-bar {
  height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden;
}
.deck-progress-bar span {
  display: block; height: 100%; width: 0;
  background: var(--accent); transition: width .3s ease;
}
.deck-progress-text {
  margin: .45rem 0 0; font-size: .78rem; color: var(--text-faint);
}

.deck-stage { min-height: 16rem; }
.deck-empty {
  padding: 3rem 1rem; text-align: center; color: var(--text-muted);
  background: var(--surface-2); border-radius: var(--radius);
  font-size: .9rem;
}

.card-q {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 1.4rem 1.5rem;
}
.card-type {
  margin: 0 0 .8rem; font-size: .7rem; font-weight: 650;
  text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint);
}
.card-prompt {
  font-family: var(--font-body); font-size: 1.1rem; line-height: 1.5;
  margin-bottom: 1.1rem;
}
.card-prompt p:last-child { margin-bottom: 0; }

.card-answer {
  font-family: var(--font-body); font-size: 1rem; line-height: 1.6;
  padding: 1rem 1.1rem; margin-bottom: 1rem;
  background: var(--example-bg);
  border: 1px solid var(--example-edge); border-radius: var(--radius);
}
.card-answer p:last-child { margin-bottom: 0; }

.card-marks {
  padding: .8rem 1.1rem; margin-bottom: 1rem; font-size: .85rem;
  background: var(--interview-bg); border: 1px solid var(--interview-edge);
  border-radius: var(--radius);
}
.card-marks-title { margin: 0 0 .4rem; font-weight: 650; font-size: .75rem;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.card-marks ul { margin: 0; padding-left: 1.2rem; }
.card-marks li { margin-bottom: .3rem; }

.card-input, .card-input-num {
  font: inherit; width: 100%; padding: .6rem .7rem; margin-bottom: .8rem;
  color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius); resize: vertical;
}
.card-numeric { display: flex; gap: .6rem; align-items: flex-start; }
.card-numeric .card-input-num { max-width: 14rem; margin-bottom: 0; }
.card-input-num.right { border-color: var(--example-edge); }
.card-input-num.wrong { border-color: var(--flag-edge); }

.reveal-btn {
  font: inherit; font-size: .85rem; font-weight: 600;
  padding: .5rem 1rem; cursor: pointer;
  color: var(--accent-text); background: var(--accent-soft);
  border: 1px solid var(--accent); border-radius: var(--radius);
}
.reveal-btn:hover { filter: brightness(0.97); }

.card-options { display: grid; gap: .5rem; margin-bottom: 1rem; }
.option-btn {
  font: inherit; font-size: .9rem; text-align: left; cursor: pointer;
  padding: .7rem .9rem; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.option-btn:hover { border-color: var(--border-strong); }
.option-btn.correct { border-color: var(--example-edge); background: var(--example-bg); }
.option-btn.incorrect { border-color: var(--flag-edge); background: var(--flag-bg); }
.option-btn.chosen { box-shadow: inset 0 0 0 1px var(--accent); }
.option-why {
  display: block; margin-top: .35rem; font-size: .78rem; color: var(--text-muted);
}

.card-verdict { font-size: .9rem; font-weight: 600; margin: .8rem 0 .6rem; }
.card-verdict.right { color: var(--accent-text); }
.card-verdict.wrong { color: var(--text); }
.card-working, .deck-working {
  font-family: var(--font-body); font-size: .95rem; line-height: 1.6;
  padding: .9rem 1.1rem; margin-bottom: 1rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.card-working p:last-child, .deck-working p:last-child { margin-bottom: 0; }

.card-grade { display: flex; gap: .5rem; margin-top: .4rem; }
.grade-btn {
  font: inherit; font-size: .85rem; font-weight: 600; padding: .5rem 1rem;
  border-radius: var(--radius); cursor: pointer; border: 1px solid var(--border-strong);
  background: var(--bg); color: var(--text);
}
.grade-yes { border-color: var(--example-edge); background: var(--example-bg); }
.grade-no  { border-color: var(--flag-edge); background: var(--flag-bg); }

.flag-btn {
  font: inherit; font-size: .78rem; margin-top: .8rem; padding: .3rem .6rem;
  color: var(--text-faint); background: transparent;
  border: 1px dashed var(--border-strong); border-radius: var(--radius); cursor: pointer;
}
.flag-btn.on { color: var(--accent-text); border-style: solid; border-color: var(--accent); }

.deck-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-top: 1.25rem; flex-wrap: wrap;
}
.deck-note { margin: 0; font-size: .75rem; color: var(--text-faint); }

.deck-index { margin-top: 3rem; }
.deck-list { font-family: var(--font-ui); font-size: .9rem; }
.deck-list li { margin-bottom: 1rem; }
.deck-list-q { margin: 0 0 .3rem; font-weight: 400; }
.deck-list-q strong { font-weight: 650; }
.deck-list-q p { margin: 0; }
.deck-list summary { font-size: .8rem; color: var(--text-muted); cursor: pointer; }
.deck-list-a {
  font-family: var(--font-body); margin-top: .5rem; padding-left: .9rem;
  border-left: 2px solid var(--border);
}
.deck-why { font-size: .85rem; color: var(--text-muted); }
.deck-marks { font-size: .9rem; }

@media print {
  .deck-bar, .deck-progress, .deck-stage, .deck-foot { display: none !important; }
  .deck-list details > *:not(summary) { display: revert !important; }
}

.deck-link { margin: .9rem 0 0; font-family: var(--font-ui); font-size: .85rem; }
.deck-link a { display: inline-block; padding: .4rem .8rem; text-decoration: none; font-weight: 600;
  color: var(--accent-text); background: var(--accent-soft);
  border: 1px solid var(--accent); border-radius: var(--radius); }

/* Header icon buttons — home and theme, matched to each other.
   Note these are NOT .ghost-btn: the mobile rule that hides ghost buttons was
   also hiding the theme toggle on phones, so it lives in its own class. */
.icon-btn {
  width: 2rem; height: 2rem; padding: 0; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-size: 1rem; line-height: 1; cursor: pointer;
  color: var(--text-muted); background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none;
}
.icon-btn:hover { color: var(--accent); border-color: var(--border-strong); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn svg { width: 16px; height: 16px; display: block; }
