/* Ōmo Coach. Vanity counter + vocal studio: powder rose, plum ink, champagne rim. */
:root {
  --bg: #F6E9E4;
  --bg-deep: #EFDAD4;
  --surface: #FFF7F3;
  --ink: #2E1729;
  --ink-soft: #5E4458;
  --muted: #7A6274;
  --rose: #B8456A;
  --rose-ink: #FFFFFF;
  --rose-soft: #F0C9CC;
  --champagne: #CFA978;
  --champagne-soft: #EEDDC4;
  --line: #E2C8C3;
  --band: rgba(184, 69, 106, 0.16);
  --trace: #6D2E62;
  --focus: #6D2E62;
  --calm: #3F6B5E;
  --shadow: 0 1px 0 rgba(46, 23, 41, 0.05), 0 8px 24px -12px rgba(110, 46, 98, 0.28);
  --r-mirror: 28px;
  --r-panel: 18px;
  --r-ctl: 12px;
  --tabs-h: 64px;
  --gutter: 16px;
  --font-display: "Young Serif", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Roboto Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1C1019;
    --bg-deep: #150B13;
    --surface: #2A1925;
    --ink: #F7E8E7;
    --ink-soft: #DCC5D2;
    --muted: #B79FB1;
    --rose: #F08FAA;
    --rose-ink: #2A0F1E;
    --rose-soft: #4E2639;
    --champagne: #D9B98C;
    --champagne-soft: #3B2B26;
    --line: #47303F;
    --band: rgba(240, 143, 170, 0.2);
    --trace: #F3C9D6;
    --focus: #F3C9D6;
    --calm: #9FD2C0;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 24px; height: 24px; flex: none; }
img, video, canvas { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; font-weight: 400; line-height: 1.2; }
h1 { font-family: var(--font-display); font-size: 1.9rem; letter-spacing: -0.01em; }
h2 { font-family: var(--font-display); font-size: 1.35rem; }
h3 { font-family: var(--font-body); font-weight: 700; font-size: 1.0625rem; }
p { margin: 0; }
a { color: var(--rose); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: 0.9375rem; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 10px 14px; z-index: 50; }
.skip:focus { left: 8px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 8px) calc(var(--gutter) + env(safe-area-inset-right)) 8px calc(var(--gutter) + env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
}
.wordmark { font-family: var(--font-display); font-size: 1.5rem; color: var(--ink); text-decoration: none; padding: 6px 0; min-height: 44px; display: inline-flex; align-items: center; }
.top-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; padding: 0;
}
.support-btn { color: var(--rose); border-color: var(--rose-soft); }

/* Main */
main {
  padding: 4px calc(var(--gutter) + env(safe-area-inset-right)) calc(var(--tabs-h) + env(safe-area-inset-bottom) + 28px) calc(var(--gutter) + env(safe-area-inset-left));
  max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 18px;
}
main:focus { outline: none; }
body.no-tabs .tabs { display: none; }
body.no-tabs main { padding-bottom: calc(env(safe-area-inset-bottom) + 28px); }

/* Tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px calc(8px + env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left));
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabs a {
  min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 0.8125rem; border-radius: 14px;
}
.tabs a[aria-current="page"] { color: var(--ink); background: var(--rose-soft); font-weight: 700; }

/* Buttons and controls */
.btn {
  min-height: 48px; padding: 10px 18px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; color: var(--ink); background: transparent;
}
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--rose); color: var(--rose-ink); }
.btn.ghost { border-color: var(--line); background: var(--surface); }
.btn.quiet { color: var(--ink-soft); padding-inline: 10px; }
.btn.danger { background: var(--ink); color: var(--bg); }
.btn.small { min-height: 44px; padding: 8px 14px; font-size: 0.9375rem; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .btn { flex: 1 1 auto; }
.stack { display: flex; flex-direction: column; gap: 12px; }

label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
label.field span.hint { font-weight: 400; color: var(--muted); font-size: 0.9375rem; }
input[type="text"], input[type="number"], textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 11px 12px; min-height: 48px; width: 100%;
}
textarea { min-height: 88px; resize: vertical; }
input[type="number"] { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 12px; align-items: flex-start; min-height: 44px; cursor: pointer; }
.check input { width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--rose); flex: none; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Surfaces */
.panel { background: var(--surface); border-radius: var(--r-panel); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.panel.flat { box-shadow: none; border: 1px solid var(--line); }
.panel.calm { border-left: 4px solid var(--calm); }
.kicker { color: var(--muted); font-size: 0.9375rem; }

/* Today */
.hello { padding: 10px 2px 4px; display: flex; flex-direction: column; gap: 6px; }
.hello h1 { font-size: 2.15rem; }
.hello .pron { color: var(--muted); }
.next-step { background: var(--ink); color: var(--bg); border-radius: var(--r-mirror); padding: 22px 20px; display: flex; flex-direction: column; gap: 12px; }
.next-step h2 { color: var(--bg); }
.next-step p { color: color-mix(in srgb, var(--bg) 82%, var(--ink)); }
.next-step .btn.primary { align-self: flex-start; }
.path { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.path li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.path li:first-child { border-top: 0; }
.dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--champagne); display: grid; place-items: center; flex: none; margin-top: 1px; }
.dot svg { width: 16px; height: 16px; }
.path li.done .dot { background: var(--champagne); color: var(--ink); }

