/* =====================================================================
   OSCE circuits: /osce, /osce/{slug}, the station screen and results.
   Night palette from ph-theme.css / ph-student.css. Prefix: os-
   ===================================================================== */
.os-narrow { max-width: 880px; }
.os-muted { color: var(--ph-muted); }
.os-lead { max-width: 70ch; line-height: 1.7; margin: 0 0 1.6rem; color: var(--ph-text); overflow-wrap: anywhere; }
.os-h2 { font-size: clamp(1.2rem, 2.4vw, 1.5rem); color: var(--ph-white); margin: 0 0 .9rem; }
.os-tag { display: inline-flex; align-items: center; font-size: .76rem; font-weight: 700; color: #F08CFF; border: 1px solid rgba(225, 28, 242, .35); border-radius: 6px; padding: .12rem .5rem; white-space: nowrap; }
.os-tag.is-plain { color: var(--ph-muted); border-color: var(--ph-line2); }
.os-pass { color: var(--ph-green); font-weight: 700; }
.os-fail { color: var(--ph-red); font-weight: 700; }
.os-note { padding: .9rem 1rem; border: 1px solid var(--ph-line2); border-left: 3px solid var(--ph-yellow); border-radius: 8px; background: var(--ph-surface); color: var(--ph-text); margin: 0 0 1.2rem; overflow-wrap: anywhere; }
.os-note.is-error { border-left-color: var(--ph-red); }
.os-note.is-ok { border-left-color: var(--ph-green); }
:is(.os-run-body, .os-page) [hidden] { display: none !important; }

/* ---------- How a station runs ---------- */
.os-flow { list-style: none; margin: 0 0 2.4rem; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--ph-line); counter-reset: osflow; }
.os-flow li { position: relative; padding: 1rem 0 1rem 2.6rem; border-bottom: 1px solid var(--ph-line); counter-increment: osflow; }
.os-flow li::before { content: counter(osflow); position: absolute; left: 0; top: 1rem; width: 1.8rem; height: 1.8rem; display: grid; place-items: center; border: 1px solid rgba(225, 28, 242, .45); border-radius: 6px; color: #F08CFF; font-weight: 700; font-size: .9rem; }
.os-flow strong { display: block; color: var(--ph-white); margin-bottom: .2rem; }
.os-flow span { color: var(--ph-muted); font-size: .93rem; line-height: 1.55; }
@media (min-width: 860px) {
  .os-flow { grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 0; gap: 0; }
  .os-flow li { padding: 2.6rem 1.2rem 0 0; border-bottom: 0; border-top: 1px solid var(--ph-line); }
  .os-flow li::before { top: .7rem; }
}

/* ---------- Circuit list ---------- */
.os-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; align-items: start; }
@media (min-width: 1000px) { .os-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 300px); } }
.os-list { display: grid; border-top: 1px solid var(--ph-line); }
.os-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; padding: 1.2rem 0; border-bottom: 1px solid var(--ph-line); }
@media (min-width: 700px) { .os-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1.5rem; } }
.os-row h3 { font-size: 1.1rem; margin: 0 0 .35rem; overflow-wrap: anywhere; }
.os-row h3 a { color: var(--ph-white); text-decoration: none; }
.os-row h3 a:hover { color: #F08CFF; }
.os-row p { margin: 0 0 .55rem; color: var(--ph-muted); font-size: .93rem; line-height: 1.6; max-width: 70ch; }
.os-meta { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: center; font-size: .86rem; color: var(--ph-muted); }
.os-meta b { color: var(--ph-text); font-weight: 600; }
.os-empty { padding: 2rem 0; color: var(--ph-muted); }
.os-aside { padding: 1.1rem 1.2rem; border: 1px solid var(--ph-line); border-radius: 8px; background: var(--ph-surface); }
.os-aside h2 { font-size: 1rem; color: var(--ph-white); margin: 0 0 .7rem; }
.os-aside ul { list-style: none; margin: 0; padding: 0; display: grid; }
.os-aside li { display: flex; justify-content: space-between; gap: .6rem; padding: .55rem 0; border-top: 1px solid var(--ph-line); font-size: .9rem; }
.os-aside li:first-child { border-top: 0; }
.os-aside li a { color: var(--ph-text); overflow-wrap: anywhere; }
.os-aside p { font-size: .9rem; color: var(--ph-muted); margin: .9rem 0 0; }

/* ---------- Circuit page ---------- */
.os-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--ph-line); border-radius: 8px; margin-bottom: 2rem; background: var(--ph-surface); }
.os-summary > div { padding: .9rem 1rem; border-top: 1px solid var(--ph-line); }
.os-summary > div:nth-child(-n+2) { border-top: 0; }
.os-summary > div:nth-child(even) { border-left: 1px solid var(--ph-line); }
.os-summary small { display: block; color: var(--ph-muted); font-size: .8rem; margin-bottom: .15rem; }
.os-summary b { color: var(--ph-white); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
@media (min-width: 760px) {
  .os-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .os-summary > div { border-top: 0; border-left: 1px solid var(--ph-line); }
  .os-summary > div:first-child { border-left: 0; }
}
.os-stations { list-style: none; margin: 0 0 2rem; padding: 0; border-top: 1px solid var(--ph-line); }
.os-stations li { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr); gap: .3rem .8rem; padding: .9rem 0; border-bottom: 1px solid var(--ph-line); }
@media (min-width: 640px) { .os-stations li { grid-template-columns: 2.2rem minmax(0, 1fr) auto; align-items: center; } }
.os-stations .os-n { color: #F08CFF; font-weight: 700; font-variant-numeric: tabular-nums; }
.os-stations strong { color: var(--ph-white); overflow-wrap: anywhere; }
.os-stations small { display: block; color: var(--ph-muted); }
.os-stations .os-side { grid-column: 2; display: flex; gap: .8rem; align-items: center; font-size: .88rem; color: var(--ph-muted); }
@media (min-width: 640px) { .os-stations .os-side { grid-column: auto; } }
.os-cta { padding: 1.3rem; border: 1px solid var(--ph-line2); border-top: 3px solid var(--ph-magenta); border-radius: 8px; background: var(--ph-surface); }
.os-cta h2 { font-size: 1.05rem; color: var(--ph-white); margin: 0 0 .5rem; }
.os-cta p { font-size: .92rem; color: var(--ph-muted); margin: 0 0 1rem; line-height: 1.6; }
.os-cta .btn { width: 100%; justify-content: center; min-height: 44px; }
.os-cta .btn + .btn { margin-top: .5rem; }
.os-table-wrap { overflow-x: auto; border: 1px solid var(--ph-line); border-radius: 8px; }
.os-table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 520px; }
.os-table th, .os-table td { padding: .7rem .9rem; border-bottom: 1px solid var(--ph-line); text-align: left; vertical-align: top; }
.os-table th { color: var(--ph-muted); font-weight: 600; font-size: .82rem; background: var(--ph-surface); }
.os-table tr:last-child td { border-bottom: 0; }
.os-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.os-table a { color: var(--ph-text); }

