:root {
  color-scheme: light;
  --ink: #10201b;
  --muted: #64746e;
  --line: #d9e2de;
  --paper: #f7faf8;
  --panel: #ffffff;
  --green: #2f6f58;
  --green-dark: #214f41;
  --blue: #2f5f8f;
  --rose: #9a4652;
  --amber: #a66a2b;
  --shadow: 0 16px 40px rgba(16, 32, 27, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 20px 16px 96px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 20px;
}

.topbar-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.7rem;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: #edf5f1;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 700;
}

.share-pill {
  background: var(--ink);
  color: #fff;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.primary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.action-card {
  min-height: 140px;
  border: 0;
  border-radius: 8px;
  padding: 16px;
  color: #fff;
  text-align: left;
  box-shadow: var(--shadow);
}

.action-card span {
  display: block;
  margin-bottom: 34px;
  font-size: 0.86rem;
  opacity: 0.84;
}

.action-card strong {
  display: block;
  max-width: 8rem;
  font-size: 1.45rem;
  line-height: 1.05;
}

.tune-card {
  background: var(--green-dark);
}

.capture-card {
  background: var(--blue);
}

.let-us-card {
  grid-column: 1 / -1;
  background: var(--amber);
}

.principle,
.recent-card,
.flow-panel,
.let-us-panel,
.let-us-deck,
.settings-list,
.timeline-item,
.insight-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.principle {
  margin: 14px 0;
  padding: 18px;
}

.principle p {
  margin-bottom: 6px;
  font-size: 1.25rem;
  font-weight: 800;
}

.principle span,
.empty-state,
.settings-list p,
.timeline-meta,
.insight-card p,
#record-help,
.capture-context {
  color: var(--muted);
}

.recent-card,
.flow-panel,
.auth-panel,
.let-us-panel,
.settings-list {
  padding: 16px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 800;
}

.field-label {
  display: block;
  margin: 18px 0 8px;
  font-size: 0.86rem;
  font-weight: 800;
}

.field-label:first-child {
  margin-top: 0;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.choice-list {
  display: grid;
  gap: 8px;
}

.choice {
  position: relative;
}

.choice input {
  position: absolute;
  opacity: 0;
}

.choice span,
.segmented label {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 12px;
  background: #fbfdfc;
  color: var(--ink);
  font-weight: 750;
}

.choice input:checked + span,
.segmented label:has(input:checked) {
  border-color: var(--green);
  background: #e8f4ee;
  color: var(--green-dark);
}

.enter-panel {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.enter-panel p {
  margin-bottom: 14px;
  font-size: 1.25rem;
  font-weight: 850;
}

.primary-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 850;
}

.secondary-button {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  font-weight: 850;
}

.let-us-panel {
  display: grid;
  gap: 14px;
}

.let-us-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.let-us-filters::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fbfdfc;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.filter-chip.active {
  border-color: var(--amber);
  background: #fff3e4;
  color: #704316;
}

.let-us-deck {
  min-height: 300px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 243, 228, 0.82), rgba(255, 255, 255, 0) 46%),
    var(--panel);
}

.card-kicker {
  margin-bottom: 12px;
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.let-us-deck h2 {
  margin-bottom: 12px;
  font-size: 1.55rem;
  line-height: 1.08;
}

.let-us-deck > p {
  margin-bottom: 18px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.let-us-reveal {
  display: grid;
  gap: 10px;
}

.reveal-block {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.reveal-block span {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.reveal-block p {
  margin-bottom: 0;
  font-size: 1.02rem;
  line-height: 1.45;
}

.let-us-controls {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.35fr) minmax(0, 0.75fr);
  gap: 8px;
}

.let-us-controls .primary-button,
.let-us-controls .secondary-button {
  font-size: 0.9rem;
}

.capture-context {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfc;
}

.valence-wrap {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--green);
}

output {
  display: block;
  margin-top: 8px;
  font-weight: 850;
  text-align: center;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented label {
  min-height: 48px;
  display: grid;
  place-items: center;
  padding: 8px;
  text-align: center;
  font-size: 0.86rem;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfc;
  color: var(--ink);
}

.auth-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.recent-card .auth-panel {
  border: 0;
  padding: 0;
  background: transparent;
}

.auth-panel h2 {
  margin-bottom: 8px;
  font-size: 1.18rem;
}

.auth-panel p,
.auth-message {
  margin-bottom: 14px;
  color: var(--muted);
  line-height: 1.4;
}

.text-input {
  width: 100%;
  min-height: 46px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfdfc;
  color: var(--ink);
}

.auth-switch {
  width: 100%;
  margin-top: 12px;
}

.auth-message {
  min-height: 1.2em;
  margin-top: 10px;
  margin-bottom: 0;
  font-size: 0.86rem;
  font-weight: 750;
}

.share-overlay[hidden] {
  display: none;
}

.share-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: end;
  padding: 16px;
}

.share-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 32, 27, 0.42);
}

.share-sheet {
  position: relative;
  width: min(100%, 420px);
  margin: 0 auto calc(76px + env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.share-qr {
  display: block;
  width: min(100%, 270px);
  height: auto;
  margin: 8px auto 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.share-url {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbfdfc;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
  overflow-wrap: anywhere;
  text-align: center;
}

.share-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.share-message {
  min-height: 1.2em;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
  text-align: center;
}

.voice-panel {
  margin: 18px 0;
  text-align: center;
}

.record-button {
  width: 172px;
  height: 172px;
  border: 0;
  border-radius: 50%;
  background: var(--rose);
  color: #fff;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.record-button.recording {
  background: var(--amber);
}

#audio-preview {
  width: 100%;
  margin-top: 10px;
}

.timeline-list,
.insight-grid,
.settings-list {
  display: grid;
  gap: 10px;
}

.timeline-item,
.insight-card {
  padding: 14px;
}

.timeline-item p,
.insight-card p,
.settings-list p {
  margin-bottom: 0;
}

.timeline-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.78rem;
  font-weight: 750;
}

.audio-link {
  color: var(--green);
  font-weight: 850;
  text-decoration: none;
}

.insight-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.4rem;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}

.nav-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.nav-button.active {
  background: #e8f4ee;
  color: var(--green-dark);
}

@media (min-width: 680px) {
  .app-shell {
    padding-top: 32px;
  }

  h1 {
    font-size: 2.2rem;
  }

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

  .let-us-card {
    grid-column: auto;
  }

  .bottom-nav {
    width: min(100%, 720px);
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
  }
}
