:root {
  --topic-ink: var(--brand);
  --topic-tint: var(--brand-tint);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  min-height: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
}

button,
input {
  color: inherit;
  font: inherit;
}

button {
  min-height: var(--control-md);
}

button,
a,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: var(--bw-bold) solid var(--focus);
  outline-offset: var(--space-1);
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background-image: radial-gradient(var(--line-ink) 1.1px, transparent 1.2px);
  background-size: 7px 7px;
  opacity: 0.08;
  pointer-events: none;
}

.ambient-one {
  top: calc(var(--space-10) * -1);
  left: calc(var(--space-8) * -1);
  color: var(--brand);
}

.ambient-two {
  right: calc(var(--space-9) * -1);
  bottom: calc(var(--space-10) * -1);
  color: var(--accent);
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(var(--container-wide), calc(100% - var(--gutter) * 2));
  min-height: 100vh;
  margin: 0 auto;
  padding: var(--space-5) 0 var(--space-6);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  min-height: 72px;
  padding-bottom: var(--space-4);
  border-bottom: var(--border-card);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--text-strong);
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 160px;
  height: 48px;
  object-fit: contain;
  object-position: left center;
}

.brand-tagline {
  max-width: 190px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--t-xs);
  line-height: var(--lh-body);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.icon-button,
.text-button,
.voice-mode-button,
.start-button,
.nav-button,
.summary-button,
.timer-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: var(--border-card);
  font-family: var(--font-display);
  font-weight: var(--w-bold);
  line-height: 1;
  cursor: pointer;
  transition:
    box-shadow var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out);
}

.icon-button,
.text-button,
.voice-mode-button {
  background: var(--surface-raised);
  box-shadow: var(--shadow-sticker);
  color: var(--text-strong);
}

.icon-button:hover,
.text-button:hover,
.voice-mode-button:hover,
.start-button:hover,
.nav-button:hover,
.summary-button:hover {
  box-shadow: var(--shadow-sticker-lg);
  transform: translate(calc(var(--space-1) * -1), calc(var(--space-1) * -1));
}

.icon-button:active,
.text-button:active,
.voice-mode-button:active,
.start-button:active,
.nav-button:active,
.summary-button:active,
.timer-button:active {
  box-shadow: none;
  transform: translate(var(--space-1), var(--space-1));
}

.icon-button {
  width: var(--control-md);
  height: var(--control-md);
  padding: 0;
  border-radius: var(--radius-md);
}

.icon-button .lucide,
.text-button .lucide,
.quiet-button .lucide,
.nav-button .lucide,
.start-button .lucide {
  width: 19px;
  height: 19px;
  stroke-width: 2.1;
}

.text-button,
.voice-mode-button {
  min-height: var(--control-md);
  padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  font-size: var(--t-sm);
}

.voice-mode-button {
  position: relative;
}

.voice-mode-dot,
.start-voice-indicator,
.status-dot,
.recording-dot {
  flex: 0 0 auto;
  width: var(--space-2);
  height: var(--space-2);
  border: var(--bw-hair) solid var(--line-ink);
  border-radius: 50%;
  background: var(--brand);
}

.voice-shortcut,
.timer-shortcut,
.state-shortcut,
.nav-shortcut,
.keycap,
.start-step {
  display: inline-grid;
  place-items: center;
  min-width: 25px;
  height: 25px;
  padding: 0 var(--space-1);
  border: var(--bw-ink) solid currentColor;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: var(--t-kicker);
  font-weight: var(--w-bold);
  line-height: 1;
}

.voice-mode-button[data-state="loading"] .voice-mode-dot,
.voice-mode-button[data-state="speaking"] .voice-mode-dot {
  background: var(--accent);
  animation: status-pulse 800ms var(--ease-out) infinite alternate;
}

.voice-mode-button[data-state="error"] .voice-mode-dot {
  background: var(--bad);
}

.voice-mode-button[data-state="off"] {
  color: var(--text-muted);
  box-shadow: none;
}

