:root {
  color-scheme: light;
  --bg: #f1f4f3;
  --surface: #e6ece9;
  --surface-raised: #fbfcfb;
  --surface-soft: #dce5e1;
  --ink: #17201c;
  --muted: #59645e;
  --faint: #68756e;
  --line: #c7d1cc;
  --accent: #c94b32;
  --accent-hover: #a83b27;
  --accent-soft: #f4d9d2;
  --on-accent: #fff9f6;
  --danger: #a83b27;
  --shadow: 0 24px 70px rgba(39, 58, 49, 0.12);
  --radius: 16px;
  --header-height: 72px;
  --font-sans: "Aptos", "Avenir Next", "Segoe UI Variable", "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101714;
  --surface: #1b2521;
  --surface-raised: #202c27;
  --surface-soft: #27342f;
  --ink: #edf3ef;
  --muted: #aebbb4;
  --faint: #87978f;
  --line: #384740;
  --accent: #df6d55;
  --accent-hover: #ee826a;
  --accent-soft: #4c2d27;
  --on-accent: #17110f;
  --danger: #ee826a;
  --shadow: 0 24px 70px rgba(1, 8, 5, 0.3);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    color-scheme: dark;
    --bg: #101714;
    --surface: #1b2521;
    --surface-raised: #202c27;
    --surface-soft: #27342f;
    --ink: #edf3ef;
    --muted: #aebbb4;
    --faint: #87978f;
    --line: #384740;
    --accent: #df6d55;
    --accent-hover: #ee826a;
    --accent-soft: #4c2d27;
    --on-accent: #17110f;
    --danger: #ee826a;
    --shadow: 0 24px 70px rgba(1, 8, 5, 0.3);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button,
label,
summary {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  transform: translateY(-150%);
  transition: transform 180ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(100%, 1480px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 max(24px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: calc(var(--header-height) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.brand,
.top-nav,
.question-actions,
.record-controls,
.session-actions,
.export-actions {
  display: flex;
  align-items: center;
}

.brand {
  min-height: 44px;
  gap: 11px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0.95rem;
  font-weight: 720;
  letter-spacing: -0.015em;
  cursor: pointer;
}

.brand-mark {
  position: relative;
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--ink);
}

.brand-mark::before,
.brand-mark span {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.brand-mark span {
  margin-left: 5px;
}

.top-nav {
  gap: 6px;
  margin-left: auto;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.install-button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 740;
  cursor: pointer;
}

.nav-button,
.theme-button,
.text-button,
.dialog-close {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.nav-button,
.theme-button {
  padding: 0 13px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 650;
}

.nav-button:hover,
.theme-button:hover,
.nav-button.is-active {
  background: var(--surface);
  color: var(--ink);
}

.view {
  padding: clamp(42px, 7vw, 92px) 0 70px;
}

.conversation-grid {
  display: grid;
  grid-template-columns: minmax(230px, 0.7fr) minmax(520px, 1.5fr);
  gap: clamp(32px, 5vw, 78px);
  align-items: stretch;
}

.intro-panel {
  display: flex;
  min-height: 510px;
  flex-direction: column;
  align-items: flex-start;
  padding: 18px 0 8px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 780;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.intro-panel h1,
.archive-heading h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2.55rem, 4.4vw, 5.4rem);
  font-weight: 650;
  letter-spacing: -0.065em;
  line-height: 0.96;
}

.intro-copy {
  max-width: 28ch;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 1.03rem;
}

.time-picker {
  width: 100%;
  margin: auto 0 0;
  padding: 0;
  border: 0;
}

.question-time-picker {
  max-width: 360px;
  margin: clamp(20px, 3vw, 34px) 0 0;
}

.time-picker legend {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 680;
}

.time-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  padding: 6px;
  border-radius: var(--radius);
  background: var(--surface);
}

.time-options label {
  cursor: pointer;
}

.time-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.time-options span {
  display: grid;
  min-height: 44px;
  place-items: center;
  border-radius: 11px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 720;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.time-options input:checked + span {
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--ink) 7%, transparent);
}

.time-options input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 2px;
}

.mode-note {
  max-width: 30ch;
  margin: auto 0 0;
  color: var(--faint);
  font-size: 0.82rem;
}

.question-surface {
  display: flex;
  min-height: 510px;
  flex-direction: column;
  padding: clamp(28px, 4vw, 58px);
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

.question-surface.is-changing {
  animation: question-change 360ms cubic-bezier(0.16, 1, 0.3, 1);
}

.question-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--faint);
  font-size: 0.8rem;
  font-weight: 680;
}

.scene {
  max-width: 60ch;
  margin: clamp(38px, 5vw, 72px) 0 20px;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.2vw, 1.1rem);
}

