/* Howdy Moon — editorial, warm, quietly playful. */
:root {
  --paper: #f6f2ea; --paper-2: #efe8dc; --card: #fbf9f4; --ink: #1f1c18; --ink-2: #4a443d;
  --muted: #847b70; --line: #e2d9cb; --clay: #b65a3c; --sage: #7d8b6a; --ochre: #c89b3c;
  --serif: "Fraunces", Georgia, serif; --sans: "DM Sans", system-ui, sans-serif;
  --r: 4px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
main { max-width: 1240px; margin: 0 auto; padding: 0 28px 60px; }
canvas { display: block; width: 100%; height: auto; }
h1, h2, h3, legend { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; }
h2 { font-size: 30px; line-height: 1.15; margin: 0 0 6px; }
em { font-style: italic; }
.muted { color: var(--muted); } .center { text-align: center; } .small { font-size: 13px; } .tiny { font-size: 12px; }
.eyebrow { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--clay); font-weight: 600; margin: 0 0 10px; }
code { font-size: 13px; background: var(--paper-2); padding: 1px 6px; border-radius: 3px; }

/* header */
.top { display: flex; align-items: center; gap: 24px; padding: 26px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.logo { font-family: var(--serif); font-size: 24px; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.logo em { color: var(--clay); font-weight: 300; }
.steps { display: flex; gap: 4px; list-style: none; margin: 0 auto; padding: 0; }
.steps li > * { display: block; padding: 6px 14px; font: 500 13px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: #b3a99c; background: none; border: 0; }
.steps li.done > * { color: var(--ink-2); }
.steps li.on > * { color: var(--ink); box-shadow: inset 0 -2px 0 var(--clay); }
.steps li button { cursor: pointer; } .steps li button:hover { color: var(--clay); }
.ai-pill { font-size: 12px; color: var(--muted); letter-spacing: .04em; }

/* buttons */
.btn { font: 500 15px var(--sans); padding: 13px 24px; border-radius: 999px; border: 1px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; transition: background .2s, color .2s; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--clay); border-color: var(--clay); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); }
.btn.small { font-size: 13px; padding: 8px 18px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--ink-2); font: 500 14px var(--sans); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.link:hover { color: var(--clay); text-decoration-color: var(--clay); }
.link.small { font-size: 13px; } .link.danger:hover { color: #a33; }
.link:disabled { opacity: .4; cursor: default; }
.center-block { display: block; margin: 14px auto 0; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.btns.stack { flex-direction: column; align-items: stretch; }

/* home */
.hero { padding: 96px 0 72px; max-width: 820px; }
.hero h1 { font-size: clamp(44px, 7vw, 84px); line-height: 1.02; margin: 0 0 24px; font-weight: 300; letter-spacing: -0.025em; }
.hero h1 em { color: var(--clay); }
.lede { font-size: 19px; color: var(--ink-2); max-width: 560px; margin: 0 0 32px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.block { padding: 40px 0; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 28px; }
.story-card { position: relative; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: inherit; display: flex; flex-direction: column; gap: 4px; }
.story-card canvas { border-radius: var(--r); margin-bottom: 12px; transition: transform .4s ease, box-shadow .4s; box-shadow: 0 1px 0 var(--line); }
.story-card:hover canvas { transform: translateY(-4px); box-shadow: 0 18px 40px -20px rgba(60,40,20,.35); }
.story-no { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.story-title { font-family: var(--serif); font-size: 23px; line-height: 1.2; margin-top: 14px; }
.story-blurb { color: var(--muted); font-size: 14px; }
.foot { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

/* characters */
.char-row, .char-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.char-card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 8px 12px; display: flex; flex-direction: column; gap: 6px; text-align: left; font: inherit; color: inherit; }
.char-card[data-pickhero] { cursor: pointer; transition: border-color .2s; }
.char-card[data-pickhero]:hover { border-color: var(--ink-2); }
.char-card.selected { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.char-card img, .char-card canvas { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 2px; background: #fff; }
.char-meta { display: flex; flex-direction: column; padding: 0 4px; }
.char-meta strong { font-family: var(--serif); font-weight: 400; font-size: 18px; }
.char-meta span { font-size: 12px; color: var(--muted); }
.char-card .link { padding: 0 4px; align-self: flex-start; }
.char-card .tick { position: absolute; top: 14px; right: 14px; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-size: 13px; }
.char-card.new { align-items: center; justify-content: center; border-style: dashed; cursor: pointer; min-height: 180px; color: var(--ink-2); }
.char-card.new span { font-family: var(--serif); font-size: 40px; font-weight: 300; line-height: 1; }
.char-card.new strong { font-weight: 500; font-size: 14px; }
.char-card.new:hover { border-color: var(--ink); }

/* shelf */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 24px; }
.shelf-card { display: flex; flex-direction: column; gap: 2px; }
.shelf-card canvas { border-radius: var(--r); margin-bottom: 12px; box-shadow: 0 14px 30px -18px rgba(60,40,20,.45); }
.shelf-card.current canvas { outline: 1px solid var(--ink); outline-offset: 5px; }
.shelf-card strong { font-family: var(--serif); font-weight: 400; font-size: 18px; line-height: 1.25; }
.shelf-card > span { font-size: 13px; }
.shelf-btns { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }

/* forms + panels */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 40px; }
.studio, .setup { display: grid; grid-template-columns: 1fr 420px; gap: 40px; align-items: start; margin-top: 40px; }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 28px 0 0; padding: 24px 0 0; display: grid; gap: 16px; }
legend { font-size: 20px; padding-right: 12px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); letter-spacing: .01em; }
input:not([type=checkbox]):not([type=color]), select, textarea {
  font: 400 15px var(--sans); padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: end; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 400; font-size: 14px; }
.check.inline { padding-bottom: 12px; }
.consent { align-items: flex-start; background: var(--paper); padding: 12px 14px; border-radius: var(--r); font-size: 13px; color: var(--ink-2); }
.consent input { margin-top: 3px; }
.drop { border: 1px dashed #cbbfae; border-radius: var(--r); padding: 22px; text-align: center; cursor: pointer; font: 500 15px var(--sans); color: var(--ink); }
.drop:hover { border-color: var(--ink); }
.drop small { font-weight: 400; color: var(--muted); font-size: 13px; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { position: relative; width: 68px; height: 68px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--r); }
.thumb button { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; cursor: pointer; line-height: 1; }
.swatch-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.swatch-row span { width: 52px; }
.sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.sw.on { box-shadow: 0 0 0 2px var(--ink); }
input[type=color] { width: 34px; height: 30px; border: 0; padding: 0; background: none; cursor: pointer; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 32px; }
.actions .primary { margin-left: auto; }
.sticky { position: sticky; top: 24px; }
.sheet-frame { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 10px; margin-bottom: 18px; }
.sheet-frame img { display: block; width: 100%; }
.status { text-align: center; font-size: 14px; color: var(--clay); }
.book-mock { position: relative; border-radius: var(--r); overflow: hidden; box-shadow: 0 30px 60px -30px rgba(60,40,20,.5); margin-bottom: 12px; }
.mock-title { position: absolute; left: 8%; right: 8%; top: 9%; font-family: var(--serif); font-size: 30px; line-height: 1.15; text-align: center; color: var(--ink); }
.mock-hero { position: absolute; left: 15%; bottom: 6%; width: 70%; mix-blend-mode: multiply; }

/* preview */
.proof-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; margin: 40px 0 24px; }
.title-input { font: 400 36px var(--serif) !important; letter-spacing: -0.01em; border: 0 !important; background: transparent !important; padding: 0 !important; width: min(680px, 90vw) !important; }
.notice { background: #f5ead2; border: 1px solid #e8d3a6; border-radius: var(--r); padding: 12px 16px; margin-bottom: 20px; font-size: 14px; }
.art-bar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 18px; margin-bottom: 28px; }
.art-bar.off { font-size: 14px; color: var(--ink-2); }
.art-info { display: grid; gap: 2px; flex: 1; min-width: 240px; font-size: 14px; }
.art-info strong { font-family: var(--serif); font-weight: 400; font-size: 18px; }
.art-bar select { width: auto; }
.char-sheet { width: 64px; height: 64px; border-radius: var(--r); object-fit: cover; background: var(--paper-2); }
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 28px; }
.page-card { display: grid; gap: 10px; }
.page-card canvas { border-radius: 2px; box-shadow: 0 12px 30px -20px rgba(60,40,20,.5); }
.page-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.page-card textarea { font-size: 14px; }

/* approve / print */
.final { display: grid; grid-template-columns: 400px 1fr; gap: 48px; align-items: center; margin-top: 40px; }
.final h2 { font-size: 40px; font-weight: 300; }
.final-cover canvas { box-shadow: 0 30px 60px -30px rgba(60,40,20,.55); }
.spec { color: var(--ink-2); padding-left: 18px; margin: 18px 0 28px; }
.final .btns.stack { max-width: 320px; }
.progress { height: 4px; background: var(--paper-2); border-radius: 2px; overflow: hidden; margin: 18px 0 10px; max-width: 420px; }
.progress div { height: 100%; background: var(--clay); transition: width .6s; }

/* loading */
#loading { position: fixed; inset: 0; background: rgba(246,242,234,.9); display: grid; place-content: center; justify-items: center; text-align: center; z-index: 10; font: 300 22px var(--serif); }
#loading[hidden] { display: none; }
.spinner { width: 36px; height: 36px; border: 1px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  main { padding: 0 16px 40px; }
  .studio, .setup, .final { grid-template-columns: 1fr; }
  .studio-side, .setup-side { order: -1; } .sticky { position: static; }
  .steps { display: none; }
  .panel { padding: 24px; }
  .hero { padding: 56px 0 40px; }
}

/* navigation */
.nav { margin-left: auto; display: flex; gap: 6px; }
.nav-link { background: none; border: 0; font: 500 13px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); padding: 8px 14px; cursor: pointer; }
.nav-link:hover { color: var(--clay); }
.nav-link.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--clay); }
.flowbar { display: flex; align-items: center; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.flow-title { font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--ink-2); }
.flowbar .steps { margin: 0 auto 0 0; }
.resume-strip { width: 100%; display: flex; align-items: baseline; gap: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 22px; margin-bottom: 24px; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.resume-strip .eyebrow { margin: 0; }
.resume-strip .resume-title { font-family: var(--serif); font-size: 22px; flex: 1; }
.resume-strip .arrow { font-size: 20px; transition: transform .2s; }
.resume-strip:hover { border-color: var(--ink); } .resume-strip:hover .arrow { transform: translateX(4px); }
.account-head { padding: 64px 0 24px; }
.account-head h1 { font-size: clamp(36px, 5vw, 56px); font-weight: 300; margin: 0 0 8px; letter-spacing: -0.02em; }
.account-head h1 em { color: var(--clay); }
.soon-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 24px; }
.soon-row > div { display: flex; flex-direction: column; gap: 4px; padding: 22px; border: 1px dashed #cfc4b4; border-radius: var(--r); }
.soon .story-title { color: var(--ink-2); }
@media (max-width: 900px) { .flowbar .steps { display: flex; } }
a.btn { display: inline-block; text-align: center; text-decoration: none; }

/* sample covers on the story cards */
.cover-art { position: relative; display: block; border-radius: var(--r); overflow: hidden; margin-bottom: 12px; aspect-ratio: 1; transition: transform .4s ease, box-shadow .4s; box-shadow: 0 1px 0 var(--line); }
.cover-art canvas, .cover-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; margin: 0; }
.story-card .cover-art canvas { transition: none; box-shadow: none; }
.story-card:hover canvas { transform: none; box-shadow: none; }
.story-card:hover .cover-art { transform: translateY(-4px); box-shadow: 0 18px 40px -20px rgba(60,40,20,.35); }
.cover-title { position: absolute; left: 10%; right: 10%; top: 9%; text-align: center; font: 400 clamp(18px, 2.1vw, 26px)/1.15 var(--serif); color: var(--ink); text-shadow: 0 0 18px rgba(250,247,241,.9), 0 0 4px rgba(250,247,241,.8); }

