/* IBA PSS Notes — design system
   Palette is drawn from the school crest: deep ink, crest red, crest gold, crest blue (sparingly),
   on warm ivory. Display serif for headings, humanist sans for interface. */
:root {
  --ink: #0f1a2e;
  --red: #c0191f;
  --gold: #e0a912;
  --blue: #1d7fc1;
  --green: #2f7d62;

  --bg: #faf6ee;
  --bg-2: #f2ecdf;
  --surface: #ffffff;
  --text: #1c2333;
  --muted: #566074;
  --rule: #d9d1c0;
  --rule-strong: #b9ae95;
  --accent: var(--red);
  --accent-ink: #ffffff;
  --link: #14508a;
  --focus: #1d7fc1;
  --plate: #ffffff;
  --shadow: 0 1px 0 rgba(15,26,46,.04), 0 8px 24px -12px rgba(15,26,46,.18);

  --font-display: "Newsreader", "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-ui: "Public Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;

  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem; --s8: 4.5rem; --s9: 6.5rem;
  --maxw: 1160px;
  --radius: 4px;
}
:root[data-theme="dark"] {
  --bg: #0b1220;
  --bg-2: #101a2d;
  --surface: #131f36;
  --text: #ebe7dc;
  --muted: #a3adc0;
  --rule: #26364f;
  --rule-strong: #3a4e70;
  --accent: #ee5a5f;
  --accent-ink: #1a0709;
  --link: #7cc0f2;
  --focus: #7cc0f2;
  --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 28px -14px rgba(0,0,0,.6);
  --gold: #f0bd3a;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-ui); font-size: 1rem; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 200; }
.skip:focus { left: 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -.2em; }

.wrap { width: min(100% - 2rem, var(--maxw)); margin-inline: auto; }
.rule { border: 0; border-top: 1px solid var(--rule); margin: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .5em; color: var(--text); text-wrap: balance; }
h1 { font-size: clamp(2rem, 4.2vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; text-wrap: pretty; }
.eyebrow { font: 600 .74rem/1 var(--font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 0 0 var(--s4); display: flex; align-items: center; gap: .6rem; }
.eyebrow::before { content: ""; width: 1.6rem; height: 2px; background: var(--gold); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: .55rem; font: 600 .95rem/1 var(--font-ui); padding: .85rem 1.2rem; border-radius: var(--radius); border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
:root[data-theme="dark"] .btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: var(--red); border-color: var(--red); color: #fff; text-decoration: none; }
:root[data-theme="dark"] .btn-primary:hover { filter: brightness(1.08); background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--rule-strong); }
.btn-ghost:hover { border-color: var(--text); text-decoration: none; }
.btn-sm { padding: .55rem .8rem; font-size: .85rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.link-arrow { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--gold); padding-bottom: 2px; }
.link-arrow:hover { border-bottom-width: 2px; }

/* ---------- announcement + header ---------- */
.announce { background: var(--ink); color: #fff; font-size: .9rem; text-align: center; padding: .55rem 1rem; }
.announce a { color: var(--gold); }
.site-header { position: sticky; top: 0; z-index: 100; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: saturate(1.2) blur(6px); border-bottom: 1px solid var(--rule); transition: padding .2s, box-shadow .2s; }
.site-header.scrolled { box-shadow: var(--shadow); }
.header-in { display: flex; align-items: center; gap: var(--s5); padding: .85rem 0; transition: padding .2s; }
.site-header.scrolled .header-in { padding: .4rem 0; }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--text); }
.logo-plate { background: var(--plate); border-radius: 6px; padding: 2px; box-shadow: 0 0 0 1px var(--rule); display: grid; place-items: center; }
.logo-plate img { width: 52px; height: 52px; object-fit: contain; transition: width .2s, height .2s; }
.site-header.scrolled .logo-plate img { width: 38px; height: 38px; }
.brand-name { font: 600 1.28rem/1 var(--font-display); letter-spacing: -.01em; }
.brand-name small { display: block; font: 500 .66rem/1.2 var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: .3rem; }
.nav { margin-left: auto; display: flex; align-items: center; gap: .15rem; }
.nav a, .nav button.link { font: 500 .93rem/1 var(--font-ui); color: var(--text); text-decoration: none; padding: .6rem .7rem; border-radius: var(--radius); background: none; border: 0; cursor: pointer; position: relative; white-space: nowrap; }
.nav a:hover, .nav button.link:hover { background: var(--bg-2); }
.nav a[aria-current="page"] { font-weight: 700; }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: .7rem; right: .7rem; bottom: .2rem; height: 2px; background: var(--accent); }
.nav .sep { width: 1px; height: 1.4rem; background: var(--rule); margin: 0 .35rem; }
.icon-btn { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: var(--radius); border: 1px solid transparent; background: none; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--bg-2); border-color: var(--rule); }
.admin-link { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--rule-strong) !important; font-size: .85rem !important; }
.menu-toggle { display: none; margin-left: auto; }
.searchbar { border-top: 1px solid var(--rule); background: var(--bg-2); }
.searchbar form { display: flex; gap: .5rem; padding: .7rem 0; }
.searchbar input { flex: 1; }
.i-theme-dark { display: none; }
:root[data-theme="dark"] .i-theme-light { display: none; }
:root[data-theme="dark"] .i-theme-dark { display: inline-block; }

