/* ============================================================
   OSCE Patient — history-taking practice
   One phase owns the screen at a time: history, then the clinical
   steps, then the report. The top bar is the only constant.
   ============================================================ */

:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --line: #e6e8ef;
  --line-soft: #eef0f6;
  --ink: #111111;
  --ink-2: #1a1f2e;
  --label: #2b3550;
  --muted: #667085;
  --muted-2: #98a2b3;
  --field: #d0d5dd;
  --accent: #2b63ff;
  --accent-dark: #1f4bd8;
  --accent-soft: #e7f0ff;
  --accent-soft-line: #cfe0ff;
  --dark: #0b1020;
  --dark-ink: #e9eeff;
  --dark-muted: #b9c6ff;
  --good-bg: #e8f8ee;
  --good-line: #b9e6c9;
  --good-ink: #14562e;
  --warn-bg: #fff8e6;
  --warn-line: #ffdf9e;
  --warn-ink: #7a5200;
  --warn-ink-2: #6b4800;
  --bad-bg: #fdeced;
  --bad-line: #f6c5c8;
  --bad-ink: #8a1f28;
  --radius: 16px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* Class-level display rules outrank the browser's [hidden] rule, so state
   this once and loudly rather than per component. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 12px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.brandName { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.brandSub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topControls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }

.pickField {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px 10px 5px 12px;
  border: 1px solid var(--field);
  border-radius: 10px;
  background: var(--card);
}
.pickField > span { font-size: 12px; color: var(--muted); }
.pickField select {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  padding: 4px 2px;
  min-width: 0;
  max-width: 260px;
  text-overflow: ellipsis;
}
.pickField select:focus { outline: none; }

.topActions { display: flex; align-items: center; gap: 8px; }

