:root {
  color-scheme: light dark;
  --background: #f2f2f7;
  --card: #fbfbfd;
  --text: #18181c;
  --muted: #66666e;
  --border: #20202816;
  --input: #1d1d2409;
  --green: #457d54;
  --indigo: #5856d6;
  --cyan: #32ade6;
  --mint: #00a991;
  --red: #bb302e;
  --tab: #fffE;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: #1c1c1e; --card: #262629; --text: #f5f5f7; --muted: #b4b4bd;
    --border: #f1f1ff1e; --input: #fff1; --tab: #202023ed; --indigo: #a3a1ff;
    --cyan: #64d2ff; --mint: #63dac5; --red: #ff7772;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--background); color: var(--text); }
main { padding: max(16px, env(safe-area-inset-top)) 16px calc(72px + env(safe-area-inset-bottom)); max-width: 760px; margin: auto; }
.screen,.stack { display: grid; gap: 12px; }
.screen.clinic { gap: 16px; }
h1,h2,h3,p { margin: 0; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
button,input,textarea,select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 3px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 4px 8px #0000000a; padding: 14px; min-width: 0; }
.card header .caption { margin-top: 4px; }
.recording { display: grid; gap: 14px; }
.wordmark { font-family: ui-rounded, "SF Pro Rounded", -apple-system, sans-serif; width: fit-content; font-size: 36px; font-weight: 900; line-height: 1.12; color: var(--indigo); background: linear-gradient(90deg, var(--indigo), var(--cyan)); background-clip: text; -webkit-text-fill-color: transparent; }
.wave { position: relative; color: #34c759; height: 42px; }
.wave svg { position: absolute; width: 100%; height: 100%; display: block; overflow: visible; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.meter { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.between,.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.meter-track { height: 8px; background: var(--input); border-radius: 100px; overflow: hidden; position: relative; }
.meter-track::before { content: ""; width: 6px; height: 8px; background: #5bcf70; position: absolute; border-radius: 20px; }
progress { position: absolute; border: 0; appearance: none; width: 100%; height: 8px; background: transparent; }
progress::-webkit-progress-bar { background: transparent; }
progress::-webkit-progress-value { border-radius: 20px; background: linear-gradient(90deg,#5bcf70,#34c759,#ffd60a,#ff9500); }
progress::-moz-progress-bar { border-radius: 20px; background: linear-gradient(90deg,#5bcf70,#34c759,#ffd60a,#ff9500); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.actions.stretch > * { flex: 1; }
.pill,.status-pill { border: 0; border-radius: 100px; padding: 8px 14px; min-height: 34px; font-size: 14px; font-weight: 650; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.pill:active { transform: scale(.985); }
.green { background: var(--green); color: #fff; }
#analyze:disabled { background: #8e8e9359; color: var(--muted); opacity: 1; }
.subtle { color: var(--indigo); background: color-mix(in srgb, var(--indigo) 10%, transparent); }
.danger { color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); }
.status-pill { background: var(--input); font-size: 12px; padding-inline: 12px; }
.status-pill::before { content: ""; border-radius: 50%; background: currentColor; width: 7px; height: 7px; }
.status-pill.live { color: var(--red); }
.pill svg,h2 svg,nav svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.65; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.caption { font-size: 12px; color: var(--muted); line-height: 1.45; }
.note { text-align: center; }
.error { color: var(--red); padding: 10px; background: color-mix(in srgb, var(--red) 8%, transparent); border: 1px solid color-mix(in srgb, var(--red) 25%, transparent); border-radius: 10px; font-size: 13px; }
.inputs { border: 1px solid var(--border); background: var(--input); border-radius: 10px; display: grid; }
.inputs input { border: 0; background: transparent; padding: 11px 12px; width: 100%; min-width: 0; }
.inputs input + input { border-top: 1px solid var(--border); }
.transcript-box,.dialogue { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: linear-gradient(130deg, #00c7be14, var(--input)); border: 1px solid #00c7be40; }
.transcript-box h2 { display: flex; gap: 8px; align-items: center; }
.transcript-box h2 svg { color: var(--mint); }
.transcript-box textarea { border: 0; background: transparent; resize: vertical; width: 100%; min-height: 110px; padding: 0; font-size: 16px; line-height: 1.45; }
.dialogue { background: #34c75914; border-color: #34c75938; }
.dialogue p { white-space: pre-wrap; font-size: 15px; }
.icon-label,summary { cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#audio-file:focus-visible + button { outline-offset: 3px; }
.actions:focus-within .icon-label { outline: 2px solid var(--indigo); outline-offset: 2px; }
.result-empty { font-size: 14px; }
.metrics { display: flex; flex-wrap: wrap; gap: 8px; }
.metric { border-radius: 10px; background: #00c7be29; padding: 8px 12px; display: grid; gap: 2px; }
.metric:first-child { background: #ff950029; }
.metric span { font-size: 11px; color: var(--muted); font-weight: 700; }
.metric strong { font-size: 18px; font-weight: 850; }
.chart-fields,.settings-fields,.score-fields { display: grid; gap: 8px; }
.chart-fields label,.settings-fields label,.score-fields label { display: grid; gap: 5px; font-size: 14px; font-weight: 600; }
.chart-fields textarea,.settings-fields select,.score-fields input,.score-fields select,.login input { border: 1px solid var(--border); border-radius: 8px; background: var(--input); padding: 8px; min-width: 0; width: 100%; font-weight: 400; font-size: 16px; }
.chart-fields textarea { resize: vertical; min-height: 48px; }
.score-fields { grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); margin-block: 10px; }
.score-fields .wide { grid-column: 1/-1; }
.score-fields input[type=checkbox] { width: auto; justify-self: start; }
details { padding-block: 4px; }
details > :not(summary) { margin-block: 8px; }
.setting-row { padding: 6px; list-style: none; }
.setting-row::-webkit-details-marker { display: none; }
summary.setting-row::after { content: "›"; color: var(--muted); }
summary.setting-row > span:first-child { flex: 1; }
.about { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.about img,.login img { border-radius: 14px; }
.segments { display: flex; border-radius: 8px; background: var(--input); padding: 2px; }
.segments button { flex: 1; border: 0; border-radius: 7px; background: transparent; padding: 6px; font-size: 14px; }
.segments button[aria-pressed=true] { background: var(--card); box-shadow: 0 1px 4px #0002; font-weight: 650; }
.record-row { width: 100%; text-align: left; display: grid; gap: 8px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th,td { padding: 8px; border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 14px; }
td button { border: 0; background: none; text-decoration: underline; padding: 0; }
.tabs { position: fixed; z-index: 2; bottom: 0; width: 100%; display: flex; justify-content: center; background: var(--tab); border-top: 1px solid var(--border); backdrop-filter: blur(18px); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { background: none; border: none; color: var(--muted); display: grid; justify-items: center; align-content: center; gap: 4px; width: min(33.33%, 250px); min-height: 50px; font-size: 10px; font-weight: 600; }
.tabs button[aria-current] { color: #007aff; }
.tabs svg { width: 24px; height: 24px; }
dialog { width: min(530px, calc(100% - 24px)); max-height: 85dvh; padding: 16px; border: 1px solid var(--border); border-radius: 14px; color: var(--text); background: var(--card); box-shadow: 0 12px 48px #0003; }
dialog::backdrop { background: #0005; }
#detail-content { margin-top: 12px; }
#detail-content p { white-space: pre-wrap; overflow-wrap: anywhere; }
.splash { position: fixed; z-index: 5; inset: 0; background: linear-gradient(var(--background),var(--card)); display: grid; place-content: center; justify-items: center; gap: 18px; pointer-events: none; animation: splash 280ms 1.1s forwards; }
.splash .wordmark { font-size: 44px; }
.splash .wave { width: 230px; height: 44px; }
@keyframes splash { to { opacity: 0; visibility: hidden; } }
.login { max-width: 410px; margin: 12vh auto 0; }
@media (prefers-reduced-motion: reduce) { .splash { display: none; } }
.quiet { color: #b25c04; }

/* Layout measurements from OrthoFlow on the iPhone 17 Pro simulator. */
main { padding-top: calc(16px + env(safe-area-inset-top)); padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.wordmark { --indigo: #5856f3; --cyan: #00bedf; }
.record-actions .pill { font-size: 15px; }
.status-pill { font-size: 12px; }
.status-pill::before { width: 12px; height: 12px; margin-right: 3px; }
.record-actions button svg { width: 17px; height: 17px; }
.caption.ready { color: var(--green); }
.inputs input { min-height: 43px; font-size: 17px; }
.inputs input::placeholder { color: #a5a5af; opacity: 1; }
.transcript-box textarea { font-size: 15px; }
.transcript-box textarea::placeholder { color: var(--text); opacity: 1; }
.clinic > .actions.stretch .pill { min-height: 40px; }
.clinic > .actions.stretch .pill:disabled { opacity: .82; }
.tabs {
  width: min(276px, calc(100% - 32px));
  min-height: 62px;
  bottom: max(18px, calc(env(safe-area-inset-bottom) - 12px));
  left: 50%;
  transform: translateX(-50%);
  padding: 3px;
  border-radius: 40px;
  border: 1px solid #ffffffa6;
  background: color-mix(in srgb, var(--tab) 80%, transparent);
  backdrop-filter: blur(24px) saturate(1.35);
  box-shadow: 0 10px 28px #34344420, inset 0 0 1px 2px #ffffff36;
}
.tabs button {
  width: auto;
  flex: 1;
  border-radius: 35px;
  min-height: 54px;
  gap: 3px;
  color: var(--text);
  font-size: 10.5px;
}
.tabs button[aria-current] { background: var(--input); color: #0087e9; }
.tabs svg { width: 26px; height: 26px; }
@media (prefers-color-scheme: dark) {
  .tabs { border-color: #ffffff30; }
}
