:root {
  color-scheme: light;
  --bg-primary: #fafaf7;
  --bg-secondary: #f2f2ee;
  --text-primary: #1a1a1a;
  --text-secondary: #71717a;
  --text-tertiary: #a1a1aa;
  --divider: #e4e4e1;
  --accent: #f0a868;
  --accent-muted: #f0a86833;
  --shadow: rgba(30, 25, 18, 0.12);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-primary: #0a0a0b;
  --bg-secondary: #141416;
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-tertiary: #52525b;
  --divider: #27272a;
  --shadow: rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 10%, var(--accent-muted), transparent 34rem),
    var(--bg-primary);
}

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

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  left: 0;
  padding: 22px clamp(20px, 5vw, 56px);
  position: fixed;
  right: 0;
  top: 0;
  z-index: 10;
}

.brand {
  align-items: center;
  color: var(--text-primary);
  display: inline-flex;
  font-weight: 650;
  gap: 10px;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  border-radius: 10px;
  height: 34px;
  width: 34px;
}

.toolbar {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  position: relative;
}

.ghost-button,
.link-button {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  padding: 8px 10px;
}

.ghost-button {
  background: color-mix(in srgb, var(--bg-secondary) 72%, transparent);
  border: 1px solid color-mix(in srgb, var(--divider) 72%, var(--text-secondary));
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  min-width: 64px;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.menu-toggle {
  display: none;
}

:root[data-theme="dark"] .toolbar .ghost-button {
  background: rgba(244, 244, 245, 0.1);
  border-color: rgba(244, 244, 245, 0.22);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: color-mix(in srgb, var(--text-primary) 82%, var(--text-secondary));
}

.link-button:hover,
.ghost-button:hover {
  color: var(--text-primary);
}

.toolbar .ghost-button:hover,
.toolbar .ghost-button:focus-visible {
  background: color-mix(in srgb, var(--bg-secondary) 86%, var(--accent-muted));
  border-color: var(--accent);
  outline: none;
  transform: translateY(-1px);
}

:root[data-theme="dark"] .toolbar .ghost-button:hover,
:root[data-theme="dark"] .toolbar .ghost-button:focus-visible {
  background: rgba(240, 168, 104, 0.16);
  border-color: rgba(240, 168, 104, 0.68);
}

.shell {
  min-height: 100vh;
  padding: 108px clamp(20px, 5vw, 56px) 48px;
}

.auth-status {
  align-items: center;
  color: var(--text-secondary);
  display: none;
  justify-content: center;
  min-height: calc(100vh - 180px);
  text-align: center;
}

.auth-loading .auth-status {
  display: flex;
}

.landing,
.recorder {
  margin: 0 auto;
  width: min(920px, 100%);
}

.landing {
  align-items: center;
  display: grid;
  gap: 56px;
  grid-template-columns: minmax(0, 1.1fr) minmax(240px, 0.9fr);
  min-height: calc(100vh - 180px);
}

.auth-loading .landing,
.auth-loading .recorder,
.auth-loading .usage-panel {
  visibility: hidden;
}

.logo {
  border-radius: 18px;
  box-shadow: 0 18px 50px var(--shadow);
  height: 72px;
  margin-bottom: 28px;
  width: 72px;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  margin: 0 0 16px;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2.5rem, 8vw, 5.6rem);
  letter-spacing: -0.075em;
  line-height: 0.92;
  margin: 0;
  max-width: 780px;
}

.lead {
  color: var(--text-secondary);
  font-size: 1.12rem;
  line-height: 1.7;
  margin: 24px 0 0;
  max-width: 620px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  border: 1px solid var(--divider);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  padding: 13px 20px;
  text-decoration: none;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #16110a;
}

.fine-print {
  color: var(--text-tertiary);
  font-size: 0.92rem;
  margin-top: 14px;
}

.landing-wave {
  align-items: center;
  display: flex;
  gap: 12px;
  height: 220px;
  justify-content: center;
}

