/* The workbook pages are images of the original PDF; everything here is the stage around
   them and the answer layer on top. Colours are sampled from the workbook itself. */

@font-face { font-family: "Carlito"; src: url("/fonts/Carlito-Regular.woff2") format("woff2"); font-weight: 400; font-display: block; }
@font-face { font-family: "Carlito"; src: url("/fonts/Carlito-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Gelasio"; src: url("/fonts/Gelasio.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Gelasio"; src: url("/fonts/Gelasio-Italic.woff2") format("woff2"); font-weight: 400 700; font-style: italic; font-display: swap; }

:root {
  --plum: #34113d;      /* headings, cover */
  --plum-deep: #34113c;
  --plum-2: #3e1a47;    /* Strategy */
  --rose: #a3476b;      /* Management */
  --gold: #e0a23c;      /* Execution */
  --gold-rule: #d4a03a;
  --cream: #fdf9f1;
  --ink: #34113d;       /* answers */
  --stage-1: #1c0a21;
  --stage-2: #2b1131;
  --serif: Georgia, "Gelasio", "Times New Roman", serif;
  --sans: Calibri, "Carlito", "Segoe UI", system-ui, sans-serif;
  --hand: "Carlito", Calibri, sans-serif;
  --u: 1;               /* CSS px per PDF point, set by the layout */
  --pw: 595.5px;
  --ph: 841.9px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 90% at 50% 40%, var(--stage-2), var(--stage-1) 70%) fixed, var(--stage-1);
  color: #f6ecdf; font-family: var(--sans); -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- lock screen ---------- */
.lock { min-height: 100%; display: grid; place-items: center; padding: 32px 16px 96px; background: var(--plum-deep); position: relative; }
.lock-card { width: min(420px, 100%); text-align: center; animation: rise 1.1s cubic-bezier(.2,.7,.2,1) both; }
.lock-mark { width: min(300px, 78%); height: auto; display: block; margin: 0 auto 28px; }
.lock-kicker { font: 700 12px/1 var(--sans); letter-spacing: .32em; text-transform: uppercase; color: var(--gold); margin: 0 0 10px; }
.lock-title { font: 400 40px/1.1 var(--serif); margin: 0 0 12px; color: #fbf3e6; }
.lock-sub { font: 16px/1.5 var(--sans); color: #d9c8d8; margin: 0 0 28px; }
.lock-input {
  width: 100%; font: 600 24px/1 var(--sans); letter-spacing: .24em; text-align: center; text-transform: uppercase;
  padding: 16px 12px; border-radius: 10px; border: 1px solid rgba(224,162,60,.55); background: rgba(255,255,255,.06); color: #fff;
}
.lock-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(224,162,60,.18); }
.lock-btn {
  margin-top: 14px; width: 100%; padding: 15px; border: 0; border-radius: 10px; font: 700 16px/1 var(--sans); letter-spacing: .04em;
  background: linear-gradient(180deg, #ebb456, var(--gold)); color: var(--plum); box-shadow: 0 8px 24px rgba(224,162,60,.25);
}
.lock-btn:disabled { opacity: .6; cursor: progress; }
.lock-error { min-height: 1.4em; color: #f3b8c9; font-size: 15px; margin: 14px 0 0; }
.lock-foot { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); width: 150px; height: auto; opacity: .9; }

@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ---------- top bar ---------- */
.app { height: 100%; display: flex; flex-direction: column; }
.bar {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(18px, env(safe-area-inset-left)); z-index: 30;
}
.bar-brand { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bar-title { font: 400 17px/1.1 var(--serif); color: #f8ecd8; }
.bar-sub { font: 700 10px/1.2 var(--sans); letter-spacing: .26em; text-transform: uppercase; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-actions { display: flex; align-items: center; gap: 6px; }
.bar-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 999px; font-size: 14px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.10); color: #f1e6d6; transition: background .2s, border-color .2s;
}
.bar-btn:hover { background: rgba(224,162,60,.14); border-color: rgba(224,162,60,.45); }
.bar-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bar-btn[aria-pressed="false"] { opacity: .55; }
.save-state { font-size: 13px; color: #cdbccb; margin-right: 6px; white-space: nowrap; }
.save-state.warn { color: #f3c37a; }

/* ---------- stage ---------- */
.stage { flex: 1; position: relative; min-height: 0; }
/* bottom bar: where you are, what to do, and the way to the next answer */
.foot {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  width: min(calc(var(--pw) * 2 + 40px), 100%); margin: 0 auto; padding: 4px 4px 12px; font: 13px/1.3 var(--sans); color: #cdbccb; z-index: 30;
}
.foot-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.foot-pages { letter-spacing: .06em; color: #bfaebd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-guide { color: #f3e3c6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-guide:empty { display: none; }
.foot-act { flex: none; display: flex; align-items: center; gap: 12px; }
.foot-prog { font-size: 12.5px; color: #cdbccb; white-space: nowrap; }
.next-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 10px 16px 10px 18px;
  background: linear-gradient(180deg, #ebb456, var(--gold)); color: var(--plum); font: 700 14px/1 var(--sans); white-space: nowrap;
  box-shadow: 0 6px 20px rgba(224,162,60,.25);
}
.next-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.next-btn.done { background: rgba(255,255,255,.08); color: #f3e3c6; box-shadow: none; }
.pg-btn { display: none; flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(224,162,60,.4); background: rgba(255,255,255,.06); place-items: center; padding: 0; }
.pg-btn svg { width: 20px; height: 20px; fill: none; stroke: #f3e3c6; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pg-btn:disabled { opacity: .3; }
.app.is-single .pg-btn { display: grid; }
.app.is-compact .foot {
  width: 100%; gap: 10px; padding: 10px max(12px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(28,10,33,.88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid rgba(224,162,60,.18);
}
.app.is-scroll .foot { position: fixed; left: 0; right: 0; bottom: 0; }
.app.is-compact .foot-info { flex: 1; }
.app.is-single .foot-info { text-align: center; }
.app.is-compact .foot-info > span { display: block; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app.is-compact .foot-pages { font-size: 13px; color: #f3e3c6; letter-spacing: .02em; max-width: 100%; }
.app.is-compact .foot-guide { font-size: 12px; color: #cdbccb; }
.app.is-compact .foot-prog { display: none; }
.app.is-compact ~ .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
@media (max-width: 420px) { .app.is-single .next-btn { padding: 12px; } .app.is-single .next-btn .nb-text { display: none; } }

/* ---------- single-page mode (phones) ---------- */
.book.single { width: var(--pw); }
.book.single .slot-r { left: 0; }
.book.single .slot-l, .book.single .edges { display: none; }
.book.single .leaf.fwd { left: 0; }
.book-wrap.single { flex-direction: column; justify-content: center; gap: 0; touch-action: pan-y pinch-zoom; }
.book-wrap.single .turn, .book-wrap.single .open-hint { display: none; }
.book-wrap.single .note-btn, .book-wrap.single .rotate-btn { position: relative; inset: auto; }
/* fixed height, so the page never shifts when the text under it changes length */
.single-meta { display: none; width: var(--pw); padding: 8px 2px 0; height: 100px; overflow: hidden; }
.single-meta.tight { height: 46px; }
.book-wrap.single .single-meta { display: block; }
.sm-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 34px; }
.sm-label { font: 12.5px/1.3 var(--sans); color: #cdbccb; letter-spacing: .03em; }
.sm-guide { margin: 6px 0 0; font: 13px/1.45 var(--sans); color: #f1e2c8;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.sm-guide:empty { display: none; }
.sm-guide b { color: #fff; }
.single-meta.tight .sm-guide { display: none; }

/* Skip activity: an outlined pill beside Next answer (laptops), under the page (phones),
   in the page's guide card (scroll view); "Undo skip" in gold */
.skip-btn {
  flex: none; border: 1px solid rgba(243,227,198,.35); background: transparent; color: #f1e2c8; border-radius: 999px;
  padding: 9px 14px; font: 600 13px/1 var(--sans); white-space: nowrap; transition: background .2s, border-color .2s;
}
.skip-btn:hover { background: rgba(255,255,255,.07); border-color: rgba(243,227,198,.6); }
.skip-btn.undo { color: var(--gold); border-color: rgba(224,162,60,.6); }
.sm-row .meta-btns { align-items: center; }
.guide-card .skip-btn { margin-top: 8px; padding: 7px 12px; font-size: 12.5px; }
.guide-card.skipped { opacity: .7; }
/* a skipped page shows no writing hints */
.page.skipped .hint-dot, .page.skipped .hint-pill, .page.skipped .hint-ring { display: none; }
.guides .page.skipped .f-text.empty { background: transparent; }
.page.skipped .f-text.empty::placeholder { color: transparent; }
.toc button.skipped .t { opacity: .5; }
.toc .dot.skip { width: 10px; height: 0; border-radius: 0; border-top: 2px solid #b9a5b8; }
.toast.has-action { pointer-events: auto; display: flex; align-items: center; gap: 14px; width: max-content; max-width: calc(100vw - 32px); }
.toast-act { border: 0; background: var(--plum); color: #fff; border-radius: 999px; padding: 7px 14px; font: 700 13px/1 var(--sans); }

/* writing guides: shown on empty answers only, never printed */
.guides .f-text.empty { background: rgba(224,162,60,.085); }
.guides .f-text.empty:hover { background: rgba(224,162,60,.14); }
.f-text::placeholder { color: rgba(163,71,107,.62); font-style: italic; opacity: 1; }
.f-num::placeholder { font-weight: 400; }
.hint-dot, .hint-pill {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; white-space: nowrap;
  border: calc(var(--u) * .9px) dashed rgba(163,71,107,.55); color: rgba(163,71,107,.75); font: 700 calc(var(--u) * 7.5px)/1 var(--hand);
  background: rgba(224,162,60,.08); pointer-events: none;
}
.hint-dot { width: calc(var(--u) * 26px); height: calc(var(--u) * 26px); border-radius: 50%; letter-spacing: .02em; }
.hint-pill { padding: calc(var(--u) * 4px) calc(var(--u) * 6px); border-radius: 999px; font-size: calc(var(--u) * 8px); }
.hint-ring { position: absolute; inset: calc(var(--u) * 3px); border: calc(var(--u) * .9px) dashed rgba(163,71,107,.45); border-radius: calc(var(--u) * 6px); background: rgba(224,162,60,.06); pointer-events: none; }
.spot { animation: spot 1.6s ease; }
@keyframes spot { 0%, 100% { box-shadow: 0 0 0 0 rgba(224,162,60,0); } 30% { box-shadow: 0 0 0 calc(var(--u) * 4px) rgba(224,162,60,.55); } }

/* "how to fill this page" card above each input page on phones */
.guide-card {
  display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 8px; padding: 11px 13px; border-radius: 12px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(224,162,60,.25); color: #f1e2c8; font: 14px/1.45 var(--sans);
}
.guide-card svg { flex: none; width: 18px; height: 18px; margin-top: 1px; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.guide-card b { color: #fff; font-weight: 700; }
.guide-card .gc-prog { display: block; font-size: 12px; color: #cdb6c8; margin-top: 3px; }

/* ---------- book mode ---------- */
.book-wrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.book {
  position: relative; width: calc(var(--pw) * 2); height: var(--ph); perspective: calc(var(--pw) * 22);
  transition: transform .95s cubic-bezier(.45,.05,.25,1);
}
.book.at-cover { transform: translateX(calc(var(--pw) * -.5)); }
.book.at-back { transform: translateX(calc(var(--pw) * .5)); }
.slot { position: absolute; top: 0; width: var(--pw); height: var(--ph); will-change: transform; }
.slot-l { left: 0; } .slot-r { left: var(--pw); }
.slot:not(:empty) { box-shadow: 0 30px 70px rgba(0,0,0,.45), 0 6px 18px rgba(0,0,0,.25); }
/* stacked page edges, thicker on the side with more pages */
.edges { position: absolute; top: 3px; bottom: 3px; pointer-events: none;
  background: repeating-linear-gradient(90deg, #efe6d4 0 1px, #d9ccb4 1px 2px); border-radius: 2px; }
.edges-l { width: var(--edge-l, 0px); left: calc(var(--edge-l, 0px) * -1); }
.edges-r { width: var(--edge-r, 0px); right: calc(var(--edge-r, 0px) * -1); }
.book.at-cover .edges-l, .book.at-back .edges-r { display: none; }

.turn {
  flex: none; width: 52px; height: 52px; margin: 0 22px; border-radius: 50%; border: 1px solid rgba(224,162,60,.35);
  background: rgba(255,255,255,.05); display: grid; place-items: center; transition: background .2s, opacity .3s; z-index: 5;
}
.turn:hover { background: rgba(224,162,60,.16); }
.turn:disabled { opacity: 0; pointer-events: none; }
.turn svg { width: 22px; height: 22px; fill: none; stroke: #f3e3c6; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.open-hint {
  position: fixed; bottom: 6px; left: 50%; z-index: 25; transform: translateX(-50%); padding: 11px 22px; border-radius: 999px;
  border: 1px solid rgba(224,162,60,.6); background: rgba(52,17,60,.85); color: #f6e3bd; font: 600 14px/1 var(--sans); letter-spacing: .08em;
  animation: breathe 2.6s ease-in-out infinite;
}
@keyframes breathe { 50% { box-shadow: 0 0 0 8px rgba(224,162,60,.10); } }

/* the turning leaf */
.leaf { position: absolute; top: 0; width: var(--pw); height: var(--ph); transform-style: preserve-3d; z-index: 20; pointer-events: none; }
.leaf.fwd { left: var(--pw); transform-origin: left center; }
.leaf.back { left: 0; transform-origin: right center; }
.leaf .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
/* a page in the air can't be tapped mid-turn; its moving art is frozen where it is (app.js) */
.page.in-leaf .picks { display: none; }
.page.in-leaf .fields { pointer-events: none; }
.leaf .page { box-shadow: none; }
.leaf .face-b { transform: rotateY(180deg); }
.leaf .shade { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.leaf.fwd .face-a .shade { background: linear-gradient(90deg, rgba(0,0,0,.28), rgba(0,0,0,0) 45%, rgba(255,255,255,.06)); }
.leaf.fwd .face-b .shade { background: linear-gradient(270deg, rgba(0,0,0,.30), rgba(0,0,0,0) 45%); }
.leaf.back .face-a .shade { background: linear-gradient(270deg, rgba(0,0,0,.28), rgba(0,0,0,0) 45%, rgba(255,255,255,.06)); }
.leaf.back .face-b .shade { background: linear-gradient(90deg, rgba(0,0,0,.30), rgba(0,0,0,0) 45%); }
.cast { position: absolute; top: 0; width: var(--pw); height: var(--ph); pointer-events: none; z-index: 19; opacity: 0; }

/* ---------- scroll mode ---------- */
.scroll { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 0 40px; scroll-behavior: smooth; }
.scroll-item { width: var(--pw); margin: 0 auto 10px; }
.scroll-item .page { box-shadow: 0 14px 40px rgba(0,0,0,.45); }
.scroll-meta { display: flex; justify-content: space-between; align-items: center; padding: 8px 2px 16px; font: 12px/1.2 var(--sans); color: #bfaebd; letter-spacing: .04em; }
.scroll-meta .note-btn { position: relative; }
.app.is-scroll .scroll { padding-bottom: 120px; }
.touch .reorder button { width: 22px; height: 22px; font-size: 11px; }

/* drawer footer: guides switch, help */
.drawer-foot { border-top: 1px solid #ecdcbc; padding: 14px 22px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.switch { display: flex; align-items: center; gap: 10px; font: 15px/1.3 var(--sans); color: var(--plum); cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--rose); }
.link-btn { align-self: flex-start; border: 0; background: none; padding: 0; color: var(--rose); font: 700 14px/1.3 var(--sans); text-decoration: underline; text-underline-offset: 3px; }

/* sheet additions: context line, big choices, next */
.sheet-btns { display: flex; gap: 8px; flex: none; }
.sheet-next { display: inline-flex; align-items: center; gap: 4px; border: 1px solid rgba(52,17,61,.25); border-radius: 999px; padding: 9px 12px 9px 16px; background: #fff; color: var(--plum); font-weight: 700; }
.sheet-next svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.sheet-context { margin: -2px 0 2px; padding: 10px 12px; border-left: 3px solid var(--gold); background: #f6ecda; border-radius: 0 8px 8px 0; font: 15px/1.45 var(--sans); color: #4a2a52; }
.sheet-context:empty { display: none; }
.sheet-choices { display: grid; gap: 8px; }
.sheet-choices:empty { display: none; }
.choice {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 13px 14px; border-radius: 12px;
  border: 1px solid #e6d5b4; background: #fffdf8; color: var(--plum); font: 16px/1.3 var(--sans); min-height: 56px;
}
.choice:hover { border-color: var(--gold); }
.choice.on { border-color: var(--rose); background: #fbeef2; box-shadow: inset 0 0 0 1px var(--rose); }
.choice .sw { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font: 700 16px/1 var(--hand); color: #fff; background: #d8c8d8; }
.choice .sw.S { background: var(--plum-2); } .choice .sw.M { background: var(--rose); } .choice .sw.E { background: var(--gold); color: var(--plum); }
.choice .sw.ring { background: transparent; border: 2px solid var(--rose); color: var(--rose); font-size: 13px; }
.choice .sw.tk { background: #fbeef2; color: var(--rose); }
.choice small { display: block; font-size: 13px; color: #8a6f8b; margin-top: 2px; }
.choice.clear { min-height: 0; padding: 10px 14px; color: #8a6f8b; font-size: 14px; justify-content: center; border-style: dashed; }

/* first-open welcome */
.coach { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(12,4,14,.72); backdrop-filter: blur(3px); animation: fade .3s both; }
.coach-card { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: #fbf6ec; color: var(--plum); border-radius: 18px; padding: 26px 22px 22px; box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: rise .5s cubic-bezier(.2,.7,.2,1) both; }
.coach-card h2 { font: 400 28px/1.15 var(--serif); margin: 0 0 16px; }
.coach-card .lock-kicker { color: #a17322; }
.coach-steps { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 14px; }
.coach-steps li { display: flex; gap: 14px; align-items: flex-start; font: 15.5px/1.45 var(--sans); }
.coach-steps b { font-weight: 700; }
.coach-ic { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #f3e4c4; }
.coach-ic svg { width: 18px; height: 18px; fill: none; stroke: var(--plum); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.coach-ic.sticker-demo { background: var(--plum-2); color: #fff; font: 700 17px/1 var(--hand); }
.turned-hint { position: fixed; bottom: 18px; left: 0; right: 0; text-align: center; font: 14px/1.4 var(--sans); color: #d9c8d8; padding: 0 16px; }
@media (orientation: landscape) { .turned-hint { display: none; } }

/* ---------- a page ---------- */
.page { position: relative; width: var(--pw); height: var(--ph); background: var(--cream); overflow: hidden; user-select: none; -webkit-user-select: none;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; /* drawn the same way at rest as on a turning leaf */ }
.page > img.pg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; -webkit-user-drag: none; }
.page.spine-r::after, .page.spine-l::after { content: ""; position: absolute; top: 0; bottom: 0; width: 7%; pointer-events: none; z-index: 1; }
.page.spine-r::after { right: 0; background: linear-gradient(270deg, rgba(60,30,10,.16), rgba(60,30,10,0)); }
.page.spine-l::after { left: 0; background: linear-gradient(90deg, rgba(60,30,10,.16), rgba(60,30,10,0)); }
.fields { position: absolute; inset: 0; z-index: 2; }
.page.static .fields { pointer-events: none; }

.f { position: absolute; margin: 0; }
.f-text {
  border: 0; outline: 0; resize: none; overflow: hidden; background: transparent; color: var(--ink); padding: 0 calc(var(--u) * 2px);
  font-family: var(--hand); font-weight: 400; white-space: pre-wrap; overflow-wrap: break-word; user-select: text; -webkit-user-select: text;
  caret-color: var(--rose); border-radius: calc(var(--u) * 2px); transition: background .2s, box-shadow .2s;
}
.f-text:hover { background: rgba(224,162,60,.06); }
.f-text:focus { background: rgba(224,162,60,.09); box-shadow: 0 0 0 calc(var(--u) * 1px) rgba(224,162,60,.35); }
.f-text::placeholder { color: rgba(52,17,61,.38); }
.f-text.full { animation: full .5s ease; }
@keyframes full { 30% { background: rgba(163,71,107,.18); } }
.sheet-mode .f-text { cursor: pointer; caret-color: transparent; }
.page.static .f-text:hover { background: transparent; }

.f-rot { position: absolute; overflow: visible; }
.f-rot > .f { left: 0; top: 0; transform-origin: 0 0; }

.f-num { text-align: center; padding: 0; }
.f-hit { background: transparent; border: 0; padding: 0; border-radius: calc(var(--u) * 3px); transition: background .2s; }
.f-hit:hover, .f-hit:focus-visible { background: rgba(224,162,60,.10); outline: none; }
.f-hit:focus-visible { box-shadow: 0 0 0 calc(var(--u) * 1px) rgba(224,162,60,.55); }

.sticker {
  position: absolute; left: 50%; top: 50%; width: calc(var(--u) * 24px); height: calc(var(--u) * 24px); margin: calc(var(--u) * -12px) 0 0 calc(var(--u) * -12px);
  border-radius: 50%; display: grid; place-items: center; font: 700 calc(var(--u) * 13px)/1 var(--hand); color: #fff;
  box-shadow: 0 calc(var(--u) * 1px) calc(var(--u) * 2px) rgba(0,0,0,.25), inset 0 calc(var(--u) * 1px) 0 rgba(255,255,255,.22);
}
.sticker.S { background: var(--plum-2); } .sticker.M { background: var(--rose); } .sticker.E { background: var(--gold); color: var(--plum); }
.tickmark { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: calc(var(--u) * 3px);
  font: 400 calc(var(--u) * 12px)/1 var(--hand); color: var(--ink); }
.tickmark svg { width: calc(var(--u) * 11px); height: calc(var(--u) * 11px); fill: none; stroke: var(--rose); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ring { position: absolute; pointer-events: none; overflow: visible; }
.ring ellipse { fill: none; stroke: var(--rose); stroke-width: 1.3; vector-effect: non-scaling-stroke; }
.ring.draw ellipse { stroke-dasharray: 400; stroke-dashoffset: 400; animation: draw .5s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.f-total { font: 700 calc(var(--u) * 11px)/calc(var(--u) * 15px) var(--hand); color: var(--rose); white-space: nowrap; pointer-events: none; }
.f-total.ok { color: #b47f1f; }
.f-calc { display: flex; align-items: center; justify-content: center; font: 700 calc(var(--u) * 11px)/1 var(--hand); color: var(--ink); white-space: nowrap; pointer-events: none; }
.f-link { border-radius: 50%; }
.f-link:hover { background: rgba(224,162,60,.25); box-shadow: 0 0 0 calc(var(--u) * 3px) rgba(224,162,60,.18); }

.f-photo { overflow: hidden; border: 0; padding: 0; background: transparent; }
.f-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-cta {
  position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%); font: 600 calc(var(--u) * 10px)/1 var(--sans); white-space: nowrap;
  padding: calc(var(--u) * 6px) calc(var(--u) * 11px); border-radius: 999px; color: var(--plum); background: rgba(255,255,255,.75);
  border: calc(var(--u) * .8px) solid rgba(212,160,58,.7); opacity: .0; transition: opacity .25s;
}
.f-photo:hover .photo-cta, .f-photo:focus-visible .photo-cta, .touch .photo-cta, .guides .f-photo:not(.has) .photo-cta { opacity: 1; }
.f-photo.has .photo-cta { opacity: 0; }
.f-photo.has:hover .photo-cta { opacity: 1; }

.reorder { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: calc(var(--u) * 6px) 0; opacity: 0; transition: opacity .2s; }
.page:hover .reorder, .reorder:focus-within { opacity: 1; }
.touch .reorder { opacity: .9; }
.reorder button { border: 0; background: rgba(224,162,60,.18); color: var(--plum); width: calc(var(--u) * 16px); height: calc(var(--u) * 16px); border-radius: 50%;
  font-size: calc(var(--u) * 9px); line-height: 1; padding: 0; display: grid; place-items: center; }
.reorder button:hover { background: rgba(224,162,60,.45); }

.picks { position: absolute; z-index: 6; display: flex; gap: calc(var(--u) * 4px); flex-wrap: wrap; }
.picks button, .sheet-picks button {
  font: 600 calc(var(--u) * 9.5px)/1 var(--sans); padding: calc(var(--u) * 5px) calc(var(--u) * 8px); border-radius: 999px;
  border: calc(var(--u) * .8px) solid rgba(212,160,58,.8); background: #fffaf0; color: var(--plum); box-shadow: 0 2px 8px rgba(52,17,61,.12);
}
.picks button:hover { background: #fbe9c6; }

/* margin note pens */
.note-btn {
  position: absolute; z-index: 8; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.06); border: 1px solid rgba(224,162,60,.35); color: #f2dfb9; transition: background .2s;
}
.note-btn:hover { background: rgba(224,162,60,.2); }
.note-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.note-btn.has::after { content: ""; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.slot-l .note-btn { left: -50px; top: 18px; } .slot-r .note-btn { right: -50px; top: 18px; }
.rotate-btn { position: absolute; z-index: 8; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.06); border: 1px solid rgba(224,162,60,.35); color: #f2dfb9; }
.rotate-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.slot-l .rotate-btn { left: -50px; top: 62px; } .slot-r .rotate-btn { right: -50px; top: 62px; }
.scroll-meta .rotate-btn { position: static; }
.meta-btns { display: flex; gap: 8px; }

/* corner curl hint for page turns */
.corner { position: absolute; bottom: 0; width: 56px; height: 56px; z-index: 7; border: 0; padding: 0; background: transparent; }
.slot-r .corner { right: 0; } .slot-l .corner { left: 0; }
.corner::before { content: ""; position: absolute; bottom: 0; width: 0; height: 0; transition: width .25s, height .25s; }
.slot-r .corner::before { right: 0; background: linear-gradient(315deg, var(--stage-1) 50%, #e9dfcb 50%, #fffaf0 80%); box-shadow: -2px -2px 6px rgba(0,0,0,.18); }
.slot-l .corner::before { left: 0; background: linear-gradient(45deg, var(--stage-1) 50%, #e9dfcb 50%, #fffaf0 80%); box-shadow: 2px -2px 6px rgba(0,0,0,.18); }
.corner:hover::before { width: 30px; height: 30px; }

/* living illustrations */
.motion { position: absolute; left: 0; right: 0; top: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.motion.full { -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 84%, transparent 100%); mask-image: linear-gradient(to bottom, #000 0, #000 84%, transparent 100%); }
.motion.inset { -webkit-mask-image: radial-gradient(ellipse 74% 72% at 50% 50%, #000 68%, transparent 100%); mask-image: radial-gradient(ellipse 74% 72% at 50% 50%, #000 68%, transparent 100%); }
.motion .art { position: absolute; inset: 0; overflow: hidden; opacity: 0; transition: opacity .9s ease; }
.motion.ready .art { opacity: 1; }
.motion .art img { position: absolute; max-width: none; will-change: transform; }
.motion canvas { position: absolute; inset: -4%; width: 108%; height: 108%; opacity: 0; }
.motion .rays { position: absolute; inset: -30% -60%; mix-blend-mode: soft-light; opacity: .9; transform: translateX(-38%);
  background: linear-gradient(112deg, transparent 42%, rgba(255,238,196,.0) 44%, rgba(255,238,196,.55) 50%, rgba(255,238,196,0) 56%, transparent 58%); }
.motion .glow { position: absolute; inset: -10%; mix-blend-mode: soft-light;
  background: radial-gradient(60% 45% at 62% 38%, rgba(255,226,160,.55), rgba(255,226,160,0) 70%); opacity: .15; }
.no-motion .motion { display: none; }

/* ---------- drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-scrim, .sheet-scrim { position: absolute; inset: 0; background: rgba(12,4,14,.55); backdrop-filter: blur(2px); animation: fade .25s both; }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); background: #fbf6ec; color: var(--plum);
  box-shadow: -20px 0 60px rgba(0,0,0,.4); display: flex; flex-direction: column; animation: slide .35s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 22px 22px 10px; border-bottom: 1px solid #ecdcbc; }
.drawer-head h2 { font: 400 26px/1 var(--serif); margin: 0; }
.x { border: 0; background: none; font-size: 30px; line-height: 1; color: var(--plum); }
.toc { list-style: none; margin: 0; padding: 8px 0 30px; overflow-y: auto; }
.toc .sec { font: 700 10.5px/1.3 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: #a17322; padding: 18px 22px 6px; }
.toc button { width: 100%; text-align: left; border: 0; background: none; padding: 9px 22px; display: flex; gap: 12px; align-items: baseline; color: var(--plum); font: 15px/1.3 var(--sans); }
.toc button:hover { background: #f3e7cf; }
.toc button.cur { background: #efe0c3; }
.toc .pn { width: 26px; flex: none; color: #a58aa6; font-size: 13px; text-align: right; }
.toc .t { flex: 1; }
.toc .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; align-self: center; }
.toc .dot.fill { background: var(--gold); }
.toc .dot.part { border: 1.5px solid var(--gold); }

/* ---------- sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 86vh; background: #fbf6ec; color: var(--plum); border-radius: 18px 18px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; animation: up .3s cubic-bezier(.2,.8,.2,1) both;
  box-shadow: 0 -20px 60px rgba(0,0,0,.35);
}
@media (min-width: 700px) { .sheet-panel { left: 50%; right: auto; bottom: 50%; width: 560px; transform: translate(-50%, 50%); border-radius: 16px; animation: fade .25s both; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sheet-kicker { margin: 0 0 4px; font: 700 10.5px/1.2 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: #a17322; }
.sheet-title { margin: 0; font: 400 20px/1.25 var(--serif); }
.sheet-done { flex: none; border: 0; border-radius: 999px; padding: 9px 18px; background: var(--plum); color: #fff; font-weight: 700; }
.sheet-text {
  width: 100%; min-height: 34vh; resize: none; border: 1px solid #e6d5b4; border-radius: 12px; padding: 14px; background: #fffdf8;
  font: 18px/1.5 var(--hand); color: var(--ink); outline: none;
}
.sheet-text:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(224,162,60,.18); }
.sheet-meter { margin: 0; font-size: 13px; color: #8a6f8b; min-height: 1.2em; }
.sheet-meter.full { color: var(--rose); font-weight: 700; }
.sheet-picks { display: flex; gap: 8px; flex-wrap: wrap; }
.sheet-picks:empty { display: none; }
.sheet-picks button { font-size: 14px; padding: 8px 14px; }

/* ---------- landscape canvas ---------- */
.turned { position: fixed; inset: 0; z-index: 55; background: radial-gradient(100% 90% at 50% 50%, var(--stage-2), var(--stage-1)); display: grid; place-items: center; animation: fade .3s both; }
.turned-stage { position: relative; }
.turned-stage .page { transform-origin: 0 0; box-shadow: 0 30px 70px rgba(0,0,0,.5); position: absolute; left: 0; top: 0; }
.turned-close { position: fixed; top: 14px; right: 16px; padding: 10px 18px; border-radius: 999px; border: 1px solid rgba(224,162,60,.5); background: rgba(52,17,60,.8); color: #f6e3bd; font-weight: 700; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); opacity: 0; z-index: 80; pointer-events: none;
  background: #fbf6ec; color: var(--plum); padding: 12px 18px; border-radius: 12px; font: 600 14px/1.3 var(--sans); box-shadow: 0 12px 40px rgba(0,0,0,.35); transition: opacity .3s, transform .3s; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* measuring room for fit checks (off-screen) */
.measure { position: fixed; left: -99999px; top: 0; visibility: hidden; --u: 2; }

@media (max-width: 760px) {
  .bar { padding-top: max(10px, env(safe-area-inset-top)); }
  .next-btn { padding: 12px 14px 12px 16px; font-size: 15px; }
  .sheet-head { flex-wrap: wrap; }
  .bar-btn span:not(.sr) { display: none; }
  #btn-sound, #btn-motion, #btn-lock { display: none; }
  .bar-btn { padding: 8px; }
  .save-state { display: none; }
  .bar-title { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .book { transition: none; }
  .lock-card { animation: none; }
}
