/* Podiatry Interview Study — theme matched to the "spin and speak" style: deep green-black, cream, copper. */
:root {
  --bg: #121816;
  --bg-2: #171f1c;
  --ink: #f4e8d6;
  --ink-2: rgba(244, 232, 214, 0.68);
  --ink-3: rgba(244, 232, 214, 0.42);
  --line: rgba(244, 232, 214, 0.10);
  --line-2: rgba(244, 232, 214, 0.18);
  --card: rgba(244, 232, 214, 0.05);
  --card-2: rgba(244, 232, 214, 0.08);
  --copper: #c47a4a;
  --copper-2: #d9915f;
  --on-copper: #1a1612;
  --good: #7fb48a;
  --warn: #d8b25a;
  --bad: #d46a5f;
  --surface: #1b2320;
  --surface-2: #161e1b;
  --scrim: rgba(5, 8, 7, .6);
  --shadow: rgba(0, 0, 0, .45);
  --strong: #fff6e9;
  --input-bg: rgba(0, 0, 0, .2);
  --copper-glow: rgba(196, 122, 74, .28);
  --glow-1: var(--glow-1);
  --glow-2: rgba(44, 92, 74, .5);
  --bad-line: rgba(212, 106, 95, .4);
  color-scheme: dark;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --r: 20px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* Clinical light theme — white and navy. Same variable names as above (--copper is simply the accent).
   Switched on by <html data-theme="light"> from Settings → Theme. Radiographs stay on black frames. */
:root[data-theme="light"] {
  --bg: #f5f7fa;
  --bg-2: #ffffff;
  --ink: #14263a;
  --ink-2: rgba(20, 38, 58, 0.72);
  --ink-3: rgba(20, 38, 58, 0.52);
  --line: rgba(20, 38, 58, 0.12);
  --line-2: rgba(20, 38, 58, 0.22);
  --card: #ffffff;
  --card-2: rgba(20, 38, 58, 0.05);
  --copper: #1f5fa6;
  --copper-2: #1a4f8a;
  --on-copper: #ffffff;
  --good: #1f7a4d;
  --warn: #946200;
  --bad: #b3362b;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --scrim: rgba(20, 38, 58, .45);
  --shadow: rgba(20, 38, 58, .18);
  --strong: #0b1b2c;
  --input-bg: #ffffff;
  --copper-glow: rgba(31, 95, 166, .25);
  --glow-1: rgba(31, 95, 166, .16);
  --glow-2: rgba(31, 122, 77, .10);
  --bad-line: rgba(179, 54, 43, .45);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 3px; }

/* ambient glows */
.glow { position: fixed; pointer-events: none; border-radius: 50%; filter: blur(90px); opacity: .55; z-index: 0; }
.glow-a { width: 520px; height: 520px; left: -160px; top: -200px; background: radial-gradient(circle, var(--glow-1), transparent 70%); }
.glow-b { width: 620px; height: 620px; right: -220px; top: 10vh; background: radial-gradient(circle, var(--glow-2), transparent 70%); }

.view { position: relative; z-index: 1; }

/* ---------- spin view ---------- */
#spinView {
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center;
  padding: 28px 16px 40px;
  text-align: center;
}
.brand { margin-bottom: 36px; }
.wordmark { font-family: var(--serif); font-size: 2.15rem; font-weight: 500; margin: 0; letter-spacing: -.01em; }
.tagline { margin: 2px 0 0; color: var(--ink-2); font-size: .95rem; }

.mode-toggle {
  position: relative; display: inline-flex; padding: 4px; gap: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
}
.mode-pill {
  position: absolute; top: 4px; bottom: 4px; left: 4px; border-radius: 999px;
  background: var(--copper); transition: transform .35s var(--ease), width .35s var(--ease);
}
.mode-btn {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 7px;
  border: 0; background: none; padding: 8px 16px; border-radius: 999px;
  font-size: .92rem; font-weight: 600; color: var(--ink-2); transition: color .25s;
  white-space: nowrap;
}
.mode-btn svg { width: 17px; height: 17px; fill: currentColor; stroke: none; opacity: .9; }
.mode-btn[aria-selected="true"] { color: var(--on-copper); }
.mode-hint { color: var(--ink-2); font-size: .85rem; margin: 10px 0 12px; min-height: 1.3em; }