.question-surface h2 {
  max-width: 18ch;
  margin: 0;
  font-size: clamp(2.25rem, 4.7vw, 5rem);
  font-weight: 610;
  letter-spacing: -0.06em;
  line-height: 0.99;
  text-wrap: balance;
}

.question-actions {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  padding-top: 38px;
}

.button,
.file-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 740;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 120ms ease;
}

.button:active,
.file-button:active,
.nav-button:active,
.theme-button:active,
.record-button:active {
  transform: scale(0.98);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.button-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.button-secondary,
.file-button {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--ink);
}

.button-secondary:hover:not(:disabled),
.file-button:hover {
  background: var(--surface);
}

.button-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.button-quiet:hover {
  background: var(--surface);
  color: var(--ink);
}

.question-actions .button-primary {
  margin-left: auto;
}

.session-workspace {
  margin-top: clamp(48px, 7vw, 92px);
  padding-top: clamp(36px, 5vw, 66px);
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--header-height) + env(safe-area-inset-top) + 12px);
}

.session-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: start;
  margin-bottom: 34px;
}

.session-context {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 740;
}

.session-heading h2 {
  max-width: 24ch;
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.4rem);
  font-weight: 610;
  letter-spacing: -0.05em;
  line-height: 1.02;
  text-wrap: balance;
}

.text-button,
.dialog-close {
  padding: 0 4px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 680;
}

.text-button:hover,
.dialog-close:hover {
  color: var(--ink);
}

.recorder-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 22px;
}

.recorder-panel,
.take-panel {
  min-height: 510px;
  border-radius: var(--radius);
}

.recorder-panel {
  display: flex;
  flex-direction: column;
  padding: clamp(24px, 4vw, 44px);
  background: var(--ink);
  color: var(--bg);
}

html[data-theme="dark"] .recorder-panel {
  background: #e8efeb;
  color: #16201b;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .recorder-panel {
    background: #e8efeb;
    color: #16201b;
  }
}

.recorder-copy h3,
.take-panel h3 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.025em;
}

.recorder-copy p {
  max-width: 48ch;
  margin: 6px 0 0;
  color: color-mix(in srgb, currentColor 68%, transparent);
  font-size: 0.88rem;
}

.iphone-recording-note {
  display: none;
}

html.is-ios .iphone-recording-note {
  display: block;
}

.wave-field {
  display: grid;
  min-height: 170px;
  margin: 34px 0 20px;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: color-mix(in srgb, currentColor 7%, transparent);
}

.wave-field canvas {
  display: block;
  width: 100%;
  height: 170px;
}

.record-status {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  color: color-mix(in srgb, currentColor 72%, transparent);
  font-size: 0.86rem;
  font-weight: 670;
}

