:root {
  --cream: #F6F0E4;
  --paper: #FBF7EE;
  --ink: #2B2420;
  --muted: #6F645B;
  --line: #E3D9C6;
  --accent: #6E2433;
  --accent-ink: #FBF7EE;
  --accent-soft: #F0E1DF;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 18px/1.55 var(--sans);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .45; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 16px 8px;
  max-width: 640px; width: 100%; margin: 0 auto;
}
.brand {
  background: none; border: 0; padding: 8px 0;
  font: 700 26px/1 var(--serif); color: var(--accent); letter-spacing: .01em;
}
.top-links { display: flex; gap: 4px; }
.link { background: none; border: 0; padding: 10px 10px; color: var(--accent); font-weight: 500; }
.link.small { font-size: 16px; padding: 10px 4px; align-self: flex-start; }
.lang { color: var(--muted); }

main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 0 16px 32px; outline: none; }
.screen { animation: in .2s ease-out; }
@keyframes in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

h1 { font: 600 34px/1.15 var(--serif); margin: 12px 0 6px; letter-spacing: -.005em; }
h2 { font: 600 22px/1.2 var(--serif); margin: 0 0 6px; }
.hint { color: var(--muted); margin: 0 0 20px; }
.notice { background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; font-size: 16px; margin: 0 0 16px; }

.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 8px 0 0; }
.steps li { height: 4px; flex: 1; border-radius: 2px; background: var(--line); }
.steps li.on { background: var(--accent); }

.back { background: none; border: 0; color: var(--muted); padding: 10px 0; font-size: 16px; }

/* Age */
.age-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 8px; }
.age {
  aspect-ratio: 1 / .82; border-radius: var(--radius);
  background: var(--paper); border: 1.5px solid var(--line);
  font: 600 52px/1 var(--serif); color: var(--ink);
  transition: border-color .15s, background .15s;
}
.age:active, .age.chosen { border-color: var(--accent); background: var(--accent-soft); }

/* Interests */
.field-label { font-weight: 600; margin: 12px 0 6px; }
.gender { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 4px 0 18px; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--paper); }
.seg { min-height: 50px; border: 0; background: none; font-weight: 600; color: var(--muted); }
.seg + .seg { border-left: 1.5px solid var(--line); }
.seg[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.tags { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.tag {
  min-height: 48px; padding: 10px 18px; border-radius: 999px;
  background: var(--paper); border: 1.5px solid var(--line); font-weight: 500;
}
.tag[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.note-label { display: block; font-weight: 600; margin-bottom: 6px; }
textarea {
  width: 100%; font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); resize: vertical;
}
textarea:focus { outline: none; border-color: var(--accent); }

.primary, .secondary {
  min-height: 52px; border-radius: 12px; padding: 12px 20px; font-weight: 600; font-size: 17px;
}
.primary { background: var(--accent); color: var(--accent-ink); border: 0; }
.secondary { background: var(--paper); color: var(--accent); border: 1.5px solid var(--line); }
#toStart { width: 100%; margin-top: 20px; }

/* Starting point */
.choices { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.choice {
  text-align: left; padding: 22px 20px; border-radius: var(--radius);
  background: var(--paper); border: 1.5px solid var(--line);
  display: flex; flex-direction: column; gap: 4px;
}
.choice:active { border-color: var(--accent); }
.choice + .choice, .link.small + .choice { margin-top: 10px; }
.choice-title { font: 600 26px/1.15 var(--serif); color: var(--accent); }
.choice-sub { color: var(--ink); }
.sub { color: var(--muted); font-size: 15px; }

/* Parsha picker */
.book { margin-top: 22px; color: var(--accent); }
.parsha-list { display: grid; grid-template-columns: 1fr; gap: 6px; }
.parsha {
  display: flex; justify-content: space-between; align-items: center; min-height: 48px;
  padding: 10px 14px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); text-align: left;
}
.parsha .count { color: var(--muted); font-size: 15px; }
.parsha.empty span:first-child { color: var(--muted); }

/* Cards */
.cards { display: flex; flex-direction: column; gap: 12px; }
.card {
  text-align: left; padding: 18px 18px 16px; border-radius: var(--radius);
  background: var(--paper); border: 1.5px solid var(--line);
  display: flex; flex-direction: column; gap: 6px; width: 100%;
}
.card:active { border-color: var(--accent); }
.card-title { font: 600 25px/1.15 var(--serif); color: var(--ink); }
.card-hook { color: var(--ink); }
.card-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; color: var(--muted); margin-top: 4px; flex-wrap: wrap; }
.cite { color: var(--accent); font-weight: 500; }
.saved-card { flex-direction: row; align-items: center; padding: 0 8px 0 0; }
.card-open { flex: 1; background: none; border: 0; text-align: left; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }

.empty-state { text-align: center; padding: 40px 8px; }
.empty-state p { font: 500 24px/1.3 var(--serif); margin: 0 0 20px; }

.loading { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 0; color: var(--muted); text-align: center; }
.loading.big p { margin: 0; }
.loading .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }

/* Story */
.source { margin: 8px 0 0; color: var(--accent); font-weight: 600; font-size: 15px; letter-spacing: .02em; text-transform: uppercase; }
.story-title { font-size: 38px; margin-top: 4px; }
.meta { color: var(--muted); margin: 0 0 18px; font-size: 16px; }
.story-body p { font-size: 20px; line-height: 1.6; margin: 0 0 16px; }
.story-body p.prompt {
  font-size: 16px; font-style: italic; color: var(--accent); background: var(--accent-soft);
  border-radius: 10px; padding: 8px 12px; margin: 4px 0 16px;
}
.story-body p.prompt::before { content: 'Do together: '; font-style: normal; font-weight: 600; }
.notes-toggle { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); margin: 0 0 14px; }
.notes-toggle input { width: 20px; height: 20px; accent-color: var(--accent); }
.before { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 18px; }
.before h2 { font-size: 18px; color: var(--accent); margin-bottom: 4px; }
.before p { margin: 0; font-size: 16px; }
.guide .beat { padding: 0 0 14px; margin: 0 0 14px; border-bottom: 1px dashed var(--line); }
.guide .beat:last-child { border-bottom: 0; }
.guide .label { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin: 0 0 4px; }
.guide .opening .say { font-family: var(--serif); font-size: 24px; line-height: 1.35; }
.guide .say { font-size: 20px; line-height: 1.55; margin: 0 0 6px; }
.guide .do { display: inline-block; font-size: 16px; color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 6px 10px; margin: 2px 0 6px; }
.guide .do::before { content: 'Do together: '; font-weight: 600; }
.guide .why { font-size: 15px; color: var(--muted); margin: 0; padding-left: 12px; border-left: 2px solid var(--line); }
.ask, .point { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 8px; }
.ask ul { margin: 0; padding-left: 20px; }
.ask li { font-size: 19px; margin-bottom: 8px; }
.point p { font-size: 19px; margin: 0; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 28px; }
.actions #save { grid-column: 1 / -1; }
.actions #save[aria-pressed="true"] { background: var(--paper); color: var(--accent); border: 1.5px solid var(--accent); }

.foot { max-width: 640px; margin: 0 auto; padding: 8px 16px max(20px, env(safe-area-inset-bottom)); color: var(--muted); font-size: 14px; text-align: center; }
.foot p { margin: 0; }

@media (min-width: 560px) {
  .age-grid { grid-template-columns: repeat(4, 1fr); }
  .age { aspect-ratio: 1; }
  .parsha-list { grid-template-columns: 1fr 1fr; }
  .actions { grid-template-columns: repeat(5, auto); justify-content: start; }
  .actions #save { grid-column: auto; }
}