/* ---------- Station screen ---------- */
.os-run-body { margin: 0; min-height: 100vh; background: var(--ph-bg); color: var(--ph-text); font-family: var(--ph-font, inherit); }
.os-wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; box-sizing: border-box; }
.os-top { position: sticky; top: 0; z-index: 20; background: var(--ph-bg2); border-bottom: 1px solid var(--ph-line); }
.os-top-in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 60px; padding: .5rem 0; }
.os-top-t { min-width: 0; }
.os-top-t strong { display: block; color: var(--ph-white); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.os-top-t small { color: var(--ph-muted); font-size: .82rem; overflow-wrap: anywhere; }
.os-top-r { flex: none; display: flex; align-items: center; gap: .6rem; font-size: .88rem; color: var(--ph-muted); }
.os-steps { display: flex; gap: 4px; padding-bottom: 10px; }
.os-steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--ph-line2); }
.os-steps span.is-done { background: rgba(225, 28, 242, .55); }
.os-steps span.is-now { background: var(--ph-magenta); }
.os-shell { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.4rem; padding: 1.4rem 0 3rem; }
@media (min-width: 960px) { .os-shell { grid-template-columns: minmax(0, 1fr) minmax(0, 340px); align-items: start; gap: 2rem; } .os-shell.is-wide { grid-template-columns: minmax(0, 1fr); max-width: 900px; } }
.os-phase { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .4rem 1rem; margin-bottom: .9rem; }
.os-phase h1 { font-size: clamp(1.3rem, 3.2vw, 1.9rem); color: var(--ph-white); margin: 0; line-height: 1.25; overflow-wrap: anywhere; }
.os-phase small { color: var(--ph-muted); font-size: .9rem; }
.os-clock { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; border: 1px solid var(--ph-line2); border-radius: 8px; background: var(--ph-surface); margin-bottom: 1.2rem; transition: border-color .2s ease, background-color .2s ease; }
.os-clock small { display: block; color: var(--ph-muted); font-size: .85rem; }
.os-clock-v { font-family: "Space Grotesk", var(--ph-font, inherit); font-size: clamp(2.4rem, 9vw, 3.6rem); line-height: 1; font-weight: 700; color: var(--ph-white); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.os-clock.is-warn { border-color: var(--ph-yellow); background: rgba(255, 201, 74, .08); }
.os-clock.is-warn .os-clock-v { color: var(--ph-yellow); }
.os-clock.is-over { border-color: var(--ph-red); background: rgba(255, 77, 109, .08); }
.os-clock.is-over .os-clock-v { color: var(--ph-red); }
.os-clock-msg { font-size: .9rem; color: var(--ph-text); max-width: 32ch; text-align: right; }
@media (max-width: 480px) { .os-clock { flex-direction: column; align-items: flex-start; } .os-clock-msg { text-align: left; } }
.os-card { padding: 1.2rem 1.3rem; border: 1px solid var(--ph-line); border-left: 3px solid var(--ph-magenta); border-radius: 8px; background: var(--ph-surface); margin-bottom: 1.2rem; }
.os-card h2 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ph-muted); margin: 0 0 .6rem; }
.os-card p { margin: 0; font-size: 1.08rem; line-height: 1.7; color: var(--ph-white); white-space: pre-line; overflow-wrap: anywhere; max-width: 70ch; }
.os-notes { border: 1px solid var(--ph-line); border-radius: 8px; margin-bottom: 1.2rem; background: var(--ph-surface); }
.os-notes summary { cursor: pointer; padding: .85rem 1.1rem; min-height: 44px; box-sizing: border-box; display: flex; align-items: center; color: var(--ph-text); font-weight: 600; }
.os-notes summary:focus-visible { outline: 2px solid var(--ph-magenta); outline-offset: 2px; }
.os-notes p { margin: 0; padding: 0 1.1rem 1rem; color: var(--ph-text); line-height: 1.65; white-space: pre-line; overflow-wrap: anywhere; }
.os-notes.is-open { border-left: 3px solid var(--ph-yellow); }
.os-notes.is-open h2 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ph-muted); margin: 0; padding: .9rem 1.1rem .5rem; }
.os-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: 1rem; }
.os-actions .btn { min-height: 44px; }
@media (max-width: 520px) { .os-actions .btn { flex: 1 1 100%; justify-content: center; } }

