:root {
  --ink: #18302c;
  --muted: #667873;
  --deep: #173b36;
  --deep-2: #24544d;
  --cream: #f7f1e6;
  --paper: #fffdf8;
  --sage: #dce8df;
  --gold: #c69a4b;
  --line: #d9e1dc;
  --danger: #8c3e3e;
  --shadow: 0 12px 30px rgba(23, 59, 54, 0.10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: linear-gradient(180deg, #edf3ef 0%, #f8f5ed 55%, #eef2ef 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body { padding-bottom: env(safe-area-inset-bottom); }

button, input, textarea, select { font: inherit; }

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

.app-shell {
  width: min(100%, 560px);
  min-height: 100vh;
  margin: 0 auto;
  background: rgba(255,255,255,.55);
  box-shadow: 0 0 50px rgba(20,50,45,.08);
  position: relative;
  padding-bottom: 92px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 20px 14px;
  background: rgba(247, 241, 230, 0.92);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(23,59,54,.08);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--deep); color: white;
  font-size: 24px; font-weight: 800;
}
.brand h1 { margin: 0; font-size: 16px; line-height: 1.1; letter-spacing: .02em; }
.brand p { margin: 2px 0 0; color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }

main { padding: 24px 18px 8px; }

.view { display: none; animation: fade .22s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.eyebrow, .kicker {
  margin: 0 0 7px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h2 { margin: 0 0 20px; font-family: Georgia, serif; font-size: 31px; line-height: 1.12; }
h3 { margin: 0; font-size: 18px; }
p { line-height: 1.55; }

.hero-card {
  background: linear-gradient(150deg, var(--deep), #2f665d);
  color: white;
  border-radius: 28px;
  padding: 26px 24px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}
.hero-card::after {
  content: "→";
  position: absolute;
  right: -12px;
  bottom: -50px;
  color: rgba(255,255,255,.06);
  font-size: 180px;
  font-weight: 900;
}
.day-pill {
  display: inline-flex;
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
}
.theme { color: #f2d39c; font-weight: 800; margin: 20px 0 8px; }
blockquote {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 26px;
  line-height: 1.28;
  position: relative;
  z-index: 1;
}
.favorite-button {
  margin-top: 22px;
  display: inline-flex; gap: 8px; align-items: center;
  border: 0; border-radius: 999px;
  background: white; color: var(--deep);
  padding: 9px 14px;
  font-weight: 800;
  cursor: pointer;
  position: relative; z-index: 2;
}

.content-card, .support-card, .settings-card {
  background: var(--paper);
  border: 1px solid rgba(23,59,54,.08);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(23,59,54,.07);
  margin-bottom: 16px;
}

.card-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 14px; }
.number {
  width: 38px; height: 38px; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--sage); color: var(--deep);
  font-weight: 900;
}
.card-heading .kicker { margin-bottom: 2px; }

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px;
  background: #fff;
  color: var(--ink);
  resize: vertical;
  outline: none;
}
textarea:focus, input:focus { border-color: var(--deep-2); box-shadow: 0 0 0 3px rgba(36,84,77,.12); }

.privacy-note, .status {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 0;
}

.audio-controls { display: flex; gap: 10px; margin: 16px 0 6px; }
.primary-button, .secondary-button, .ghost-button, .danger-button {
  border-radius: 12px;
  padding: 11px 15px;
  border: 0;
  font-weight: 850;
  cursor: pointer;
}
.primary-button { background: var(--deep); color: white; }
.secondary-button { background: var(--sage); color: var(--deep); }
.ghost-button { background: transparent; color: var(--deep); border: 1px solid var(--deep); }
.danger-button { background: #f6e7e5; color: var(--danger); }
.link-button { display: inline-flex; text-decoration: none; margin-top: 6px; }
.hidden { display: none !important; }

details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 13px; }
summary { cursor: pointer; font-weight: 800; }

.support-card {
  background: linear-gradient(150deg, #f4e8d2, #fffaf0);
}
.support-card h3 { font-family: Georgia, serif; font-size: 23px; }

.section-intro { margin-top: -10px; color: var(--muted); }
.card-list { display: grid; gap: 12px; }
.mini-card {
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 1px solid rgba(23,59,54,.09);
  border-radius: 18px;
  padding: 16px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(23,59,54,.06);
}
.mini-card:hover { transform: translateY(-1px); }
.mini-card .mini-day { color: var(--gold); font-size: 10px; font-weight: 900; letter-spacing: .13em; }
.mini-card h3 { margin: 5px 0 6px; }
.mini-card p { margin: 0; color: var(--muted); font-size: 14px; }

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 42px 20px;
  border: 1px dashed var(--line);
  border-radius: 18px;
}

.settings-card label { display: block; font-weight: 800; margin-bottom: 9px; }
.settings-card input[type="time"] {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 12px;
  background: white;
}
.settings-card input[type="range"] { width: 100%; }
.crisis-card { border-left: 5px solid var(--gold); }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: min(100%, 560px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255,253,248,.95);
  border-top: 1px solid rgba(23,59,54,.10);
  backdrop-filter: blur(18px);
}
.nav-button {
  display: grid;
  place-items: center;
  gap: 3px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.nav-button span { font-size: 18px; line-height: 1; }
.nav-button.active { color: var(--deep); }

@media (min-width: 700px) {
  body { padding: 24px 0; }
  .app-shell { min-height: calc(100vh - 48px); border-radius: 30px; overflow: hidden; }
  .bottom-nav { bottom: 24px; border-radius: 0 0 30px 30px; }
}

.voice-select {
  width: 100%;
  padding: 12px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  margin: 3px 0 18px;
}

.filter-label { display: block; font-weight: 800; margin: 0 0 8px; }
.library-filter { margin-bottom: 16px; }


/* Personal voice recording */
.my-voice-panel {
  margin-top: 18px;
  padding: 17px;
  border: 1px solid rgba(23,59,54,.12);
  border-radius: 17px;
  background: linear-gradient(145deg, #f1f7f3, #fffdf8);
}

.my-voice-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.my-voice-heading h4 {
  margin: 0;
  font-size: 17px;
}

.my-voice-copy {
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.record-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.record-button {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  background: #8c3e3e;
  color: white;
  font-weight: 850;
  cursor: pointer;
}

.record-button:disabled,
.primary-button:disabled,
.secondary-button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--danger);
  padding: 9px 5px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.recording-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 9px;
  background: #f6e7e5;
  color: var(--danger);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  animation: recordPulse 1.2s ease-in-out infinite;
}

.recording-timer {
  margin: 12px 0 0;
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 900;
  color: var(--danger);
}

@keyframes recordPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .52; }
}


/* Optional meditation soundscapes */
.soundscape-panel {
  margin-top: 18px;
  padding: 17px;
  border: 1px solid rgba(23,59,54,.12);
  border-radius: 17px;
  background: linear-gradient(145deg, #eef5f5, #fffdf8);
}

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

.soundscape-heading h4 {
  margin: 0;
  font-size: 17px;
}

.soundscape-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: var(--sage);
  color: var(--deep);
  font-size: 19px;
  font-weight: 900;
}

.soundscape-panel label {
  display: block;
  margin: 9px 0 7px;
  font-weight: 800;
  font-size: 13px;
}

.soundscape-select { margin-bottom: 12px; }
.soundscape-panel input[type="range"] { width: 100%; }
.soundscape-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Evening reflection */
.evening-card {
  background: linear-gradient(155deg, #233a4a, #3f5260);
  color: #fff;
  border: 0;
}

.evening-card .kicker { color: #f1c987; }
.evening-number { background: rgba(255,255,255,.14); color: #fff; }
.evening-intro { color: rgba(255,255,255,.82); margin-top: 2px; }
.evening-card label {
  display: block;
  margin: 17px 0 7px;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
}
.evening-card textarea {
  background: rgba(255,255,255,.96);
  border-color: rgba(255,255,255,.22);
}
.evening-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 16px;
}
.evening-card .primary-button { background: #f2d39c; color: #233a4a; }
.evening-card .text-button { color: #fff; }
.evening-card .status { color: rgba(255,255,255,.76); }
.evening-complete {
  outline: 3px solid rgba(242,211,156,.32);
  outline-offset: -3px;
}

/* Quiet reading reset */
.reset-instructions {
  color: var(--muted);
  margin: 2px 0 14px;
}

.reading-reset {
  border-left: 4px solid var(--gold);
  border-radius: 0 16px 16px 0;
  background: linear-gradient(135deg, rgba(220, 232, 223, 0.62), rgba(255, 253, 248, 0.92));
  padding: 18px 18px 18px 20px;
  margin-bottom: 18px;
}

.reading-reset p {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 19px;
  line-height: 1.72;
  white-space: pre-line;
}