@media (max-width: 980px) {
  .menu-toggle { display: inline-grid; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--bg); border-bottom: 1px solid var(--rule); flex-direction: column; align-items: stretch; padding: .5rem 1rem 1rem; margin: 0; max-height: calc(100vh - 70px); overflow: auto; box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav a, .nav button.link { padding: .95rem .5rem; border-bottom: 1px solid var(--rule); font-size: 1rem; text-align: left; }
  .nav a[aria-current="page"]::after { display: none; }
  .nav .sep { display: none; }
  .nav .row-tools { display: flex; gap: .5rem; padding-top: .8rem; }
  .brand-name small { display: none; }
}
@media (min-width: 981px) { .nav .row-tools { display: contents; } }

/* ---------- forms ---------- */
input[type=text], input[type=search], input[type=email], input[type=url], input[type=number], input[type=password], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: .65rem .8rem; width: 100%; min-height: 2.75rem;
}
textarea { min-height: 7rem; resize: vertical; }
label { font-weight: 600; font-size: .86rem; display: block; margin-bottom: .35rem; }
.field { margin-bottom: 1rem; }

/* ---------- hero ---------- */
.hero { padding: var(--s8) 0 var(--s7); position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: var(--s7); align-items: center; }
.hero h1 { margin-bottom: var(--s4); max-width: 15ch; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .lede { font-size: 1.15rem; color: var(--muted); max-width: 52ch; margin-bottom: var(--s5); }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
.hero-plate { position: relative; justify-self: center; width: min(100%, 400px); }
.hero-plate .frame { background: var(--plate); border: 1px solid var(--rule); padding: 1.1rem; box-shadow: var(--shadow); transform: rotate(-1.4deg); }
.hero-plate .frame img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.hero-plate .caption { position: absolute; right: -.4rem; bottom: -1.2rem; background: var(--ink); color: #fff; font: 600 .72rem/1 var(--font-ui); letter-spacing: .12em; text-transform: uppercase; padding: .7rem .9rem; transform: rotate(1.2deg); }
.hero-plate::before { content: ""; position: absolute; inset: 1.4rem -1.2rem -1.4rem 1.2rem; border: 1px solid var(--rule-strong); z-index: -1; }
.hero-index { grid-column: 1 / -1; margin-top: var(--s6); border-top: 1px solid var(--rule-strong); display: grid; grid-template-columns: repeat(4, 1fr); }
.hero-index a { display: flex; align-items: baseline; gap: .75rem; padding: 1rem 1rem 1rem 0; color: var(--text); text-decoration: none; border-right: 1px solid var(--rule); }
.hero-index a:last-child { border-right: 0; }
.hero-index a + a { padding-left: 1rem; }
.hero-index .n { font: 600 1.9rem/1 var(--font-display); color: var(--accent); min-width: 2.4rem; }
.hero-index .t { font-weight: 600; font-size: .9rem; line-height: 1.25; }
.hero-index .t small { display: block; font-weight: 500; color: var(--muted); font-size: .76rem; margin-top: .2rem; }
.hero-index a:hover .t { text-decoration: underline; }
@media (max-width: 860px) {
  .hero { padding: var(--s6) 0; }
  .hero-grid { grid-template-columns: 1fr; gap: var(--s6); }
  .hero-plate { width: min(78%, 300px); order: -1; justify-self: start; }
  .hero-index { grid-template-columns: 1fr 1fr; }
  .hero-index a:nth-child(2) { border-right: 0; }
  .hero-index a:nth-child(3) { padding-left: 0; border-top: 1px solid var(--rule); }
  .hero-index a:nth-child(4) { border-top: 1px solid var(--rule); }
}
@media (prefers-reduced-motion: no-preference) {
  .hero .rise { animation: rise .6s cubic-bezier(.2,.7,.2,1) both; }
  .hero .rise:nth-child(2) { animation-delay: .06s; } .hero .rise:nth-child(3) { animation-delay: .12s; } .hero .rise:nth-child(4) { animation-delay: .18s; }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
}

/* ---------- sections ---------- */
.section { padding: var(--s8) 0 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: var(--s5); margin-bottom: var(--s5); border-bottom: 1px solid var(--rule); padding-bottom: var(--s4); flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head p { margin: .4rem 0 0; color: var(--muted); max-width: 56ch; }

/* classes: editorial panels */
.class-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: var(--s5); }
.class-panel { background: var(--surface); border: 1px solid var(--rule); padding: var(--s5) var(--s5) var(--s4); position: relative; }
.class-panel:nth-child(2) { margin-top: var(--s6); }
.class-panel .num { font: 600 3.4rem/1 var(--font-display); color: var(--accent); }
.class-panel h3 { margin: .15rem 0 .35rem; font-size: 1.5rem; }
.class-panel .desc { color: var(--muted); margin-bottom: var(--s4); }
.res-list { list-style: none; margin: 0 0 var(--s4); padding: 0; border-top: 1px solid var(--rule); }
.res-list a { display: flex; align-items: center; gap: .7rem; padding: .7rem .2rem; border-bottom: 1px solid var(--rule); color: var(--text); text-decoration: none; font-weight: 500; }
.res-list a:hover { background: var(--bg-2); }
.res-list a .i:first-child { color: var(--accent); }
.res-list a .count { margin-left: auto; color: var(--muted); font-size: .85rem; font-weight: 500; }
.res-list a .i:last-child { color: var(--muted); }
.soon-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s5); grid-column: 1 / -1; }
.soon { border: 1px dashed var(--rule-strong); padding: var(--s5); display: flex; gap: var(--s4); align-items: flex-start; background: repeating-linear-gradient(135deg, transparent 0 10px, color-mix(in srgb, var(--rule) 35%, transparent) 10px 11px); }
.soon .num { font: 600 2.4rem/1 var(--font-display); color: var(--muted); }
.soon h3 { margin: 0 0 .3rem; }
.soon p { margin: 0; color: var(--muted); font-size: .95rem; }
.tag { display: inline-block; font: 700 .68rem/1 var(--font-ui); letter-spacing: .1em; text-transform: uppercase; padding: .35rem .5rem; border: 1px solid var(--rule-strong); border-radius: 2px; color: var(--muted); margin-bottom: .6rem; }
.tag.gold { border-color: var(--gold); color: #7a5a00; background: color-mix(in srgb, var(--gold) 18%, transparent); }
:root[data-theme="dark"] .tag.gold { color: var(--gold); }
@media (max-width: 860px) { .class-grid, .soon-row { grid-template-columns: 1fr; } .class-panel:nth-child(2) { margin-top: 0; } }

/* subjects: ruled directory */
.subject-dir { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--rule-strong); }
.subject-dir a { display: flex; align-items: center; gap: .9rem; padding: 1.15rem 1rem 1.15rem 0; border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--text); position: relative; }
.subject-dir a:not(:nth-child(3n+1)) { padding-left: 1rem; border-left: 1px solid var(--rule); }
.subject-dir a:hover { background: var(--bg-2); }
.subj-ic { width: 2.6rem; height: 2.6rem; display: grid; place-items: center; border-radius: 50%; color: var(--sc, var(--ink)); background: color-mix(in srgb, var(--sc, var(--ink)) 13%, transparent); border: 1px solid color-mix(in srgb, var(--sc, var(--ink)) 35%, transparent); flex: none; overflow: hidden; }
.subj-ic img { width: 100%; height: 100%; object-fit: cover; }
.subj-ic .i { width: 1.3rem; height: 1.3rem; }
.subject-dir b { display: block; font: 600 1.1rem/1.2 var(--font-display); }
.subject-dir small { color: var(--muted); font-size: .8rem; }
@media (max-width: 860px) { .subject-dir { grid-template-columns: 1fr 1fr; } .subject-dir a:not(:nth-child(3n+1)) { padding-left: 0; border-left: 0; } .subject-dir a:nth-child(even) { padding-left: 1rem; border-left: 1px solid var(--rule); } }
@media (max-width: 520px) { .subject-dir { grid-template-columns: 1fr; } .subject-dir a:nth-child(even) { padding-left: 0; border-left: 0; } }