.topic-wrap { position: relative; }
.topic-btn {
  display: inline-flex; align-items: center; gap: 10px; min-width: 220px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 16px; font-size: .92rem; font-weight: 550;
}
.topic-btn:hover { background: var(--card-2); }
.topic-btn .chev { margin-left: auto; width: 16px; height: 16px; transition: transform .2s; }
.topic-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.spark { font-size: 1.05rem; }
.topic-menu {
  position: absolute; z-index: 20; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  min-width: 270px; max-height: 60vh; overflow: auto; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px;
  box-shadow: 0 20px 50px var(--shadow); text-align: left;
}
.topic-menu li button {
  width: 100%; display: flex; justify-content: space-between; gap: 12px;
  border: 0; background: none; padding: 9px 12px; border-radius: 12px; font-size: .92rem;
}
.topic-menu li button:hover, .topic-menu li button:focus-visible { background: var(--card-2); }
.topic-menu li button[aria-selected="true"] { color: var(--copper-2); }
.topic-menu li button:disabled { color: var(--ink-3); cursor: default; background: none; }
.topic-menu .count { color: var(--ink-3); font-variant-numeric: tabular-nums; }

.stage { margin: auto 0; padding: 40px 0 28px; width: 100%; max-width: 860px; }
.eyebrow {
  margin: 0 0 6px; color: var(--copper); font-size: .72rem; font-weight: 650;
  letter-spacing: .18em; text-transform: uppercase;
}
.hook {
  font-family: var(--serif); font-weight: 500; margin: 0;
  font-size: clamp(3rem, 11vw, 5.75rem); line-height: 1.02; letter-spacing: -.02em;
  text-wrap: balance; transition: opacity .15s;
}
.hook.spinning { filter: blur(.4px); opacity: .85; }
.hook.landed { animation: land .5s var(--ease); }
@keyframes land { 0% { transform: scale(.96); opacity: .4; } 100% { transform: none; opacity: 1; } }
.stem { color: var(--ink-2); max-width: 560px; margin: 16px auto 0; font-size: 1.02rem; text-wrap: pretty; }
.meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; min-height: 28px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px; border-radius: 999px; font-size: .78rem; font-weight: 550;
  background: var(--card); border: 1px solid var(--line); color: var(--ink-2);
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.good { color: var(--good); }
.chip.warn { color: var(--warn); }
.chip.bad { color: var(--bad); }
.diff { letter-spacing: 2px; color: var(--copper-2); }

.timer { margin-top: 22px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.timer-ring { position: relative; width: 120px; height: 120px; }
.timer-ring svg { width: 120px; height: 120px; transform: rotate(-90deg); }
.timer-ring circle { fill: none; stroke-width: 5; }
.timer-ring .track { stroke: var(--line); }
.timer-ring .bar { stroke: var(--copper); stroke-dasharray: 339.3; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear; }
.timer-ring.present .bar { stroke: var(--good); }
.timer-ring.over .bar { stroke: var(--bad); }
.timer-ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.timer-label { margin: 0; color: var(--ink-2); font-size: .85rem; }

.actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
.btn {
  border: 1px solid var(--line-2); background: none; border-radius: 999px;
  padding: 11px 22px; font-size: .95rem; font-weight: 600; transition: background .2s, transform .1s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--copper); border-color: var(--copper); color: var(--on-copper); box-shadow: 0 8px 30px var(--copper-glow); }
.btn.primary:hover { background: var(--copper-2); }
.btn.ghost:hover { background: var(--card); }
.btn:disabled { opacity: .4; cursor: default; box-shadow: none; }
.btn.sm { padding: 7px 14px; font-size: .85rem; }
.btn.danger { color: var(--bad); border-color: var(--bad-line); }
.icon-btn {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
}
.icon-btn:hover { color: var(--ink); background: var(--card-2); }
.pool-note { color: var(--ink-3); font-size: .8rem; margin: 14px 0 0; min-height: 1.2em; }
.kbd-hint { color: var(--ink-3); font-size: .75rem; margin: 4px 0 0; }
@media (hover: none) { .kbd-hint { display: none; } }