/* in-page dialogs */
.dialog-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(31,28,24,.35); display: grid; place-items: center; padding: 16px; animation: fade .15s ease; }
.dialog { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); max-width: 440px; width: 100%; padding: 32px; box-shadow: 0 30px 80px -30px rgba(31,28,24,.5); }
.dialog p { font: 400 20px/1.4 var(--serif); margin: 0 0 24px; }
.dialog .btns { justify-content: flex-end; }
.btn.primary.danger { background: #8f2f22; border-color: #8f2f22; }
@keyframes fade { from { opacity: 0; } }
.char-card .tick.wide { width: auto; padding: 0 10px; border-radius: 999px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.roles { display: grid; gap: 12px; margin-top: 6px; padding-top: 14px; border-top: 1px dashed var(--line); }

/* "Read your book" */
.reader { position: fixed; inset: 0; z-index: 30; background: #1f1c18; color: #efe8dc; display: grid; grid-template-rows: auto 1fr auto; animation: fade .2s ease; }
.reader-top, .reader-bottom { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; }
.reader-title { font: italic 300 20px var(--serif); }
.reader-close { background: none; border: 1px solid #5a534b; color: #efe8dc; border-radius: 999px; padding: 8px 16px; font: 500 13px var(--sans); cursor: pointer; }
.reader-close:hover { border-color: #efe8dc; }
.reader-stage { display: flex; align-items: center; justify-content: center; gap: 16px; min-height: 0; padding: 0 16px; }
.reader-page { height: min(78vh, 92vw); aspect-ratio: 1; cursor: pointer; box-shadow: 0 40px 80px -30px rgba(0,0,0,.7); }
.reader-page canvas { width: 100%; height: 100%; border-radius: 2px; }
.reader-page.turn { animation: turn .35s ease; }
@keyframes turn { from { opacity: .3; transform: translateX(8px) scale(.995); } }
.reader-nav { background: none; border: 0; color: #efe8dc; font: 300 56px var(--serif); cursor: pointer; padding: 0 8px; opacity: .8; }
.reader-nav:disabled { opacity: .15; cursor: default; }
.reader-bottom { justify-content: center; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: #a89f92; }
.page-card canvas[data-read] { cursor: zoom-in; }
@media (max-width: 700px) { .reader-nav { display: none; } }

/* look inside + parents + paired fields */
.look-inside { position: absolute; left: 50%; bottom: 14px; transform: translate(-50%, 6px); opacity: 0; transition: opacity .25s, transform .25s;
  background: rgba(31,28,24,.85); color: var(--paper); font: 500 12px var(--sans); letter-spacing: .12em; text-transform: uppercase; padding: 8px 16px; border-radius: 999px; white-space: nowrap; }
.story-card:hover .look-inside, .story-card:focus-visible .look-inside { opacity: 1; transform: translate(-50%, 0); }
@media (hover: none) { .look-inside { opacity: 1; transform: translate(-50%, 0); } }
.pair-row { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; }
.roles.parents select { width: 100%; }
.reader-actions { display: flex; gap: 10px; align-items: center; }
.reader-cta { border-color: var(--paper); background: var(--paper); color: var(--ink); }
.reader-cta:hover { background: var(--clay); border-color: var(--clay); color: var(--paper); }
@media (max-width: 560px) { .pair-row { grid-template-columns: 1fr; } }
.abc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; }
.abc-grid label { display: grid; grid-template-columns: 24px 1fr; align-items: center; gap: 8px; }
.abc-grid label span { font: italic 300 22px var(--serif); color: var(--clay); text-align: center; }
.abc-grid input { padding: 9px 11px !important; font-size: 14px !important; }
.char-actions { display: flex; justify-content: space-between; padding: 0 4px; }

/* the story summary under a custom book's title */
.proof-head .summary { font-family: "Fraunces", serif; font-size: 1.05rem; line-height: 1.5; max-width: 38rem; margin: .4rem 0 .5rem; }

/* Change / Redo on preview pages, and the text box in dialogs */
.page-tools { display: inline-flex; gap: 14px; }
.dialog-input { width: 100%; margin: 4px 0 16px; font: inherit; padding: 10px 12px; border: 1px solid var(--line, #d9d2c5); border-radius: 10px; background: var(--paper, #fbf8f2); resize: vertical; }

/* collection: each story shown as a board book on a soft tile */
.book-stage { position: relative; display: grid; place-items: center; aspect-ratio: 1 / 0.92; background: var(--paper-2); border-radius: var(--r); overflow: hidden; }
.board-book { position: relative; display: block; width: 62%; aspect-ratio: 1; border-radius: 4% 7% 7% 4%; overflow: hidden;
  /* thick board pages: a stack of edges on the right and bottom, then a soft floor shadow */
  box-shadow: 1px 1px 0 #f7f2e8, 2px 2px 0 #e3d9c8, 3px 3px 0 #f7f2e8, 4px 4px 0 #ddd2bf, 5px 5px 0 #f4eee3,
    6px 6px 0 #d6cab5, 7px 7px 0 #f1ebdf, 8px 8px 0 #cfc2ab, 18px 22px 30px -12px rgba(60,40,20,.35);
  transition: transform .4s ease, box-shadow .4s; }
.board-book canvas { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; border-radius: 0; box-shadow: none; transition: none; }
.board-book::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 7%; pointer-events: none;   /* the spine fold */
  background: linear-gradient(90deg, rgba(0,0,0,.18), rgba(255,255,255,.12) 45%, rgba(0,0,0,.08) 70%, transparent); }
.story-card:hover .board-book { transform: translateY(-5px) rotate(-1deg); }
.story-card:hover canvas, .story-card canvas { transform: none; }
.board-book.own { background: var(--ink); }
.own-cover { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  color: var(--paper); font: 300 clamp(22px, 2.6vw, 32px)/1.1 var(--serif); padding: 12%; }
.own-cover em { color: var(--ochre); }
.own-cover small { display: block; margin-top: 12px; font: 500 10px var(--sans); letter-spacing: .14em; text-transform: uppercase; color: #cfc6b8; }
.story-meta { font-size: 14px; color: var(--ink-2); }
.story-price { font-size: 15px; font-weight: 600; color: var(--sage); margin-top: 2px; }
.drop.lead { padding: 34px 22px; background: var(--card); border-color: var(--clay); font: 400 20px var(--serif); }
.drop.lead small { display: block; margin-top: 6px; font-family: var(--sans); }
.dialog-note { font: 400 13px/1.5 var(--sans) !important; margin: -8px 0 18px !important; }
input.dialog-input { font-size: 17px; }

/* ===================== Nightlight brand (customer site: <body class="night">) =====================
   Midnight navy, a glowing butter moon, rounded Fredoka headings and Nunito Sans text.
   The admin page keeps the light look above. Book pages and covers keep their own print typography. */
body.night {
  --paper: #172142; --paper-2: #1e2a4a; --card: #1e2a4a; --field: #111a36; --ink: #f5f3ee; --ink-2: #c9d0e4;
  --muted: #9aa5c8; --line: #33416e; --clay: #ffc94d; --sage: #7fae8b; --ochre: #ffc94d; --cheek: #f4a493;
  --serif: "Fredoka", system-ui, sans-serif; --sans: "Nunito Sans", system-ui, sans-serif; --r: 16px;
  background-color: var(--paper);
  /* a few faint stars */
  background-image: radial-gradient(1.5px 1.5px at 12% 18%, rgba(245,243,238,.35), transparent),
    radial-gradient(1px 1px at 78% 9%, rgba(245,243,238,.3), transparent),
    radial-gradient(1.5px 1.5px at 64% 42%, rgba(255,201,77,.25), transparent),
    radial-gradient(1px 1px at 30% 70%, rgba(245,243,238,.25), transparent),
    radial-gradient(1px 1px at 90% 80%, rgba(245,243,238,.25), transparent);
  background-size: 640px 640px; background-attachment: fixed;
}
.night h1, .night h2, .night h3, .night legend { font-weight: 600; letter-spacing: 0; }
.night .hero h1 { font-weight: 600; letter-spacing: -0.01em; }
.night em { font-style: normal; }
.night .hero h1 em, .night .account-head h1 em { color: var(--clay); }

/* logo */
.night .logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 600; font-size: 26px; color: var(--ink); letter-spacing: 0; }
.night .logo svg { width: 34px; height: 34px; flex: none; }
.night .logo em { color: var(--ink); font-weight: 600; }

/* buttons and links */
.night .btn { border-color: var(--ink); color: var(--ink); font-family: var(--serif); font-weight: 500; font-size: 16px; }
.night .btn.primary { background: var(--clay); border-color: var(--clay); color: #172142; }
.night .btn.primary:hover { background: #ffd978; border-color: #ffd978; color: #172142; }
.night .btn.ghost:hover { background: var(--ink); color: #172142; }
.night .btn.primary.danger { background: #e8806e; border-color: #e8806e; color: #172142; }
.night .link { text-decoration-color: #4a5788; }
.night .link.danger:hover { color: #ff9a8a; }
.night .steps li > * { color: #6f7aa0; }

/* fields */
.night input:not([type=checkbox]):not([type=color]), .night select, .night textarea, .night .dialog-input {
  background: var(--field); color: var(--ink); border-color: var(--line); }
.night input::placeholder, .night textarea::placeholder { color: #7d87a8; }
.night input:focus, .night select:focus, .night textarea:focus { border-color: var(--clay); }
.night .title-input { color: var(--ink); }
.night .consent { background: var(--field); }
.night .drop { border-color: #4a5788; }
.night .drop.lead { background: var(--field); border-color: var(--clay); }
.night .sw { border-color: var(--card); }

/* cards, notices, overlays */
.night .char-card .tick { background: var(--clay); color: #172142; }
.night .char-card.selected { border-color: var(--clay); box-shadow: 0 0 0 1px var(--clay); }
.night .notice { background: rgba(255,201,77,.1); border-color: rgba(255,201,77,.35); color: var(--ink); }
.night #loading { background: rgba(23,33,66,.94); color: var(--ink); }
.night .spinner { border-top-color: var(--clay); }
.night .dialog-backdrop { background: rgba(8,12,28,.6); }
.night .dialog { box-shadow: 0 30px 80px -30px rgba(0,0,0,.7); }
.night .look-inside { background: rgba(15,23,48,.88); color: var(--ink); }
.night .reader { background: #0f1730; }
.night .reader-cta { background: var(--clay); border-color: var(--clay); color: #172142; }
.night .soon-row > div { border-color: #4a5788; }
.night .shelf-card.current canvas { outline-color: var(--clay); }

/* the "Your own story" board book */
.night .board-book.own { background: #2e3c6b; }
.night .own-cover { color: var(--ink); font-weight: 600; }
.night .own-cover small { color: var(--ink-2); }
.night .book-stage { background: var(--paper-2); }
.night .story-price { color: var(--clay); }

/* ---------- Nightlight on cream: the site's look ----------
   Same logo, fonts and butter-yellow buttons, on a warm cream background with navy text.
   These rules come last, so they override the navy values above. */
body.night {
  --paper: #fbf6ea; --paper-2: #f3ead6; --card: #ffffff; --field: #ffffff; --ink: #1e2a4a; --ink-2: #4a5470;
  --muted: #5f6886; --line: #e6dcc6; --clay: #8f6200; --ochre: #ffc94d;
  background-image: none;
}
/* butter buttons get a honey edge so they stand off the cream page */
.night .btn.primary { background: #ffc94d; border-color: #b8820f; color: #1e2a4a; box-shadow: 0 3px 0 #b8820f; }
.night .btn.primary:hover { background: #ffd56e; border-color: #b8820f; }
.night .btn.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #b8820f; }
.night .btn.primary:disabled { box-shadow: none; }
.night .btn.ghost:hover { background: #1e2a4a; color: #fbf6ea; }
/* one butter yellow everywhere: a highlighter stroke behind the word, navy text on top (13:1) */
.night .hero h1 em, .night .account-head h1 em { color: var(--ink);
  background: linear-gradient(transparent 60%, #ffc94d 60%, #ffc94d 92%, transparent 92%);
  padding: 0 .06em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.night .logo svg path:last-child { fill: #ffc94d; }
.night .char-card .tick { background: #ffc94d; color: #1e2a4a; }
.night .char-card.selected { border-color: #1e2a4a; box-shadow: 0 0 0 1px #1e2a4a; }
.night .notice { background: #fff4d6; border-color: #f0d68f; }
.night #loading { background: rgba(251,246,234,.94); }
.night .dialog-backdrop { background: rgba(30,42,74,.35); }
.night .dialog { box-shadow: 0 30px 80px -30px rgba(30,42,74,.45); }
.night .drop { border-color: #d8ccb2; }
.night .drop.lead { background: #fffdf7; border-color: #e3b23c; }
.night .steps li > * { color: #8a90a8; }
.night .link { text-decoration-color: #d8ccb2; }
.night .link.danger:hover { color: #b03a2e; }
.night .shelf-card.current canvas { outline-color: #1e2a4a; }
.night .story-price { color: #8f6200; }
.night .own-cover { color: #f5f3ee; }
.night .own-cover small { color: #c9d0e4; }
.night .look-inside { background: rgba(30,42,74,.88); color: #f5f3ee; }