.voice-mode-button[data-state="off"] .voice-mode-dot {
  background: var(--surface-sunken);
}

.start-screen {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(570px, 1.22fr);
  align-items: center;
  gap: clamp(var(--space-7), 7vw, var(--space-9));
  padding: var(--space-8) 0 var(--space-7);
}

.start-intro {
  align-self: center;
  max-width: 560px;
}

.eyebrow,
.filter-label,
.summary-metrics span,
.summary-table-head,
.type-label,
.progress-label {
  font-family: var(--font-mono);
  font-size: var(--t-kicker);
  font-weight: var(--w-bold);
  letter-spacing: var(--track-kicker);
  text-transform: uppercase;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  color: var(--brand-deep);
}

.eyebrow::before {
  width: 18px;
  height: var(--bw-ink);
  background: currentColor;
  content: "";
}

.start-intro h1 {
  max-width: 720px;
  font-family: var(--font-display);
  font-size: var(--t-display);
  font-weight: var(--w-black);
  letter-spacing: var(--track-display);
  line-height: var(--lh-tight);
}

.start-intro > p:last-child {
  max-width: 520px;
  margin-top: var(--space-5);
  color: var(--text-body);
  font-size: var(--t-lead);
  line-height: var(--lh-relaxed);
}

.start-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: var(--border-card);
  border-radius: var(--radius-xl);
  background: var(--surface-card);
  box-shadow: var(--shadow-sticker-lg);
}

.start-card::before {
  position: absolute;
  z-index: -1;
  top: 0;
  right: 0;
  width: 52%;
  height: 35%;
  background-image: radial-gradient(var(--brand) 1.1px, transparent 1.2px);
  background-size: 7px 7px;
  content: "";
  mask-image: radial-gradient(125% 120% at 100% 0%, var(--line-ink) 8%, transparent 65%);
  opacity: 0.22;
  pointer-events: none;
}

.start-option {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  border-bottom: var(--border-card);
}

.start-option-copy {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.start-option-copy > div {
  display: grid;
  gap: var(--space-1);
}

.start-option-copy strong {
  color: var(--text-strong);
  font-family: var(--font-display);
  font-size: var(--t-body);
  font-weight: var(--w-bold);
}

.start-option-copy span:not(.start-step) {
  color: var(--text-muted);
  font-size: var(--t-xs);
}

.start-step {
  width: 30px;
  min-width: 30px;
  height: 30px;
  border-color: var(--line-ink);
  background: var(--surface-sunken);
  color: var(--text-strong);
}

.start-segments,
.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.start-segment,
.segment,
.state-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-md);
  padding: 0 var(--space-4);
  border: var(--border-card);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: var(--t-sm);
  font-weight: var(--w-semibold);
  cursor: pointer;
  transition:
    color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.start-segment:hover,
.segment:hover,
.state-button:hover {
  transform: translateY(calc(var(--space-1) * -1));
}

.start-segment.is-active,
.segment.is-active {
  background: var(--brand);
  color: var(--text-onink);
}

.start-segment.add-pack-button {
  border-style: dashed;
  background: var(--accent-tint);
  color: var(--pink-deep);
}

.start-segment.add-pack-button:hover {
  background: var(--accent);
  color: var(--ink-0);
}

.recording-mode-segments {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pack-history {
  margin-left: 42px;
  border-left: var(--bw-ink) solid var(--line-ink);
}

.pack-history summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--control-md);
  padding-left: var(--space-4);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--t-sm);
  font-weight: var(--w-semibold);
  list-style: none;
}

.pack-history summary::-webkit-details-marker {
  display: none;
}

.pack-history summary::before {
  width: var(--space-2);
  height: var(--space-2);
  margin-left: calc(var(--space-5) * -1);
  border-right: var(--bw-ink) solid currentColor;
  border-bottom: var(--bw-ink) solid currentColor;
  content: "";
  transform: rotate(-45deg);
  transition: transform var(--dur-fast) var(--ease-out);
}

.pack-history[open] summary::before {
  transform: rotate(45deg);
}