.record-status time {
  color: currentColor;
  font-family: "Aptos Mono", "Cascadia Mono", monospace;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.record-controls {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  padding-top: 28px;
}

.record-button {
  display: inline-flex;
  min-height: 62px;
  align-items: center;
  gap: 12px;
  padding: 0 20px 0 11px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 780;
  cursor: pointer;
}

.record-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.record-button-core {
  display: block;
  width: 40px;
  height: 40px;
  border: 3px solid color-mix(in srgb, var(--on-accent) 72%, transparent);
  border-radius: 50%;
  background: transparent;
  transition: border-radius 180ms ease, transform 180ms ease, background 180ms ease;
}

.record-button.is-recording .record-button-core {
  width: 34px;
  height: 34px;
  margin: 3px;
  border: 0;
  border-radius: 9px;
  background: var(--on-accent);
}

.record-button.is-requesting .record-button-core {
  animation: permission-pulse 900ms ease-in-out infinite alternate;
}

.recorder-fallback {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.recorder-fallback input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.recorder-panel .file-button,
.recorder-panel .button-secondary {
  border-color: color-mix(in srgb, currentColor 28%, transparent);
  background: transparent;
  color: currentColor;
}

.inline-message {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: currentColor;
  font-size: 0.86rem;
}

.take-panel {
  display: flex;
  flex-direction: column;
  padding: clamp(22px, 3vw, 34px);
  border: 1px solid var(--line);
  background: var(--surface);
}

.take-panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.take-panel-heading span {
  color: var(--faint);
  font-size: 0.8rem;
  font-weight: 680;
}

.empty-takes {
  display: grid;
  flex: 1;
  place-items: center;
  text-align: center;
}

.empty-takes p {
  max-width: 25ch;
  color: var(--muted);
}

.takes-list {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.take-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
}

.take-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.take-item-title {
  font-size: 0.88rem;
  font-weight: 740;
}

.take-item-meta {
  color: var(--faint);
  font-size: 0.75rem;
}

.take-item audio {
  width: 100%;
  height: 38px;
}

.take-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.take-item-actions button {
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 720;
  cursor: pointer;
}

.take-item-actions button:hover {
  color: var(--ink);
}

.take-item-actions .delete-take {
  margin-left: auto;
  color: var(--danger);
}

.nudge-block {
  margin-top: 18px;
  padding: 16px 0 2px;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--header-height) + env(safe-area-inset-top) + 12px);
}

.nudge-label {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 780;
}

.nudge-block p:last-child {
  margin: 0;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 600;
}

.session-actions {
  flex-wrap: wrap;
  gap: 9px;
  margin-top: auto;
  padding-top: 24px;
}

.archive-heading {
  margin-bottom: clamp(42px, 7vw, 84px);
}

.archive-heading h1 {
  max-width: 14ch;
}

.archive-heading > p:last-child {
  max-width: 52ch;
  margin: 22px 0 0;
  color: var(--muted);
}

.archive-list {
  display: grid;
  gap: 14px;
}

.archive-entry {
  border-bottom: 1px solid var(--line);
}

.archive-entry summary {
  display: grid;
  grid-template-columns: minmax(110px, 0.25fr) minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  min-height: 90px;
  list-style: none;
  cursor: pointer;
}

.archive-entry summary::-webkit-details-marker {
  display: none;
}

.archive-date,
.archive-count {
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 680;
}

.archive-title {
  font-size: clamp(1.15rem, 2vw, 1.6rem);
  font-weight: 650;
  letter-spacing: -0.03em;
}

.archive-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.55fr);
  gap: 28px;
  padding: 6px 0 28px min(25%, 220px);
}

.archive-question {
  margin: 0 0 20px;
  color: var(--muted);
}

.archive-audio-list {
  display: grid;
  gap: 12px;
}

.keep-line {
  display: grid;
  gap: 8px;
}

.keep-line label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.keep-line textarea,
.brief-label + textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  color: var(--ink);
  resize: vertical;
}

.keep-line textarea {
  min-height: 110px;
  padding: 12px;
}

.archive-entry-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.archive-entry-actions button {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.archive-entry-actions .delete-session {
  color: var(--danger);
}

.archive-empty {
  max-width: 620px;
  padding: 42px;
  border-radius: var(--radius);
  background: var(--surface);
}

.archive-empty h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  letter-spacing: -0.05em;
}

.archive-empty p {
  max-width: 40ch;
  margin: 12px 0 24px;
  color: var(--muted);
}

.site-footer {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.76rem;
}

dialog {
  color: var(--ink);
}