/* ---------- case view ---------- */
#caseView { max-width: 860px; margin: 0 auto; padding: 18px 16px 40px; }
.case-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.case-head-text { flex: 1; min-width: 0; }
.case-head .eyebrow { margin: 0; }
.case-head h2 { font-family: var(--serif); font-weight: 500; font-size: clamp(1.5rem, 5vw, 2rem); margin: 0; line-height: 1.1; }
.mini-timer {
  font-variant-numeric: tabular-nums; font-weight: 600; padding: 6px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); font-size: .92rem;
}
.mini-timer.present { color: var(--good); }
.mini-timer.over { color: var(--bad); }

.rail { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail button {
  flex: none; border: 1px solid var(--line); background: var(--card); color: var(--ink-3);
  padding: 6px 12px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap;
}
.rail button.seen { color: var(--ink-2); }
.rail button.current { color: var(--on-copper); background: var(--copper); border-color: var(--copper); }

.step-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 24px; min-height: 320px;
}
.step-num { color: var(--copper); font-size: .72rem; font-weight: 650; letter-spacing: .18em; text-transform: uppercase; margin: 0; }
.step-title { font-family: var(--serif); font-weight: 500; font-size: clamp(1.6rem, 5vw, 2.2rem); margin: 2px 0 14px; line-height: 1.1; }
.prompt-box {
  border: 1px dashed var(--line-2); border-radius: 16px; padding: 18px; color: var(--ink-2);
}
.prompt-box p { margin: 0 0 12px; }
.reveal-btn { margin-top: 4px; }
.content { font-size: 1rem; }
.content p { margin: 0 0 10px; }
.content ul { margin: 0 0 12px; padding-left: 20px; }
.content li { margin: 3px 0; }
.content li::marker { color: var(--copper); }
.content h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; color: var(--copper-2); margin: 18px 0 6px; }
.content strong { color: var(--strong); font-weight: 600; }
.kv { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 4px 16px; margin: 0 0 12px; }
.kv dt { color: var(--ink-2); font-weight: 550; }
.kv dd { margin: 0; }
.quote { font-family: var(--serif); font-size: clamp(1.4rem, 4.5vw, 1.9rem); line-height: 1.25; margin: 0 0 10px; }

.figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 16px 0; }
.fig { margin: 0; background: #0b0f0e; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; cursor: zoom-in; }
.fig img { display: block; width: 100%; height: 200px; object-fit: contain; background: #000; }
.fig figcaption { padding: 8px 10px; font-size: .8rem; color: var(--ink-2); }

.block { margin-top: 18px; }
.block-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-3); margin: 0 0 8px; font-weight: 650; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; color: var(--ink-2); }
.checklist input { margin-top: 4px; accent-color: var(--copper); }
.checklist input:checked + span { color: var(--ink); }