.pack-history-count {
  display: inline-grid;
  min-width: 26px;
  height: 26px;
  place-items: center;
  border: var(--bw-ink) solid var(--line-ink);
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  color: var(--text-strong);
  font-family: var(--font-mono);
  font-size: var(--t-kicker);
  font-weight: var(--w-bold);
}

.pack-history-list {
  display: grid;
  gap: var(--space-2);
  max-height: 200px;
  padding: var(--space-2) 0 var(--space-3) var(--space-4);
  overflow-y: auto;
}

.pack-history-empty {
  color: var(--text-faint);
  font-size: var(--t-xs);
}

.pack-history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--control-lg);
  padding: var(--space-2) var(--space-3);
  border: var(--border-card);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--text-body);
  text-align: left;
  cursor: pointer;
}

.pack-history-item.is-active {
  background: var(--brand-tint);
}

.pack-history-item > span:first-child {
  display: grid;
  gap: var(--space-1);
}

.pack-history-item strong {
  font-family: var(--font-display);
  font-size: var(--t-sm);
}

.pack-history-item small,
.pack-history-use {
  color: var(--text-muted);
  font-size: var(--t-xs);
}

.pack-history-use {
  font-family: var(--font-mono);
  font-weight: var(--w-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.start-voice-toggle {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 64px;
  padding: var(--space-2) var(--space-3);
  border: var(--border-card);
  border-radius: var(--radius-md);
  background: var(--brand-tint);
  color: var(--text-strong);
  text-align: left;
  cursor: pointer;
}

.start-voice-toggle > span:nth-child(2) {
  display: grid;
  gap: var(--space-1);
}

.start-voice-toggle strong {
  font-family: var(--font-display);
  font-size: var(--t-sm);
}

.start-voice-toggle small {
  color: var(--text-muted);
  font-size: var(--t-xs);
}

.start-voice-indicator {
  width: var(--space-3);
  height: var(--space-3);
}

.toggle-track {
  position: relative;
  width: 52px;
  height: 30px;
  border: var(--border-card);
  border-radius: var(--radius-pill);
  background: var(--brand);
  transition: background var(--dur-base) var(--ease-out);
}

.toggle-track span {
  position: absolute;
  top: 1px;
  left: 23px;
  width: 24px;
  height: 24px;
  border: var(--border-card);
  border-radius: 50%;
  background: var(--surface-raised);
  transition: left var(--dur-base) var(--ease-snap);
}

.start-voice-toggle[aria-pressed="false"] {
  background: var(--surface-raised);
}

.start-voice-toggle[aria-pressed="false"] .start-voice-indicator {
  background: var(--surface-sunken);
}

.start-voice-toggle[aria-pressed="false"] .toggle-track {
  background: var(--surface-sunken);
}

.start-voice-toggle[aria-pressed="false"] .toggle-track span {
  left: 1px;
}

.recording-privacy-note {
  margin-left: 42px;
  color: var(--text-muted);
  font-size: var(--t-xs);
  line-height: var(--lh-body);
}

.recording-privacy-note.is-error,
.add-pack-status.is-error {
  color: var(--bad);
  font-weight: var(--w-semibold);
}

.start-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding: var(--space-5);
  background: var(--surface-sunken);
}

.start-actions > div {
  display: grid;
  gap: var(--space-1);
}

.start-actions strong {
  color: var(--text-strong);
  font-family: var(--font-display);
  font-size: var(--t-body);
}

.start-actions span {
  color: var(--text-muted);
  font-size: var(--t-xs);
}

.start-button,
.summary-button.primary,
.nav-button.primary {
  min-height: var(--control-lg);
  padding: 0 var(--space-5);
  border-radius: var(--radius-pill);
  background: var(--accent);
  box-shadow: var(--shadow-sticker);
  color: var(--ink-0);
  font-size: var(--t-body);
}

.start-button:disabled,
.summary-button:disabled,
.nav-button:disabled,
.timer-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.session-screen {
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr) auto;
  min-height: 0;
}