dialog::backdrop {
  background: color-mix(in srgb, #07100c 58%, transparent);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.sheet-dialog,
.export-dialog {
  width: min(calc(100% - 32px), 720px);
  max-height: min(88dvh, 820px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

.sheet-dialog[open],
.export-dialog[open] {
  animation: dialog-in 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.sheet-dialog form,
.export-inner {
  padding: clamp(22px, 4vw, 40px);
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.dialog-heading p {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 740;
}

.dialog-heading h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: -0.045em;
  line-height: 1.04;
}

.theme-choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.theme-choice {
  min-height: 72px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.theme-choice:hover,
.theme-choice.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.theme-choice strong,
.theme-choice span {
  display: block;
}

.theme-choice span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.dialog-submit {
  width: 100%;
  margin-top: 22px;
}

.export-note {
  max-width: 58ch;
  margin: -8px 0 24px;
  color: var(--muted);
}

.export-takes {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}

.export-take {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 14px;
  border-radius: 12px;
  background: var(--surface);
}

.export-take strong,
.export-take span {
  display: block;
}

.export-take span {
  color: var(--faint);
  font-size: 0.75rem;
}

.export-take-actions {
  display: flex;
  gap: 8px;
}

.export-take-actions button {
  min-height: 44px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.brief-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 720;
}

.brief-label + textarea {
  min-height: 245px;
  padding: 15px;
  line-height: 1.5;
}

.export-actions {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.install-inner {
  display: flex;
  max-height: min(88dvh, 820px);
  flex-direction: column;
  padding: clamp(22px, 4vw, 40px);
}

.install-body {
  overflow: auto;
  overscroll-behavior: contain;
}

.install-lead {
  max-width: 58ch;
  margin: -8px 0 24px;
  color: var(--muted);
}

.install-steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.install-steps li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 13px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.install-steps li > span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.78rem;
  font-weight: 780;
}

.install-steps strong,
.local-storage-note strong {
  display: block;
  font-size: 0.9rem;
}

.install-steps p,
.local-storage-note p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.local-storage-note {
  margin-top: 14px;
  padding: 13px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
}

.install-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 20px;
}

.mobile-tabbar {
  display: none;
}

.toast {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 30;
  max-width: min(420px, calc(100% - 36px));
  padding: 13px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  font-weight: 650;
}

@keyframes question-change {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes permission-pulse {
  from {
    transform: scale(0.86);
    opacity: 0.55;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .conversation-grid,
  .recorder-layout {
    grid-template-columns: 1fr;
  }

  .conversation-grid {
    gap: 28px;
  }

  .intro-panel {
    min-height: auto;
    padding-top: 0;
  }

  .intro-panel h1 {
    max-width: 13ch;
  }

  .time-picker {
    max-width: 360px;
    margin-top: 32px;
  }

  .question-surface {
    min-height: 480px;
  }

  .recorder-panel,
  .take-panel {
    min-height: 460px;
  }

  .archive-detail {
    grid-template-columns: 1fr;
    padding-left: 0;
  }
}

@media (max-width: 640px) {
  :root {
    --header-height: 58px;
  }

  .app-shell {
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
  }

  .app-header {
    gap: 10px;
  }

  .desktop-nav {
    display: none;
  }

  .header-tools {
    margin-left: auto;
  }

  .brand > span:last-child {
    max-width: 96px;
    font-size: 0.82rem;
    line-height: 1.05;
  }

  .brand-mark {
    width: 25px;
    height: 25px;
  }

  .theme-button {
    padding: 0 9px;
    font-size: 0.79rem;
  }

  .install-button {
    min-height: 44px;
  }

  .view {
    padding: 16px 0 34px;
  }

  .conversation-grid {
    gap: 0;
  }

  .intro-panel {
    display: none;
  }

  .archive-heading h1 {
    font-size: clamp(2.55rem, 13vw, 4rem);
  }

  .question-surface {
    min-height: calc(100dvh - var(--header-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 104px);
    padding: 22px;
  }

  .question-time-picker {
    max-width: none;
    margin-top: 18px;
  }

  .time-picker legend {
    margin-bottom: 7px;
    font-size: 0.78rem;
  }

  .scene {
    margin-top: 32px;
  }

  .question-surface h2 {
    font-size: clamp(2rem, 10vw, 2.75rem);
  }

  .question-actions {
    align-items: stretch;
    padding-top: 24px;
  }

  .question-actions .button-primary {
    width: 100%;
    margin-left: 0;
    order: -1;
  }

  .question-actions .button-quiet {
    flex: 1;
  }

  .mobile-tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 14;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 6px max(16px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(16px, env(safe-area-inset-left));
    border-top: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .mobile-tab {
    display: grid;
    min-height: 54px;
    place-content: center;
    gap: 2px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 720;
    cursor: pointer;
  }

  .mobile-tab.is-active {
    color: var(--ink);
  }

  .mobile-tab-dot {
    width: 17px;
    height: 17px;
    margin: 0 auto;
    border: 5px solid currentColor;
    border-radius: 50%;
  }

  .mobile-tab-lines {
    position: relative;
    width: 19px;
    height: 17px;
    margin: 0 auto;
    border-top: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
  }

  .mobile-tab-lines::after {
    position: absolute;
    top: 6px;
    right: 0;
    left: 0;
    border-top: 2px solid currentColor;
    content: "";
  }

  body.session-active .mobile-tabbar {
    display: none;
  }

  body.session-active .app-shell {
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }

  body.session-active .conversation-grid {
    display: none;
  }

  body.session-active .view {
    padding-top: 0;
  }

  body.session-active .session-workspace {
    margin-top: 0;
    padding-top: 18px;
    border-top: 0;
  }

  .session-heading {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 22px;
  }

  .text-button {
    justify-self: start;
  }

  .recorder-panel {
    min-height: 520px;
    padding: 22px;
  }

  .take-panel {
    min-height: auto;
    padding: 22px;
  }

  .empty-takes {
    min-height: 160px;
  }

  .wave-field {
    min-height: 120px;
    margin: 24px 0 16px;
  }

  .wave-field canvas {
    height: 120px;
  }

  .record-controls {
    align-items: stretch;
  }

  body.is-recording .record-controls {
    position: sticky;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 5;
    margin: auto -10px -10px;
    padding: 12px 10px 10px;
    border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
    border-radius: 14px;
    background: color-mix(in srgb, currentColor 10%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .record-button {
    width: 100%;
    justify-content: flex-start;
  }

  .record-controls .button-secondary {
    flex: 1;
  }

  .session-actions {
    position: sticky;
    bottom: 0;
    z-index: 4;
    flex-direction: column;
    align-items: stretch;
    margin: 20px -4px -4px;
    padding: 14px 4px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--surface);
  }

  .archive-entry summary {
    grid-template-columns: 1fr auto;
    gap: 6px 16px;
    padding: 15px 0;
  }

  .archive-date {
    grid-column: 1;
    grid-row: 1;
  }

  .archive-title {
    grid-column: 1;
    grid-row: 2;
  }

  .archive-count {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .archive-empty {
    padding: 28px 22px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 18px 0;
  }

  .sheet-dialog,
  .export-dialog {
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    margin: auto 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
  }

  .sheet-dialog form,
  .export-inner,
  .install-inner {
    max-height: 92dvh;
    padding: 22px 20px calc(16px + env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .dialog-heading {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: -2px -2px 20px;
    padding: 2px 2px 12px;
    background: var(--surface-raised);
  }

  .theme-choices {
    grid-template-columns: 1fr;
  }

  .export-take {
    align-items: flex-start;
    flex-direction: column;
  }

  .export-take-actions,
  .export-take-actions button {
    width: 100%;
  }

  .export-actions {
    position: sticky;
    bottom: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 14px 0 calc(4px + env(safe-area-inset-bottom));
    background: var(--surface-raised);
  }

  .install-actions {
    position: static;
    flex: 0 0 auto;
    flex-direction: column-reverse;
    align-items: stretch;
    padding: 14px 0 calc(4px + env(safe-area-inset-bottom));
    background: var(--surface-raised);
  }

  .install-inner {
    overflow: hidden;
  }

  .install-inner .dialog-heading {
    flex: 0 0 auto;
  }

  .install-body {
    flex: 1 1 auto;
    min-height: 0;
    padding-right: 2px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dialog-submit {
    position: sticky;
    bottom: 0;
  }

  .keep-line textarea,
  .brief-label + textarea {
    font-size: 16px;
  }

  .toast {
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(76px + env(safe-area-inset-bottom));
    left: max(16px, env(safe-area-inset-left));
    max-width: none;
  }

  body.session-active .toast {
    bottom: calc(18px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .app-header,
  dialog::backdrop {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .app-header {
    background: var(--bg);
  }
}
