/* radiologytrainee.org — reading-room dark theme */
:root {
  --bg: #0a0d12; --bg-2: #0f141b; --panel: #131a23; --panel-2: #18212c; --border: #243142;
  --text: #e6edf3; --muted: #97a6b5; --accent: #5ec8f0; --accent-ink: #04202c; --amber: #f2b84b;
  --ok: #6fd3a6; --radius: 12px; --wrap: 1180px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.6 var(--font); }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: #9adcf6; }
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }
code { background: var(--panel-2); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: .2em 0 .3em; }
h2 { font-size: 1.35rem; margin: 1.4em 0 .5em; }
h3 { font-size: 1.05rem; margin: 1.2em 0 .4em; color: var(--accent); }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: .88rem; } .center { text-align: center; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* header / footer */
.site-header { position: sticky; top: 0; z-index: 5; background: rgba(10,13,18,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 1.15rem; letter-spacing: .01em; }
.brand b { color: var(--accent); font-weight: 700; }
.brand-mark { width: 22px; height: 22px; border-radius: 50%; border: 4px solid var(--accent); box-shadow: 0 0 12px rgba(94,200,240,.45); }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); background: var(--panel-2); }
.lock { font-size: .8em; opacity: .8; }
.site-footer { margin-top: 64px; border-top: 1px solid var(--border); background: var(--bg-2); padding: 24px 0 40px; color: var(--muted); font-size: .9rem; }
.disclaimer strong { color: var(--text); }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer; border-radius: 9px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); padding: 8px 14px; text-decoration: none; line-height: 1.2; }
.btn:hover { background: #8ad8f5; color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }
.btn-ghost[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.btn-lg { padding: 12px 20px; font-size: 1.02rem; }
.btn-small { padding: 5px 10px; font-size: .85rem; }

/* home */
.hero { padding: 56px 0 24px; max-width: 860px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; color: var(--accent); margin: 0; font-weight: 700; }
.accent { color: var(--accent); }
.lead { font-size: 1.12rem; color: #c5d1dc; max-width: 820px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 32px 0; }
.step, .panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.step h2 { margin: .4em 0 .3em; font-size: 1.15rem; }
.step p { margin: 0; color: #c5d1dc; }
.step-n { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--panel-2); color: var(--accent); font-weight: 700; border: 1px solid var(--border); }
.panel { margin: 20px 0; } .panel h2 { margin-top: .2em; }
.panel-alt { background: linear-gradient(135deg, #132433, var(--panel)); }
.page-head { padding: 36px 0 8px; }
.prose { max-width: 820px; } .prose li { margin: .35em 0; }
.notice { border-left: 3px solid var(--amber); background: rgba(242,184,75,.08); padding: 10px 14px; border-radius: 0 8px 8px 0; }

/* library */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.chip { font: inherit; font-size: .88rem; color: var(--muted); background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.chip[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 600; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.case-table { width: 100%; border-collapse: collapse; background: var(--panel); }
.case-table th, .case-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.case-table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: var(--bg-2); }
.case-table tr:last-child td { border-bottom: 0; }
.case-table tbody tr:hover { background: var(--panel-2); }
.case-table .num { text-align: center; }
.case-link { font-weight: 700; text-decoration: none; }

/* case page */
.page-case .wrap { max-width: 1320px; }
.case-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding-top: 18px; }
.crumbs { margin: 0; font-size: .88rem; color: var(--muted); } .crumbs a { color: var(--muted); }
.case-head h1 { margin: .1em 0 .2em; }
.meta { margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.tag { display: inline-block; font-size: .8rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: #c5d1dc; }
.tag-mod { color: var(--accent); border-color: rgba(94,200,240,.4); }
.timer { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; flex-wrap: wrap; }
.timer-min { font: inherit; font-size: .85rem; background: var(--bg-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.timer-display { font: 700 1.5rem/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; min-width: 4.2ch; text-align: center; font-variant-numeric: tabular-nums; }
.timer.running .timer-display { color: var(--ok); }
.timer.warn .timer-display { color: var(--amber); }
.timer.done { border-color: var(--amber); animation: pulse 1s ease-in-out 3; }
.timer.done .timer-display { color: var(--amber); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(242,184,75,.25); } }
.stem { background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 14px 18px; margin: 16px 0; }
.stem p { margin: .2em 0; }
.label { display: inline-block; text-transform: uppercase; font-size: .72rem; letter-spacing: .1em; font-weight: 700; color: var(--accent); margin-right: 8px; }
.films { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 8px 0 28px; }
.films-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); align-items: start; }
.film { margin: 0; background: #000; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.film-btn { display: block; position: relative; width: 100%; padding: 0; border: 0; background: #000; cursor: zoom-in; }
.film-btn img { display: block; margin: 0 auto; width: auto; max-width: 100%; max-height: 78vh; object-fit: contain; }
.films-2 .film-btn img { max-height: 70vh; }
.zoom-hint { position: absolute; right: 10px; bottom: 10px; font-size: .78rem; background: rgba(10,13,18,.75); color: var(--text); padding: 4px 8px; border-radius: 6px; opacity: .0; transition: opacity .2s; }
.film-btn:hover .zoom-hint, .film-btn:focus-visible .zoom-hint { opacity: 1; }
.film figcaption { padding: 8px 12px; font-size: .9rem; color: #c5d1dc; background: var(--bg-2); border-top: 1px solid var(--border); }
.img-letter { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; border-radius: 6px; background: var(--panel-2); color: var(--accent); font-weight: 700; font-size: .8rem; margin-right: 4px; border: 1px solid var(--border); }

.q-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.q-toolbar h2 { margin: 0; }
.q-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.q-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 12px; counter-reset: none; }
.q { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; }
.q[hidden] { display: none; }
.q.just-shown { animation: fadein .3s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }
.q-text { margin: 0 0 8px; font-weight: 600; }
.q-num { display: inline-block; min-width: 2.4em; color: var(--accent); font-weight: 800; }
.q-foot { margin-top: 10px; }
.q-foot:empty { display: none; }
.end-note { margin: 0; color: var(--muted); font-size: .9rem; }
details.answer > summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; font-size: .95rem; list-style: none; padding: 4px 10px; border: 1px dashed rgba(94,200,240,.5); border-radius: 8px; user-select: none; }
details.answer > summary::-webkit-details-marker { display: none; }
details.answer > summary::before { content: "\25B8"; transition: transform .15s; }
details.answer[open] > summary::before { transform: rotate(90deg); }
details.answer[open] > summary { border-style: solid; background: rgba(94,200,240,.08); }
details.answer > ul { margin: 10px 0 2px; padding-left: 1.3em; color: #d6e0ea; }
details.answer li { margin: .3em 0; }
.summary-box { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.summary-box[open] { border-color: rgba(94,200,240,.45); }
.dx { font-size: 1.2rem; font-weight: 700; margin: 14px 0 4px; }
.plain { list-style: none; padding: 0; } .plain li { margin: .45em 0; }
.reading li { margin: .35em 0; font-size: .93rem; }
.credits { margin-top: 24px; font-size: .92rem; color: #c5d1dc; }
.credits h2 { font-size: 1.05rem; }
.credit-list li { margin: .5em 0; }
.credit-case h2 { font-size: 1.1rem; margin-bottom: .2em; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin: 32px 0 0; padding-top: 16px; border-top: 1px solid var(--border); }
.pager a { text-decoration: none; font-weight: 600; }

/* lightbox */
.lightbox { width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; margin: 0; padding: 0; border: 0; background: #000; color: var(--text); }
.lightbox::backdrop { background: rgba(0,0,0,.92); }
.lb-bar { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; background: rgba(10,13,18,.9); border-bottom: 1px solid var(--border); z-index: 1; flex-wrap: wrap; }
.lb-tools { display: flex; gap: 8px; }
.lb-stage { height: calc(100vh - 58px); overflow: auto; display: grid; place-items: center; }
.lb-img { max-width: 100%; max-height: calc(100vh - 70px); object-fit: contain; cursor: zoom-in; }
.lightbox.zoomed .lb-stage { place-items: start; }
.lightbox.zoomed .lb-img { max-width: none; max-height: none; width: 200%; cursor: zoom-out; }
.lightbox.inverted .lb-img { filter: invert(1); }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .header-inner { padding: 8px 0; }
  .site-nav a { padding: 6px 8px; font-size: .9rem; }
  .case-head { align-items: stretch; }
  .timer { width: 100%; }
  .timer-min { flex: 1 1 100%; }
  .timer-display { margin-right: auto; }
  .film-btn img, .films-2 .film-btn img { max-height: 65vh; }
  .q { padding: 12px 14px; }
  .lightbox.zoomed .lb-img { width: 300%; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print {
  .site-header, .site-footer, .timer, .q-actions, .q-foot, .lightbox, .pager { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ---------- OSCER format ---------- */
.station-k { margin: .5em 0 0; text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; font-weight: 700; color: var(--amber); }
.q-intro { margin: 8px 0 0; }
.release-panel { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 6px; min-height: 260px;
  background: repeating-linear-gradient(135deg, var(--panel), var(--panel) 12px, var(--bg-2) 12px, var(--bg-2) 24px);
  border: 1px dashed var(--amber); border-radius: var(--radius); padding: 24px; }
.release-panel p { margin: 0; }
.release-k { text-transform: uppercase; letter-spacing: .12em; font-weight: 800; color: var(--amber); font-size: .85rem; }
.film.just-shown { animation: fadein .35s ease; }
.ans-body { margin-top: 12px; }
.ans-body.has-ann { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.ann-wrap { display: grid; gap: 10px; }
.ans-body.has-ann-2 { grid-template-columns: 1fr; }
.has-ann-2 .ann-svg { max-height: 62vh; }
.ann-wrap.ann-2 { grid-template-columns: 1fr 1fr; }
.annotated { margin: 0; background: #000; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.ann-svg { display: block; width: 100%; height: auto; max-height: 72vh; }
.annotated figcaption { padding: 6px 10px; font-size: .85rem; color: #c5d1dc; background: var(--bg-2); border-top: 1px solid var(--border); }
.mk-head { margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mk-total { font-weight: 800; color: var(--amber); }
.dom { font-size: .8rem; padding: 2px 10px; border-radius: 999px; border: 1px solid rgba(242,184,75,.45); color: var(--amber); }
.guide-list { margin: 6px 0; padding-left: 1.2em; color: #d6e0ea; }
.guide-list li { margin: .35em 0; }
.guide-list li::marker { color: var(--amber); }
.mk { font-weight: 700; color: var(--amber); white-space: nowrap; }
.ex-note { margin: 10px 0 0; font-size: .92rem; color: var(--muted); border-left: 3px solid #5fc9c0; padding: 4px 10px; background: rgba(95,201,192,.06); border-radius: 0 8px 8px 0; }
.ex-k { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: #5fc9c0; }
.ext-section { margin-top: 28px; padding-top: 6px; border-top: 2px solid rgba(95,201,192,.5); }
.ext-section h2 { color: #5fc9c0; margin-top: .8em; }
.q-ext .q-num { color: #5fc9c0; }
.q-ext details.answer > summary { color: #5fc9c0; border-color: rgba(95,201,192,.55); }
.q-ext details.answer[open] > summary { background: rgba(95,201,192,.08); }
.q-film { margin: 8px 0 12px; }
.q-film .film-btn img { max-height: 60vh; }
.syl-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.syl-table th, .syl-table td { text-align: left; vertical-align: top; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.syl-table th { width: 15em; color: var(--amber); font-weight: 600; }
.syl-table tr:last-child th, .syl-table tr:last-child td { border-bottom: 0; }
.chip-n { display: inline-block; min-width: 1.4em; margin-left: 4px; padding: 0 5px; border-radius: 999px; background: var(--bg-2); color: var(--muted); font-size: .78rem; text-align: center; }
.chip[aria-pressed="true"] .chip-n { background: rgba(4,32,44,.25); color: var(--accent-ink); }
.chip-empty { opacity: .6; }
@media (max-width: 900px) {
  .ans-body.has-ann { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .ann-wrap.ann-2 { grid-template-columns: 1fr; }
  .syl-table th { width: auto; display: block; border-bottom: 0; padding-bottom: 0; }
  .syl-table td { display: block; }
  .release-panel { min-height: 160px; }
}