.qa { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.qa-q { display: flex; gap: 12px; justify-content: space-between; align-items: center; width: 100%; text-align: left; border: 0; background: var(--card); padding: 12px 14px; font-weight: 550; }
.qa-q .tag { flex: none; font-size: .75rem; color: var(--copper-2); font-weight: 600; }
.qa-a { padding: 12px 14px 4px; border-top: 1px solid var(--line); }
.pearls li { margin-bottom: 4px; }

.final { text-align: center; padding: 8px 0; }
.final .title { font-family: var(--serif); font-size: clamp(1.7rem, 5.5vw, 2.4rem); margin: 4px 0 6px; line-height: 1.15; }
.rate { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0 12px; }
.rate button {
  border: 1px solid var(--line-2); background: var(--card); border-radius: 16px; padding: 14px 8px;
  font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.rate button small { color: var(--ink-3); font-weight: 400; font-size: .75rem; }
.rate button[data-status="good"]:hover, .rate button[data-status="good"].on { border-color: var(--good); color: var(--good); }
.rate button[data-status="improve"]:hover, .rate button[data-status="improve"].on { border-color: var(--warn); color: var(--warn); }
.rate button[data-status="failed"]:hover, .rate button[data-status="failed"].on { border-color: var(--bad); color: var(--bad); }
.note-input {
  width: 100%; min-height: 70px; resize: vertical; background: var(--input-bg); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: 14px; padding: 10px 12px; font: inherit; font-size: .92rem;
}
details.editor { margin-top: 18px; color: var(--ink-3); font-size: .85rem; text-align: left; }
details.editor summary { cursor: pointer; }

.notes-panel { margin-top: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px 14px; }
.notes-panel.collapsed { padding-bottom: 10px; }
.notes-head { display: flex; align-items: center; gap: 10px; }
.notes-toggle { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px 2px; font-weight: 600; color: var(--ink); }
.notes-toggle .chev { width: 16px; height: 16px; transition: transform .2s; }
.notes-toggle[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.notes-status { margin-left: auto; font-size: .78rem; color: var(--ink-3); }
.btn.small { padding: 5px 12px; font-size: .8rem; }
.notes-area { margin-top: 10px; min-height: 110px; }
.step-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.switch { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: .85rem; cursor: pointer; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); transition: transform .2s; }
.switch input:checked { background: var(--copper); }
.switch input:checked::after { transform: translateX(16px); }

/* ---------- drawer / modal ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(3px); z-index: 30; }
.drawer {
  position: fixed; z-index: 31; top: 0; right: 0; bottom: 0; width: min(440px, 100%);
  background: var(--surface-2); border-left: 1px solid var(--line); padding: 18px 16px; overflow-y: auto;
  animation: slide .3s var(--ease);
}
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.drawer-head h2 { font-family: var(--serif); font-weight: 500; margin: 0; font-size: 1.6rem; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px; text-align: center; }
.stat b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: .72rem; color: var(--ink-2); }
.stat.good b { color: var(--good); } .stat.warn b { color: var(--warn); } .stat.bad b { color: var(--bad); }
.bar-row { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--line); display: flex; overflow: hidden; }
.bar-row i { display: block; height: 100%; }
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.filter-row button { border: 1px solid var(--line); background: var(--card); padding: 5px 11px; border-radius: 999px; font-size: .8rem; color: var(--ink-2); }
.filter-row button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.case-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.case-list button {
  width: 100%; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 14px;
  padding: 10px 12px; display: grid; grid-template-columns: 10px 1fr auto; gap: 4px 10px; align-items: center;
}
.case-list button:hover { background: var(--card-2); }
.case-list .sdot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); }
.case-list .sdot.good { background: var(--good); } .case-list .sdot.improve { background: var(--warn); } .case-list .sdot.failed { background: var(--bad); }
.case-list .t { font-weight: 550; font-size: .92rem; }
.case-list .s { grid-column: 2 / 4; color: var(--ink-3); font-size: .78rem; }
.case-list .d { color: var(--ink-3); font-size: .75rem; }
.empty { color: var(--ink-3); text-align: center; padding: 30px 0; font-size: .9rem; }

.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: var(--scrim); backdrop-filter: blur(3px); }
.modal-card { width: min(460px, 100%); max-height: 90dvh; overflow: auto; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 22px; padding: 20px; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; color: var(--ink-2); font-size: .92rem; flex-wrap: wrap; }
.field.col { flex-direction: column; align-items: flex-start; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 999px; }
.stepper button { border: 0; background: none; width: 34px; height: 34px; font-size: 1.1rem; }
.stepper output { min-width: 64px; text-align: center; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; border-radius: 999px; padding: 5px 10px; font-size: .8rem; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--copper); color: var(--on-copper); font-weight: 600; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }

.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 82dvh; object-fit: contain; border-radius: 8px; }
.lightbox p { color: var(--ink-2); font-size: .9rem; margin: 12px 0 0; text-align: center; }

.toast {
  position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .9rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); animation: up .25s var(--ease);
}
@keyframes up { from { transform: translate(-50%, 10px); opacity: 0; } }

@media (max-width: 560px) {
  .brand { margin-bottom: 26px; }
  .mode-btn { padding: 8px 11px; font-size: .84rem; gap: 5px; }
  .mode-btn svg { display: none; }
  .topic-btn { min-width: 0; width: 100%; max-width: 320px; }
  .step-card { padding: 18px 16px; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dd { margin-bottom: 8px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .actions .btn { padding: 11px 18px; }
  .figs { grid-template-columns: 1fr 1fr; }
  .fig img { height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