/* Checklist marking */
.os-form { display: grid; gap: 1rem; }
.os-score-live { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .8rem 1rem; border: 1px solid var(--ph-line); border-radius: 8px; background: var(--ph-surface); }
.os-score-live b { color: var(--ph-white); font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.os-score-live small { color: var(--ph-muted); }
.os-items { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ph-line); }
.os-item { display: grid; grid-template-columns: minmax(0, 1fr); gap: .6rem; padding: .85rem 0; border-bottom: 1px solid var(--ph-line); }
@media (min-width: 760px) { .os-item { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1.2rem; } }
.os-item-t { display: grid; grid-template-columns: 1.8rem minmax(0, 1fr); gap: .5rem; color: var(--ph-text); line-height: 1.55; }
.os-item-t .os-n { color: var(--ph-muted); font-variant-numeric: tabular-nums; }
.os-item-t small { display: block; color: var(--ph-muted); font-size: .8rem; }
.os-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--ph-line2); border-radius: 8px; overflow: hidden; min-width: min(100%, 300px); }
.os-seg label { position: relative; display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 .7rem; font-size: .88rem; font-weight: 600; color: var(--ph-muted); cursor: pointer; border-left: 1px solid var(--ph-line2); transition: background-color .15s ease, color .15s ease; text-align: center; }
.os-seg label:first-child { border-left: 0; }
.os-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.os-seg label:hover { color: var(--ph-white); }
.os-seg label:has(input:focus-visible) { outline: 2px solid var(--ph-magenta); outline-offset: -2px; }
.os-seg label:has(input[value=done]:checked) { background: rgba(46, 211, 138, .18); color: var(--ph-green); }
.os-seg label:has(input[value=partial]:checked) { background: rgba(255, 201, 74, .16); color: var(--ph-yellow); }
.os-seg label:has(input[value=not]:checked) { background: rgba(255, 77, 109, .16); color: var(--ph-red); }
.os-field { display: grid; gap: .45rem; }
.os-field > span, .os-field legend { color: var(--ph-white); font-weight: 600; font-size: .95rem; padding: 0; }
.os-field small { color: var(--ph-muted); font-size: .85rem; }
.os-field textarea { width: 100%; box-sizing: border-box; min-height: 96px; padding: .7rem .8rem; font: inherit; font-size: 16px; color: var(--ph-text); background: var(--ph-surface); border: 1px solid var(--ph-line2); border-radius: 8px; resize: vertical; }
.os-field textarea:focus { outline: 2px solid var(--ph-magenta); outline-offset: 1px; }
fieldset.os-field { border: 0; margin: 0; padding: 0; min-width: 0; }
.os-rating { display: flex; flex-wrap: wrap; gap: .4rem; }
.os-rating label { position: relative; display: grid; place-items: center; min-width: 48px; min-height: 48px; border: 1px solid var(--ph-line2); border-radius: 8px; font-weight: 700; color: var(--ph-text); cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.os-rating input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.os-rating label:has(input:checked) { border-color: var(--ph-magenta); background: rgba(225, 28, 242, .16); color: var(--ph-white); }
.os-rating label:has(input:focus-visible) { outline: 2px solid var(--ph-magenta); outline-offset: 2px; }
.os-save { font-size: .85rem; color: var(--ph-muted); }
.os-err { color: var(--ph-red); font-size: .88rem; margin: 0; }

/* Side column on the station screen */
.os-side-col { display: grid; gap: 1rem; }
.os-plan { list-style: none; margin: 0; padding: 0; border: 1px solid var(--ph-line); border-radius: 8px; background: var(--ph-surface); }
.os-plan li { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: .6rem; align-items: center; padding: .65rem .9rem; border-top: 1px solid var(--ph-line); font-size: .9rem; }
.os-plan li:first-child { border-top: 0; }
.os-plan li span { overflow-wrap: anywhere; }
.os-plan li.is-now { background: rgba(225, 28, 242, .08); }
.os-plan li.is-now span { color: var(--ph-white); font-weight: 600; }
.os-plan .os-n { color: var(--ph-muted); font-variant-numeric: tabular-nums; }
.os-plan small { color: var(--ph-muted); white-space: nowrap; }
.os-end { padding-top: .2rem; }
.os-end .btn { width: 100%; justify-content: center; min-height: 44px; }

/* ---------- Results ---------- */
.os-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; margin-bottom: 1.4rem; }
@media (min-width: 900px) { .os-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.os-stats > div { padding: 1rem 1.1rem; border: 1px solid var(--ph-line); border-radius: 8px; background: var(--ph-surface); min-width: 0; }
.os-stats small { display: block; color: var(--ph-muted); font-size: .82rem; }
.os-stats b { display: block; font-size: 1.6rem; color: var(--ph-white); font-variant-numeric: tabular-nums; line-height: 1.25; }
.os-stats em { font-style: normal; color: var(--ph-muted); font-size: .85rem; }
.os-grid2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; margin-bottom: 1rem; }
@media (min-width: 900px) { .os-grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.os-meter { padding: .6rem 0; }
.os-meter-t { display: flex; justify-content: space-between; gap: .8rem; font-size: .92rem; margin-bottom: .35rem; }
.os-meter-t span { color: var(--ph-text); overflow-wrap: anywhere; }
.os-meter-t small { flex: none; color: var(--ph-muted); font-variant-numeric: tabular-nums; }
.os-bar { height: 8px; border-radius: 4px; background: var(--ph-surface2); overflow: hidden; }
.os-bar span { display: block; height: 100%; border-radius: 4px; background: var(--ph-green); }
.os-bar span.is-mid { background: var(--ph-yellow); }
.os-bar span.is-low { background: var(--ph-red); }
.os-station-res { border-top: 1px solid var(--ph-line); }
.os-station-res details { border-bottom: 1px solid var(--ph-line); }
.os-station-res summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .3rem 1rem; align-items: center; padding: .9rem 0; cursor: pointer; min-height: 44px; }
.os-station-res summary strong { color: var(--ph-white); overflow-wrap: anywhere; }
.os-station-res summary small { color: var(--ph-muted); display: block; }
.os-station-res summary b { font-variant-numeric: tabular-nums; text-align: right; }
.os-station-res .os-items { margin-bottom: 1rem; }
.os-mk { font-size: .84rem; font-weight: 700; white-space: nowrap; }
.os-mk.is-done { color: var(--ph-green); }
.os-mk.is-partial { color: var(--ph-yellow); }
.os-mk.is-not { color: var(--ph-red); }
.os-comment { margin: 0 0 1rem; padding: .8rem 1rem; border-left: 3px solid var(--ph-line2); background: var(--ph-surface); color: var(--ph-text); white-space: pre-line; overflow-wrap: anywhere; }
.os-trend { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: .5rem; }
.os-trend a { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; text-decoration: none; color: var(--ph-muted); font-size: .72rem; }
.os-trend a span { width: 100%; max-width: 36px; border-radius: 4px 4px 0 0; background: rgba(225, 28, 242, .4); }
.os-trend a.is-this span { background: var(--ph-magenta); }
.os-trend a b { color: var(--ph-text); font-size: .76rem; }
@media (prefers-reduced-motion: reduce) {
  .os-clock, .os-seg label, .os-rating label { transition: none; }
}