.controls {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-5) 0 var(--space-4);
  border-bottom: var(--border-card);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.filter-label {
  color: var(--text-muted);
}

.filter-divider {
  width: var(--bw-ink);
  height: 32px;
  background: var(--line-ink);
}

.segment {
  min-height: var(--control-sm);
  padding: 0 var(--space-3);
  font-size: var(--t-xs);
}

.stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: var(--space-6) 0;
}

.question-card {
  --topic-ink: var(--brand);
  --topic-tint: var(--brand-tint);
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto;
  width: min(1080px, 100%);
  min-height: 510px;
  overflow: hidden;
  border: var(--border-card);
  border-radius: var(--radius-xl);
  background: var(--surface-card);
  box-shadow: var(--shadow-sticker-lg);
}

.question-card::before {
  position: absolute;
  z-index: -1;
  top: 0;
  right: 0;
  width: 55%;
  height: 62%;
  background-image: radial-gradient(var(--topic-ink) 1.2px, transparent 1.3px);
  background-size: 7px 7px;
  content: "";
  mask-image: radial-gradient(125% 120% at 100% 0%, var(--line-ink) 8%, transparent 64%);
  opacity: 0.34;
  pointer-events: none;
}

.question-card[data-topic="ai"] {
  --topic-ink: var(--grape-ink);
  --topic-tint: var(--grape-paper);
}

.question-card[data-topic="economics"] {
  --topic-ink: var(--gold-deep);
  --topic-tint: var(--gold-paper);
}

.question-card[data-topic="bitcoin"] {
  --topic-ink: var(--flag-ink);
  --topic-tint: var(--flag-paper);
}

.question-card[data-topic="business"] {
  --topic-ink: var(--mint-ink);
  --topic-tint: var(--mint-paper);
}

.question-card[data-pack-source="generated"] {
  --topic-ink: var(--blue-ink);
  --topic-tint: var(--blue-paper);
}

.question-card[data-topic="complete"] {
  --topic-ink: var(--pink-ink);
  --topic-tint: var(--pink-paper);
}

.card-topline,
.card-footer {
  position: relative;
  z-index: 2;
  display: grid;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
}

.card-topline {
  grid-template-columns: auto 1fr auto;
  border-bottom: var(--border-card);
  background: color-mix(in oklab, var(--surface-card) 88%, transparent);
}

.card-footer {
  grid-template-columns: 1fr auto auto;
  border-top: var(--border-card);
  background: var(--surface-sunken);
}

.question-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.topic-pill,
.summary-topic,
.summary-status {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 0 var(--space-3);
  border: var(--border-card);
  border-radius: var(--radius-pill);
  background: var(--topic-tint);
  color: var(--topic-ink);
  font-family: var(--font-mono);
  font-size: var(--t-kicker);
  font-weight: var(--w-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.type-label,
.progress-label {
  color: var(--text-muted);
}

.progress-label {
  justify-self: end;
}

.timer-panel {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-lg);
  padding: var(--space-1);
  border: var(--border-card);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
}

.timer-readout {
  display: grid;
  gap: 1px;
  min-width: 74px;
  padding: 0 var(--space-3);
}

.timer-readout span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--t-kicker);
  font-weight: var(--w-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.timer-readout time {
  color: var(--text-strong);
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  font-weight: var(--w-bold);
  font-variant-numeric: tabular-nums;
}

.timer-divider {
  width: var(--bw-ink);
  height: 30px;
  background: var(--line-ink);
}

.timer-button {
  min-height: var(--control-md);
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  color: var(--text-strong);
  font-size: var(--t-xs);
}

.pause-button {
  background: var(--brand);
  color: var(--text-onink);
}

.reset-button {
  background: var(--gold-paper);
}

.stop-button {
  background: var(--flag-paper);
  color: var(--flag-deep);
}

.timer-panel[data-running="false"] .pause-button {
  background: var(--surface-sunken);
  color: var(--text-muted);
}

.timer-panel[data-session="stopped"] {
  background: var(--flag-paper);
}

.question-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(900px, calc(100% - var(--space-9)));
  margin: 0 auto;
  padding: var(--space-7) 0;
}

