@font-face {
  font-family: "Figtree";
  src: url("/assets/figtree-latin-f7c28c58.woff2") format("woff2");
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
}

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/assets/bricolage-grotesque-latin-78692770.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #faf8f4;
  --card: #fff;
  --ink: #1f1c17;
  --muted: #6a6358;
  --line: #ece6da;
  --dash: #d6cdbb;
  --gold: #d9ae52;
  --gold-ink: #7a5810;
  --gold-soft: #f7edd6;
  --on-gold: #211a0c;
  --radius: 20px;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #18171a;
  --card: #222125;
  --ink: #f4efe5;
  --muted: #a9a297;
  --line: #34323a;
  --dash: #4a4750;
  --gold: #e2ba62;
  --gold-ink: #e8c57c;
  --gold-soft: #3a3221;
  --on-gold: #1c160a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --bg: #18171a;
    --card: #222125;
    --ink: #f4efe5;
    --muted: #a9a297;
    --line: #34323a;
    --dash: #4a4750;
    --gold: #e2ba62;
    --gold-ink: #e8c57c;
    --gold-soft: #3a3221;
    --on-gold: #1c160a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Figtree", system-ui, sans-serif; font-size: 17px; line-height: 1.5; }
body.app-shell { min-height: 100svh; display: flex; flex-direction: column; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--gold-ink); outline-offset: 4px; }
::selection { background: var(--gold-soft); color: var(--ink); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); }
strong { font-weight: 600; }
.muted { color: var(--muted); }
.gold-text { color: var(--gold-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: absolute; top: 8px; left: 16px; transform: translateY(-150%); padding: 8px 16px; background: var(--card); z-index: 10; border-radius: 8px; }
.skip-link:focus { transform: translateY(0); }
.site-header { padding: 20px max(24px, env(safe-area-inset-right)) 20px max(24px, env(safe-area-inset-left)); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -.01em; min-height: 44px; }
.brand .icon { width: 26px; height: 26px; color: var(--gold); }
.icon { flex: none; width: 20px; height: 20px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 24px; }
.button { min-height: 56px; padding: 12px 24px; border: 0; border-radius: 16px; display: inline-flex; gap: 10px; align-items: center; justify-content: center; font-size: 17px; line-height: 1.3; font-weight: 600; text-decoration: none; text-align: center; }
.button-primary { color: var(--on-gold); background: var(--gold); }
.button-primary:not(:disabled):hover { filter: brightness(.96); }
.button-quiet { background: transparent; color: var(--muted); min-height: 44px; padding: 8px 6px; font-size: 15px; }
.button-outline { color: var(--ink); border: 1px solid var(--ink); background: transparent; }
.icon-button { width: 44px; height: 44px; flex: none; display: grid; place-items: center; background: transparent; border: 0; border-radius: 12px; color: var(--muted); }
.eyebrow { color: var(--gold-ink); text-transform: uppercase; letter-spacing: .06em; font-size: 13px; font-weight: 600; }
.icon-tile, .icon-circle { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 12px; background: var(--gold-soft); color: var(--gold-ink); }
.icon-circle { width: 34px; height: 34px; border-radius: 50%; color: var(--gold); }
.welcome { width: 100%; max-width: 1200px; margin: auto; padding: 64px 48px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(40px, 6vw, 96px); align-items: center; flex: 1; }
.welcome-intro { display: flex; flex-direction: column; gap: 24px; }
.welcome h1 { font-size: clamp(40px, 5.2vw, 68px); font-weight: 600; line-height: 1.04; letter-spacing: -.025em; }
.welcome-description { color: var(--muted); font-size: 19px; line-height: 1.55; max-width: 520px; }
.welcome-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-top: 8px; }
.welcome-actions .button-primary { min-height: 60px; padding-inline: 30px; font-size: 18px; }
.welcome-footnote, .coming-soon { color: var(--muted); font-size: 14px; }
.coming-soon { width: 100%; }
.welcome-preview { min-width: 0; }
.question-card { padding: clamp(24px, 3vw, 36px); border-radius: 24px; display: grid; gap: 20px; }
.question-eyebrow { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; font-weight: 600; }
.question-card h2 { font-size: 30px; font-weight: 600; line-height: 1.15; letter-spacing: -.015em; }
.question-example { min-height: 140px; padding: 18px; border: 1.5px dashed var(--dash); border-radius: 18px; background: var(--bg); display: grid; align-content: space-between; gap: 16px; color: var(--muted); }
.dictation-tip { display: flex; gap: 8px; align-items: flex-start; color: var(--gold-ink); font-size: 14px; font-weight: 600; }
.dictation-tip .icon { width: 16px; height: 20px; }
.install-tip { display: none; }
.reminder-card { display: grid; gap: 22px; border-radius: 24px; }
.card-heading { display: flex; justify-content: space-between; gap: 12px; }
.card-heading h2 { font-size: 24px; font-weight: 600; line-height: 1.2; margin-bottom: 6px; }
.card-heading p { font-size: 15px; }
fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
legend, .field-label { display: block; font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.field-label { margin-top: 20px; }
.field { width: 100%; min-width: 0; min-height: 52px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--ink); padding: 12px 16px; }
.weekday-options { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.weekday { position: relative; }
.weekday input { position: absolute; opacity: 0; }
.weekday > span:first-of-type { display: grid; place-items: center; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; font-weight: 600; }
.weekday input:checked + span { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.weekday input:focus-visible + span { outline: 3px solid var(--gold-ink); outline-offset: 3px; }
.dev-page { width: min(100% - 48px, 960px); margin: 32px auto 64px; display: grid; gap: 24px; }
.dev-page h1 { font-size: clamp(32px, 4vw, 48px); line-height: 1.1; }
.dev-page .card { display: grid; gap: 16px; }
.dev-page pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.dev-page textarea { min-height: 180px; }
.dev-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.sample-entry { border-top: 1px solid var(--line); padding-top: 16px; display: grid; gap: 8px; }

@media (min-width: 800px) {
  .site-header { padding-inline: clamp(24px, 4vw, 48px); }
}

@media (max-width: 799px) {
  .site-header { padding-top: max(24px, env(safe-area-inset-top)); padding-bottom: 0; }
  .welcome { max-width: 520px; padding: 28px 24px max(24px, env(safe-area-inset-bottom)); grid-template-columns: minmax(0, 1fr); gap: 28px; align-content: start; align-items: start; }
  .welcome-intro { display: contents; }
  .welcome h1 { font-size: 38px; line-height: 1.08; letter-spacing: -.02em; }
  .welcome-description { font-size: 17px; line-height: 1.5; margin-top: -14px; }
  .install-tip { display: grid; gap: 4px; padding: 20px; }
  .install-tip h2 { font-size: 20px; font-weight: 600; line-height: 1.3; }
  .install-tip > .muted { font-size: 15px; line-height: 1.45; }
  .install-steps { display: grid; gap: 12px; padding: 0; margin: 12px 0 0; list-style: none; }
  .install-steps li { display: flex; align-items: center; gap: 14px; font-size: 16px; line-height: 1.35; }
  .welcome-actions { grid-row: 4; display: grid; gap: 8px; margin-top: 0; }
  .welcome-actions .button-primary { font-size: 17px; min-height: 56px; padding-inline: 12px; }
  .coming-soon { font-size: 12px; text-align: center; }
  .welcome-footnote { display: none; }
  .welcome-preview { display: none; }
  .welcome.is-scheduling .install-tip { display: none; }
  .welcome.is-scheduling .welcome-preview { display: block; grid-row: 3; }
  .dev-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Accounts share the welcome palette and adapt to phone and desktop layouts. */
.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
.account-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; font-size: 15px; }
.account-nav > a { display: inline-flex; align-items: center; min-height: 44px; text-underline-offset: 4px; }
.account-page { width: min(100% - 48px, 1040px); margin: 48px auto 80px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; align-items: center; }
.account-page-narrow { max-width: 560px; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.account-intro { display: grid; gap: 20px; }
.account-intro h1 { font-size: clamp(36px, 4.5vw, 56px); line-height: 1.08; letter-spacing: -.025em; }
.account-card { display: grid; gap: 20px; min-width: 0; }
.account-card h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.15; }
.account-card h2 { font-size: 26px; line-height: 1.2; }
.account-form { display: grid; gap: 10px; min-width: 0; }
.account-form .field-label { margin: 8px 0 0; }
.account-form .button { margin-top: 12px; width: 100%; }
.account-form .field_with_errors { min-width: 0; }
.field_with_errors .field { border-color: var(--gold-ink); }
.field-hint, .account-footer { font-size: 14px; color: var(--muted); }
.form-link { font-size: 14px; margin-block: 4px; }
.account-footer a { color: var(--ink); }
.account-email { overflow-wrap: anywhere; }
.flash-message { width: min(100% - 48px, 1040px); margin: 20px auto 0; padding: 16px 20px; border: 1px solid var(--dash); border-radius: 14px; background: var(--gold-soft); }
.flash-alert, .form-errors { border-inline-start: 4px solid var(--gold-ink); }
.form-errors { padding: 12px 16px; background: var(--gold-soft); border-radius: 8px; font-size: 15px; }
.form-errors ul { margin: 8px 0 0; padding-inline-start: 20px; }
.verification-status { color: var(--gold-ink); font-weight: 600; }
@media (max-width: 799px) {
  .account-page { grid-template-columns: minmax(0, 1fr); gap: 28px; margin-top: 32px; max-width: 520px; }
  .account-card { padding: 20px; }
  .account-nav { gap: 4px 12px; }
}

/* The journal uses native form controls and plain-text content. */
.journal-page { width: min(100% - 48px, 800px); margin: 40px auto 72px; display: grid; gap: 24px; }
.journal-page h1 { font-size: clamp(30px, 4vw, 44px); line-height: 1.13; letter-spacing: -.025em; }
.journal-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.journal-form { display: grid; gap: 24px; min-width: 0; }
.writing-card { display: grid; gap: 16px; padding: 24px; border: 1.5px dashed var(--dash); }
.journal-textarea { width: 100%; min-width: 0; resize: vertical; min-height: 220px; border: 0; background: transparent; color: var(--ink); line-height: 1.65; font-size: 19px; }
.journal-textarea::placeholder { color: var(--muted); }
.writing-card .field_with_errors { min-width: 0; }
.character-count { text-align: right; }
.category-options { display: flex; flex-wrap: wrap; gap: 8px; }
.category-choice { position: relative; }
.category-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.category-choice span { display: block; padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 15px; font-weight: 600; }
.category-choice input:checked + span { background: var(--gold-soft); border-color: var(--gold-ink); color: var(--gold-ink); }
.category-choice input:focus-visible + span { outline: 3px solid var(--gold-ink); outline-offset: 3px; }
.journal-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.journal-form-footer .button-primary { min-width: 160px; }
.journal-form-footer .field-hint { max-width: 300px; }
.saved-label { display: flex; align-items: center; gap: 10px; color: var(--gold-ink); font-weight: 600; }
.win-quote { margin: 0; border-inline-start: 3px solid var(--gold); padding: 12px 20px; color: var(--muted); overflow-wrap: anywhere; white-space: pre-wrap; }
.editor-notice { padding: 18px; border: 1px solid var(--gold-ink); border-radius: 14px; background: var(--gold-soft); }
.editor-recovery { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.saved-page { max-width: 640px; text-align: center; margin-top: 64px; gap: 20px; }
.saved-star { display: grid; place-items: center; width: 76px; height: 76px; margin-inline: auto; background: var(--gold-soft); color: var(--gold-ink); border-radius: 24px; }
.saved-star .icon { width: 40px; height: 40px; }
.saved-page .win-quote { text-align: left; margin-block: 16px; }
.saved-actions { display: grid; gap: 12px; }
.story-page { width: min(100% - 48px, 960px); margin: 40px auto 72px; display: grid; gap: 28px; }
.story-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.story-heading h1 { font-size: clamp(36px, 5vw, 52px); line-height: 1.1; }
.story-list { display: grid; gap: 16px; }
.story-entry { display: grid; gap: 16px; }
.story-entry h2 { font-family: inherit; font-size: 20px; font-weight: 500; line-height: 1.55; overflow-wrap: anywhere; }
.story-entry h2 a { text-decoration: none; }
.story-entry h2 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.category-badge { display: inline-block; padding: 4px 12px; background: var(--gold-soft); color: var(--gold-ink); font-size: 13px; border-radius: 999px; white-space: nowrap; }
.story-empty { display: grid; justify-items: center; gap: 20px; padding: 40px 24px; text-align: center; }
.story-pagination { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.story-notice { width: 100%; margin: 0; }
.entry-content { display: grid; gap: 24px; }
.entry-content h2 { font-size: 20px; line-height: 1.3; }
.entry-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; }
.back-link { font-size: 15px; color: var(--muted); width: fit-content; }
@media (max-width: 799px) {
  .journal-page, .story-page { margin-top: 28px; margin-bottom: max(40px, env(safe-area-inset-bottom)); gap: 20px; }
  .writing-card { padding: 20px; }
  .journal-textarea { font-size: 17px; min-height: 200px; }
  .journal-form-footer { flex-wrap: wrap; }
  .journal-form-footer .button-primary { flex: 1; }
  .journal-form-footer .field-hint { max-width: none; flex-basis: 100%; }
  .saved-page { margin-top: 40px; }
}

/* Story browsing preserves search, cursor, and selection in ordinary URLs. */
.story-browser { width: min(100% - 48px, 1240px); }
.story-controls { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(160px, 230px) auto auto; align-items: end; gap: 16px; }
.story-controls .field-label { margin-top: 0; }
.story-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 32px; align-items: start; }
.story-week { display: grid; gap: 14px; margin-bottom: 28px; }
.week-heading { font-family: inherit; font-size: 14px; font-weight: 600; color: var(--muted); }
.story-entry h3 { font-family: inherit; font-size: 18px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.story-entry h3 a { text-decoration: none; }
.story-entry h3 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.story-entry.is-selected { border-color: var(--gold-ink); background: var(--gold-soft); }
.story-detail-panel { position: sticky; top: 24px; min-width: 0; max-height: calc(100vh - 48px); overflow-y: auto; padding: 4px; }
.entry-detail { display: grid; gap: 22px; min-width: 0; }
.entry-detail .journal-heading h2 { font-size: 32px; }
.entry-detail h3 { font-size: 19px; line-height: 1.3; }
.entry-actions, .context-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.entry-actions a { min-height: 44px; display: inline-flex; align-items: center; }
.context-actions { display: grid; }
.story-selection-hint { display: grid; gap: 20px; padding: 56px 32px; text-align: center; }
.conflict-comparison { display: grid; gap: 20px; border-color: var(--gold-ink); background: var(--gold-soft); }
.delete-confirmation { display: flex; flex-wrap: wrap; gap: 16px; }
.button-danger { background: #8b2929; color: #fff; }
@media (max-width: 799px) {
  .story-controls { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .story-columns { grid-template-columns: minmax(0, 1fr); }
  .story-selection-hint { display: none; }
  .story-detail-panel { position: static; max-height: none; overflow: visible; padding: 0; }
  .story-browser.has-selection .story-list-panel, .story-browser.has-selection .story-controls, .story-browser.has-selection .story-heading { display: none; }
  .delete-confirmation { display: grid; }
}

/* Progress reflects saved calendar dates, including months with six weeks. */
.progress-card { display: grid; gap: 18px; text-align: center; }
.monthly-total { display: grid; gap: 2px; }
.monthly-total strong { font-family: var(--font-display); font-size: 44px; line-height: 1.1; color: var(--gold-ink); }
.monthly-total span { color: var(--muted); }
.streak-total { color: var(--gold-ink); font-weight: 600; }
.month-weeks { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; padding: 0; margin: 0; }
.month-week { display: grid; justify-items: center; gap: 6px; min-width: 40px; font-size: 13px; color: var(--muted); }
.week-mark { display: grid; place-items: center; width: 36px; height: 36px; border: 1px dashed var(--dash); border-radius: 50%; font-size: 20px; }
.month-week.is-active .week-mark { background: var(--gold); color: var(--on-gold); border: 1px solid var(--gold); }
.month-week.is-current .week-mark { outline: 2px solid var(--gold-ink); outline-offset: 3px; }
.story-total { margin-top: 10px; font-size: 15px; }
.settings-navigation { font-size: 15px; display: flex; flex-wrap: wrap; gap: 8px; }
.settings-navigation a { display: inline-flex; align-items: center; padding: 10px 16px; min-height: 44px; border-radius: 12px; text-decoration: none; }
.settings-navigation a[aria-current="page"] { background: var(--gold-soft); color: var(--gold-ink); font-weight: 600; }
.appearance-options { display: grid; gap: 12px; border: 0; margin: 0; padding: 0; min-width: 0; }
.appearance-options legend { margin-bottom: 12px; font-weight: 600; }
.appearance-choice { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.appearance-choice > span { display: grid; gap: 4px; }
.appearance-choice:has(input:checked) { background: var(--gold-soft); border-color: var(--gold-ink); }
.appearance-choice input { accent-color: var(--gold-ink); width: 20px; height: 20px; flex: none; }
.account-nav a, .back-link { display: inline-flex; align-items: center; min-height: 44px; }
.account-card, .entry-content, .progress-card, .story-list-panel { min-width: 0; }
.account-card, .entry-content, .progress-card { overflow-wrap: anywhere; }
#main:focus, #entry-detail:focus { outline: none; }
.story-browser:has(.story-empty):not(.has-selection) .story-columns { grid-template-columns: minmax(0, 1fr); }
.story-empty { max-width: 760px; width: 100%; margin-inline: auto; }
@media (max-width: 799px) {
  .month-weeks { gap: 10px; }
  .progress-card { padding: 20px 16px; }
  .account-nav { flex-wrap: wrap; }
  .story-heading { align-items: flex-start; }
  .entry-actions .button { flex: 1; }
}
@media (max-width: 359px) {
  .journal-page, .story-page, .account-page { width: calc(100% - 32px); }
  .site-header { padding-inline: max(16px, env(safe-area-inset-left)); }
  .month-weeks { gap: 8px; }
  .month-week { min-width: 32px; }
  .week-mark { width: 30px; height: 30px; }
}

@media (min-width: 600px) {
  .progress-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 20px; text-align: left; }
  .monthly-total { grid-column: 1; grid-row: 1; }
  .streak-total { grid-column: 1; grid-row: 2; }
  .month-weeks { grid-column: 2; grid-row: 1 / 3; align-content: center; column-gap: 8px; }
  .progress-card .field-hint { grid-column: 1 / -1; text-align: center; }
}

.reminder-page { max-width: 680px; }
.notification-actions { display: grid; gap: 12px; }
.reminder-toggle { display: flex; align-items: center; gap: 12px; padding-block: 16px; cursor: pointer; }
.reminder-toggle input { width: 22px; height: 22px; flex: none; accent-color: var(--gold-ink); }
.weekday-options { margin-bottom: 12px; }
@media (display-mode: standalone) { .site-header { padding-top: max(20px, env(safe-area-inset-top)); } }