/* resource rows */
.res-rows { border-top: 1px solid var(--rule-strong); }
.res-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: var(--s4); padding: var(--s4) 0; border-bottom: 1px solid var(--rule); align-items: start; }
.res-row.lead { grid-template-columns: 140px minmax(0, 1fr) auto; padding: var(--s5) 0; }
.res-thumb { width: 100%; aspect-ratio: 3/4; background: var(--bg-2); border: 1px solid var(--rule); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.res-thumb img { width: 100%; height: 100%; object-fit: cover; }
.res-thumb .i { width: 1.8rem; height: 1.8rem; }
.res-thumb.t-mcq, .res-thumb.t-short, .res-thumb.t-long { aspect-ratio: 1; }
.res-meta { display: flex; flex-wrap: wrap; gap: .35rem .7rem; font-size: .78rem; color: var(--muted); margin-bottom: .35rem; letter-spacing: .01em; }
.res-meta .type { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .09em; font-size: .7rem; }
.res-meta span + span::before { content: "·"; margin-right: .7rem; color: var(--rule-strong); }
.res-row h3 { font-size: 1.2rem; margin: 0 0 .3rem; }
.res-row.lead h3 { font-size: 1.55rem; }
.res-row h3 a { color: var(--text); text-decoration: none; }
.res-row h3 a:hover { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; }
.res-row p { margin: 0; color: var(--muted); font-size: .95rem; }
.res-act { display: flex; flex-direction: column; gap: .5rem; align-items: stretch; min-width: 9.5rem; }
.res-act .small { text-align: center; }
@media (max-width: 720px) {
  .res-row, .res-row.lead { grid-template-columns: 64px minmax(0, 1fr); }
  .res-row.lead { grid-template-columns: 88px minmax(0, 1fr); }
  .res-act { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .res-act .btn { flex: 1; justify-content: center; }
}
details.qa { margin-top: .7rem; border: 1px solid var(--rule); background: var(--surface); }
details.qa summary { cursor: pointer; padding: .65rem .9rem; font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: .5rem; list-style: none; }
details.qa summary::-webkit-details-marker { display: none; }
details.qa[open] summary { border-bottom: 1px solid var(--rule); }
details.qa .prose { padding: .9rem 1rem; }
.empty { text-align: center; padding: var(--s7) var(--s4); border: 1px dashed var(--rule-strong); color: var(--muted); }
.empty h3 { color: var(--text); }
.notice { border-left: 3px solid var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); padding: .8rem 1rem; font-size: .92rem; margin: 0 0 var(--s5); }
.notice.err { border-color: var(--red); background: color-mix(in srgb, var(--red) 9%, transparent); }

/* how it works */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); counter-reset: s; border-top: 1px solid var(--rule-strong); }
.steps li { list-style: none; padding: var(--s5) var(--s5) var(--s5) 0; border-bottom: 1px solid var(--rule); counter-increment: s; }
.steps li + li { padding-left: var(--s5); border-left: 1px solid var(--rule); }
.steps li::before { content: "0" counter(s); font: 600 2.2rem/1 var(--font-display); color: var(--accent); display: block; margin-bottom: .6rem; }
.steps b { font-family: var(--font-display); font-size: 1.15rem; display: block; margin-bottom: .2rem; }
.steps p { color: var(--muted); margin: 0; font-size: .95rem; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; padding: 0; } .steps li + li { padding-left: 0; border-left: 0; } }