.question-wrap h1 {
  max-width: 920px;
  color: var(--text-strong);
  font-family: var(--font-display);
  font-size: var(--t-h1);
  font-weight: var(--w-bold);
  letter-spacing: var(--track-head);
  line-height: var(--lh-head);
}

.recording-monitor,
.voice-activity {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  width: max-content;
  max-width: 100%;
  margin-bottom: var(--space-4);
  padding: var(--space-2) var(--space-3);
  border: var(--border-card);
  border-radius: var(--radius-md);
  background: var(--flag-paper);
  color: var(--flag-deep);
}

.recording-monitor video {
  width: 72px;
  height: 46px;
  border: var(--bw-ink) solid var(--line-ink);
  border-radius: var(--radius-sm);
  background: var(--surface-inverse);
  object-fit: cover;
  transform: scaleX(-1);
}

.recording-monitor-copy {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: var(--space-1) var(--space-2);
}

.recording-monitor-copy strong {
  font-family: var(--font-display);
  font-size: var(--t-xs);
}

.recording-monitor-copy > span:last-child {
  grid-column: 2;
  color: var(--text-muted);
  font-size: var(--t-kicker);
}

.recording-dot {
  grid-row: 1 / 3;
  background: var(--bad);
  animation: status-pulse 800ms var(--ease-out) infinite alternate;
}

.recording-monitor[data-state="paused"] .recording-dot {
  background: var(--surface-sunken);
  animation: none;
}

.voice-activity {
  border-radius: var(--radius-pill);
  background: var(--mint-paper);
  color: var(--mint-deep);
  font-family: var(--font-mono);
  font-size: var(--t-kicker);
  font-weight: var(--w-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.voice-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 14px;
}

.voice-wave span {
  width: 2px;
  border-radius: var(--radius-pill);
  background: currentColor;
  animation: voice-wave 650ms var(--ease-out) infinite alternate;
}

.voice-wave span:nth-child(1) {
  height: 5px;
}

.voice-wave span:nth-child(2) {
  height: 13px;
  animation-delay: -220ms;
}

.voice-wave span:nth-child(3) {
  height: 9px;
  animation-delay: -410ms;
}

.voice-wave span:nth-child(4) {
  height: 4px;
  animation-delay: -120ms;
}

.voice-transition {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  border-radius: inherit;
  background: color-mix(in oklab, var(--surface-inverse) 92%, transparent);
  color: var(--text-onink);
}

.voice-transition > div {
  display: grid;
  gap: var(--space-1);
}

.voice-transition strong {
  font-family: var(--font-display);
  font-size: var(--t-h4);
}

.voice-transition div span {
  color: var(--paper-3);
  font-size: var(--t-sm);
}

.voice-spinner {
  width: 32px;
  height: 32px;
  border: var(--bw-bold) solid var(--ink-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: voice-spin 760ms linear infinite;
}

.session-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--t-xs);
  font-weight: var(--w-semibold);
}

.status-dot {
  background: var(--ok);
}

.question-state-controls {
  display: flex;
  gap: var(--space-2);
}

.state-button {
  min-height: var(--control-sm);
  padding: 0 var(--space-3);
  font-size: var(--t-xs);
}

.state-shortcut {
  min-width: 22px;
  height: 22px;
}

.state-button[data-status="completed"].is-active {
  background: var(--mint-ink);
  color: var(--text-onink);
}

.state-button[data-status="needs-work"].is-active {
  background: var(--flag-ink);
  color: var(--text-onink);
}

.quiet-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-md);
  padding: 0 var(--space-3);
  border: 0;
  background: transparent;
  color: var(--text-link);
  font-family: var(--font-display);
  font-size: var(--t-xs);
  font-weight: var(--w-bold);
  cursor: pointer;
}

