/* FSP Simulator prototype. Clinic palette: pale teal paper, ink, rose accent. */
:root {
  --paper: #EDF3F2; --card: #FFFFFF; --plate: #DCE9E7; --ink: #16282C; --soft: #52666A; --line: #C9D7D5;
  --rose: #D23C63; --rose-tint: #F7D3DD; --on-rose: #FFFFFF;
  --teal: #157A73; --teal-tint: #CDE8E4; --amber: #A86C00; --amber-tint: #FAE5BA;
  --violet: #5B5FB0; --violet-tint: #E2E3F7;
  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0D191B; --card: #16282B; --plate: #1B3134; --ink: #E2EDEB; --soft: #98ACAF; --line: #2B4346;
    --rose: #FF7A99; --rose-tint: #4B2131; --on-rose: #1A0B10; --teal: #4FC3B8; --teal-tint: #173D3B;
    --amber: #F0B445; --amber-tint: #463717; --violet: #A9ACF5; --violet-tint: #2A2C52;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.5 var(--font); }
main { max-width: 920px; margin: 0 auto; padding: 24px 16px 72px; display: grid; gap: 20px; }
h1, h2 { margin: 0; line-height: 1.15; text-wrap: balance; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h2 { font-size: 1.2rem; margin-bottom: 8px; }
p { margin: 0; }
a { color: inherit; text-underline-offset: 3px; }
.muted { color: var(--soft); }
.small { font-size: .9rem; }
.mono { font-family: var(--mono); font-size: .88em; }
.label { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.error { color: var(--rose); font-weight: 700; }

nav { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--card); flex-wrap: wrap; }
nav .brand { font-weight: 800; text-decoration: none; }
nav .spacer { flex: 1; }
nav .who { color: var(--soft); }
nav form { margin: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: grid; gap: 10px; min-width: 0; }
.narrow { max-width: 420px; margin: 8vh auto 0; width: 100%; }
.intro { display: grid; gap: 6px; }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row.center { justify-content: center; align-items: center; }
.row.between { justify-content: space-between; align-items: center; }
.grow { flex: 1; min-width: 180px; }
label { display: grid; gap: 4px; font-weight: 700; font-size: .95rem; }
label.inline { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; }
input, select { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); min-width: 0; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--rose); outline-offset: 2px; }

button, .button { font: inherit; font-weight: 700; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; }
button.primary, .button.primary { background: var(--rose); border-color: var(--rose); color: var(--on-rose); }
button.danger { border-color: var(--rose); color: var(--rose); }
button.big { padding: 14px 28px; font-size: 1.05rem; }
button.link { border: 0; background: none; padding: 0; color: var(--soft); text-decoration: underline; }
button:disabled { opacity: .5; cursor: default; }

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 14px; font-weight: 400; cursor: pointer; background: var(--paper); }
.choice:has(input:checked) { border-color: var(--rose); box-shadow: 0 0 0 3px var(--rose-tint); }
.choice input { margin-top: 4px; accent-color: var(--rose); }
.choice span { display: grid; gap: 2px; min-width: 0; }
.choice small { color: var(--soft); }
.choice em { font-style: normal; }

/* talk */
.talk-head { grid-template-columns: 1fr auto; align-items: center; }
.timer { font-family: var(--mono); font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer.over { color: var(--amber); }
.stage-card { justify-items: center; text-align: center; padding: 28px 18px; gap: 16px; }
.status { font-size: 1.1rem; font-weight: 700; max-width: 40ch; }
.orb { width: 120px; height: 120px; border-radius: 50%; background: var(--plate); display: grid; place-items: center; transition: background .3s; }
.orb span { width: 56px; height: 56px; border-radius: 50%; background: var(--soft); transition: transform .2s, background .3s; }
.orb[data-state="listening"] span { background: var(--teal); }
.orb[data-state="thinking"] span { background: var(--amber); animation: pulse 1s infinite alternate; }
.orb[data-state="speaking"] { background: var(--rose-tint); }
.orb[data-state="speaking"] span { background: var(--rose); animation: pulse .45s infinite alternate; }
@keyframes pulse { from { transform: scale(.85); } to { transform: scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .orb span { animation: none !important; } }
.talk { display: grid; gap: 6px; max-height: 50vh; overflow-y: auto; }
.talk.hidden { display: none; }
.line { padding: 8px 12px; border-radius: 12px; background: var(--paper); }
.line b { display: block; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--soft); }
.line.doctor { background: var(--teal-tint); }
.line.interim { opacity: .65; }

/* feedback */
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.total { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.total small { font-size: 1.1rem; color: var(--soft); }
ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.facts { list-style: none; padding: 0; }
.facts li.no { color: var(--amber); }
.facts li.yes span { color: var(--teal); }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: .8rem; color: var(--soft); padding: 6px 8px; }
td { padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.st-ok .chip { background: var(--teal-tint); color: var(--teal); }
.st-error .chip { background: var(--amber-tint); color: var(--amber); }
.st-unsure .chip { background: var(--violet-tint); color: var(--violet); }
.st-tip .chip { background: var(--plate); color: var(--soft); }
.said { font-weight: 700; }
.fix { color: var(--teal); margin-top: 4px; }
.fix::before { content: "→ "; }
.why { color: var(--soft); font-size: .93rem; }
details summary { cursor: pointer; color: var(--soft); font-size: .9rem; }
details div { font-size: .9rem; }
audio { width: 220px; max-width: 100%; height: 34px; }
@media (max-width: 640px) {
  table.sent td:nth-child(3) { display: block; border-top: 0; padding-top: 0; }
  table.sent tr { display: grid; grid-template-columns: auto 1fr; }
  table.sent td:nth-child(3) { grid-column: 1 / -1; }
}

/* voice picker */
.voices { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.choice.voice { align-items: center; padding: 8px 10px; }
.choice.voice input { margin-top: 0; }
.choice.voice span { flex: 1; }
.choice:has(input:disabled) { opacity: .55; cursor: default; }
button.play { padding: 6px 0; width: 44px; min-height: 36px; text-align: center; flex: none; }
button.play.on { background: var(--rose); border-color: var(--rose); color: var(--on-rose); }