/* about preview */
.about-prev { display: grid; grid-template-columns: 1fr 1.4fr; gap: var(--s7); align-items: start; }
.about-prev blockquote { margin: 0; font: italic 500 1.5rem/1.4 var(--font-display); border-left: 3px solid var(--gold); padding-left: var(--s5); }
@media (max-width: 860px) { .about-prev { grid-template-columns: 1fr; gap: var(--s5); } }

/* ---------- library ---------- */
.page-head { padding: var(--s7) 0 var(--s5); border-bottom: 1px solid var(--rule); }
.page-head h1 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); margin-bottom: .4rem; }
.page-head p { color: var(--muted); max-width: 60ch; margin: 0; }
.crumbs { font-size: .82rem; color: var(--muted); margin-bottom: var(--s3); display: flex; gap: .4rem; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.lib { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: var(--s6); padding: var(--s6) 0 var(--s8); }
.filters { position: sticky; top: 5.2rem; align-self: start; display: grid; gap: var(--s3); }
.filters .field { margin: 0; }
.filters h2 { font: 700 .72rem/1 var(--font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--s2); }
.check { display: flex; align-items: center; gap: .55rem; font-weight: 500; font-size: .92rem; margin: 0; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.lib-top { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); margin-bottom: var(--s4); flex-wrap: wrap; }
.lib-top .count { color: var(--muted); font-size: .9rem; }
.pager { display: flex; gap: .4rem; justify-content: center; margin-top: var(--s6); flex-wrap: wrap; }
.pager button { min-width: 2.5rem; height: 2.5rem; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--text); cursor: pointer; font: 600 .9rem var(--font-ui); border-radius: var(--radius); }
.pager button[aria-current="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.filter-toggle { display: none; }
@media (max-width: 860px) {
  .lib { grid-template-columns: 1fr; gap: var(--s4); }
  .filters { position: static; display: none; padding: var(--s4); border: 1px solid var(--rule); background: var(--surface); }
  .filters.open { display: grid; }
  .filter-toggle { display: inline-flex; }
}
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: var(--s4); }
.chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; padding: .3rem .55rem; border: 1px solid var(--rule-strong); background: var(--surface); border-radius: 2px; cursor: pointer; color: var(--text); font-family: var(--font-ui); }
.chip:hover { border-color: var(--text); }