.navigation {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) auto minmax(170px, 1fr);
  align-items: center;
  gap: var(--space-5);
  padding-top: var(--space-4);
  border-top: var(--border-card);
}

.nav-button,
.summary-button {
  min-height: var(--control-lg);
  padding: 0 var(--space-5);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  box-shadow: var(--shadow-sticker);
  color: var(--text-strong);
  font-size: var(--t-sm);
}

.nav-button.secondary {
  justify-self: start;
}

.nav-button.primary {
  justify-self: end;
}

.keyboard-hint {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--t-xs);
}

.keycap {
  min-width: 28px;
  height: 28px;
  border-color: var(--line-ink);
  background: var(--surface-sunken);
  color: var(--text-strong);
}

.help-dialog,
.session-summary-dialog {
  width: min(640px, calc(100% - var(--space-6)));
  max-height: calc(100vh - var(--space-6));
  padding: 0;
  overflow: hidden;
  border: var(--border-card);
  border-radius: var(--radius-xl);
  background: var(--surface-card);
  color: var(--text-body);
  box-shadow: var(--shadow-float);
}

.session-summary-dialog {
  width: min(1080px, calc(100% - var(--space-6)));
}

.help-dialog::backdrop,
.session-summary-dialog::backdrop {
  background: color-mix(in oklab, var(--ink-0) 72%, transparent);
}

.dialog-header,
.summary-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  padding: var(--space-5);
  border-bottom: var(--border-card);
  background: var(--brand-tint);
}

.dialog-header h2,
.summary-header h2 {
  color: var(--text-strong);
  font-family: var(--font-display);
  font-size: var(--t-h2);
  font-weight: var(--w-bold);
  letter-spacing: var(--track-head);
  line-height: var(--lh-snug);
}

.dialog-header .eyebrow,
.summary-header .eyebrow {
  margin-bottom: var(--space-2);
}

.summary-header p:last-child {
  max-width: 660px;
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: var(--t-sm);
}

.shortcut-list {
  display: grid;
  padding: var(--space-3) var(--space-5);
}

.shortcut-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--control-lg);
  border-bottom: var(--bw-hair) solid var(--line-soft);
  font-size: var(--t-sm);
}

.shortcut-list > div:last-child {
  border-bottom: 0;
}

.shortcut-keys {
  display: flex;
  gap: var(--space-2);
}

.dialog-note {
  padding: var(--space-4) var(--space-5);
  border-top: var(--border-card);
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-size: var(--t-xs);
}

.add-pack-body,
.invite-code-body {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  color: var(--text-body);
}

.add-pack-body label,
.invite-code-field {
  display: grid;
  gap: var(--space-2);
  color: var(--text-strong);
  font-family: var(--font-mono);
  font-size: var(--t-kicker);
  font-weight: var(--w-bold);
  letter-spacing: var(--track-kicker);
  text-transform: uppercase;
}

.add-pack-body input,
.invite-code-field input {
  width: 100%;
  min-height: var(--control-lg);
  padding: 0 var(--space-4);
  border: var(--border-card);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--text-strong);
  font-family: var(--font-body);
  font-size: var(--t-body);
  letter-spacing: normal;
  text-transform: none;
}

.add-pack-body input:focus,
.invite-code-field input:focus {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 var(--bw-ink) var(--brand);
  outline: none;
}

.add-pack-body > p,
.invite-code-note,
.invite-code-body {
  font-size: var(--t-sm);
  line-height: var(--lh-body);
}

.add-pack-status,
.invite-code-status {
  min-height: 1.4em;
  color: var(--brand-deep);
  font-size: var(--t-xs);
}

.add-pack-actions,
.invite-code-actions,
.summary-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5) var(--space-5);
  border-top: var(--border-card);
  background: var(--surface-sunken);
}

.add-pack-dialog[data-generating="true"] .icon-button,
.add-pack-dialog[data-generating="true"] .secondary {
  pointer-events: none;
  opacity: 0.45;
}

code {
  padding: var(--space-1) var(--space-2);
  border: var(--bw-hair) solid var(--line-soft);
  border-radius: var(--radius-xs);
  background: var(--surface-sunken);
  color: var(--text-strong);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
}