.landing-wave span {
  background: var(--accent);
  border-radius: 999px;
  display: block;
  opacity: 0.72;
  width: 10px;
}

.landing-wave span:nth-child(1) { height: 34px; opacity: 0.22; }
.landing-wave span:nth-child(2) { height: 72px; opacity: 0.34; }
.landing-wave span:nth-child(3) { height: 128px; opacity: 0.48; }
.landing-wave span:nth-child(4) { height: 188px; opacity: 0.86; }
.landing-wave span:nth-child(5) { height: 156px; opacity: 0.66; }
.landing-wave span:nth-child(6) { height: 92px; opacity: 0.42; }
.landing-wave span:nth-child(7) { height: 52px; opacity: 0.3; }
.landing-wave span:nth-child(8) { height: 26px; opacity: 0.2; }

.recorder {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - 180px);
  text-align: center;
}

.quota-strip {
  background: var(--bg-secondary);
  border: 1px solid var(--divider);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-bottom: 42px;
  padding: 8px 14px;
}

.quota-strip.low,
.banner.warn {
  background: var(--accent-muted);
  border-color: transparent;
  color: var(--text-primary);
}

.timer {
  font-size: clamp(4rem, 14vw, 6.5rem);
  font-variant-numeric: tabular-nums;
  font-weight: 200;
  letter-spacing: -0.08em;
  line-height: 0.92;
}

.status-line {
  color: var(--text-secondary);
  margin: 20px 0 22px;
}

.waveform {
  height: 120px;
  max-width: 720px;
  width: 100%;
}

.transcript-row {
  align-items: center;
  display: flex;
  gap: 24px;
  justify-content: center;
  margin: 26px 0 28px;
  max-width: 860px;
  width: 100%;
}

.transcript-surface {
  flex: 0 1 760px;
  max-width: 760px;
  min-width: 0;
}

.transcript-toolbar {
  align-items: center;
  color: var(--text-tertiary);
  display: flex;
  font-size: 0.82rem;
  justify-content: space-between;
  letter-spacing: 0.08em;
  margin: 0 auto 10px;
  max-width: 760px;
  text-transform: uppercase;
}

.transcript-toolbar span {
  color: color-mix(in srgb, var(--text-tertiary) 82%, var(--text-secondary));
}

.icon-button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--divider);
  border-radius: 999px;
  color: var(--text-tertiary);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  height: 34px;
  justify-content: center;
  width: 34px;
}

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

.icon-button.ready {
  color: var(--text-secondary);
  opacity: 1;
}

.icon-button.ready:hover,
.icon-button.ready:focus-visible,
.icon-button.copied {
  border-color: var(--accent);
  color: var(--text-primary);
  outline: none;
}

.chevron-button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--divider);
  border-radius: 999px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  flex: 0 0 auto;
  font-size: 1.4rem;
  height: 40px;
  justify-content: center;
  line-height: 1;
  /* The ‹ / › glyphs carry asymmetric side bearings; nudge for optical centering. */
  padding-bottom: 2px;
  width: 40px;
}

.chevron-button:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.chevron-button[hidden] {
  display: none;
}

.transcript {
  color: var(--text-primary);
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  line-height: 1.55;
  max-width: 760px;
  min-height: 74px;
  overflow-wrap: anywhere;
  text-align: left;
}

.transcript:empty::before {
  color: var(--text-tertiary);
  content: attr(data-placeholder);
}

.record-button {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: #16110a;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  min-width: 148px;
  padding: 17px 34px;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, opacity 180ms ease;
}

.record-button.recording {
  background: transparent;
  color: var(--text-primary);
}

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

.recorder-links {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin-top: 16px;
}

.shortcut-hint {
  color: var(--text-tertiary);
  font-size: 0.86rem;
  margin: 12px 0 0;
}

.period-line,
.saved-line {
  font-size: 0.9rem;
  margin: 12px 0 20px;
}

