/* ============================================================
   Magic Days — book renderer (foundation)
   Renders a book.json-style page array into on-screen "pages"
   at a landscape photo-book trim, themed like the reference book,
   and prints/exports them for hand-off to a photo-book service.
   ============================================================ */

/* ----- build section chrome ----- */
.md-build{ padding:56px 0 80px; border-top:1px solid var(--rule); }
.build-head{ text-align:center; margin-bottom:26px; }
.build-controls{ display:flex; flex-wrap:wrap; gap:12px; justify-content:center; margin:0 auto 30px; }

.day-editors{ display:flex; flex-direction:column; gap:14px; max-width:920px; margin:0 auto 28px; }
.day-ed{ background:var(--paper); border:1px solid var(--rule); border-radius:var(--radius-sm); padding:16px; box-shadow:var(--shadow-sm); }
.day-ed .day-ed-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:8px; }
.day-ed .day-ed-head h4{ font-family:'Fredoka',sans-serif; font-weight:600; color:var(--ink); margin:0; font-size:1.1rem; }
.day-ed textarea{ width:100%; min-height:120px; resize:vertical; font-family:'Nunito',sans-serif; font-size:.95rem;
  color:var(--ink); border:1.5px solid var(--rule); border-radius:10px; padding:.7em .85em; background:#FFFDFA; line-height:1.5; }
.day-ed textarea:focus{ outline:none; border-color:var(--gold); box-shadow:0 0 0 3px rgba(240,169,59,.18); }
.day-ed .btn-draft{ font-size:.85rem; padding:.45em 1em; white-space:nowrap; }
.day-ed .draft-status{ font-size:.82rem; color:var(--twilight); font-weight:700; min-height:1.1em; margin:6px 0 0; }
.day-ed .draft-status.err{ color:var(--rose-deep); }

/* ----- the rendered book ----- */
.book-doc{ display:flex; flex-direction:column; align-items:center; gap:26px; }
.book-page{
  /* LOCKED to the 9x7 print trim (canonical 1000x778px). Fixed size on EVERY device —
     the page never reflows or rescales by viewport, so it always looks exactly like print.
     On small screens you scroll + pinch-zoom to navigate; the layout never changes. */
  position:relative; width:1000px; height:778px; flex:0 0 auto; overflow:hidden;
  border-radius:10px; box-shadow:var(--shadow); background:#fff; color:#3a3340;
  -webkit-print-color-adjust:exact; print-color-adjust:exact;
}
.book-page .bp-pad{ position:absolute; inset:0; padding:7% 7.5%; display:flex; flex-direction:column; }
.bp-title{ font-family:'Fredoka',sans-serif; font-weight:600; font-size:1.7rem; color:#2c2738;
  border-bottom:2px solid currentColor; padding-bottom:4px; margin:0 0 14px; align-self:flex-start; }
.bp-plan{ column-count:2; column-gap:8%; white-space:pre-wrap; font-size:.92rem; line-height:1.5; flex:1; overflow:hidden; }
.bp-empty-note{ color:#9a90a0; font-style:italic; }

/* day-page themes (echoing the reference book's color-coded days) */
.theme-0{ background:linear-gradient(160deg,#efe4c8,#e7d9bb); }   /* kraft */
.theme-1{ background:linear-gradient(160deg,#d6e7ee,#c6dde7); }   /* leafy blue */
.theme-2{ background:linear-gradient(160deg,#e2dcef,#d4cbe6); }   /* lavender */
.theme-3{ background:linear-gradient(160deg,#f8d2d6,#f4c2c9); }   /* pink */
.theme-4{ background:linear-gradient(160deg,#e3e6ad,#d8dc9c); }   /* yellow-green */
.theme-5{ background:linear-gradient(160deg,#f3b9a6,#ef9f88); }   /* coral */

/* cover + back */
.bp-cover, .bp-back{ background:#23204d; display:flex; align-items:center; justify-content:center; padding:0; }
.bp-cover .cover-inner{ position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:14px; padding:6%; }
.bp-cover img{ width:82%; max-height:64%; object-fit:cover; border:6px solid #fff; border-radius:4px; box-shadow:0 10px 30px rgba(0,0,0,.4); }
.bp-cover .cover-fallback{ width:82%; aspect-ratio:5/3; border:6px solid #fff; border-radius:4px;
  background:linear-gradient(180deg,#BFE3F6,#E7F2D9 78%,#D8EBC2); display:flex; align-items:center; justify-content:center; color:#6a6a6a; font-family:'Fredoka',sans-serif; }
.cover-words{ text-align:center; color:#fff; }
.cover-words .cw-fam{ font-family:'Caveat',cursive; font-size:1.7rem; color:#ffd98c; display:block; line-height:1; }
.cover-words .cw-title{ font-family:'Fredoka',sans-serif; font-weight:700; font-size:2rem; display:block; line-height:1.05;
  background:linear-gradient(120deg,#ffd98c,#ff9e8f); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
.cover-words .cw-sub{ font-size:.8rem; letter-spacing:1px; text-transform:uppercase; opacity:.85; }
.bp-back .back-words{ color:#cdbfe0; font-family:'Caveat',cursive; font-size:1.5rem; text-align:center; }

/* challenge / list pages */
.bp-list .bp-items{ list-style:none; padding:0; margin:0; flex:1; display:flex; flex-direction:column; gap:10px; overflow:hidden; }
.bp-list .bp-items li{ font-size:.96rem; line-height:1.35; padding-left:1.4em; position:relative; }
.bp-list .bp-items li::before{ content:"✦"; position:absolute; left:0; color:#d98a4f; }
.bp-sub{ margin:-8px 0 14px; font-size:.86rem; color:#6b6276; }

/* autograph page */
.bp-auto{ background:linear-gradient(160deg,#eae3f6,#dbe7f6); }
.bp-auto .auto-frame{ flex:1; border:3px dashed rgba(122,107,176,.5); border-radius:18px; margin-top:4px;
  display:flex; align-items:flex-start; justify-content:center; padding-top:10px; }
.bp-auto .auto-frame span{ font-family:'Caveat',cursive; font-size:1.4rem; color:#9a8fc0; }

/* notes page */
.bp-notes .notes-lines{ flex:1; background-image:repeating-linear-gradient(transparent, transparent 31px, rgba(0,0,0,.12) 32px); margin-top:6px; }

/* page caption under each page in preview */
.page-cap{ font-size:.78rem; color:var(--ink-faint); margin-top:-16px; }

/* hand-off note */
.handoff{ max-width:680px; margin:30px auto 0; background:var(--paper); border:1px solid var(--rule);
  border-radius:var(--radius); padding:20px 24px; box-shadow:var(--shadow-sm); }
.handoff h4{ font-family:'Fredoka',sans-serif; margin:0 0 8px; color:var(--ink); }
.handoff p, .handoff li{ color:var(--ink-soft); font-size:.92rem; }

/* ----- print: only the book pages, one per sheet ----- */
@media print{
  @page{ size:9in 7in; margin:0; }          /* 9x7 landscape (Lulu Small Landscape) trim, one page per sheet */
  html,body{ background:#fff !important; margin:0; padding:0; }
  .md-topbar,.md-hero,.md-pitch,.md-inside,.md-how,.md-start,.md-footer,
  .build-head,.build-controls,.day-editors,.handoff,.page-cap,.crop-modal{ display:none !important; }
  .md-build{ padding:0 !important; border:0 !important; margin:0 !important; }
  .md-wrap{ max-width:none !important; padding:0 !important; margin:0 !important; }
  .book-doc{ gap:0 !important; display:block !important; }
  .book-page{
    max-width:none !important; width:100% !important; height:100vh !important;
    aspect-ratio:auto !important; border-radius:0 !important; box-shadow:none !important;
    break-after:page; page-break-after:always; break-inside:avoid;
  }
  .book-page:last-child{ break-after:auto; page-break-after:auto; }
  /* force backgrounds/colors to print (Firefox/Chrome/Safari) */
  .book-page, .book-page *{ -webkit-print-color-adjust:exact !important; print-color-adjust:exact !important; }
}

/* The book page is print-locked (fixed 1000x778) and must NOT reflow by viewport —
   no page-internal @media font/size overrides. Mobile navigates via scroll + pinch-zoom. */

/* ----- flights (travel) block in the build area ----- */
.travel-block{ max-width:920px; margin:0 auto 24px; background:var(--paper); border:1px solid var(--rule);
  border-radius:var(--radius-sm); padding:16px 18px; box-shadow:var(--shadow-sm); }
.travel-h{ font-family:'Fredoka',sans-serif; margin:0 0 10px; color:var(--ink); font-size:1.05rem; }
.travel-h span{ font-weight:400; font-size:.82rem; color:var(--ink-faint); }
.travel-fields{ display:flex; flex-wrap:wrap; gap:12px; align-items:flex-end; }
.travel-fields .field{ flex:1 1 180px; }
.travel-results{ margin:10px 0 0; font-size:.9rem; color:var(--ink-soft); min-height:1em; }

/* ----- travel line on day pages + in-book game pages ----- */
.bp-travel{ margin:0 0 10px; font-weight:700; color:#2c2738; font-size:.95rem;
  background:rgba(255,255,255,.55); display:inline-block; padding:4px 12px; border-radius:10px; }
.bp-game .bp-pad{ overflow:hidden; }
.bp-game-host{ height:100%; overflow:hidden; font-size:.8rem; }
.bp-game-host .game-title{ margin-top:0; }

/* ----- save / resume bar ----- */
.save-bar{ max-width:920px; margin:0 auto 18px; display:flex; flex-wrap:wrap; align-items:center; gap:10px;
  background:var(--paper); border:1px solid var(--rule); border-radius:var(--radius-sm); padding:12px 16px; box-shadow:var(--shadow-sm); }
.save-label{ font-family:'Fredoka',sans-serif; font-weight:600; color:var(--ink); }
.save-bar input[type=email]{ flex:1 1 200px; font-family:'Nunito',sans-serif; font-size:1rem; padding:.55em .8em;
  border:1.5px solid var(--rule); border-radius:var(--radius-sm); background:#FFFDFA; }
.save-bar input[type=email]:focus{ outline:none; border-color:var(--gold); box-shadow:0 0 0 3px rgba(240,169,59,.18); }
.save-status{ flex:1 1 100%; font-size:.88rem; color:var(--twilight); font-weight:700; min-height:1em; }

/* ----- trip insights (planning panel; not printed) ----- */
.insights{ max-width:920px; margin:0 auto 22px; }
.insights-card{ background:var(--paper); border:1px solid var(--rule); border-radius:var(--radius-sm); padding:16px 18px; box-shadow:var(--shadow-sm); }
.insights-card h4{ font-family:'Fredoka',sans-serif; margin:0 0 12px; color:var(--ink); }
.insights-card h4 span{ font-weight:400; font-size:.8rem; color:var(--ink-faint); }
.heatmap{ display:flex; flex-wrap:wrap; gap:8px; }
.heat-day{ flex:1 1 84px; min-width:84px; border-radius:10px; padding:8px 6px; text-align:center;
  color:#3a3340; background:var(--c); border:1px solid rgba(0,0,0,.07); display:flex; flex-direction:column; gap:1px; }
.heat-dow{ font-weight:700; font-size:.74rem; text-transform:uppercase; letter-spacing:.4px; }
.heat-date{ font-size:.95rem; font-weight:700; }
.heat-band{ font-size:.74rem; }
.heat-lvl{ font-size:.72rem; color:#5a5260; }
.insights-note{ font-size:.86rem; color:var(--ink-soft); margin:12px 0 0; }
.insights-sub{ font-family:'Fredoka',sans-serif; margin:14px 0 6px; color:var(--ink); font-size:1rem; }
.insights-closures{ margin:0; padding-left:1.2em; columns:2; font-size:.88rem; color:var(--ink-soft); }
.insights-closures li{ break-inside:avoid; }

/* ----- #28 insights calendar: busyness fill bars + travel-day badges ----- */
.heat-day{ position:relative; overflow:hidden; }
.heat-bar{ position:absolute; left:0; right:0; bottom:0; height:var(--fill,0%); background:var(--c,#ccc); opacity:.20; z-index:0; }
.heat-day > span:not(.heat-bar){ position:relative; z-index:1; }
.heat-travel{ display:block; font-size:.6rem; font-weight:700; color:#fff; background:var(--c,#888); border-radius:6px; padding:1px 5px; margin:0 auto 3px; width:max-content; }
.heat-day.heat-trav{ outline:2px solid var(--c,#888); outline-offset:-2px; }

/* ============================================================
   Cover styles — 5 layouts. The AI art carries NO text; the title is
   overlaid here via CSS so it stays crisp (like Britt's spine title).
   ============================================================ */

/* 1) Classic Keepsake — navy cover, white-framed portrait, vertical spine title (Britt's) */
.bp-cover.cover-classic_keepsake{ background:#1f1c44; background-image:radial-gradient(120% 90% at 35% 18%, #2e2a66, #181530 82%); }
.cover-classic_keepsake .cover-inner{ flex-direction:row; padding:6.5% 6.5% 6.5% 13%; }
.cover-classic_keepsake img{ width:100%; max-height:84%; object-fit:cover; border:7px solid #fbf7ef; border-radius:3px; box-shadow:0 12px 34px rgba(0,0,0,.5); }
.cover-classic_keepsake .cover-words{ position:absolute; left:0; top:0; bottom:0; width:12%; display:flex; flex-direction:row;
  align-items:center; justify-content:center; gap:10px; writing-mode:vertical-rl; text-align:center; }
.cover-classic_keepsake .cw-fam{ font-family:'Caveat',cursive; color:#ffd98c; font-size:1.3rem; line-height:1; }
.cover-classic_keepsake .cw-title{ font-family:'Fredoka',sans-serif; font-weight:600; color:#efe6d4; font-size:1rem; letter-spacing:1px;
  -webkit-text-fill-color:#efe6d4; background:none; }
.cover-classic_keepsake .cw-sub{ display:none; }

/* 2) Storybook Scene — full-bleed art, translucent title banner at the bottom */
.bp-cover.cover-storybook_scene{ background:#10243a; }
.cover-storybook_scene .cover-inner{ padding:0; }
.cover-storybook_scene img{ width:100%; height:100%; max-height:none; object-fit:cover; border:0; border-radius:0; box-shadow:none; }
.cover-storybook_scene .cover-words{ position:absolute; left:0; right:0; bottom:0; padding:14% 8% 6%; text-align:center;
  background:linear-gradient(to top, rgba(10,14,40,.82), rgba(10,14,40,0)); }
.cover-storybook_scene .cw-fam{ font-family:'Caveat',cursive; color:#ffe4a3; font-size:1.7rem; display:block; line-height:1; }
.cover-storybook_scene .cw-title{ font-family:'Fredoka',sans-serif; font-weight:700; font-size:1.7rem; display:block; color:#fff;
  -webkit-text-fill-color:#fff; background:none; }
.cover-storybook_scene .cw-sub{ font-size:.72rem; letter-spacing:2px; text-transform:uppercase; color:#cfe0f0; }

/* 3) Vintage Postcard — thick white border, art inset, bold title + script subtitle */
.bp-cover.cover-vintage_postcard{ background:#e9ddc4; }
.cover-vintage_postcard .cover-inner{ padding:5%; }
.cover-vintage_postcard img{ width:100%; height:100%; max-height:none; object-fit:cover; border:10px solid #fff; border-radius:2px;
  box-shadow:0 6px 18px rgba(80,60,30,.35); }
.cover-vintage_postcard .cover-words{ position:absolute; left:8%; right:8%; top:9%; text-align:center; }
.cover-vintage_postcard .cw-fam{ display:none; }
.cover-vintage_postcard .cw-title{ font-family:'Fredoka',sans-serif; font-weight:700; font-size:2rem; color:#e0492f;
  -webkit-text-fill-color:#e0492f; background:none; text-shadow:1px 1px 0 #fff, 2px 2px 0 rgba(0,0,0,.15); letter-spacing:1px; }
.cover-vintage_postcard .cw-sub{ display:inline-block; margin-top:4px; font-family:'Caveat',cursive; font-size:1.15rem; color:#3a3340;
  background:rgba(255,255,255,.78); padding:1px 12px; border-radius:12px; }

/* 4) Animated Poster — full-bleed, bold masthead at top with gradient scrim */
.bp-cover.cover-pixar_poster{ background:#0b1230; }
.cover-pixar_poster .cover-inner{ padding:0; }
.cover-pixar_poster img{ width:100%; height:100%; max-height:none; object-fit:cover; border:0; border-radius:0; box-shadow:none; }
.cover-pixar_poster .cover-words{ position:absolute; left:0; right:0; top:0; padding:6% 8% 13%; text-align:center;
  background:linear-gradient(to bottom, rgba(7,10,30,.8), rgba(7,10,30,0)); }
.cover-pixar_poster .cw-fam{ font-family:'Fredoka',sans-serif; font-weight:700; color:#ffd166; font-size:1.05rem; letter-spacing:3px;
  text-transform:uppercase; display:block; }
.cover-pixar_poster .cw-title{ font-family:'Fredoka',sans-serif; font-weight:700; font-size:2.3rem; display:block; line-height:1;
  background:linear-gradient(120deg,#ffe29a,#ff8fab,#8fd3ff); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
.cover-pixar_poster .cw-sub{ font-size:.7rem; letter-spacing:2px; text-transform:uppercase; color:#cdd7f0; }

/* 5) Watercolor Dream — full-bleed soft art, hand-lettered centered title on a wash */
.bp-cover.cover-watercolor_dream{ background:#f4eef7; }
.cover-watercolor_dream .cover-inner{ padding:0; }
.cover-watercolor_dream img{ width:100%; height:100%; max-height:none; object-fit:cover; border:0; border-radius:0; box-shadow:none; }
.cover-watercolor_dream .cover-words{ position:absolute; left:8%; right:8%; bottom:7%; text-align:center;
  background:rgba(255,255,255,.55); border-radius:16px; padding:10px 14px; }
.cover-watercolor_dream .cw-fam{ font-family:'Caveat',cursive; color:#9a6cb0; font-size:1.8rem; display:block; line-height:1; }
.cover-watercolor_dream .cw-title{ font-family:'Caveat',cursive; font-weight:700; font-size:1.6rem; display:block; color:#4a6a8a;
  -webkit-text-fill-color:#4a6a8a; background:none; }
.cover-watercolor_dream .cw-sub{ font-size:.7rem; letter-spacing:1.5px; text-transform:uppercase; color:#8a7fa0; }

/* ============================================================
   Page manager — include / exclude / reorder / edit pages
   ============================================================ */
.page-manager{ max-width:920px; margin:0 auto 22px; background:var(--paper); border:1px solid var(--rule); border-radius:var(--radius-sm); padding:16px 18px; box-shadow:var(--shadow-sm); }
.pm-head{ display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px; margin-bottom:12px; }
.pm-head h4{ font-family:'Fredoka',sans-serif; margin:0; color:var(--ink); }
.pm-head h4 span{ font-weight:400; font-size:.8rem; color:var(--ink-faint); }
.pm-actions{ display:flex; gap:8px; }
.pm-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:6px; }
.pm-item{ display:flex; align-items:center; gap:10px; padding:7px 10px; background:#FFFDFA; border:1px solid var(--rule); border-radius:10px; }
.pm-item.pm-off{ opacity:.5; }
.pm-inc{ display:flex; align-items:center; margin:0; }
.pm-inc input{ width:17px; height:17px; accent-color:var(--gold); cursor:pointer; }
.pm-title{ flex:1; font-weight:700; color:var(--ink); font-size:.95rem; }
.pm-tag{ font-size:.68rem; text-transform:uppercase; letter-spacing:.5px; color:var(--ink-faint); background:rgba(0,0,0,.05); padding:2px 7px; border-radius:8px; }
.pm-move{ display:flex; gap:4px; }
.pm-btn{ border:1px solid var(--rule); background:#fff; border-radius:8px; padding:3px 9px; cursor:pointer; font-size:.85rem; color:var(--ink); font-family:inherit; }
.pm-btn:hover:not(:disabled){ border-color:var(--gold); }
.pm-btn:disabled{ opacity:.35; cursor:default; }
.pm-edit{ white-space:nowrap; }
.pm-edit-gap{ display:inline-block; width:62px; }

/* day intro line + journal prompt on day pages */
.bp-intro-line{ font-style:italic; color:#5a5260; margin:0 0 10px; font-size:.95rem; }
.bp-journal-q{ margin:12px 0 0; font-weight:700; color:#2c2738; font-size:.92rem;
  border-top:1px dashed rgba(0,0,0,.18); padding-top:8px; }

@media print{ .page-manager{ display:none !important; } }

/* ============================================================
   Phase-2 editor (editor.php) — admin shell, tabs, stage, spread
   ============================================================ */
.md-admin{ min-height:100vh; background:#f3eee7; }
.admin-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 22px; background:#23204d; color:#fff; box-shadow:0 2px 12px rgba(0,0,0,.18); position:sticky; top:0; z-index:30; }
.admin-id{ font-family:'Fredoka',sans-serif; font-size:1.15rem; }
.admin-id strong{ color:#ffd98c; }
.admin-id span{ opacity:.7; font-weight:400; font-size:.9rem; }
.admin-head-tools{ display:flex; align-items:center; gap:12px; }
.admin-head-tools .save-status{ color:#cde8d4; font-size:.85rem; }
.admin-head .btn-ghost{ color:#fff; border-color:rgba(255,255,255,.4); }
.admin-tabs{ display:flex; justify-content:center; gap:2px; padding:0 16px; background:#2c2961; position:sticky; top:55px; z-index:29; flex-wrap:wrap; }
.atab{ appearance:none; border:0; background:transparent; color:#cfc9f0; cursor:pointer; font-family:'Fredoka',sans-serif; font-size:1rem; padding:12px 18px; border-bottom:3px solid transparent; }
.atab:hover{ color:#fff; }
.atab.is-active{ color:#fff; border-bottom-color:#ffd98c; background:rgba(255,255,255,.06); }
.apanel{ display:none; }
.apanel.is-active{ display:block; }
.apanel-wrap{ max-width:960px; margin:0 auto; padding:24px 22px 70px; }
.trip-basics{ display:flex; flex-wrap:wrap; gap:12px; margin-bottom:16px; }
.trip-basics .field{ flex:1 1 180px; }

/* (3) pages two-pane */
.pages-layout{ display:grid; grid-template-columns:300px 1fr; min-height:calc(100vh - 100px); }
.pages-rail{ border-right:1px solid var(--rule); background:var(--paper); padding:16px; overflow:auto; }
.rail-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.rail-head h4{ font-family:'Fredoka',sans-serif; margin:0; color:var(--ink); }
.btn-sm{ padding:3px 10px; font-size:.82rem; }
.rail-hint{ font-size:.76rem; color:var(--ink-faint); margin:12px 4px 0; }
.pages-rail .pm-item{ cursor:pointer; }
.pm-grip{ cursor:grab; color:var(--ink-faint); font-size:1rem; padding:0 2px; -webkit-user-select:none; user-select:none; }
.pm-item.pm-active{ border-color:var(--gold); box-shadow:0 0 0 2px rgba(240,169,59,.28); }
.pm-item.dragging{ opacity:.4; }
.pm-item.drop-above{ box-shadow:0 -3px 0 var(--gold); }
.pm-item.drop-below{ box-shadow:0 3px 0 var(--gold); }

.page-stage{ display:flex; align-items:flex-start; gap:12px; padding:24px 18px 60px; justify-content:center; overflow-x:auto; -webkit-overflow-scrolling:touch; }   /* the fixed page scrolls within the panel on mobile — chrome stays put */
.stage-mid{ flex:1 1 auto; max-width:860px; display:flex; flex-direction:column; align-items:center; gap:16px; min-width:0; }
.stage-page{ width:100%; display:flex; justify-content:center; }
.stage-page .book-page{ zoom:.76; max-width:none; flex:0 0 auto; }   /* uniform scale of the fixed page — layout identical to print, no reflow */
.stage-edit{ width:100%; max-width:820px; }
.stage-arrow{ position:sticky; top:46vh; flex:0 0 auto; width:46px; height:46px; border-radius:50%; border:1px solid var(--rule); background:#fff; color:var(--ink); font-size:1.6rem; line-height:1; cursor:pointer; box-shadow:var(--shadow-sm); }
.stage-arrow:hover{ border-color:var(--gold); }
.stage-arrow:disabled{ opacity:.3; cursor:default; }
.se-card{ background:var(--paper); border:1px solid var(--rule); border-radius:var(--radius-sm); padding:14px 16px; box-shadow:var(--shadow-sm); }
.se-card h5{ font-family:'Fredoka',sans-serif; margin:0 0 8px; color:var(--ink); }
.stage-edit textarea{ width:100%; min-height:150px; resize:vertical; font-family:'Nunito',sans-serif; font-size:.95rem; color:var(--ink); border:1.5px solid var(--rule); border-radius:10px; padding:.7em .85em; background:#FFFDFA; line-height:1.5; }
.stage-edit textarea:focus{ outline:none; border-color:var(--gold); box-shadow:0 0 0 3px rgba(240,169,59,.18); }
.se-row{ display:flex; gap:12px; align-items:center; margin-top:10px; flex-wrap:wrap; }
.se-note{ font-size:.88rem; color:var(--ink-soft); }
.se-inc{ font-size:.9rem; color:var(--ink); display:flex; align-items:center; gap:6px; }

/* (4) print spread */
.print-bar{ max-width:1040px; margin:0 auto; padding:18px 22px 4px; display:flex; align-items:center; gap:16px; flex-wrap:wrap; }
.spread-toggle{ font-size:.9rem; color:var(--ink-soft); display:flex; align-items:center; gap:6px; }
.spread-pos{ font-size:.85rem; color:var(--ink-faint); margin-left:auto; }
.spread-stage{ display:flex; align-items:center; justify-content:center; gap:12px; padding:12px 18px 60px; overflow-x:auto; -webkit-overflow-scrolling:touch; }
.spread-view{ display:flex; gap:0; box-shadow:var(--shadow); border-radius:6px; overflow:hidden; background:#fff; }
.spread-view .book-page{ zoom:.46; max-width:none; border-radius:0; box-shadow:none; }   /* uniform scale; layout identical to print */
.spread-view.single .book-page{ zoom:.68; max-width:none; }
.spread-blank{ width:1000px; height:778px; zoom:.46; max-width:none; background:#eee7dc; }
.print-source{ display:none; }
.send-placeholder{ text-align:center; padding-top:48px; }
.send-placeholder h3{ font-family:'Fredoka',sans-serif; color:var(--ink); font-size:1.4rem; }

@media (max-width:820px){
  .pages-layout{ grid-template-columns:1fr; }      /* editor CHROME stacks on mobile (the book page stays print-locked) */
  .pages-rail{ border-right:0; border-bottom:1px solid var(--rule); }
}
/* editor chrome (NOT the book page) made reachable on phones */
@media (max-width:680px){
  .admin-head{ flex-wrap:wrap; padding:10px 14px; }
  .admin-head-tools{ flex-wrap:wrap; gap:8px; }
  .head-email{ width:120px; }
  .apanel-wrap{ padding:16px 10px 70px; }
  .page-stage{ padding:12px 6px 60px; }
  .stage-mid{ max-width:100%; }
}
@media print{
  .admin-head, .admin-tabs, .admin-body{ display:none !important; }
  .print-source{ display:block !important; }
}

/* admin-mode badge + landing admin cog */
body.admin-editing .admin-id::after{ content:" · ADMIN EDITING"; color:#ff9e8f; font-weight:700; font-size:.72em; letter-spacing:.5px; }
.topbar-admin{ font-size:1.15rem; text-decoration:none; line-height:1; }
.admin-thumb{ height:34px; width:46px; object-fit:cover; border-radius:4px; border:2px solid #fff; box-shadow:0 1px 5px rgba(0,0,0,.4); vertical-align:middle; margin-right:9px; }
.build-hint{ flex:1 1 100%; color:var(--ink-soft); font-size:.9rem; margin:0 0 8px; }
.build-hint strong{ color:var(--ink); }
.admin-foot{ position:sticky; bottom:0; z-index:28; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 22px; background:#fff; border-top:1px solid var(--rule); box-shadow:0 -3px 12px rgba(0,0,0,.07); }
.foot-step{ font-family:'Fredoka',sans-serif; color:var(--ink-soft); font-weight:600; font-size:.95rem; }
.foot-actions{ display:flex; gap:10px; }
@media print{ .admin-foot{ display:none !important; } }

/* lazy-generate loading state (spinning ✨ + pulsing text) */
.md-gen{ display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; flex:1; color:#6b6276; }
.md-gen-star{ display:inline-block; font-size:2.6rem; animation:md-spin 1.1s linear infinite; }
.md-gen-text{ font-family:'Fredoka',sans-serif; font-size:1.05rem; animation:md-pulse 1.3s ease-in-out infinite; }
@keyframes md-spin{ to{ transform:rotate(360deg); } }
@keyframes md-pulse{ 0%,100%{ opacity:.4; } 50%{ opacity:1; } }

/* ============================================================
   Book structure pages: blank · section title · table of contents
   ============================================================ */
.bp-blank{ background:#fcf9f3; }
.bp-section{ display:flex; align-items:center; justify-content:center; }
.bp-section .bp-pad{ display:flex; align-items:center; justify-content:center; }
.sec-inner{ text-align:center; }
.sec-kicker{ display:block; font-family:'Nunito',sans-serif; text-transform:uppercase; letter-spacing:3px; font-size:.8rem; color:rgba(0,0,0,.45); margin-bottom:8px; }
.sec-title{ font-family:'Fredoka',sans-serif; font-weight:700; font-size:2.4rem; color:#2c2738; margin:0; }
.toc-title{ font-family:'Fredoka',sans-serif; font-weight:700; font-size:1.7rem; color:#2c2738; border-bottom:2px solid currentColor; padding-bottom:4px; margin:0 0 18px; }
.toc-list{ list-style:none; margin:0; padding:0; }
.toc-list li{ display:flex; align-items:baseline; gap:8px; font-size:1.05rem; color:#3a3340; margin:11px 0; }
.toc-name{ font-weight:700; }
.toc-dots{ flex:1; border-bottom:2px dotted rgba(0,0,0,.25); transform:translateY(-4px); }
.toc-pg{ font-weight:700; color:#6b6276; }

/* ============================================================
   I Spy: collage (left) + find-it checklist (right) — the sample's signature spread
   ============================================================ */
.bp-ispy{ display:flex; background:#fdf6e9; }
.bp-ispy .ispy-art{ flex:0 0 62%; background-size:cover; background-position:center; }
.bp-ispy .ispy-list{ flex:1; padding:6% 5%; background:linear-gradient(160deg,#fbe9c8,#f6d9a8); display:flex; flex-direction:column; overflow:hidden; }
.ispy-h{ font-family:'Fredoka',sans-serif; font-weight:700; font-size:1.8rem; color:#c0531f; margin:0; line-height:1; }
.ispy-sub{ font-size:.82rem; color:#7a5230; margin:3px 0 12px; font-weight:700; }
.spy-items{ list-style:none; margin:0; padding:0; }
.spy-items li{ position:relative; padding-left:1.7em; margin:6px 0; line-height:1.25; font-size:.92rem; color:#3a3340; }
.spy-items li::before{ content:"\2610"; position:absolute; left:0; color:#c0531f; font-size:1.05em; }

/* ============================================================
   Autograph page: original character art + big blank signing space (one-sided)
   ============================================================ */
.bp-auto{ position:relative; background:linear-gradient(160deg,#eae3f6,#dbe7f6); overflow:hidden; }
.bp-auto .auto-char{ position:absolute; right:1%; bottom:0; height:60%; max-width:46%; object-fit:contain; filter:drop-shadow(0 4px 10px rgba(0,0,0,.18)); }
.bp-auto .auto-pad{ position:absolute; inset:0; padding:7% 7.5%; display:flex; flex-direction:column; }
.bp-auto .auto-h{ font-family:'Fredoka',sans-serif; font-weight:600; font-size:1.5rem; color:#5b4a86; margin:0 0 12px; }
.bp-auto .auto-frame{ flex:1; border:3px dashed rgba(122,107,176,.5); border-radius:18px; margin-right:34%; display:flex; align-items:flex-start; justify-content:center; padding-top:12px; }
.bp-auto .auto-frame span{ font-family:'Caveat',cursive; font-size:1.3rem; color:#9a8fc0; }

.spread-view .bp-blank{ background:#f3ece0; }
/* (removed mobile reflow of .bp-ispy — the I-Spy page is print-locked, never reflows) */

/* PDF capture (html2canvas): un-hide the print source off-screen at the book trim (10x8 = 1000x800px) */
body.md-capturing #book-output{ display:block !important; position:fixed; left:-20000px; top:0; width:1000px; background:#fff; z-index:-1; }
body.md-capturing #book-output .book-page{ width:1000px !important; height:778px !important; max-width:none !important; min-width:0 !important; aspect-ratio:auto !important; border-radius:0 !important; box-shadow:none !important; margin:0 0 6px !important; }

/* ----- #21 consolidation: header save, collapsible trip details, on-page Update ----- */
.head-email{ width:150px; padding:.4em .6em; border:1px solid rgba(255,255,255,.4); border-radius:8px; background:rgba(255,255,255,.12); color:#fff; font-size:.85rem; }
.head-email::placeholder{ color:rgba(255,255,255,.6); }
.admin-head-tools .btn-sm{ padding:5px 10px; font-size:.82rem; }
.trip-details{ max-width:1040px; margin:0 auto 4px; background:var(--paper); border:1px solid var(--rule); border-radius:var(--radius-sm); padding:0 16px; box-shadow:var(--shadow-sm); }
.trip-details > summary{ cursor:pointer; padding:12px 4px; font-family:'Fredoka',sans-serif; font-weight:600; color:var(--ink); list-style:none; }
.trip-details > summary::-webkit-details-marker{ display:none; }
.trip-details[open] > summary{ border-bottom:1px solid var(--rule); margin-bottom:12px; }
.trip-details .trip-basics{ padding-bottom:8px; }
.trip-actions{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; padding:0 0 14px; }
.trip-actions .travel-results{ font-size:.85rem; color:var(--ink-soft); }
.apanel .panel-hint{ max-width:900px; margin:0 auto 16px; color:var(--ink-soft); font-size:.92rem; text-align:center; }
.page-stage{ position:relative; }
.stage-page{ position:relative; }
.page-update{ position:absolute; top:8px; right:8px; z-index:5; border:1px solid var(--rule); background:rgba(255,255,255,.92); color:var(--ink); border-radius:8px; padding:5px 11px; font-size:.82rem; font-weight:700; cursor:pointer; box-shadow:var(--shadow-sm); font-family:inherit; }
.page-update:hover{ border-color:var(--gold); }
@media print{ .page-update{ display:none !important; } }

/* ----- #22 day page: plan (left) + contained route map & numbered legend (right) ----- */
.bp-day .bp-pad{ overflow:hidden; }
.day-grid{ display:flex; gap:5%; height:100%; }
.day-main{ flex:1 1 56%; min-width:0; display:flex; flex-direction:column; overflow:hidden; }
.day-main .bp-plan{ column-count:1; }
.day-route{ flex:0 0 38%; display:flex; flex-direction:column; min-width:0; }
.route-h{ font-family:'Fredoka',sans-serif; font-size:1rem; color:#2c2738; margin:0 0 6px; }
.day-map{ width:100%; aspect-ratio:8/5; background:#eef3f6; border-radius:8px; overflow:hidden; display:flex; align-items:center; justify-content:center; flex:0 0 auto; }
.day-map img{ width:100%; height:100%; object-fit:cover; display:block; }
.map-loading{ font-size:.78rem; color:#9a90a0; padding:8px; text-align:center; }
.route-legend{ list-style:none; margin:8px 0 0; padding:0; font-size:.78rem; color:#3a3340; overflow:hidden; }
.route-legend li{ display:flex; align-items:center; gap:7px; margin:4px 0; line-height:1.2; }
.rl-num{ flex:0 0 auto; width:18px; height:18px; border-radius:50%; color:#fff; font-size:.7rem; font-weight:700; display:inline-flex; align-items:center; justify-content:center; }
.route-legend .rl-start .rl-num{ opacity:.6; }

/* ----- editor buy/print controls on phones (chrome only — the book page stays print-locked) ----- */
@media (max-width:640px){
  .order-actions{ flex-direction:column; }
  .order-actions .btn{ width:100%; }
  .admin-foot{ flex-wrap:wrap; gap:8px; padding:10px 14px; }
  .admin-foot .foot-actions{ width:100%; display:flex; }
  .admin-foot .foot-actions .btn{ flex:1; }
  .print-bar{ padding:14px 14px 4px; }
  .quote-spec > .field{ max-width:none; }
}

/* ----- (5) send to printer: live Lulu quote ----- */
.send-panel h3{ font-family:'Fredoka',sans-serif; color:#2c2738; margin:0 0 4px; }
.quote-grid{ display:flex; gap:24px; flex-wrap:wrap; align-items:flex-start; margin:16px 0 8px; }
.quote-spec{ flex:1 1 320px; min-width:280px; }
.qs-spec-line{ font-size:1.05rem; margin:0 0 12px; color:#43354F; }
.quote-spec > .field{ display:flex; flex-direction:column; gap:4px; max-width:160px; margin:0 0 12px; }
.quote-ship{ margin:0 0 14px; border:1px solid var(--rule,#e4dccd); border-radius:10px; padding:8px 12px; background:#fbf8f2; }
.quote-ship summary{ cursor:pointer; font-weight:600; color:#6b6276; }
.qs-fields{ display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:12px; }
.qs-fields .field{ display:flex; flex-direction:column; gap:3px; margin:0; }
.qs-fields .field span{ font-size:.78rem; color:#6b6276; }
.qs-fields input, .qs-fields select{ padding:7px 9px; border:1px solid #d9cbb6; border-radius:7px; font:inherit; }
.quote-result{ flex:1 1 280px; min-width:260px; }
.qr-empty, .qr-loading{ color:#9a90a0; padding:24px; text-align:center; border:2px dashed #e4dccd; border-radius:12px; }
.qr-err{ color:#b4452f; padding:16px; background:#fdeee9; border-radius:10px; }
.qr-card{ border:1px solid var(--rule,#e4dccd); border-radius:14px; padding:18px 20px; background:linear-gradient(180deg,#fffdf8,#fbf6ec); box-shadow:0 2px 10px rgba(0,0,0,.05); }
.qr-card h4{ font-family:'Fredoka',sans-serif; margin:0 0 4px; color:#2c2738; }
.qr-spec{ font-size:.85rem; color:#6b6276; margin:0 0 12px; }
.qr-lines{ list-style:none; margin:0; padding:0; }
.qr-lines li{ display:flex; justify-content:space-between; padding:5px 0; border-bottom:1px dashed #e8e0d2; font-size:.95rem; }
.qr-total{ display:flex; justify-content:space-between; align-items:baseline; margin:12px 0 6px; font-family:'Fredoka',sans-serif; font-size:1.25rem; color:#2c2738; }
.qr-total b{ color:#E08A2B; }
.order-gate{ margin-top:18px; padding:16px 18px; border-radius:12px; background:#f6f2fb; border:1px solid #e6ddf2; }
.order-gate h4{ font-family:'Fredoka',sans-serif; margin:0 0 6px; color:#43354F; }
.order-gate p{ font-size:.9rem; color:#6b6276; margin:0 0 12px; }
@media(max-width:680px){ .qs-fields{ grid-template-columns:1fr; } }

/* ----- (#16) AI planner: CTA bar + loading overlay ----- */
.ai-plan-bar{ display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin:0 0 16px; padding:14px 16px; border-radius:12px; background:linear-gradient(120deg,#fef6e7,#f3e9fb); border:1px solid #ecdcc6; }
.btn-ai{ background:linear-gradient(120deg,#E08A2B,#b566d6); border:none; color:#fff; font-weight:700; }
.btn-ai:hover{ filter:brightness(1.05); }
.ai-plan-hint{ font-size:.85rem; color:#6b6276; flex:1 1 240px; }
.brain-overlay{ position:fixed; inset:0; z-index:9999; display:flex; align-items:center; justify-content:center; background:rgba(40,30,55,.55); -webkit-backdrop-filter:blur(4px); backdrop-filter:blur(4px); }
.brain-overlay[hidden]{ display:none; }
.brain-card{ width:min(440px,90vw); text-align:center; background:linear-gradient(180deg,#fffdf8,#f7f0fb); border-radius:20px; padding:34px 30px; box-shadow:0 20px 60px rgba(0,0,0,.35); }
.brain-spin{ font-size:3rem; animation:brain-pop 1.6s ease-in-out infinite; }
@keyframes brain-pop{ 0%,100%{ transform:scale(1) rotate(-6deg); } 50%{ transform:scale(1.25) rotate(8deg); } }
.brain-title{ font-family:'Fredoka',sans-serif; color:#2c2738; margin:10px 0 6px; font-size:1.4rem; }
.brain-msg{ font-family:'Caveat',cursive; font-size:1.5rem; color:#9148c9; min-height:2.2em; transition:opacity .25s ease; margin:6px 0 14px; }
.brain-bar{ height:6px; border-radius:6px; background:#e9def5; overflow:hidden; }
.brain-bar span{ display:block; height:100%; width:40%; border-radius:6px; background:linear-gradient(90deg,#E08A2B,#b566d6); animation:brain-slide 1.5s ease-in-out infinite; }
@keyframes brain-slide{ 0%{ margin-left:-40%; } 100%{ margin-left:100%; } }
.brain-fine{ font-size:.8rem; color:#8a8092; margin:14px 0 0; }

/* ----- replace-image buttons + library picker ----- */
.page-replace, .page-orig{ position:absolute; right:14px; background:#fff; border:1px solid var(--rule,#e4dccd); border-radius:8px; padding:4px 10px; font-size:.78rem; cursor:pointer; box-shadow:0 1px 5px rgba(0,0,0,.14); z-index:6; }
.page-replace{ top:52px; } .page-orig{ top:88px; }
.page-replace:hover, .page-orig:hover{ background:#fbf6ec; }
.art-picker{ position:fixed; inset:0; z-index:10000; display:flex; align-items:center; justify-content:center; background:rgba(40,30,55,.55); -webkit-backdrop-filter:blur(3px); backdrop-filter:blur(3px); }
.art-picker[hidden]{ display:none; }
.art-picker-box{ width:min(820px,92vw); max-height:86vh; display:flex; flex-direction:column; background:#fff; border-radius:16px; padding:18px 20px; box-shadow:0 20px 60px rgba(0,0,0,.35); }
.ap-head{ display:flex; justify-content:space-between; align-items:center; }
.ap-head h3{ font-family:'Fredoka',sans-serif; margin:0; color:#2c2738; }
.ap-close{ background:none; border:none; font-size:1.3rem; cursor:pointer; color:#6b6276; }
.ap-actions{ display:flex; align-items:center; gap:12px; margin:10px 0 14px; flex-wrap:wrap; }
.ap-note{ font-size:.82rem; color:#6b6276; }
.ap-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:12px; overflow:auto; padding:2px; }
.ap-loading{ grid-column:1/-1; text-align:center; color:#9a90a0; padding:30px; }
.ap-item{ border:1px solid var(--rule,#e4dccd); border-radius:10px; background:#faf7f1; padding:6px; cursor:pointer; display:flex; flex-direction:column; gap:4px; font:inherit; }
.ap-item:hover{ border-color:#E08A2B; box-shadow:0 2px 8px rgba(0,0,0,.12); }
.ap-item img{ width:100%; height:110px; object-fit:cover; border-radius:6px; background:#fff; }
.ap-item span{ font-size:.74rem; color:#6b6276; text-align:center; }
@media print{ .page-replace, .page-orig, .art-picker{ display:none !important; } }

/* ----- #24 day pages: 2-page spread (Morning/Afternoon | Evening + full map) ----- */
.bp-day .bp-pad{ overflow:hidden; display:flex; flex-direction:column; }
.day-am, .day-cont{ display:flex; flex-direction:column; height:100%; min-height:0; }
.day-sec{ margin:0 0 10px; }
.day-sec-h{ font-family:'Fredoka',sans-serif; font-size:1rem; color:var(--gold-deep,#E08A2B); margin:0 0 4px; border-bottom:1px solid var(--rule,#e4dccd); padding-bottom:2px; }
.day-sec-list{ list-style:none; margin:0; padding:0; font-size:.82rem; line-height:1.4; color:#3a3340; }
.day-sec-list li{ margin:0 0 4px; }
.day-route-full{ margin-top:6px; flex:1 1 auto; display:flex; flex-direction:column; min-height:0; }
.day-route-full .day-map{ width:100%; flex:1 1 auto; min-height:140px; background:#eef3f6; border-radius:8px; overflow:hidden; display:flex; align-items:center; justify-content:center; }
.day-route-full .day-map img{ width:100%; height:100%; object-fit:cover; display:block; }
.day-cont .route-legend{ list-style:none; margin:8px 0 0; padding:0; font-size:.76rem; color:#3a3340; columns:2; column-gap:16px; }
.day-cont .route-legend li{ display:flex; align-items:center; gap:6px; margin:3px 0; break-inside:avoid; line-height:1.2; }

/* ----- fixed-size editor pages: scroll (never distort) when screen is narrow ----- */
.page-stage, .spread-stage{ overflow:auto; }

/* ----- #26 cover title placement (move text off faces; works over any cover style) ----- */
.bp-cover.ct-bottom .cover-words{ position:absolute !important; left:0 !important; right:0 !important; bottom:0 !important; top:auto !important; width:auto !important; height:auto !important; flex-direction:column !important; align-items:center !important; justify-content:center !important; text-align:center !important; padding:5% 8% !important; }
.bp-cover.ct-top .cover-words{ position:absolute !important; left:0 !important; right:0 !important; top:0 !important; bottom:auto !important; width:auto !important; height:auto !important; flex-direction:column !important; align-items:center !important; justify-content:center !important; text-align:center !important; padding:5% 8% !important; }
.bp-cover.ct-band .cover-words{ background:rgba(20,16,40,.84) !important; }
.bp-cover.ct-over .cover-words{ background:transparent !important; text-shadow:0 2px 10px rgba(0,0,0,.7) !important; }
.bp-cover.ct-none .cover-words{ display:none !important; }
/* placement overrides must reset any style-specific vertical/rotated text (e.g. classic_keepsake ribbon) */
.bp-cover.ct-bottom .cover-words, .bp-cover.ct-top .cover-words, .bp-cover.ct-bottom .cover-words *, .bp-cover.ct-top .cover-words *{ writing-mode:horizontal-tb !important; transform:none !important; }
.bp-cover.ct-bottom .cw-title, .bp-cover.ct-top .cw-title{ font-size:1.6rem !important; line-height:1.05 !important; letter-spacing:0 !important; }
.bp-cover.ct-bottom .cw-fam, .bp-cover.ct-top .cw-fam{ font-size:1.5rem !important; }
.bp-cover.ct-bottom .cw-sub, .bp-cover.ct-top .cw-sub{ font-size:.72rem !important; letter-spacing:1.5px !important; }
.bp-cover.ct-band .cw-fam, .bp-cover.ct-over .cw-fam{ color:#ffd98c !important; display:block !important; }
.bp-cover.ct-band .cw-title, .bp-cover.ct-over .cw-title{ color:#fff !important; display:block !important; }
.bp-cover.ct-band .cw-sub, .bp-cover.ct-over .cw-sub{ color:#e8dffb !important; display:block !important; }

/* ----- #29 day map layout: contained (default) vs background ----- */
.day-cont.map-bg{ position:relative; }
.day-cont.map-bg .day-route-full{ position:absolute !important; inset:0 !important; margin:0 !important; z-index:0; }
.day-cont.map-bg .day-route-full .route-h, .day-cont.map-bg .route-legend{ display:none; }
.day-cont.map-bg .day-map{ height:100%; border-radius:6px; }
.day-cont.map-bg > *{ position:relative; z-index:1; }
.day-cont.map-bg > h3, .day-cont.map-bg > .day-sec, .day-cont.map-bg > .bp-journal-q{ background:rgba(255,255,255,.84); border-radius:6px; padding:5px 10px; margin-bottom:6px; }