.summary-shell {
  display: grid;
  max-height: calc(100vh - var(--space-6));
  overflow-x: hidden;
  overflow-y: auto;
}

.summary-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-bottom: var(--border-card);
  background: var(--line-ink);
  gap: var(--bw-ink);
}

.summary-metrics > div {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-4);
  background: var(--surface-card);
}

.summary-metrics span {
  color: var(--text-muted);
}

.summary-metrics strong {
  color: var(--text-strong);
  font-family: var(--font-display);
  font-size: var(--t-h4);
  font-weight: var(--w-black);
  font-variant-numeric: tabular-nums;
}

.summary-metrics [data-summary-status="completed"] {
  background: var(--mint-paper);
}

.summary-metrics [data-summary-status="needs-work"] {
  background: var(--flag-paper);
}

.summary-detail {
  min-height: 0;
  padding: var(--space-5) var(--space-5) 0;
}

.summary-detail-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}

.summary-detail-heading h3,
.summary-export h3 {
  color: var(--text-strong);
  font-family: var(--font-display);
  font-size: var(--t-h4);
  font-weight: var(--w-bold);
}

.summary-detail-heading span {
  color: var(--text-muted);
  font-size: var(--t-xs);
}

.summary-table {
  overflow: hidden;
  border: var(--border-card);
  border-radius: var(--radius-md);
  background: var(--surface-card);
}

.summary-table-head,
.summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 120px 76px;
  align-items: center;
  gap: var(--space-4);
}

.summary-table-head {
  min-height: var(--control-md);
  padding: 0 var(--space-4);
  border-bottom: var(--border-card);
  background: var(--surface-sunken);
  color: var(--text-muted);
}

#summaryRows {
  max-height: min(34vh, 340px);
  overflow-y: auto;
}

.summary-row {
  min-height: var(--control-lg);
  padding: var(--space-2) var(--space-4);
  border-bottom: var(--bw-hair) solid var(--line-soft);
}

.summary-row:last-child {
  border-bottom: 0;
}

