/* RADIB.io — Radiology Board Prep
 * Dark reading-room aesthetic with cyan accent.
 * Shared by landing, domain portals, and tools.
 */

:root {
  --bg: #0a1a2e;
  --bg-soft: #13293f;
  --bg-card: #1a334d;
  --border: #264566;
  --text: #e8f0f8;
  --text-dim: #9fb3c8;
  --text-muted: #627d98;
  --accent: #00d4ff;
  --accent-soft: rgba(0, 212, 255, 0.12);
  --accent-hover: #3de3ff;
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --physics: #8b5cf6;
  --clinical: #10b981;
  --essentials: #f59e0b;
  --nis: #ec4899;
  --radius: 12px;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-accent: 0 0 0 3px var(--accent-soft);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ---------- Layout ---------- */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.site-header {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 26, 46, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.02em;
}

.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.brand .domain { color: var(--text-dim); font-weight: 500; }

nav.top a {
  margin-left: 20px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
}

nav.top a:hover { color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
  padding: 56px 0 24px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  margin: 0 0 14px;
  letter-spacing: -0.02em;
}

.hero h1 .accent { color: var(--accent); }

.hero p.lead {
  color: var(--text-dim);
  font-size: 18px;
  max-width: 680px;
  margin: 0 auto 24px;
}

.hero .meta {
  display: inline-flex;
  gap: 18px;
  padding: 10px 18px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-muted);
}
.hero .meta strong { color: var(--text); }

/* ---------- Domain grid (landing) ---------- */
.section-title {
  font-size: 22px;
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.section-title .sub { font-size: 13px; color: var(--text-muted); font-weight: 400; }

.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  display: block;
  color: var(--text);
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.card .tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.card.physics .tag { background: rgba(139, 92, 246, 0.18); color: #c4b5fd; }
.card.clinical .tag { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; }
.card.essentials .tag { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
.card.nis .tag { background: rgba(236, 72, 153, 0.18); color: #f9a8d4; }

.card h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.card p {
  margin: 0 0 14px;
  color: var(--text-dim);
  font-size: 14px;
}

.card .card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.card .pct {
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Tools grid ---------- */
.tools-grid .card { text-align: left; }

.tool-icon {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn:hover { border-color: var(--accent); color: var(--accent); }

.btn.primary {
  background: var(--accent);
  color: #062033;
  border-color: var(--accent);
}
.btn.primary:hover { background: var(--accent-hover); color: #062033; }

.btn.ghost { background: transparent; }

.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.success { border-color: var(--success); color: var(--success); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Subtopic list (portal pages) ---------- */
.subtopic-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0 32px;
}

.subtopic {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 14px 16px;
  border-radius: 6px;
  font-size: 14px;
}
.subtopic strong { display: block; font-size: 15px; margin-bottom: 4px; color: var(--text); }
.subtopic span { color: var(--text-dim); font-size: 13px; }

a.subtopic-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
a.subtopic-link:hover {
  background: var(--bg-card);
  border-left-color: var(--accent-hover);
  transform: translateX(2px);
}
a.subtopic-link:hover strong { color: var(--accent-hover); }

/* ---------- MCQ engine styles ---------- */
.mcq-shell {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin: 24px 0;
}

.mcq-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 18px;
}

.mcq-progress .bar {
  height: 4px;
  background: var(--bg-card);
  border-radius: 2px;
  overflow: hidden;
  flex: 1;
  margin: 0 14px;
}
.mcq-progress .bar > div {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.mcq-stem {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 22px;
}

.mcq-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.mcq-choice {
  padding: 13px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.12s ease;
  font-size: 14px;
  color: var(--text);
  text-align: left;
  font-family: inherit;
}

.mcq-choice:hover:not(.locked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.mcq-choice .letter {
  display: inline-block;
  width: 24px;
  font-weight: 700;
  color: var(--accent);
  margin-right: 8px;
}

.mcq-choice.correct {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.1);
}
.mcq-choice.correct .letter { color: var(--success); }

.mcq-choice.incorrect {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}
.mcq-choice.incorrect .letter { color: var(--danger); }

.mcq-choice.locked { cursor: default; }

.mcq-rationale {
  padding: 16px 18px;
  background: var(--bg-card);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  margin-top: 18px;
  font-size: 14px;
  color: var(--text-dim);
}
.mcq-rationale strong { color: var(--text); }
.mcq-rationale .ref { display: block; margin-top: 10px; font-size: 12px; color: var(--text-muted); }

.mcq-actions { display: flex; justify-content: space-between; margin-top: 18px; }

/* ---------- MCQ Engine v2: distractor explanation, learn-more, weak areas ---------- */
.mcq-rationale .distractor-explanation {
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(239, 68, 68, 0.08);
  border-left: 3px solid var(--danger);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-dim);
}
.mcq-rationale .distractor-explanation .de-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--danger);
  margin-bottom: 6px;
  font-weight: 600;
}

.mcq-rationale .learn-more {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 13px;
}
.mcq-rationale .learn-more .lm-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
  font-weight: 600;
}
.mcq-rationale .learn-more ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text-dim);
}
.mcq-rationale .learn-more a {
  color: var(--accent-hover);
  text-decoration: none;
}
.mcq-rationale .learn-more a:hover { text-decoration: underline; }
.mcq-rationale .learn-more .src { color: var(--text-muted); font-size: 12px; }

/* End-of-session weak areas breakdown */
.weak-areas {
  margin-top: 30px;
  text-align: left;
  padding: 16px 18px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.weak-areas .wa-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 600;
}
.weak-row {
  display: grid;
  grid-template-columns: 150px 1fr 50px;
  gap: 12px;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-dim);
}
.weak-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}
.weak-bar {
  height: 8px;
  background: var(--bg-soft);
  border-radius: 4px;
  overflow: hidden;
  display: block;
  position: relative;
}
.weak-bar > span {
  display: block;
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}
.weak-pct {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  font-family: var(--font-mono);
}