.banner {
  border: 1px solid var(--divider);
  border-radius: 18px;
  margin: 4px 0 22px;
  max-width: 760px;
  padding: 14px 18px;
  text-align: left;
  width: 100%;
}

.banner.error {
  background: var(--bg-secondary);
  border-color: var(--accent);
  color: var(--text-primary);
}

.usage-panel {
  background: color-mix(in srgb, var(--bg-secondary) 88%, transparent);
  border: 1px solid var(--divider);
  border-radius: 28px;
  box-shadow: 0 24px 80px var(--shadow);
  margin: 24px auto 0;
  padding: 24px;
  scroll-margin-top: 96px;
  width: min(760px, 100%);
}

.panel-header {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.panel-header h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.05em;
  margin: 0;
}

.settings-panel {
  text-align: left;
}

.settings-panel .panel-header {
  align-items: flex-start;
  margin-bottom: 24px;
}

.settings-panel .eyebrow {
  margin-bottom: 20px;
}

.settings-panel .muted {
  line-height: 1.55;
  margin: 0 0 28px;
  max-width: 620px;
}

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

.meter {
  background: var(--divider);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.meter-fill {
  background: var(--accent);
  height: 100%;
  transition: width 180ms ease;
  width: 0;
}

.stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, 1fr);
  margin: 20px 0 24px;
}

.field-label {
  color: var(--text-secondary);
  display: block;
  font-size: 0.95rem;
  margin: 24px 0 10px;
  text-align: left;
}

.field-input {
  background: var(--bg-primary);
  border: 1px solid var(--divider);
  border-radius: 16px;
  color: var(--text-primary);
  font: inherit;
  padding: 14px;
  resize: vertical;
  text-align: left;
  width: 100%;
}

.field-input:focus {
  border-color: var(--accent);
  outline: none;
}

.stats div,
.usage-row {
  background: var(--bg-primary);
  border: 1px solid var(--divider);
  border-radius: 16px;
  padding: 14px;
}

.stats strong,
.stats span {
  display: block;
}

.stats strong {
  font-size: 1.42rem;
  font-variant-numeric: tabular-nums;
  font-weight: 300;
}

.stats span {
  color: var(--text-secondary);
  font-size: 0.86rem;
  margin-top: 6px;
}

.usage-row {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
  margin-top: 8px;
}

.usage-row span {
  color: var(--text-secondary);
}

.hidden {
  display: none !important;
}

@media (max-width: 780px) {
  .topbar {
    padding: 16px 18px;
  }

  .toolbar {
    gap: 6px;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .toolbar #language-toggle,
  .toolbar #theme-toggle,
  .toolbar #logout {
    display: none;
  }

  .toolbar.menu-open #language-toggle,
  .toolbar.menu-open #theme-toggle,
  .toolbar.menu-open #logout {
    display: inline-flex;
  }

  .toolbar.menu-open {
    align-items: flex-end;
    background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
    border: 1px solid var(--divider);
    border-radius: 24px;
    box-shadow: 0 18px 48px var(--shadow);
    flex-direction: column;
    padding: 6px;
  }

  .toolbar .ghost-button {
    min-width: 0;
    padding: 8px 12px;
  }

  .brand span {
    display: none;
  }

  .shell {
    padding: 92px 18px 36px;
  }

  .landing {
    display: block;
    min-height: auto;
  }

  .landing-wave {
    height: 140px;
    margin-top: 36px;
  }

  .recorder {
    min-height: calc(100vh - 128px);
  }

  .quota-strip {
    margin-bottom: 34px;
  }

  .waveform {
    max-width: calc(100vw - 48px);
  }

  .shortcut-hint {
    display: none;
  }

  .transcript {
    text-align: center;
  }

  .transcript-row {
    gap: 12px;
  }

  .transcript-toolbar {
    padding: 0 4px;
  }

  .stats,
  .usage-row {
    grid-template-columns: 1fr;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