.summary-question {
  overflow: hidden;
  color: var(--text-strong);
  font-size: var(--t-sm);
  font-weight: var(--w-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-topic,
.summary-status {
  width: max-content;
  min-height: 25px;
  padding: 0 var(--space-2);
  background: var(--surface-sunken);
  color: var(--text-body);
}

.summary-topic.ai {
  background: var(--grape-paper);
  color: var(--grape-deep);
}

.summary-topic.economics {
  background: var(--gold-paper);
  color: var(--gold-deep);
}

.summary-topic.bitcoin,
.summary-status.needs-work {
  background: var(--flag-paper);
  color: var(--flag-deep);
}

.summary-topic.business,
.summary-status.completed {
  background: var(--mint-paper);
  color: var(--mint-deep);
}

.summary-topic.generated {
  background: var(--blue-paper);
  color: var(--blue-deep);
}

.summary-time {
  justify-self: end;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-variant-numeric: tabular-nums;
}

.summary-empty {
  padding: var(--space-6);
  color: var(--text-muted);
  font-size: var(--t-sm);
  text-align: center;
}

.summary-export {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  margin: var(--space-5) var(--space-5) 0;
  padding: var(--space-4);
  border: var(--border-card);
  border-radius: var(--radius-md);
  background: var(--mint-paper);
}

.summary-export > div {
  display: grid;
  gap: var(--space-1);
}

.summary-export .eyebrow {
  margin: 0;
  color: var(--mint-deep);
}

.summary-export p:last-child {
  color: var(--text-body);
  font-size: var(--t-xs);
}

.summary-button.export {
  flex: 0 0 auto;
  background: var(--accent);
  color: var(--ink-0);
}

.card-enter-next {
  animation: enter-next var(--dur-slow) var(--ease-out) both;
}

.card-enter-previous {
  animation: enter-previous var(--dur-slow) var(--ease-out) both;
}

@keyframes enter-next {
  from {
    opacity: 0.55;
    transform: translateX(var(--space-5));
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes enter-previous {
  from {
    opacity: 0.55;
    transform: translateX(calc(var(--space-5) * -1));
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes voice-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes status-pulse {
  to {
    opacity: 0.45;
    transform: scale(0.78);
  }
}

@keyframes voice-wave {
  to {
    height: 3px;
    opacity: 0.45;
  }
}

@media (max-width: 980px) {
  .start-screen {
    grid-template-columns: 1fr;
    gap: var(--space-7);
    padding-top: var(--space-7);
  }

  .start-intro {
    max-width: 780px;
  }

  .brand-tagline {
    display: none;
  }

  .card-topline {
    grid-template-columns: 1fr auto;
  }

  .timer-panel {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    justify-content: center;
  }

  .question-wrap {
    width: calc(100% - var(--space-8));
  }

  .summary-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - var(--space-5), 620px);
    padding-top: var(--space-3);
  }

  .topbar {
    min-height: 62px;
  }

  .brand-logo {
    width: 122px;
    height: 42px;
  }

  .text-button span,
  #voiceModeLabel {
    display: none;
  }

  .text-button,
  .voice-mode-button {
    width: var(--control-md);
    padding: 0;
  }

  .voice-mode-dot {
    display: none;
  }

  .start-screen {
    gap: var(--space-6);
    padding: var(--space-6) 0;
  }

  .start-intro h1 {
    font-size: clamp(2.8rem, 14vw, 4.7rem);
  }

  .start-intro > p:last-child {
    font-size: var(--t-body);
  }

  .start-option {
    padding: var(--space-4);
  }

  .start-segments {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #startFormatFilters,
  .recording-mode-segments {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .start-segment {
    padding: 0 var(--space-2);
    font-size: var(--t-xs);
  }

  .pack-history,
  .recording-privacy-note {
    margin-left: 0;
  }

  .start-actions {
    align-items: stretch;
    flex-direction: column;
    padding: var(--space-4);
  }

  .start-button {
    width: 100%;
  }

  .controls {
    align-items: stretch;
    flex-direction: column;
    gap: var(--space-3);
  }

  .filter-group {
    display: grid;
    gap: var(--space-2);
  }

  .filter-divider {
    display: none;
  }

  .question-card {
    min-height: 500px;
    border-radius: var(--radius-lg);
  }

  .card-topline,
  .card-footer {
    padding: var(--space-3);
  }

  .timer-panel {
    flex-wrap: wrap;
    border-radius: var(--radius-lg);
  }

  .timer-button {
    flex: 1;
  }

  .question-wrap {
    width: calc(100% - var(--space-6));
    padding: var(--space-6) 0;
  }

  .question-wrap h1 {
    font-size: clamp(2rem, 10vw, 3.1rem);
  }

  .card-footer {
    grid-template-columns: 1fr auto;
  }

  .question-state-controls {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .state-button {
    flex: 1;
  }

  .quiet-button {
    font-size: 0;
  }

  .navigation {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
  }

  .keyboard-hint {
    display: none;
  }

  .nav-button {
    width: 100%;
    padding: 0 var(--space-3);
  }

  .summary-header,
  .dialog-header {
    padding: var(--space-4);
  }

  .summary-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-detail {
    padding: var(--space-4) var(--space-4) 0;
  }

  .summary-detail-heading span {
    display: none;
  }

  .summary-table-head,
  .summary-row {
    grid-template-columns: minmax(0, 1fr) 110px 64px;
    gap: var(--space-2);
  }

  .summary-table-head span:nth-child(2),
  .summary-topic {
    display: none;
  }

  .summary-export {
    align-items: stretch;
    flex-direction: column;
    margin: var(--space-4) var(--space-4) 0;
  }

  .summary-actions,
  .add-pack-actions,
  .invite-code-actions {
    padding: var(--space-4);
  }

  .summary-button {
    flex: 1;
    padding: 0 var(--space-3);
  }
}