/* ---------- prose / detail ---------- */
.prose { font-size: 1.06rem; line-height: 1.75; max-width: 70ch; overflow-wrap: anywhere; }
.prose h2 { font-size: 1.5rem; margin-top: 1.6em; } .prose h3 { font-size: 1.2rem; margin-top: 1.4em; } .prose h4 { font-size: 1.05rem; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1em; } .prose li { margin-bottom: .35em; }
.prose img { margin: 1em 0; border: 1px solid var(--rule); background: #fff; }
.prose blockquote { margin: 1em 0; padding: .2em 1em; border-left: 3px solid var(--gold); color: var(--muted); }
.prose table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; margin: 1em 0; }
.prose th, .prose td { border: 1px solid var(--rule-strong); padding: .5rem .7rem; text-align: left; }
.prose th { background: var(--bg-2); }
.prose pre, .prose code { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--bg-2); font-size: .92em; }
.prose code { padding: .1em .3em; } .prose pre { padding: .9em 1em; overflow-x: auto; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s7); padding: var(--s6) 0 var(--s8); }
.detail aside { align-self: start; position: sticky; top: 5.5rem; border: 1px solid var(--rule); background: var(--surface); padding: var(--s5); display: grid; gap: var(--s4); }
.detail aside .cover { border: 1px solid var(--rule); background: var(--bg-2); }
.detail dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .4rem .9rem; font-size: .9rem; }
.detail dt { color: var(--muted); } .detail dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; margin: var(--s4) 0; }
.preview { border: 1px solid var(--rule); background: var(--surface); margin-top: var(--s5); }
.preview iframe { width: 100%; height: 70vh; border: 0; background: #fff; }
.preview img { margin: 0 auto; max-height: 75vh; }
.preview .bar { padding: .6rem .9rem; border-bottom: 1px solid var(--rule); font-size: .85rem; color: var(--muted); display: flex; justify-content: space-between; gap: 1rem; }
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); margin-top: var(--s6); padding-top: var(--s4); border-top: 1px solid var(--rule); }
.pn a { text-decoration: none; color: var(--text); display: block; padding: .8rem 0; }
.pn a small { display: block; color: var(--muted); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; }
.pn a:last-child { text-align: right; }
.pn a b { font-family: var(--font-display); font-size: 1.05rem; }
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; gap: var(--s5); } .detail aside { position: static; order: -1; } }