/* Coaching card: five-part shape */
.coach { background: var(--surface); border-radius: var(--r-panel); box-shadow: var(--shadow); overflow: hidden; }
.coach dl { margin: 0; padding: 16px 18px; display: grid; grid-template-columns: 1fr; gap: 10px; }
.coach dt { color: var(--muted); font-size: 0.875rem; }
.coach dd { margin: 0; }
.coach ol { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 6px; }
.coach ol li.current { font-weight: 700; }
.coach ol li.current::marker { color: var(--rose); }
.coach .safety { background: var(--champagne-soft); padding: 12px 18px; font-size: 0.9375rem; }

/* Look chooser */
.looks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.look {
  text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 12px; min-height: 96px;
  display: flex; flex-direction: column; gap: 8px;
}
.look[aria-pressed="true"] { border: 2px solid var(--rose); padding: 11px; }
.swatches { display: flex; gap: 4px; }
.swatches i { width: 18px; height: 18px; border-radius: 50%; display: block; border: 1px solid rgba(0,0,0,.08); }
.look b { font-weight: 700; line-height: 1.25; }
.look span { color: var(--muted); font-size: 0.875rem; line-height: 1.3; }

/* Compact mirror */
.mirror {
  position: relative; border-radius: var(--r-mirror); overflow: hidden; background: #120a10;
  aspect-ratio: 3 / 4; width: 100%;
  box-shadow: 0 0 0 3px var(--champagne), 0 0 0 7px var(--champagne-soft), var(--shadow);
}
.mirror .stage { position: absolute; inset: 0; }
.mirror .stage.mirrored { transform: scaleX(-1); }
.mirror video, .mirror canvas, .mirror img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mirror .hint {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 2;
  background: rgba(28, 16, 25, 0.72); color: #F7E8E7; border-radius: 12px; padding: 8px 12px; font-size: 0.9375rem;
}
.mirror .empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: #F2DCE2; }
.mirror .empty .stack { align-items: center; }
.step-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.step-nav .num { color: var(--muted); }
.ref-thumb { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); }