.btn {
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.ghost { background: var(--card); border-color: var(--field); color: #344054; }
.btn.ghost:hover { background: #f7f8fb; border-color: var(--muted-2); }
.btn[disabled] { opacity: 0.5; cursor: default; }

/* ---------- stage ---------- */

/* A column, so anything that sits above the phase — the guest banner — is a
   full-width row rather than a second column beside it. */
.stage { flex-grow: 1; display: flex; flex-direction: column; align-items: center; padding: 24px 28px 48px; }
.phase { width: 100%; max-width: 1000px; display: flex; flex-direction: column; gap: 18px; }
.phase[hidden] { display: none; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.cardHead { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.cardHead h2 { margin: 0; font-size: 17px; font-weight: 700; }
.muted { font-size: 13px; color: var(--muted); }
.stageNote { margin: 0; text-align: center; font-size: 13px; color: var(--muted); }

/* ---------- patient strip ---------- */

.patientStrip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 13px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.patientWho { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 40px; height: 40px; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid var(--accent-soft-line);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--accent);
}
.patientName { font-size: 15px; font-weight: 700; }
.patientMeta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.patientStats { display: flex; align-items: center; gap: 18px; }
.stat { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.statLabel { font-size: 13px; color: var(--muted); }
.statValue { font-size: 15px; font-weight: 700; }
.statDivider { width: 1px; height: 32px; background: var(--line); }

/* ---------- chat ---------- */

.chatCard { display: flex; flex-direction: column; gap: 14px; }

.chatLog {
  min-height: 240px;
  max-height: 60vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #fbfbfe;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
}

.msg { display: flex; }
.msg.me { justify-content: flex-end; }
.bubble {
  max-width: 74%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.me .bubble { background: var(--accent-soft); border: 1px solid var(--accent-soft-line); }
.pt .bubble { background: var(--card); border: 1px solid #e3e6ee; }

/* Flagging a reply sits inside the patient's bubble, quiet until hovered:
   it belongs to that reply, and it shouldn't compete with the reply itself. */
.flagWrap {
  margin-top: 7px;
  min-height: 20px;
  font-size: 12px;
}
.flagBtn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.msg:hover .flagBtn,
.flagBtn:focus-visible { opacity: 1; }
.flagBtn:hover {
  color: var(--warn-ink);
  border-color: var(--warn-line);
  background: var(--warn-bg);
}

.flagForm {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.flagInput {
  flex: 1 1 180px;
  min-width: 0;
  padding: 5px 9px;
  border: 1px solid var(--field);
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  background: var(--card);
  color: var(--ink);
}
.flagSend,
.flagCancel {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--field);
  background: var(--card);
  color: var(--label);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.flagSend {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}
.flagDone { color: var(--good-ink); }
.flagFailed { color: var(--warn-ink); }

@media (prefers-reduced-motion: reduce) {
  .flagBtn { transition: none; }
}

.systemNote {
  align-self: center;
  font-size: 12px;
  color: var(--muted-2);
  padding: 4px 12px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
}

.chatForm { display: flex; gap: 10px; }
.chatInput {
  flex: 1;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--field);
  font: inherit;
  font-size: 15px;
}
.chatInput:focus, .input:focus { outline: 2px solid rgba(43,99,255,0.2); border-color: var(--accent); }

/* ---------- stepper ---------- */

.stepper { display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.stepNode { display: flex; align-items: center; gap: 10px; }
.stepDot {
  width: 28px; height: 28px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  background: var(--card); border: 1px solid var(--field); color: var(--muted-2);
}
.stepNode.done .stepDot, .stepNode.current .stepDot {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.stepName { font-size: 14px; font-weight: 600; color: var(--muted-2); }
.stepNode.done .stepName, .stepNode.current .stepName { color: var(--ink); }
.stepLine { flex-grow: 1; min-width: 24px; height: 2px; background: var(--line); margin: 0 14px; }
.stepLine.done { background: var(--accent); }

/* ---------- findings ---------- */

.findingsArea { display: flex; flex-direction: column; gap: 18px; }
.findingsArea:empty { display: none; }

.findingTable { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.findingRow {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 16px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}
.findingRow:last-child { border-bottom: none; }
.findingRow:nth-child(odd) { background: #fbfbfe; }
.findingLabel { font-weight: 700; color: var(--label); }
.findingText { color: var(--ink-2); line-height: 1.5; overflow-wrap: anywhere; }
.findingText.unavailable { color: var(--muted); font-style: italic; }

/* ---------- form fields ---------- */

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.fieldHead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.fieldLabel { font-size: 14px; font-weight: 600; color: var(--label); }
.fieldMarks { font-size: 12px; color: var(--muted-2); }
.fieldHint { font-size: 12px; color: var(--muted); }

.input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--field);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  background: var(--card);
  resize: vertical;
}

.fieldGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.rowActions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.rowActions .btn.ghost { margin-right: auto; }

/* ---------- report ---------- */

#report { display: flex; flex-direction: column; gap: 18px; }

.scoreHero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 22px 26px;
  background: var(--dark);
  border-radius: var(--radius);
}
.scoreHeroLeft { display: flex; flex-direction: column; gap: 6px; }
.scoreCaption { font-size: 13px; color: var(--dark-muted); letter-spacing: 0.02em; }
.scoreValue { display: flex; align-items: baseline; gap: 10px; }
.scoreNumber { font-size: 46px; font-weight: 700; color: var(--dark-ink); line-height: 1; }
.scoreOutOf { font-size: 20px; color: #7e8bb8; }
.pills { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill {
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  color: var(--dark-ink);
  font-size: 13px;
  font-weight: 700;
}
.pill.great { color: #7CFFB2; }
.pill.ok { color: #FFD37C; }
.pill.low { color: #FFB4B4; }

.bars { display: flex; flex-direction: column; gap: 14px; }
.bar { display: flex; flex-direction: column; gap: 6px; }
.barHead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.barName { font-size: 14px; font-weight: 600; color: var(--label); }
.barScore { font-size: 14px; color: #344054; }
.barScore b { font-weight: 700; }
.barTrack { height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.barFill { height: 8px; border-radius: 999px; background: var(--accent); }

.advice {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: var(--radius);
  padding: 20px;
}
.advice h2 { margin: 0 0 12px; font-size: 17px; font-weight: 700; color: var(--warn-ink); }
.adviceList { display: flex; flex-direction: column; gap: 9px; }
.adviceItem { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; color: var(--warn-ink-2); }
.adviceItem svg { flex-shrink: 0; margin-top: 2px; }

.coverGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.coverHead { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.coverHead h2 { margin: 0; font-size: 16px; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: #f7f8fb;
  color: #475467;
}
.chip.hit { background: var(--good-bg); border-color: var(--good-line); color: var(--good-ink); }

.answer { display: flex; flex-direction: column; gap: 14px; }
.answer h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--label);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.answer p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.answer ul, .answer ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; }
.answer li { font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.answer hr { border: 0; border-top: 1px solid var(--line-soft); margin: 2px 0; }

.marksTable { display: flex; flex-direction: column; gap: 8px; }
.markRow { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 14px; }
.markRow .barName { font-weight: 500; }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .topbar { padding: 12px 16px; gap: 12px; }
  /* On a phone the case picker is the widest thing on the page — let it take
     the full row rather than pushing the layout sideways. */
  .topControls { width: 100%; }
  .pickField:first-child { flex-grow: 1; }
  .pickField:first-child select { max-width: 100%; width: 100%; }
  .topActions { width: 100%; }
  .topActions .btn { flex-grow: 1; justify-content: center; }
  .stage { padding: 18px 16px 40px; }
  .coverGrid, .fieldGrid { grid-template-columns: 1fr; }
  .findingRow { grid-template-columns: 1fr; gap: 4px; }
  .patientStats { width: 100%; justify-content: space-between; }
  .bubble { max-width: 88%; }
}

/* ---------- the differential repeater ---------- */
.ddxField { gap: 10px; }
.ddxList { display: flex; flex-direction: column; gap: 14px; margin-bottom: 12px; }
.ddxRow {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ddxHead { display: flex; align-items: center; gap: 10px; }
.ddxIndex {
  flex: 0 0 auto;
  min-width: 58px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.ddxName { flex: 1 1 auto; }
.ddxRemove {
  flex: 0 0 auto;
  border: 0;
  background: none;
  color: var(--muted-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}
.ddxRemove:hover { color: var(--warn-ink); }
.ddxAdd { align-self: flex-start; }
@media (max-width: 640px) {
  .ddxHead { flex-wrap: wrap; }
  .ddxName { flex: 1 1 100%; order: 2; }
}

/* ---------- what you didn't ask ---------- */
.missedCard { border-color: var(--warn-line); }
.missedGroup { margin-bottom: 16px; }
.missedGroup:last-child { margin-bottom: 0; }
.missedSection {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 8px;
}
.missedItem {
  padding: 9px 0;
  border-top: 1px solid var(--line-soft);
}
.missedGroup .missedItem:first-of-type { border-top: 0; }
.missedTop { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.missedLabel { font-size: 14px; font-weight: 600; }
.missedPts { font-size: 12px; color: var(--muted-2); white-space: nowrap; }
.missedAsk {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--warn-ink);
}

/* The illness script in a sentence, under the diagnosis. It's the thing the
   student is meant to be carrying in their head — what this condition looks
   like when it's textbook — so the evidence underneath has something to be
   evidence FOR. */
.keyScript {
  margin: 2px 0 10px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted-2);
  font-style: italic;
}
.keyTell {
  margin-top: 9px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted-2);
}
.keyTellHead {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-right: 6px;
}

/* Half credit — they started this screen and stopped at one symptom. It sits
   in the same list as the misses because the advice is the same, but it isn't
   a miss and shouldn't read as one. */
.halfTag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 1px;
  background: var(--warn-bg, rgba(180, 130, 20, 0.14));
  color: var(--warn-ink);
}
.missedItemPartial .missedPts { color: var(--warn-ink); }


/* ============================================================
   Differential answer key
   The leading diagnosis first, then the rest. Under each, what
   supports it (green) and what argues against it (red) — the two
   halves of the reasoning the student is being marked on, so they
   have to be separable at a glance.
   ============================================================ */
.keyList { display: flex; flex-direction: column; gap: 12px; }

.keyCard {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--card);
}
.keyCard.isLeading {
  border-color: var(--accent-soft-line);
  background: var(--accent-soft);
}

.keyHead { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 10px; }
.keyRank {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--line-soft);
}
.keyCard.isLeading .keyRank { color: #fff; background: var(--accent); }
.keyName { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.3; }
.keyBadge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.keyBadge.leading { color: #fff; background: var(--accent); }
.keyBadge.common { color: var(--muted); background: var(--line-soft); }
.keyBadge.cantmiss { color: var(--bad-ink); background: var(--bad-bg); border: 1px solid var(--bad-line); }

.keyEvidence {
  border-radius: 10px;
  padding: 9px 12px;
  margin-top: 8px;
  border: 1px solid transparent;
}
.keyEvidence.for { background: var(--good-bg); border-color: var(--good-line); }
.keyEvidence.against { background: var(--bad-bg); border-color: var(--bad-line); }

.keyEvidenceHead {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.keyEvidence.for .keyEvidenceHead { color: var(--good-ink); }
.keyEvidence.against .keyEvidenceHead { color: var(--bad-ink); }

.keyEvidence ul { margin: 0; padding-left: 18px; }
.keyEvidence li { font-size: 13.5px; line-height: 1.55; }
.keyEvidence.for li { color: var(--good-ink); }
.keyEvidence.against li { color: var(--bad-ink); }


/* The two halves of the reasoning are two different thoughts — what points
   towards the diagnosis and what points away — so they get two boxes, tinted
   the same way as the answer key they'll be compared against. */
.ddxReasons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
@media (max-width: 640px) { .ddxReasons { grid-template-columns: 1fr; } }

.ddxReasonBox { display: block; border-radius: 10px; padding: 8px 10px; border: 1px solid transparent; }
.ddxReasonBox.for { background: var(--good-bg); border-color: var(--good-line); }
.ddxReasonBox.against { background: var(--bad-bg); border-color: var(--bad-line); }

.ddxReasonHead {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.ddxReasonBox.for .ddxReasonHead { color: var(--good-ink); }
.ddxReasonBox.against .ddxReasonHead { color: var(--bad-ink); }
.ddxReasonBox .ddxReason { background: var(--card); }

/* "Is there anything else you'd like to examine?" — asked outright, because an
   empty box with "leave blank if you're done" under it reads as a prompt to
   keep going. */
.askMore { padding: 4px 0; }
.askMoreQ { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.askMoreActions { display: flex; gap: 10px; flex-wrap: wrap; }


/* ============================================================
   Choosing a case
   The first screen of the session, so it gets the page rather
   than a corner of the header.
   ============================================================ */
.pickHead { margin: 8px 0 20px; }
.pickTitle { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.02em; }
.pickLead { margin: 0; color: var(--muted); font-size: 15px; max-width: 60ch; line-height: 1.6; }

.yearPick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.yearPickLabel { font-size: 13px; color: var(--muted); }
.yearOptions { display: inline-flex; background: var(--line-soft); border-radius: 999px; padding: 3px; gap: 3px; }
.yearOption {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.yearOption.is-on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08); }
.yearPickNote { font-size: 13px; color: var(--muted-2); }

.caseGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.caseCard {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  cursor: pointer;
  font: inherit;
  transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}
.caseCard:hover {
  border-color: var(--accent-soft-line);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.07);
}
.caseAvatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--accent-dark);
  background: var(--accent-soft);
}
.caseText { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.caseTitle { font-size: 15px; font-weight: 650; }
.caseWho { font-size: 13px; color: var(--muted); }
.caseGo { margin-left: auto; color: var(--muted-2); font-size: 18px; }
.caseCard:hover .caseGo { color: var(--accent); }

/* ============================================================
   Guest mode
   Said once, at the top, rather than after they've finished.
   ============================================================ */
.guestBanner {
  width: 100%;
  max-width: 1000px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 12px 16px;
  margin-bottom: 18px;
  border: 1px solid var(--warn-line);
  background: var(--warn-bg);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--warn-ink);
}
.guestBanner strong { margin-right: 6px; }

.savedNote {
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--muted);
}
.savedNote.unsaved {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--warn-line);
  background: var(--warn-bg);
  border-radius: var(--radius-sm);
  color: var(--warn-ink);
}

/* ============================================================
   My cases
   ============================================================ */
.attemptList { display: flex; flex-direction: column; }
.attemptRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  text-align: left;
  padding: 14px 4px;
  border: 0;
  border-top: 1px solid var(--line-soft);
  background: transparent;
  font: inherit;
  cursor: pointer;
}
.attemptList .attemptRow:first-child { border-top: 0; }
.attemptRow:hover .attemptTitle { color: var(--accent); }
.attemptMain { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.attemptTitle { font-size: 15px; font-weight: 650; }
.attemptMeta { font-size: 13px; color: var(--muted); }
.attemptScore { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.attemptNumber { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.attemptOutOf { font-size: 13px; font-weight: 500; color: var(--muted-2); }

.transcript { display: flex; flex-direction: column; gap: 12px; }
.turn { border-top: 1px solid var(--line-soft); padding-top: 10px; }
.transcript .turn:first-child { border-top: 0; padding-top: 0; }
.turnQ { font-size: 14px; font-weight: 600; }
.turnA { font-size: 14px; color: var(--muted); margin-top: 3px; line-height: 1.55; }

/* ============================================================
   Welcome
   The page a stranger lands on. One thesis, one obvious action.
   ============================================================ */
.welcomeBody { background: var(--bg); }
.welcome { max-width: 780px; margin: 0 auto; padding: 24px 20px 60px; }
.welcomeHead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 48px; }
.welcomeBrand { font-weight: 700; letter-spacing: -0.01em; }

.welcomeHero h1 {
  margin: 0 0 16px;
  font-size: 40px;
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-wrap: balance;
  max-width: 18ch;
}
.welcomeLead { margin: 0 0 26px; font-size: 16px; line-height: 1.65; color: var(--muted); max-width: 62ch; }
.welcomeActions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn.big { padding: 12px 22px; font-size: 15px; }
.welcomeFine { margin: 14px 0 0; font-size: 13px; color: var(--muted-2); }

.welcomeSteps { margin-top: 56px; }
.welcomeSteps ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.welcomeSteps li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.5; color: var(--muted); }
.welcomeSteps strong { color: var(--ink); font-weight: 650; }
.welcomeStepN {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.welcomeFoot { margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted-2); }

@media (max-width: 640px) {
  .welcomeHero h1 { font-size: 30px; }
  .welcome { padding-top: 18px; }
}


/* The pages that aren't a .phase still want the same column width. */
#listView, #detailView { width: 100%; max-width: 1000px; display: flex; flex-direction: column; gap: 18px; }

/* ---------- narrow screens ----------
   A student on a phone between lectures is the likeliest user there is, so
   the header has to fold rather than push the page sideways. */
@media (max-width: 720px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  .topActions { flex-wrap: wrap; gap: 8px; }
  .topActions .btn { padding: 7px 12px; font-size: 13px; }
  .userChip { font-size: 13px; }
  .userChip .userYear { display: none; }
  .stage { padding: 16px 16px 40px; }
  .brandSub { display: none; }
  .caseGrid { grid-template-columns: 1fr; }
  .guestBanner { flex-direction: column; align-items: flex-start; }
  .attemptRow { align-items: flex-start; }
}

/* The back link is a link, not a full-width bar. */
#detailView > .btn { align-self: flex-start; }


/* Years 3 and 4 are shown so students can see where this is going, and are
   unavailable because the content behind them hasn't been checked. */
.yearOption.is-soon { color: var(--muted-2); cursor: pointer; }
.yearOption.is-soon:hover { color: var(--muted); }

.comingSoon {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 16, 32, 0.45);
}
.comingCard {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 18px 50px rgba(16, 24, 40, 0.22);
}
.comingCard h3 { margin: 0 0 8px; font-size: 17px; }
.comingCard p { margin: 0 0 10px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.comingCard .comingFine { color: var(--muted); font-size: 13px; }
.comingCard .btn { margin-top: 6px; }

.fieldHelp {
  margin: -4px 0 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}


/* What a friend trying this for the first time needs to know, before they
   form an opinion about a slow reply or a wrong one. */
.beforeYouStart {
  margin-top: 48px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.beforeYouStart h2 { margin: 0 0 12px; font-size: 15px; letter-spacing: -0.01em; }
.beforeYouStart ul { margin: 0; padding-left: 18px; display: grid; gap: 10px; }
.beforeYouStart li { font-size: 14px; line-height: 1.6; color: var(--muted); }
.beforeYouStart strong { color: var(--ink); font-weight: 600; }


/* ---------- the station clock ----------
   Eight minutes, on the corner of the patient strip, where a clock on the wall
   would be. The ring empties as the time goes: the number is for checking, the
   ring is for glancing. Amber in the last minute, red at zero — and it stops
   there rather than cutting anyone off mid-sentence. */
.patientStrip { position: relative; }

.stationClock {
  position: absolute;
  top: -18px;
  right: -14px;
  width: 76px;
  height: 76px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.12);
  cursor: pointer;
  display: grid;
  place-items: center;
  font: inherit;
}
.stationClock.isRunning { cursor: default; }
.stationClock:disabled { opacity: 1; }

.clockRing { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.clockTrack {
  fill: none;
  stroke: var(--line-soft);
  stroke-width: 5;
}
.clockProgress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s linear, stroke 0.3s ease;
}
.stationClock.isLow .clockProgress { stroke: #d9840a; }
.stationClock.isOut .clockProgress { stroke: var(--bad-ink); }

.clockFace { display: flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1; }
.clockTime {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.stationClock.isLow .clockTime { color: #8a5200; }
.stationClock.isOut .clockTime { color: var(--bad-ink); }
.clockHint {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.stationClock:not(.isRunning):hover .clockHint { color: var(--accent); }

/* The strip has to leave room for a clock that overhangs its corner. */
.patientStrip .patientStats { padding-right: 62px; }

@media (max-width: 640px) {
  .stationClock { width: 62px; height: 62px; top: -14px; right: -6px; }
  .clockTime { font-size: 14px; }
  .patientStrip .patientStats { padding-right: 46px; }
}
