/* Quinn app. Sea-glass while she listens, amber while she speaks; one family, Atkinson Hyperlegible. */
:root {
  --bg: #E9EFEC;
  --surface: #F6F9F7;
  --ink: #12302F;
  --muted: #4E6B68;
  --line: #C6D4CF;
  --listen: #1F7F74;
  --speak: #B86A00;
  --danger: #A23B2A;
  --focus: #1F7F74;
  --radius-lg: 22px;
  --radius-sm: 10px;
  --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E2626; --surface: #143434; --ink: #E4EFEB; --muted: #93AFAA; --line: #26494A;
    --listen: #6FD3C4; --speak: #FFB547; --danger: #FF8A73; --focus: #6FD3C4; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E2626; --surface: #143434; --ink: #E4EFEB; --muted: #93AFAA; --line: #26494A;
  --listen: #6FD3C4; --speak: #FFB547; --danger: #FF8A73; --focus: #6FD3C4; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.screen {
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}

/* The name is set large and tight: it is the only display type in the app. */
.wordmark { font-weight: 700; font-size: clamp(56px, 16vw, 96px); letter-spacing: -0.04em; line-height: 0.9; margin: 0 0 20px; }
.wordmark.small { font-size: 26px; margin: 0; letter-spacing: -0.03em; }

.intro { width: 100%; max-width: 30rem; margin: auto; padding: 24px 0; }
.lede { font-size: 21px; line-height: 1.4; margin: 0 0 24px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
label { font-weight: 500; }
input[type="password"], input:not([type]), select {
  width: 100%; padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--surface);
}
.msg { min-height: 1.5em; margin: 4px 0 0; color: var(--muted); }
.msg.bad { color: var(--danger); }

button { cursor: pointer; border: 0; background: none; }
.primary {
  background: var(--ink); color: var(--bg); font-weight: 700;
  padding: 14px 22px; border-radius: 999px; min-height: 48px;
}
.primary.small { padding: 8px 16px; min-height: 40px; }
.primary:disabled { opacity: 0.5; cursor: default; }
.ghost { padding: 10px 14px; border-radius: 999px; border: 1.5px solid var(--line); min-height: 44px; }
.danger { color: var(--danger); }
.icon { width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center; }
.icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.capability-icon { position: relative; }
.new-dot { position: absolute; right: 4px; top: 3px; width: 9px; height: 9px; border-radius: 50%; background: var(--speak); }

.choice { display: flex; flex-direction: column; gap: 10px; margin: 20px 0 24px; }
.choice label {
  display: flex; gap: 12px; align-items: flex-start; font-weight: 400;
  padding: 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: var(--surface);
}
.choice label:has(input:checked) { border-color: var(--listen); }
.choice input { margin-top: 5px; accent-color: var(--listen); }
.choice b { display: block; }

.progress { margin-top: 20px; }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--listen); transition: width 0.3s; }

/* Talking screen */
.top { display: flex; align-items: center; justify-content: space-between; }
.top nav { display: flex; gap: 4px; color: var(--muted); }
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 0; }
.presence {
  width: min(78vw, 46dvh, 380px); aspect-ratio: 1; border-radius: 50%;
  position: relative; touch-action: manipulation;
}
.presence canvas { width: 100%; height: 100%; display: block; }
.state { margin: 0; font-size: 19px; font-weight: 500; color: var(--muted); min-height: 1.5em; text-align: center; }
.hint { margin: 0; color: var(--muted); text-align: center; font-size: 15px; }

.captions { width: 100%; max-width: 36rem; margin: 0 auto 12px; min-height: 7.5em; }
.captions p { margin: 0 0 8px; }
.you { color: var(--muted); }
.you:not(:empty)::before { content: "You: "; }
.agent { font-size: 20px; line-height: 1.4; }
.brief-panel { margin: 16px 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.brief-panel h2 { font-size: 23px; margin: 0 0 12px; }
.brief-panel h3 { font-size: 18px; margin: 18px 0 6px; }
.brief-panel p { white-space: pre-line; }
.brief-story { padding: 10px 0; border-top: 1px solid var(--line); }
.brief-story-title { display: block; font-weight: 600; }
.brief-story-meta { display: block; color: var(--muted); font-size: 14px; }
.brief-story a { display: inline-block; min-height: 44px; padding: 9px 0; color: var(--listen); font-weight: 700; }
#talk.brief-visible .stage { flex: 0 0 auto; position: sticky; top: 0; z-index: 1; background: var(--bg); }
#talk.brief-visible .presence { width: min(34vw, 120px); }
#talk.brief-visible .captions { flex: 1; overflow-y: auto; min-height: 0; }
.crisis-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.crisis-action {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 10px 16px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-weight: 700; text-decoration: none;
}
.card {
  margin-top: 12px; padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--speak); display: flex; gap: 12px; align-items: center; justify-content: space-between;
}
.card p { margin: 0; }
.card.confirm { border-color: var(--listen); flex-direction: column; align-items: stretch; }
.card .buttons { display: flex; gap: 8px; justify-content: flex-end; }