/* End-of-session missed-review panel */
.missed-review {
  margin-top: 24px;
  text-align: left;
  padding: 16px 18px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.missed-review .mr-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--warn);
  margin-bottom: 14px;
  font-weight: 600;
}
.missed-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
}
.missed-item:last-child { border-bottom: none; }
.missed-item .mi-stem { color: var(--text); margin-bottom: 6px; }
.missed-item .mi-answer { margin-bottom: 6px; }
.missed-item .mr-links {
  margin: 6px 0 0 18px;
  padding: 0;
  font-size: 12px;
}
.missed-item .mr-links a { color: var(--accent-hover); text-decoration: none; }
.missed-item .mr-links a:hover { text-decoration: underline; }
.missed-item .mr-links .src { color: var(--text-muted); }

/* Warm-up banner ("Yesterday's misses") */
.warmup-banner {
  padding: 14px 18px;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.14), rgba(245, 158, 11, 0.04));
  border-left: 3px solid var(--warn);
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.warmup-banner strong { color: var(--warn); }
.warmup-banner .btn { flex-shrink: 0; }

/* ---------- Flashcard ---------- */
.flashcard {
  perspective: 1200px;
  height: 280px;
  margin: 30px auto;
  max-width: 620px;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.5s;
  transform-style: preserve-3d;
  cursor: pointer;
}

.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }

.flashcard-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 18px;
}

.flashcard-face.back { transform: rotateY(180deg); background: var(--bg-card); }
.flashcard-face .hint { position: absolute; bottom: 14px; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; }

.ease-row { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.ease-row .btn { flex: 1; max-width: 120px; justify-content: center; }

/* ---------- Case viewer ---------- */
.case-viewer {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  margin: 24px 0;
}
@media (max-width: 800px) { .case-viewer { grid-template-columns: 1fr; } }

.case-image-wrap {
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.case-image-wrap img { max-width: 100%; max-height: 100%; filter: contrast(1.1); }
.case-image-wrap .placeholder { color: #36587a; font-size: 14px; text-align: center; padding: 20px; }
.case-image-wrap .slice-indicator {
  position: absolute; bottom: 10px; right: 12px;
  font-family: var(--font-mono); font-size: 11px; color: var(--accent);
  background: rgba(0, 0, 0, 0.6); padding: 3px 8px; border-radius: 4px;
}

.case-info { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.case-info h4 { margin: 0 0 8px; color: var(--accent); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.case-info p { font-size: 14px; color: var(--text-dim); margin: 0 0 14px; }
.case-info .stem { color: var(--text); font-size: 15px; line-height: 1.6; margin-bottom: 16px; }

/* ---------- Mock exam ---------- */
.exam-timer {
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--accent);
  padding: 6px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.exam-footer {
  position: sticky;
  bottom: 0;
  background: rgba(10, 26, 46, 0.95);
  border-top: 1px solid var(--border);
  padding: 14px 0;
  margin-top: 30px;
  backdrop-filter: blur(6px);
}

.results-summary {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  margin: 24px 0;
}
.results-summary .score { font-size: 56px; font-weight: 800; color: var(--accent); margin: 10px 0; }
.results-summary .breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-top: 20px; }
.results-summary .breakdown > div { padding: 12px; background: var(--bg-card); border-radius: 6px; }
.results-summary .breakdown strong { display: block; color: var(--accent); font-size: 20px; }
.results-summary .breakdown span { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 60px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* ---------- Utility ---------- */
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }
.center { text-align: center; }
.stack > * + * { margin-top: 14px; }