/* Print: one clean page with only the story. */
#printSheet { display: none; }
@media print {
  @page { size: auto; margin: 16mm 18mm; }
  body { background: #fff; display: block; }
  body > *:not(#printSheet) { display: none !important; }
  #printSheet { display: block; color: #000; font: 12pt/1.5 var(--sans); }
  #printSheet .p-source { font: 600 9.5pt/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: #6E2433; margin: 0 0 6pt; }
  #printSheet h1 { font: 600 24pt/1.1 var(--serif); margin: 0 0 12pt; }
  #printSheet h2 { font: 600 14pt/1.2 var(--serif); margin: 12pt 0 4pt; border-top: .5pt solid #bbb; padding-top: 8pt; }
  #printSheet p, #printSheet li { margin: 0 0 7pt; }
  #printSheet ul { padding-left: 16pt; margin: 0; }
  #printSheet .before { border: .5pt solid #bbb; border-radius: 4pt; padding: 5pt 7pt; margin-bottom: 8pt; }
  #printSheet .before h2 { border: 0; padding: 0; margin: 0 0 2pt; font-size: 11pt; }
  #printSheet .beat { margin: 0 0 6pt; }
  #printSheet .label { font: 600 8pt/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: #6E2433; margin: 0 0 2pt; }
  #printSheet .say { margin: 0 0 2pt; }
  #printSheet .do { margin: 0 0 2pt; color: #6E2433; font-size: .92em; }
  #printSheet .do::before { content: 'Do together: '; font-weight: 600; }
  #printSheet .why { margin: 0 0 2pt; color: #555; font-size: .85em; font-style: italic; }
  #printSheet.fit-xs { font-size: 9pt; line-height: 1.32; }
  #printSheet .prompt { font-style: italic; color: #6E2433; }
  #printSheet .prompt::before { content: 'Do together: '; font-style: normal; font-weight: 600; }
  #printSheet .p-foot { margin-top: 16pt; font-size: 8.5pt; color: #777; }
  #printSheet.fit-m { font-size: 11pt; }
  #printSheet.fit-s { font-size: 10pt; line-height: 1.4; }
  #printSheet, #printSheet * { break-inside: avoid-page; }
}
/* A quieter, more editorial home for a family ritual. */
body { background: radial-gradient(ellipse at 85% 0%, #eadfc9 0%, transparent 42%), var(--cream); }
.top { max-width: 760px; padding-top: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
main { max-width: 760px; padding-top: 24px; }
.top-links a { text-decoration: none; }
.brand { font-size: 33px; }
.welcome { position: relative; padding: 20px 0 30px; overflow: hidden; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .17em; color: var(--accent); margin: 18px 0 12px; }
.welcome h1 { font-size: clamp(42px, 8vw, 66px); max-width: 520px; letter-spacing: -.035em; line-height: 1.02; margin-bottom: 20px; }
.welcome > p:not(.eyebrow) { max-width: 470px; color: var(--muted); line-height: 1.65; }
.welcome-mark { position: absolute; right: 5px; bottom: 48px; font: 48px Georgia, serif; color: #ac855a; opacity: .22; transform: rotate(-12deg); pointer-events: none; }
.steps { margin: 16px 0 24px; gap: 10px; }
.steps li { height: 3px; }
.age-grid { margin-top: 24px; gap: 16px; }
.age { position: relative; text-align: left; padding: 22px; aspect-ratio: auto; min-height: 172px; background: rgba(255,253,247,.74); box-shadow: 0 4px 16px #47331d04; transition: transform .2s, border-color .2s; }
.age:hover { transform: translateY(-3px); border-color: var(--accent); }
.age > span:first-child { display: block; font-size: 45px; }
.age small { font: 14px var(--sans); color: var(--muted); }
.age em { display: block; margin-top: 16px; font: 15px var(--sans); color: var(--muted); }
.age-arrow { position: absolute; right: 20px; top: 22px; font: 25px var(--sans); color: var(--accent); }
input[type=number], select { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 13px; font: inherit; color: var(--ink); background: var(--paper); margin-bottom: 20px; }
.privacy-note { font-size: 13px; line-height: 1.5; color: var(--muted); }
.card, .choice { box-shadow: 0 5px 20px #47331d05; }
.card:hover, .choice:hover { border-color: var(--accent); }
.telling-toolbar { padding: 18px 20px; margin: 20px 0; background: #eee6d6; border-radius: 12px; font-size: 15px; }
.telling-toolbar p { margin-top: 0; }
#audioStatus { display: block; font-size: 13px; color: var(--muted); margin-top: 8px; }
.reflection { margin: 32px 0; padding: 22px; background: #eee6d6; border-radius: 16px; }
.reflection p:not(.eyebrow) { font-size: 16px; }
.reflection .eyebrow { margin-top: 0; }
.reflection .secondary { margin-top: 8px; }
.foot { border-top: 1px solid var(--line); }
@media (max-width: 460px) { .top { margin: 0 16px; width: calc(100% - 32px); padding-left: 0; padding-right: 0; } .top-links { font-size: 14px; gap: 0; } .welcome-mark { display: none; } .age { padding: 18px 16px; } .age em { font-size: 13px; } main { padding-top: 12px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media print { .telling-toolbar, .reflection, .welcome { display: none !important; } }
