:root {
  --ink: #17211d;
  --muted: #69766f;
  --green-950: #0d2f26;
  --green-900: #123d31;
  --green-800: #18513f;
  --green-700: #236c52;
  --green-100: #dceae3;
  --green-50: #eef4f0;
  --gold: #d6a84c;
  --gold-soft: #f4e8cc;
  --cream: #f5f3ec;
  --paper: #fffefa;
  --line: #dce2dc;
  --line-dark: #c6d0c9;
  --red: #b9483f;
  --shadow: 0 18px 48px rgba(18, 61, 49, 0.1), 0 2px 8px rgba(18, 61, 49, 0.05);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(214, 168, 76, 0.12), transparent 26rem),
    var(--cream);
}

button,
input,
textarea {
  font: inherit;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(35, 108, 82, 0.25);
  outline-offset: 2px;
}

.capture-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(66px + env(safe-area-inset-top));
  padding: calc(9px + env(safe-area-inset-top)) 18px 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(13, 47, 38, 0.97);
  color: white;
  backdrop-filter: blur(18px);
}

.capture-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.capture-mark {
  display: grid;
  grid-template-columns: repeat(3, 4px);
  align-items: end;
  gap: 3px;
  width: 26px;
  height: 26px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
}

.capture-mark i {
  display: block;
  border-radius: 99px;
  background: var(--gold);
}

.capture-mark i:nth-child(1) { height: 7px; }
.capture-mark i:nth-child(2) { height: 15px; }
.capture-mark i:nth-child(3) { height: 11px; }

.capture-brand > span:last-child {
  display: grid;
  gap: 3px;
}

.capture-brand strong {
  font-size: 13px;
  line-height: 1;
}

.capture-brand small {
  color: rgba(255, 255, 255, 0.56);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.local-pill,
.recording-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.72);
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.local-pill i,
.recording-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #75c39a;
  box-shadow: 0 0 0 4px rgba(117, 195, 154, 0.12);
}

.capture-main {
  width: min(100%, 620px);
  margin: 0 auto;
  padding: 0 18px calc(54px + env(safe-area-inset-bottom));
}

.capture-screen {
  display: none;
  padding-top: 42px;
}

.capture-screen.active {
  display: block;
  animation: screen-in 220ms ease both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  color: var(--green-700);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.screen-intro h1,
#exportScreen > h1 {
  margin: 12px 0 0;
  font-family: var(--serif);
  font-size: clamp(42px, 12vw, 62px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.screen-intro > p,
.export-lede {
  max-width: 480px;
  margin: 17px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.setup-card,
.timer-card,
.note-composer,
.timeline-card,
.export-notes-card {
  margin-top: 30px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 254, 250, 0.92);
  box-shadow: var(--shadow);
}

.setup-card > label,
.note-composer > label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.setup-card > input,
.note-composer textarea {
  display: block;
  width: 100%;
  border: 1px solid var(--line-dark);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font-size: 14px;
  outline: none;
}

.setup-card > input {
  min-height: 47px;
  margin-bottom: 18px;
  padding: 0 13px;
}

.note-composer textarea {
  padding: 13px;
  resize: vertical;
  line-height: 1.5;
}

.setup-card > input:focus,
.note-composer textarea:focus {
  border-color: var(--green-700);
  box-shadow: 0 0 0 4px rgba(35, 108, 82, 0.08);
}

.consent-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  margin: 6px 0 18px;
  padding: 15px;
  border: 1px solid #c9dbd0;
  border-radius: 11px;
  background: var(--green-50);
}

.consent-card input {
  width: 19px;
  height: 19px;
  margin: 1px 0 0;
  accent-color: var(--green-700);
}

.consent-card label {
  display: grid;
  gap: 4px;
  font-size: 11px;
  line-height: 1.45;
}

.consent-card span {
  color: var(--muted);
  font-size: 10px;
}

.capture-primary,
.capture-secondary,
.note-button,
.pause-button,
.stop-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.capture-primary {
  width: 100%;
  border: 1px solid var(--green-900);
  background: var(--green-900);
  color: white;
  box-shadow: 0 10px 24px rgba(18, 61, 49, 0.18);
}

.capture-primary:hover {
  background: var(--green-800);
  transform: translateY(-1px);
}

.capture-primary:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.record-icon {
  width: 13px;
  height: 13px;
  border: 3px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  background: white;
}

.button-note {
  margin: 10px 4px 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
  text-align: center;
}

.notes-only-button {
  margin-top: 9px;
}

.iphone-checklist {
  margin-top: 16px;
  padding: 0 3px;
  color: var(--muted);
  font-size: 11px;
}

.iphone-checklist summary {
  padding: 10px 0;
  color: var(--green-800);
  font-weight: 800;
  cursor: pointer;
}

.iphone-checklist ol {
  margin: 5px 0 0;
  padding-left: 22px;
  line-height: 1.6;
}

.iphone-checklist li + li {
  margin-top: 7px;
}

.recording-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.recording-status {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--red);
}

.recording-status i {
  width: 8px;
  height: 8px;
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(185, 72, 63, 0.1);
  animation: pulse 1.6s ease infinite;
}

.recording-status.paused {
  color: #856829;
}

.recording-status.paused i {
  border-radius: 2px;
  background: var(--gold);
  box-shadow: none;
  animation: none;
}

@keyframes pulse {
  50% { box-shadow: 0 0 0 9px rgba(185, 72, 63, 0); }
}

.recording-topline h1 {
  max-width: 500px;
  margin: 10px 0 0;
  font-family: var(--serif);
  font-size: 31px;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
}

.timer-card {
  padding: 26px 20px 19px;
  text-align: center;
}

.timer {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(38px, 13vw, 62px);
  font-weight: 450;
  letter-spacing: -0.045em;
}

.waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 34px;
  margin: 14px 0 8px;
}

.waveform i {
  width: 3px;
  height: 8px;
  border-radius: 99px;
  background: var(--green-700);
  animation: wave 1.1s ease-in-out infinite alternate;
}

.waveform i:nth-child(2n) { animation-delay: -0.4s; }
.waveform i:nth-child(3n) { animation-delay: -0.75s; }
.waveform i:nth-child(4n) { animation-delay: -0.2s; }

@keyframes wave {
  from { height: 6px; opacity: 0.45; }
  to { height: 28px; opacity: 1; }
}

.waveform.paused i {
  height: 6px;
  animation: none;
}

.timer-card p {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
}

.note-composer {
  margin-top: 14px;
}

.quick-tags {
  display: flex;
  gap: 6px;
  margin: 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.quick-tags::-webkit-scrollbar {
  display: none;
}

.quick-tags button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  background: white;
  color: var(--green-800);
  font-size: 9.5px;
  font-weight: 750;
}

.quick-tags button.selected {
  border-color: var(--green-800);
  background: var(--green-900);
  color: white;
}

.note-button {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--green-700);
  background: var(--green-50);
  color: var(--green-800);
}

.timeline-card {
  margin-top: 14px;
  box-shadow: none;
}

.timeline-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.timeline-heading h2 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.timeline-heading span {
  color: var(--muted);
  font-size: 9px;
}

.empty-notes {
  margin-top: 16px;
  padding: 18px;
  border: 1px dashed var(--line-dark);
  border-radius: 10px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.notes-list {
  display: grid;
  gap: 0;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.note-item {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.note-time {
  color: var(--green-700);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  font-weight: 750;
}

.note-content {
  display: grid;
  gap: 4px;
}

.note-content strong {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.note-content span {
  font-size: 10.5px;
  line-height: 1.45;
}

.delete-note {
  width: 27px;
  height: 27px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #96a19b;
  font-size: 16px;
}

.recording-controls {
  position: sticky;
  bottom: calc(10px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 0.72fr 1.28fr;
  gap: 8px;
  margin-top: 16px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 15px;
  background: rgba(255, 254, 250, 0.86);
  box-shadow: 0 15px 40px rgba(18, 61, 49, 0.17);
  backdrop-filter: blur(16px);
}

.pause-button {
  border: 1px solid var(--line-dark);
  background: white;
  color: var(--ink);
}

.stop-button {
  border: 1px solid var(--green-900);
  background: var(--green-900);
  color: white;
}

.pause-icon {
  display: inline-block;
  width: 10px;
  height: 14px;
  border-right: 3px solid currentColor;
  border-left: 3px solid currentColor;
}

.stop-icon {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: currentColor;
}

.complete-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 24px;
  border-radius: 50%;
  background: var(--green-900);
  color: white;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 0 0 8px rgba(35, 108, 82, 0.1);
}

#exportScreen > h1 {
  font-size: clamp(38px, 10vw, 54px);
}

.session-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 26px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--line);
}

.session-summary div {
  display: grid;
  gap: 6px;
  padding: 15px 8px;
  background: var(--paper);
  text-align: center;
}

.session-summary span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.session-summary strong {
  font-size: 11px;
}

#recordingPlayback {
  display: block;
  width: 100%;
  margin-top: 18px;
}

.export-notes-card {
  margin-top: 18px;
  box-shadow: none;
}

.export-notes {
  max-height: 260px;
  overflow-y: auto;
}

.export-actions {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

.capture-secondary {
  width: 100%;
  border: 1px solid var(--line-dark);
  background: rgba(255, 254, 250, 0.84);
  color: var(--green-800);
}

.capture-secondary:hover {
  border-color: var(--green-700);
  background: var(--green-50);
}

.capture-secondary[hidden] {
  display: none;
}

.codex-instruction {
  margin-top: 20px;
  padding: 17px;
  border-left: 4px solid var(--gold);
  border-radius: 0 11px 11px 0;
  background: var(--gold-soft);
}

.codex-instruction strong {
  color: #5c4721;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.codex-instruction p {
  margin: 7px 0 0;
  color: #5c4c2d;
  font-size: 10.5px;
  line-height: 1.55;
}

.codex-instruction code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
}

.start-over-button {
  display: block;
  margin: 22px auto 0;
  padding: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.capture-toast {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 16px;
  z-index: 80;
  width: min(calc(100% - 32px), 560px);
  margin: 0 auto;
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 11px;
  background: var(--green-950);
  color: white;
  box-shadow: 0 20px 55px rgba(13, 47, 38, 0.26);
  font-size: 10.5px;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(9px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.capture-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.info-sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: flex-end;
  background: rgba(7, 25, 20, 0.6);
  backdrop-filter: blur(8px);
}

.info-sheet.open {
  display: flex;
}

.info-sheet > div {
  position: relative;
  width: 100%;
  max-height: 80vh;
  padding: 29px 22px calc(30px + env(safe-area-inset-bottom));
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  background: var(--paper);
  box-shadow: 0 -20px 60px rgba(13, 47, 38, 0.2);
}

.info-sheet h2 {
  margin: 10px 45px 0 0;
  font-family: var(--serif);
  font-size: 29px;
  font-weight: 500;
  line-height: 1.1;
}

.info-sheet p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.sheet-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  background: white;
  color: var(--muted);
  font-size: 22px;
}

@media (min-width: 700px) {
  .capture-main {
    padding-right: 28px;
    padding-left: 28px;
  }

  .capture-screen {
    padding-top: 58px;
  }

  .info-sheet {
    align-items: center;
    justify-content: center;
    padding: 20px;
  }

  .info-sheet > div {
    max-width: 520px;
    border-radius: 20px;
  }
}

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