/* Voice */
.session-bar {
  position: sticky; top: calc(env(safe-area-inset-top) + 60px); z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg-deep); border-radius: 999px; padding: 6px 6px 6px 16px;
}
.session-bar .clock { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.hurt { background: var(--ink); color: var(--bg); }
.meter { background: var(--surface); border-radius: var(--r-panel); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.meter canvas { width: 100%; height: 190px; border-radius: 12px; background: var(--bg); touch-action: none; }
.readout { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.hz { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 2.6rem; line-height: 1; letter-spacing: -0.02em; }
.hz small { font-size: 1rem; color: var(--muted); margin-left: 4px; }
.res { display: flex; flex-direction: column; gap: 6px; }
.res-track { height: 10px; border-radius: 999px; background: linear-gradient(90deg, var(--trace), var(--champagne) 50%, var(--rose)); position: relative; opacity: .85; }
.res-mark { position: absolute; top: -5px; width: 4px; height: 20px; border-radius: 2px; background: var(--ink); transform: translateX(-2px); transition: left 120ms linear; }
.res-base { position: absolute; top: -3px; width: 2px; height: 16px; background: var(--surface); left: 50%; }
.res-labels { display: flex; justify-content: space-between; font-size: 0.8125rem; color: var(--muted); }
.timer-ring { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 2.2rem; text-align: center; padding: 6px 0; }
.passage { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.55; background: var(--champagne-soft); border-radius: 14px; padding: 14px 16px; }
.range-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--rose-soft); border-color: var(--rose); font-weight: 700; }
.ex-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ex-list button { width: 100%; text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; min-height: 56px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.ex-list button .muted { font-size: 0.875rem; }
.ex-list .done-mark { color: var(--calm); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.stats div { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.stats dt { font-size: 0.8125rem; color: var(--muted); }
.stats dd { margin: 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.locked { display: flex; gap: 12px; align-items: flex-start; }
.locked svg { color: var(--calm); margin-top: 2px; }

/* Progress */
.spark { width: 100%; height: 150px; display: block; }
.spark .band { fill: var(--band); }
.spark .line { fill: none; stroke: var(--trace); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.spark .pt { fill: var(--trace); }
.spark .axis { stroke: var(--line); stroke-width: 1; }
.spark text { fill: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.list li:first-child { border-top: 0; }
.list audio { width: 100%; }

/* Support dialog */
dialog#support {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; max-height: 92dvh;
  background: var(--surface); color: var(--ink); border-radius: 26px 26px 0 0;
}
dialog#support::backdrop { background: rgba(28, 16, 25, 0.55); }
.support-inner { padding: 20px var(--gutter) calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.support-head { display: flex; justify-content: space-between; align-items: center; }
.resources { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.resources li { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; user-select: text; }
.res-name { font-weight: 700; }
.res-where { font-weight: 400; color: var(--muted); font-size: 0.875rem; margin-left: 4px; }
.res-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; user-select: all; }
.res-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.support-foot { color: var(--ink-soft); }

/* Onboarding */
.onboard { padding-top: 12px; }
.onboard h1 { font-size: 2.2rem; }
.steps-dots { display: flex; gap: 6px; }
.steps-dots i { width: 28px; height: 4px; border-radius: 2px; background: var(--line); display: block; }
.steps-dots i.on { background: var(--rose); }
.bullets { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 8px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 16px); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease; z-index: 30; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Five tabs: keep every label on one line down to 360px */
.tabs { grid-template-columns: repeat(5, minmax(0, 1fr)); padding-inline: calc(4px + env(safe-area-inset-left)) calc(4px + env(safe-area-inset-right)); gap: 2px; }
.tabs a { font-size: 0.75rem; letter-spacing: -0.01em; min-width: 0; padding-inline: 0; }
.tabs a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Expression Studio */
.stack-lg { display: flex; flex-direction: column; gap: 18px; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; background: var(--bg-deep); border-radius: 999px; padding: 4px; }
.seg button { min-height: 44px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-soft); font: inherit; font-size: 0.9375rem; cursor: pointer; padding: 6px 4px; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: var(--shadow); }
.h3 { font-family: var(--font-body); font-weight: 700; font-size: 1.0625rem; }
.hud { flex-direction: row; align-items: center; gap: 16px; }
.ring-wrap { position: relative; width: 112px; height: 112px; flex: none; }
.ring { width: 112px; height: 112px; display: block; }
.ring-bg { fill: none; stroke: var(--bg-deep); stroke-width: 10; }
.ring-fg { fill: none; stroke: var(--rose); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 120ms linear; }
.ring-num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.35rem; }
.hud-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.hud-text .big { font-size: 1.2rem; }
.hold-track { height: 8px; border-radius: 999px; background: var(--bg-deep); overflow: hidden; margin-top: 4px; }
.hold-track span { display: block; height: 100%; width: 0; background: var(--calm); border-radius: 999px; transition: width 100ms linear; }
.fbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.fbars li { display: grid; grid-template-columns: 7.2em minmax(0, 1fr) 2.6em; gap: 10px; align-items: center; font-size: 0.9375rem; }
.fbars li.focus .flabel { font-weight: 700; color: var(--rose); }
.flabel { line-height: 1.2; }
.ftrack { position: relative; height: 14px; border-radius: 999px; background: var(--bg-deep); }
.fband { position: absolute; top: 0; bottom: 0; background: var(--band); border: 1px solid color-mix(in srgb, var(--rose) 45%, transparent); border-radius: 999px; min-width: 6px; }
.fmark { position: absolute; top: -4px; width: 6px; height: 22px; border-radius: 3px; background: var(--ink); transform: translateX(-3px); left: 0; opacity: 0; transition: left 90ms linear; }
.fval { text-align: right; color: var(--muted); font-size: 0.875rem; }
.focus-hint { background: var(--champagne-soft); border-radius: 12px; padding: 10px 12px; font-weight: 700; }
#save-face input { flex: 1 1 160px; }
.xrow { align-items: flex-end !important; }
.xrow > span:first-child { flex: 1 1 200px; min-width: 0; }
.mini-bars { display: flex; align-items: flex-end; gap: 3px; height: 30px; }
.mini-bars i { width: 7px; background: var(--trace); border-radius: 2px; opacity: .8; display: block; }
