:root {
  color-scheme: dark;
  --midnight: #071724;
  --midnight-2: #0c2639;
  --surface: rgba(17, 48, 70, 0.90);
  --surface-2: rgba(18, 54, 78, 0.84);
  --surface-3: rgba(20, 46, 64, 0.74);
  --ivory: #f7f0e7;
  --muted: #bdc8d1;
  --gold: #e0b86b;
  --gold-soft: #f3d9a6;
  --line: rgba(224,184,107,0.30);
  --danger: #e7b4a5;
  --radius: 22px;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 50% 16%, rgba(180,130,68,0.14), transparent 28rem),
    linear-gradient(180deg, #0c293d 0%, var(--midnight) 42%, #05111b 100%);
  color: var(--ivory);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(165deg, transparent 0 62%, rgba(3,13,22,0.58) 62.2% 100%),
    radial-gradient(ellipse at 50% 70%, rgba(216,176,107,0.08), transparent 40%);
}

.app-shell {
  position: relative;
  width: min(100%, 640px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}

.screen {
  min-height: calc(100dvh - max(42px, env(safe-area-inset-top)) - max(36px, env(safe-area-inset-bottom)));
  display: flex;
  flex-direction: column;
  animation: rise .36s ease both;
}

.screen.centered { justify-content: center; text-align: center; }
.screen.spacious { padding-top: clamp(36px, 8vh, 84px); }

.brand-mark { width: 118px; height: 118px; margin: 0 auto 24px; filter: drop-shadow(0 8px 24px rgba(216,176,107,.16)); }
.brand-mark.small { width: 38px; height: 38px; margin: 0; }
.wordmark { font-family: Georgia, "Times New Roman", serif; letter-spacing: .22em; font-weight: 500; font-size: clamp(36px, 10vw, 54px); margin: 0 0 10px; }
.wordmark.small { font-size: 21px; letter-spacing: .18em; margin: 0; }
.tagline { letter-spacing: .24em; font-size: 11px; text-transform: uppercase; color: var(--gold-soft); }

.splash-copy { margin-top: 56px; color: var(--muted); font-size: 15px; letter-spacing: .025em; }
.splash-line { width: 150px; height: 3px; border-radius: 99px; margin: 0 auto 20px; background: linear-gradient(90deg, var(--gold), rgba(255,255,255,.16)); overflow: hidden; }
.splash-line::after { content:""; display:block; height:100%; width:44%; background:var(--gold-soft); animation:sweep 1s ease-in-out infinite alternate; }

.eyebrow { margin: 0 0 12px; color: var(--gold-soft); font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
h1 { margin: 0; font-size: clamp(34px, 8.5vw, 48px); line-height: 1.08; }
h2 { margin: 0; font-size: 28px; line-height: 1.18; }
p { line-height: 1.65; }
.lede { color: #ddd7cf; font-size: 18px; margin: 20px 0 30px; }
.subtle { color: var(--muted); font-size: 14px; }

.topbar { display:flex; align-items:center; justify-content:space-between; min-height:48px; margin-bottom:22px; }
.brand-lockup { display:flex; align-items:center; gap:10px; }
.header-tag { font-size: 7px; color: var(--gold-soft); letter-spacing:.18em; text-transform:uppercase; margin-top:3px; }
.back, .icon-button { min-width:44px; min-height:44px; border:0; border-radius:50%; background:transparent; cursor:pointer; display:grid; place-items:center; color:var(--ivory); }
.back:hover, .icon-button:hover { background: rgba(255,255,255,.05); }
.back:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 3px; }

.progress { height:2px; background:rgba(255,255,255,.08); border-radius:99px; margin: 2px 0 32px; overflow:hidden; }
.progress > span { display:block; height:100%; background:var(--gold); border-radius:inherit; transition:width .3s ease; }

.stack { display:grid; gap:12px; margin-top:26px; }
.choice, .voice-card {
  width:100%; min-height:58px; padding:16px 18px; text-align:left; border-radius:18px; border:1px solid rgba(255,255,255,.12); background:var(--surface-2); cursor:pointer; transition:.18s ease;
}
.choice:hover, .voice-card:hover { transform: translateY(-1px); border-color: rgba(216,176,107,.28); }
.choice.selected, .voice-card.selected { border-color:rgba(224,184,107,.84); background:rgba(224,184,107,.14); box-shadow: inset 0 0 0 1px rgba(224,184,107,.14), 0 0 24px rgba(224,184,107,.035); }
.choice-title { display:block; font-weight:650; }
.choice-note { display:block; margin-top:5px; color:var(--muted); font-size:13px; }

.chips { display:flex; flex-wrap:wrap; gap:10px; margin-top:26px; }
.chip { min-height:44px; padding:10px 15px; border-radius:999px; border:1px solid rgba(255,255,255,.12); background:rgba(17,48,68,.70); cursor:pointer; }
.chip.selected { border-color:var(--gold); background:rgba(224,184,107,.15); box-shadow:0 0 22px rgba(224,184,107,.035); }

.field { margin-top:28px; }
input, textarea, select {
  width:100%; border:1px solid rgba(255,255,255,.12); border-radius:18px; background:rgba(5,17,27,.55); color:var(--ivory); padding:16px 18px; outline:none;
}
input { min-height:56px; }
textarea { min-height:150px; resize:vertical; line-height:1.55; }
input::placeholder, textarea::placeholder { color:#7f909d; }

.actions { margin-top:auto; padding-top:28px; display:grid; gap:10px; }
.primary, .secondary, .text-button {
  min-height:52px; border-radius:999px; cursor:pointer; font-weight:700;
}
.primary { border:0; background:linear-gradient(135deg, #edc97f, #c58d45); color:#12202a; box-shadow:0 12px 32px rgba(197,141,69,.18); }
.primary:disabled { opacity:.42; cursor:not-allowed; box-shadow:none; }
.secondary { border:1px solid rgba(255,255,255,.12); background:rgba(255,255,255,.045); color:var(--ivory); }
.text-button { border:0; background:transparent; color:var(--muted); }

.reading { padding-top:10px; }
.reading h1 { margin-top:8px; }
.continuity-cue { margin:14px 0 2px; padding-left:14px; border-left:2px solid rgba(216,176,107,.42); }
.continuity-cue span { display:block; color:var(--gold-soft); font-size:10px; font-weight:700; letter-spacing:.14em; text-transform:uppercase; margin-bottom:5px; }
.continuity-cue p { margin:0; color:var(--muted); font-size:13px; line-height:1.5; font-style:italic; }
.reading-body { color:#ded9d2; font-size:17px; line-height:1.78; margin:18px 0 0; }
.voice-opening { color:var(--gold-soft); font-size:15px; line-height:1.55; margin-top:18px; }
.horizon-divider { height:1px; margin:32px 0 26px; background:linear-gradient(90deg, transparent, rgba(216,176,107,.72), transparent); position:relative; }
.horizon-divider::after { content:""; position:absolute; width:14px; height:7px; border-radius:14px 14px 0 0; background:var(--gold); left:50%; top:-7px; transform:translateX(-50%); }
.reflection-block { padding:20px; border-radius:20px; background:var(--surface-3); border:1px solid rgba(255,255,255,.075); }
.reflection-block + .reflection-block { margin-top:14px; }
.reflection-block h3 { margin:0 0 10px; font-size:11px; letter-spacing:.17em; color:var(--gold-soft); text-transform:uppercase; }
.reflection-block p { margin:0; }
.symbol-card { border-color:rgba(224,184,107,.32); padding-top:24px; padding-bottom:24px; }
.symbol-name { font-family:Georgia,serif; font-size:21px; text-transform:capitalize; margin-bottom:8px !important; }

.feedback-grid { display:grid; gap:10px; margin-top:16px; }
.feedback-grid button { min-height:50px; border-radius:16px; border:1px solid rgba(255,255,255,.1); background:var(--surface-2); cursor:pointer; }
.reason-list { display:grid; gap:9px; margin-top:14px; }
.reason-list button { text-align:left; padding:13px 15px; border-radius:14px; border:1px solid rgba(255,255,255,.10); background:rgba(17,48,68,.58); cursor:pointer; font-size:15px; }

.completion-mark { width:128px; margin:0 auto 28px; }

.home-header { padding-top:4px; }
.greeting { margin:20px 0 5px; font-family:Georgia,serif; font-size:30px; }
.date { color:var(--muted); font-size:14px; }
.section-label { margin:30px 0 10px; color:var(--gold-soft); font-size:11px; letter-spacing:.17em; font-weight:700; text-transform:uppercase; }
.card { border:1px solid rgba(255,255,255,.08); background:var(--surface); border-radius:var(--radius); padding:20px; box-shadow:var(--shadow); }
.card + .card { margin-top:12px; }
.card h2 { font-size:25px; }
.card p { color:var(--muted); margin:10px 0 0; }
.card-link { display:inline-block; margin-top:18px; color:var(--gold-soft); font-size:13px; font-weight:800; letter-spacing:.04em; background:none; border:0; padding:0; cursor:pointer; }
.disabled-card { opacity:.64; }

.bottom-nav { margin-top:auto; padding-top:30px; display:grid; grid-template-columns:repeat(3,1fr); gap:8px; position:sticky; bottom:max(8px, env(safe-area-inset-bottom)); }
.bottom-nav button { min-height:50px; border:1px solid rgba(255,255,255,.08); background:rgba(6,19,29,.92); border-radius:16px; color:var(--muted); cursor:pointer; backdrop-filter:blur(16px); }
.bottom-nav button.active { color:var(--gold-soft); border-color:rgba(216,176,107,.35); }

.settings-list { margin-top:22px; border-top:1px solid rgba(255,255,255,.08); }
.setting { padding:16px 0; border-bottom:1px solid rgba(255,255,255,.08); display:flex; align-items:center; justify-content:space-between; gap:16px; }
.setting span:last-child { color:var(--muted); text-align:right; }
.danger { color:var(--danger); }
.danger-button { min-height:52px; border-radius:999px; cursor:pointer; font-weight:700; border:1px solid rgba(231,180,165,.42); background:rgba(129,55,45,.26); color:#f0c2b5; }
.danger-button:hover { background:rgba(147,61,49,.34); border-color:rgba(240,194,181,.55); }
.notice { padding:15px 16px; border-radius:16px; background:rgba(216,176,107,.08); border:1px solid rgba(216,176,107,.18); color:#d9d1c7; font-size:13px; line-height:1.55; }

@keyframes rise { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
@keyframes sweep { from { transform:translateX(-10%); } to { transform:translateX(150%); } }

@media (min-width: 760px) {
  .app-shell { padding-left:30px; padding-right:30px; }
  body::before { content:""; position:fixed; inset:20px calc(50% - 340px); border:1px solid rgba(255,255,255,.045); border-radius:34px; pointer-events:none; }
}

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

/* Edge-state clarity */
.chip:disabled { opacity:.56; cursor:not-allowed; }

/* 0.1.3 mobile interaction refinement */
body { overflow-x: hidden; }
.app-shell { min-height: 100svh; min-height: 100dvh; }
.screen { min-height: calc(100svh - 60px); min-height: calc(100dvh - max(42px, env(safe-area-inset-top)) - max(36px, env(safe-area-inset-bottom))); }

.welcome-core { margin: auto 0; }
.selection-status { min-height: 1.5em; margin-top: 18px; }
.choice[aria-pressed="true"], .voice-card[aria-pressed="true"], .chip[aria-pressed="true"] { border-color: rgba(216,176,107,.82); }
.chip:disabled { opacity: .56; cursor: not-allowed; }

input, textarea, select { font-size: 16px; }
textarea { scroll-margin-bottom: 150px; }

.pause-block {
  background: linear-gradient(180deg, rgba(216,176,107,.085), rgba(255,255,255,.035));
  border-color: rgba(216,176,107,.22);
}
.pause-block > p { font-family: Georgia, "Times New Roman", serif; font-size: 21px; line-height: 1.48; }
.feedback-grid button, .reason-list button { transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.feedback-grid button:active, .reason-list button:active { transform: translateY(1px); }

.today-card { padding: 20px; }
.home-secondary { display: grid; gap: 12px; margin-top: 14px; }
.compact-card { box-shadow: none; padding: 16px 18px; }
.compact-card + .compact-card { margin-top: 0; }
.compact-card h2 { font-size: 20px; line-height: 1.22; }
.compact-card p { font-size: 13px; line-height: 1.45; margin-top: 6px; }
.compact-card .card-link { margin-top: 10px; }
.compact-kicker { color: var(--gold-soft); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 8px; }

.screen.with-nav { padding-bottom: 4px; }
.bottom-nav {
  z-index: 20;
  padding: 6px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 20px;
  background: rgba(4,16,25,.82);
  box-shadow: 0 16px 40px rgba(0,0,0,.22);
  backdrop-filter: blur(18px);
}
.bottom-nav button { background: rgba(8,25,37,.86); }

@media (min-height: 700px) {
  .bottom-nav { position: sticky; bottom: max(8px, env(safe-area-inset-bottom)); }
}

@media (max-height: 699px) {
  .bottom-nav { position: static; margin-top: 24px; }
  .app-shell { padding-top: max(12px, env(safe-area-inset-top)); }
  .topbar { margin-bottom: 14px; }
  .progress { margin-bottom: 22px; }
  .screen.spacious { padding-top: 12px; }
}

@media (max-height: 640px) {
  .welcome-screen .brand-mark { width: 76px; height: 76px; margin-bottom: 14px; }
  .welcome-screen .wordmark { font-size: 34px; margin-bottom: 7px; }
  .welcome-screen .tagline { font-size: 9px; letter-spacing: .2em; }
  .welcome-screen h1 { margin-top: 28px !important; font-size: clamp(29px, 9vw, 34px); line-height: 1.1; }
  .welcome-screen .lede { font-size: 16px; margin: 14px 0 8px; line-height: 1.5; }
  .welcome-screen .actions { padding-top: 16px; }
  .welcome-screen .primary { min-height: 48px; }
  .welcome-screen .actions .subtle { margin: 4px 0 0; font-size: 12px; }
  .reading-body { font-size: 16px; line-height: 1.68; }
  textarea { min-height: 118px; }
}
.saved-note-status {
  margin: 14px 0 0 !important;
  color: var(--muted);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-size: 12px !important;
  line-height: 1.45 !important;
}
#reflection-next { scroll-margin-top: 24px; }


/* 0.1.6 iPhone polish pass */
.feedback-reason-core { margin-top: clamp(64px, 12vh, 118px); }
.feedback-reassurance { margin: -2px 0 16px; max-width: 34rem; }

/* When iOS opens its keyboard, keep text-entry actions near the field instead of
   pushing them to the bottom of the full layout viewport. Choice-list screens stay scroll-based. */
body.keyboard-open .keyboard-aware .keyboard-actions {
  margin-top: 18px;
  padding-top: 0;
}
body.keyboard-open .keyboard-aware .text-button { min-height: 42px; }
body.keyboard-open .keyboard-aware { padding-bottom: 10px; }

@media (max-width: 600px) {
  .welcome-screen .brand-mark { width: 100px; height: 100px; margin-bottom: 20px; }
  .welcome-screen h1 { font-size: clamp(31px, 8.4vw, 36px); line-height: 1.08; }
  .first-reflection h1 { font-size: clamp(31px, 8vw, 36px); line-height: 1.08; }
  .feedback-reason-screen .reason-list button { font-size: 15px; }
  .feedback-reason-screen h1 { font-size: clamp(34px, 8.5vw, 44px); }
  .choice, .voice-card { border-color: rgba(255,255,255,.14); }
  .choice-note { color:#c1ccd4; }
  .disabled-card { opacity:.70; }
}

/* v0.5 Path continuity */
.path-history { margin-top: 22px; }
.path-history .section-label { margin-top: 0; }

.path-history-item {
  padding: 15px 0;
  border-top: 1px solid rgba(255,255,255,.08);
}

.path-history-item:last-child {
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.path-history-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.path-history-meta span:last-child {
  text-align: right;
}

.path-history-item p {
  margin: 7px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.4;
}

/* v0.6 recurring Path themes */
.path-themes {
  margin-top: 22px;
}

.path-themes .section-label {
  margin-top: 0;
}

.path-theme-item {
  padding: 15px 0;
  border-top: 1px solid rgba(255,255,255,.08);
}

.path-theme-item:last-of-type {
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.path-theme-item strong {
  display: block;
  color: var(--gold-soft);
  font-size: 13px;
  line-height: 1.4;
}

.path-theme-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.path-theme-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

/* v0.7 reflection history detail */
.path-history-button {
  display: block;
  width: 100%;
  padding: 15px 0;
  border: 0;
  border-top: 1px solid rgba(255,255,255,.08);
  border-radius: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.path-history-button:last-child {
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.path-history-button:hover {
  background: rgba(255,255,255,.025);
}

.path-history-button:focus-visible {
  outline: 2px solid rgba(216,176,107,.7);
  outline-offset: 4px;
}

.path-history-open {
  display: block;
  margin-top: 8px;
  color: var(--gold-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
}

.path-history-detail-meta {
  margin: 10px 0 8px;
}

/* v0.8 Earlier reflections archive */
.path-archive-link {
  margin-top: 18px;
}

.path-archive-button {
  width: 100%;
  min-height: 48px;
  border-radius: 16px;
  cursor: pointer;
}

.path-history-archive {
  margin-top: 22px;
}

/* v0.9 local archive search */
.path-history-search {
  margin-top: 24px;
}

.path-history-search .section-label {
  display: block;
  margin-top: 0;
}

.path-history-search-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.path-history-empty {
  padding: 22px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

/* v1.0 Saved reflections */
.path-history-saved {
  margin-top: 22px;
}

.path-save-actions {
  margin-top: 26px;
  padding-top: 0;
}

.path-save-actions .subtle {
  margin: 0;
  text-align: center;
}