/* ---------- practice ---------- */
.practice { max-width: 820px; margin: 0 auto; padding: var(--s6) 0 var(--s8); }
.setup { border: 1px solid var(--rule); background: var(--surface); padding: var(--s5); display: grid; gap: var(--s4); }
.seg { display: inline-grid; grid-auto-flow: column; border: 1px solid var(--rule-strong); border-radius: var(--radius); overflow: hidden; }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: .7rem 1.1rem; font-weight: 600; font-size: .9rem; cursor: pointer; }
.seg input:checked + span { background: var(--ink); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -3px; }
.progress { height: 4px; background: var(--rule); margin: var(--s3) 0 var(--s4); }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .25s; }
.q-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .88rem; gap: 1rem; flex-wrap: wrap; }
.q-text { font: 500 1.35rem/1.5 var(--font-display); margin: var(--s4) 0; }
.q-text p { margin: 0 0 .6em; }
.q-img { border: 1px solid var(--rule); background: #fff; margin: var(--s3) 0; max-height: 340px; object-fit: contain; }
.opts { display: grid; gap: .6rem; margin: var(--s4) 0; padding: 0; list-style: none; }
.opt { display: flex; gap: .85rem; align-items: flex-start; padding: .9rem 1rem; border: 1px solid var(--rule-strong); background: var(--surface); cursor: pointer; border-radius: var(--radius); margin: 0; font-weight: 500; font-size: 1rem; }
.opt:hover { border-color: var(--text); }
.opt input { position: absolute; opacity: 0; }
.opt .key { width: 1.7rem; height: 1.7rem; border: 1px solid var(--rule-strong); border-radius: 50%; display: grid; place-items: center; font: 700 .78rem var(--font-ui); flex: none; }
.opt:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
:root[data-theme="dark"] .opt:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.opt:has(input:checked) .key { background: var(--ink); color: #fff; border-color: var(--ink); }
:root[data-theme="dark"] .opt:has(input:checked) .key { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.opt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.opt.correct { border-color: var(--green); background: color-mix(in srgb, var(--green) 11%, var(--surface)); box-shadow: inset 0 0 0 1px var(--green); }
.opt.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 9%, var(--surface)); }
.opt.correct .key { background: var(--green); color: #fff; border-color: var(--green); }
.explain { border-left: 3px solid var(--green); padding: .6rem 1rem; background: var(--bg-2); margin: var(--s4) 0; }
.explain h4 { font: 700 .72rem/1 var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--green); margin-bottom: .5rem; }
.q-nav { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-top: var(--s5); }
.score { text-align: center; padding: var(--s6) var(--s4); border: 1px solid var(--rule); background: var(--surface); }
.score .big { font: 600 4rem/1 var(--font-display); color: var(--accent); }
.review-item { border-top: 1px solid var(--rule); padding: var(--s4) 0; }
.review-item .verdict { font-weight: 700; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; }
.review-item .verdict.ok { color: var(--green); } .review-item .verdict.no { color: var(--red); }
.qdots { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: var(--s4); }
.qdots button { width: 1.9rem; height: 1.9rem; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--text); font-size: .75rem; cursor: pointer; border-radius: 3px; }
.qdots button.done { background: var(--bg-2); border-color: var(--text); }
.qdots button[aria-current="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s5) var(--s7); padding: var(--s6) 0; border-bottom: 1px solid var(--rule); }
.about-grid h2 { font-size: 1.3rem; position: sticky; top: 6rem; align-self: start; }
.about-grid .prose { max-width: 66ch; }
@media (max-width: 760px) { .about-grid { grid-template-columns: 1fr; } .about-grid h2 { position: static; } }

/* ---------- footer ---------- */
.site-footer { margin-top: var(--s9); background: var(--ink); color: #dde3ee; padding: var(--s7) 0 var(--s5); }
.site-footer a { color: #dde3ee; text-decoration: none; } .site-footer a:hover { color: #fff; text-decoration: underline; }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.2fr; gap: var(--s6); }
.foot-grid h2 { font: 700 .72rem/1 var(--font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-bottom: var(--s4); }
.foot-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; font-size: .93rem; }
.foot-brand { display: flex; gap: .8rem; align-items: center; margin-bottom: var(--s4); }
.foot-brand .logo-plate img { width: 56px; height: 56px; }
.foot-brand b { font: 600 1.3rem var(--font-display); color: #fff; }
.site-footer p { font-size: .9rem; color: #b8c2d4; max-width: 38ch; }
.foot-bottom { margin-top: var(--s6); padding-top: var(--s4); border-top: 1px solid #28385a; display: flex; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; font-size: .84rem; color: #9aa6bd; }
.foot-bottom .made { color: #c3cce0; }
@media (max-width: 860px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-grid > :first-child { grid-column: 1 / -1; } }
@media (max-width: 520px) { .foot-grid { grid-template-columns: 1fr; } }

/* ---------- loader ---------- */
#boot { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 500; transition: opacity .3s, visibility .3s; }
#boot.done { opacity: 0; visibility: hidden; }
#boot img { width: 96px; height: 96px; background: #fff; padding: 4px; border: 1px solid var(--rule); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { #boot img { animation: none; } * { scroll-behavior: auto !important; } }
.skeleton { height: 5rem; background: linear-gradient(90deg, var(--bg-2), var(--rule), var(--bg-2)); background-size: 200% 100%; animation: sh 1.3s linear infinite; margin: .5rem 0; }
@keyframes sh { to { background-position: -200% 0; } }

.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: var(--radius); font-size: .9rem; z-index: 300; box-shadow: var(--shadow); }

/* ---------- print ---------- */
@media print {
  .site-header, .site-footer, .announce, .toolbar, .pn, .filters, .btn, #boot, .crumbs, .detail aside .btn, .no-print { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .detail { display: block; padding: 0; }
  .detail aside { position: static; border: 0; padding: 0; margin-bottom: 1rem; }
  .prose { max-width: none; font-size: 11pt; }
  details.qa > :not(summary) { display: block !important; }
  a { color: #000; text-decoration: none; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