.type { width: 100%; max-width: 36rem; margin: 0 auto; display: flex; gap: 6px; align-items: center; }
.type input { border-radius: 999px; padding: 12px 18px; }
.quick-actions { display: flex; justify-content: center; gap: 12px; margin-bottom: 12px; }
.quick-actions button { min-width: 108px; }
.listen-screen .top { color: var(--muted); }
.listen-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.listen-orb { width: min(58vw, 250px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #8de0ce, var(--listen) 68%); box-shadow: 0 0 0 15px color-mix(in srgb, var(--listen) 14%, transparent); margin-bottom: 36px; }
.listen-center h1 { font-size: 30px; margin: 0 0 12px; }
.listen-center p { margin: 4px; font-variant-numeric: tabular-nums; }
#listen-time { font-size: 23px; font-weight: 700; }
.listen-stop { background: var(--danger); color: white; width: 100%; font-size: 21px; min-height: 64px; }
#listen-resume { margin-bottom: 12px; }
.listen-choices { display: grid; gap: 10px; margin: 20px 0; }
.listen-choices button { text-align: left; font-weight: 700; }
.work-sheet { max-height: 92dvh; }
.work-sheet section { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 8px; }
.work-sheet section h3 { margin: 0 0 6px; }
.work-sheet section p { margin: 0 0 6px; }
.work-sheet section ul { margin: 4px 0 0; padding-left: 22px; }
.work-sheet li { margin-bottom: 4px; }
.work-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.work-list-open { text-align: left; padding: 0; }
.work-list-open small { display: block; }

/* Sheets */
.sheet {
  border: 0; padding: 0; background: var(--surface); color: var(--ink);
  width: min(100vw, 34rem); max-height: 92dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  margin: auto auto 0;
}
@media (min-width: 700px) { .sheet { margin: auto; border-radius: var(--radius-lg); } }
.sheet::backdrop { background: rgb(14 38 38 / 0.45); }
.sheet form { padding: 22px 20px max(20px, env(safe-area-inset-bottom)); }
.capability-sheet { padding: 22px 20px max(20px, env(safe-area-inset-bottom)); overflow-y: auto; max-height: 92dvh; }
.capability-sheet h2 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.02em; }
.capability-sheet h3 { margin: 20px 0 4px; font-size: 17px; }
.capability-sheet .items li { display: block; }
.capability-title { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.capability-new { color: var(--speak); font-size: 13px; }
.capability-example { display: block; text-align: left; color: var(--listen); padding: 8px 0; text-decoration: underline; }
.capability-connect { margin-top: 8px; }
.sheet h2 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.02em; }
.sheet h3 { margin: 14px 0 0; font-size: 17px; }
fieldset { border: 0; border-top: 1.5px solid var(--line); margin: 8px 0 0; padding: 14px 0 0; display: flex; flex-direction: column; gap: 10px; }
legend { font-weight: 700; padding: 0 8px 0 0; }
.row { display: flex; gap: 10px; align-items: center; font-weight: 400; min-height: 32px; }
.row input { accent-color: var(--listen); width: 20px; height: 20px; flex: none; }
input[type="range"] { width: 100%; accent-color: var(--listen); }
output { color: var(--muted); font-weight: 400; margin-left: 6px; }
.fine { color: var(--muted); font-size: 15px; margin: 4px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.account { display: flex; gap: 12px; align-items: center; justify-content: space-between; min-height: 44px; }
.account small { display: block; color: var(--muted); font-size: 15px; }
.row input[type="checkbox"] { accent-color: var(--listen); width: 20px; height: 20px; flex: none; }
.items { list-style: none; margin: 0; padding: 0; }
.items li { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.items li small { display: block; color: var(--muted); }
.items .empty { color: var(--muted); border: 0; }
.about-you section { margin: 12px 0; }
.about-you h4 { margin: 0; font-size: .95rem; }
.about-you .items li { align-items: center; }
.about-you .items li > span:first-child { flex: 1; overflow-wrap: anywhere; }
.about-actions { display: flex; gap: 4px; flex-shrink: 0; }
.about-you input { min-width: 0; flex: 1; }

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