/* ==========================================================================
   Field Notes — a product manager's notebook
   Tokens → base → top bar & tabs → cover → pages → each page → overlays →
   eggs (highlighter, draft) → responsive → reduced motion → print
   ========================================================================== */

/* ------------------------------------------------------------ Tokens */
:root,
[data-theme="paper"] {
  --desk: #3a3128;
  --desk-light: #4c4034;
  --bar-ink: #f4ecdc;
  --paper: #fbf8f0;
  --paper-shade: #f1ebdc;
  --rule: rgba(70, 120, 185, 0.2);
  --rule-strong: rgba(70, 120, 185, 0.3);
  --margin-line: rgba(214, 88, 88, 0.45);
  --ink: #1f2a44;
  --ink-soft: #4d566b;
  --blue-pen: #2f5fa8;
  --red-pen: #c23f2a;
  --hl: #ffe45c;
  --hl-bg: rgba(255, 222, 70, 0.62);
  --sticky-yellow: #fff07a;
  --sticky-pink: #ffc9d6;
  --sticky-green: #c9f0d0;
  --sticky-blue: #cfe6ff;
  --sticky-ink: #1f2a44;
  --kraft: #b98a57;
  --kraft-dark: #8d6438;
  --era-ibm: rgba(120, 175, 255, 0.5);
  --era-certent: rgba(255, 160, 100, 0.48);
  --era-isw: rgba(70, 205, 150, 0.42);
  --era-pm: rgba(255, 222, 70, 0.7);
  --stamp: #1b8f5f;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 18px 40px -18px rgba(0, 0, 0, 0.55);
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --mono: "Courier Prime", "Courier New", ui-monospace, monospace;
  --book-w: 960px;
  --margin-x: 76px;
  /* Hand-drawn border radius */
  --wobbly: 255px 15px 225px 15px / 15px 225px 15px 255px;
  color-scheme: light;
}

[data-theme="blueprint"] {
  --desk: #0d1828;
  --desk-light: #15253b;
  --paper: #1d4377;
  --paper-shade: #193a68;
  --rule: rgba(255, 255, 255, 0.11);
  --rule-strong: rgba(255, 255, 255, 0.2);
  --margin-line: rgba(255, 255, 255, 0.32);
  --ink: #f1f6ff;
  --ink-soft: #c3d4ee;
  --blue-pen: #9fd0ff;
  --red-pen: #ffb19e;
  --hl: #ffe45c;
  --hl-bg: rgba(255, 222, 70, 0.3);
  --era-ibm: rgba(140, 190, 255, 0.35);
  --era-certent: rgba(255, 170, 120, 0.35);
  --era-isw: rgba(90, 220, 170, 0.3);
  --era-pm: rgba(255, 222, 70, 0.38);
  --stamp: #7de0b4;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

/* ------------------------------------------------------------ Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  font: 17px/1.65 var(--serif);
  color: var(--ink);
  background:
    radial-gradient(ellipse 90% 60% at 50% 0%, var(--desk-light), transparent 70%),
    var(--desk);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s;
}
img, svg { max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: var(--blue-pen); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
.hand { font-family: var(--hand); font-weight: 700; letter-spacing: 0.2px; }
.hand-note { font-family: var(--hand); font-size: 24px; line-height: 1.2; color: var(--blue-pen); }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--paper); color: var(--ink); padding: 10px 14px; border-radius: 6px; }
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--hl); outline-offset: 3px; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--blue-pen); font: 14px var(--mono); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ------------------------------------------------------------ Top bar */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  height: 58px; padding: 0 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  color: var(--bar-ink);
  transition: background-color 0.3s, box-shadow 0.3s;
}
body.past-cover .topbar {
  background: color-mix(in srgb, var(--desk) 90%, transparent);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px -16px rgba(0, 0, 0, 0.6);
}
.brand { display: flex; align-items: baseline; gap: 10px; color: inherit; text-decoration: none; }
.brand-title { font: 700 30px/1 var(--hand); }
.brand-sub { font: 12px var(--mono); opacity: 0.7; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.tool {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: var(--bar-ink);
  border: 1.5px solid rgba(244, 236, 220, 0.35); border-radius: var(--wobbly);
  padding: 6px 11px; font: 13px var(--mono); cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, transform 0.15s;
}
.tool:hover { border-color: rgba(244, 236, 220, 0.8); }
.tool:active { transform: translateY(1px); }
.tool svg { width: 20px; height: 20px; flex: none; }
.tool[aria-pressed="true"] { background: rgba(255, 228, 92, 0.22); border-color: var(--hl); }
.tool .count { font-weight: 700; }
.chip.bump { animation: bump 0.6s ease; }
@keyframes bump { 30% { transform: scale(1.15) rotate(-3deg); } 60% { transform: scale(0.96); } }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }
.progress span { display: block; height: 100%; background: var(--hl); transform-origin: left; transform: scaleX(0); }

/* Index tabs */
.tabs {
  position: fixed; z-index: 30; top: 110px;
  right: calc((100vw - var(--book-w)) / 2 - 31px);
  display: none; flex-direction: column; gap: 5px;
}
.tabs a {
  writing-mode: vertical-rl;
  width: 30px; padding: 12px 0;
  font: 700 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none;
  color: #1f2a44; border-radius: 0 7px 7px 0;
  box-shadow: 3px 3px 8px -4px rgba(0, 0, 0, 0.5);
  opacity: 0.8; transition: transform 0.2s, opacity 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.tabs a:nth-child(4n+1) { background: var(--sticky-yellow); }
.tabs a:nth-child(4n+2) { background: var(--sticky-pink); }
.tabs a:nth-child(4n+3) { background: var(--sticky-green); }
.tabs a:nth-child(4n+4) { background: var(--sticky-blue); }
.tabs a:hover, .tabs a.active { opacity: 1; transform: translateX(6px); }

/* ------------------------------------------------------------ Cover */
.cover {
  min-height: 100vh; min-height: 100svh;
  display: grid; place-items: center; align-content: center;
  padding: 84px 16px 40px; perspective: 1800px;
}
.cover-board {
  position: relative; width: min(440px, 86vw); aspect-ratio: 3 / 4.25;
  transform: rotate(-1.5deg);
  animation: cover-in 1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes cover-in { from { opacity: 0; transform: translateY(40px) rotate(-5deg); } }
.cover-front, .cover-inside { position: absolute; inset: 0; border-radius: 6px 14px 14px 6px; }
.cover-front {
  z-index: 2; display: flex; flex-direction: column; padding: 30px 30px 28px 38px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .2 0 0 0 0 .1 0 0 0 .35 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(160deg, #c79a66, var(--kraft) 45%, var(--kraft-dark));
  box-shadow: inset 14px 0 0 rgba(0, 0, 0, 0.12), inset 16px 0 0 rgba(255, 255, 255, 0.08), 0 40px 70px -30px rgba(0, 0, 0, 0.85), 0 6px 14px rgba(0, 0, 0, 0.3);
  transform-origin: left center; backface-visibility: hidden;
  transition: transform 1s cubic-bezier(0.6, 0.05, 0.3, 1);
}
.cover-board.open .cover-front { transform: rotateY(-160deg); }
.cover-inside {
  z-index: 1; display: grid; place-content: center; text-align: center; padding: 24px;
  background: var(--paper); color: var(--ink);
  font: 30px/1.25 var(--hand); box-shadow: var(--shadow);
}
.cover-inside .reward { font-size: 22px; color: var(--red-pen); margin-top: 8px; }
.elastic {
  position: absolute; top: -2px; bottom: -2px; right: 30px; width: 11px; border-radius: 3px;
  background: linear-gradient(90deg, #151515, #3a3a3a 40%, #1a1a1a);
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.35);
}
.cover-label {
  margin-top: 14%; max-width: 80%;
  background: #f4ecd8; color: #2a1d10;
  border: 2px solid #3a2a1a; padding: 16px 20px 14px;
  transform: rotate(-1deg);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}
.cover-kicker { margin: 0; font: 700 12px var(--mono); letter-spacing: 0.24em; text-transform: uppercase; }
.cover-title { font: 700 70px/0.95 var(--hand); margin: 2px 0 8px; }
.cover-title span { color: #b33a22; }
.cover-name { margin: 0; font: 600 21px/1.2 var(--serif); }
.cover-role { margin: 2px 0 12px; font: 13px var(--mono); }
.cover-meta { display: grid; grid-template-columns: auto 1fr; gap: 0 16px; margin: 0; border-top: 1.5px solid #3a2a1a; padding-top: 8px; }
.cover-meta div { display: contents; }
.cover-meta dt { font: 700 10px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.65; padding-top: 6px; }
.cover-meta dd { margin: 0; font: 600 21px/1.2 var(--hand); }
.cover-stickers .cs {
  position: absolute; display: grid; place-items: center; border-radius: 50%;
  font: 700 18px/1 var(--hand); color: #1f2a44;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3); border: 3px solid #fff;
}
.cs-1 { width: 78px; height: 78px; background: var(--sticky-green); left: 30px; bottom: 96px; transform: rotate(-14deg); }
.cs-2 { width: 48px; height: 48px; background: var(--sticky-yellow); right: 62px; bottom: 150px; transform: rotate(9deg); font-size: 28px; }
.cs-3 { width: 58px; height: 58px; background: #e9e4f7; right: 70px; bottom: 84px; transform: rotate(-6deg); font-size: 32px; }
.open-btn {
  margin-top: auto; align-self: flex-start;
  background: #1f2a44; color: #fbf8f0; border: 0; border-radius: var(--wobbly);
  padding: 8px 20px 10px; font: 700 25px/1 var(--hand); cursor: pointer;
  box-shadow: 0 5px 0 #0d1424, 0 10px 18px -6px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s, box-shadow 0.15s;
}
.open-btn:hover { transform: translateY(-2px); }
.open-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #0d1424; }
.cover-hint { margin: 22px 0 0; font: 22px var(--hand); color: var(--bar-ink); opacity: 0.7; text-align: center; animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(5px); } }

/* ------------------------------------------------------------ Pages */
.book { max-width: var(--book-w); margin: 0 auto 90px; padding: 0 16px; }
.page {
  position: relative; overflow: hidden;
  margin: 0 0 30px; padding: 52px 60px 60px calc(var(--margin-x) + 30px);
  background-color: var(--paper); color: var(--ink);
  border-radius: 3px 8px 8px 3px; box-shadow: var(--shadow);
  transition: background-color 0.4s;
}
.page:nth-child(odd) { transform: rotate(-0.25deg); }
.page:nth-child(even) { transform: rotate(0.2deg); }
/* Paper fibres on top of the ruling */
.page::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .38 0 0 0 0 .25 0 0 0 .12 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply; opacity: 0.9;
}
[data-theme="blueprint"] .page::after { mix-blend-mode: soft-light; opacity: 0.5; }
/* Binding holes down the left edge */
.page::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 14px; width: 14px; z-index: 1;
  background: radial-gradient(circle at 7px 7px, var(--desk) 5px, rgba(0, 0, 0, 0.18) 6px, transparent 7px) 0 18px / 14px 36px repeat-y;
}
.page > * { position: relative; z-index: 2; }
.ruled {
  background-image:
    linear-gradient(90deg, transparent var(--margin-x), var(--margin-line) var(--margin-x), var(--margin-line) calc(var(--margin-x) + 2px), transparent calc(var(--margin-x) + 2px)),
    repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px);
  background-position: 0 0, 0 20px;
}
.grid {
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 24px 24px;
}
.dotted {
  background-image: radial-gradient(var(--rule-strong) 1.3px, transparent 1.8px);
  background-size: 22px 22px;
}
.page-head { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head h2 { font-size: 54px; line-height: 1; color: var(--ink); }
.page-no { position: absolute; top: -30px; right: -36px; font: 13px var(--mono); color: var(--ink-soft); }
.date-stamp {
  font: 700 13px var(--mono); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--red-pen); border: 2px solid currentColor; border-radius: 4px;
  padding: 3px 8px; transform: rotate(-6deg); opacity: 0.8; margin-bottom: 8px;
}
.page-body { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 44px; align-items: start; }
.main-col p { margin: 0 0 22px; line-height: 32px; }
.main-col p.lede, .lede { font-size: 19px; }
.lede { margin: 0 0 26px; line-height: 32px; max-width: 62ch; }
.hl-y { background: linear-gradient(transparent 52%, var(--hl-bg) 52%, var(--hl-bg) 92%, transparent 92%); padding: 0 2px; }
.tilt { transform: rotate(-2deg); }

/* Rough SVG strokes: drawn in with a dash animation once the svg is .drawn */
.rough .ink {
  fill: none; stroke: var(--ink); stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1 2; stroke-dashoffset: 1;
}
.rough.drawn .ink { stroke-dashoffset: 0; transition: stroke-dashoffset 0.6s ease calc(var(--i) * 55ms); }
.rough.instant .ink, .rough.instant .sk-label { transition: none !important; }
.rough .ink.thin { stroke-width: 1.6; stroke: var(--ink-soft); }
.rough .ink.hatch { stroke-width: 1.1; stroke: var(--ink-soft); opacity: 0.6; }
.rough .ink.accent { stroke: var(--red-pen); }
.rough .ink.center { stroke-width: 2.8; }
.rough .ink.node.n0 { stroke: var(--blue-pen); }
.rough .ink.node.n2 { stroke: var(--red-pen); }
.sk-label { font-family: var(--hand); font-size: 22px; font-weight: 600; fill: var(--ink); opacity: 0; }
.rough.drawn .sk-label { opacity: 1; transition: opacity 0.5s ease calc(var(--i) * 55ms); }
.sk-label.big { font-size: 30px; font-weight: 700; }
.sk-label.mid { font-size: 24px; }
.sk-label.note { font-size: 24px; fill: var(--red-pen); }
.sk-label.center-label { font-weight: 700; }

/* ------------------------------------------------------------ p.1 Hello */
.doodle { margin: 0 0 10px; text-align: center; }
.doodle-svg { width: 100%; max-width: 220px; height: auto; }
.doodle figcaption { font-size: 21px; margin-top: -6px; }
.sticky {
  display: block; width: 100%; max-width: 220px; margin: 18px auto;
  padding: 22px 16px 18px; min-height: 120px; text-align: left;
  font: 600 24px/1.15 var(--hand); color: var(--sticky-ink);
  border: 0; border-radius: 2px 2px 14px 2px;
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.06) 0 16px, transparent 16px);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12), 0 12px 18px -10px rgba(0, 0, 0, 0.45);
  transform: rotate(var(--tilt));
  cursor: grab; touch-action: none; user-select: none; position: relative; z-index: 3;
  transition: box-shadow 0.2s;
}
.sticky.lifted { cursor: grabbing; z-index: 20; box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1), 0 26px 30px -14px rgba(0, 0, 0, 0.55); }
.sticky.peel { transition: transform 0.4s cubic-bezier(0.3, 1.4, 0.5, 1), box-shadow 0.2s; }
.sticky.yellow { background-color: var(--sticky-yellow); }
.sticky.pink { background-color: var(--sticky-pink); }
.sticky.green { background-color: var(--sticky-green); }
.sticky.blue { background-color: var(--sticky-blue); }

/* ------------------------------------------------------------ p.2 Mind map */
.map-canvas svg { display: block; width: 100%; height: auto; }
.map-foot { text-align: center; margin: 14px 0 0; font-size: 26px; }

/* ------------------------------------------------------------ p.3 Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; top: 10px; bottom: 30px; left: 101px; width: 12px;
  background-color: var(--ink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='80'%3E%3Cpath d='M6 0 Q3 20 6 40 T6 80' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") 0 0 / 12px 80px repeat-y;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='80'%3E%3Cpath d='M6 0 Q3 20 6 40 T6 80' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") 0 0 / 12px 80px repeat-y;
}
.tl { display: grid; grid-template-columns: 84px 1fr; gap: 0 46px; margin: 0 0 30px; position: relative; }
.tl::before {
  content: ""; position: absolute; left: 98px; top: 12px; width: 18px; height: 18px;
  border: 2.5px solid var(--ink); border-radius: 48% 52% 45% 55%; background: var(--paper);
}
.tl.era-ibm::before { background: var(--era-ibm); }
.tl.era-certent::before { background: var(--era-certent); }
.tl.era-isw::before { background: var(--era-isw); }
.tl.era-pm::before { background: var(--era-pm); }
.tl-year { font: 700 36px/1 var(--hand); text-align: right; padding-top: 4px; }
.tl-body h3 { font: 700 32px/1.1 var(--hand); }
.hl-era { padding: 0 4px; background: linear-gradient(transparent 45%, var(--hl-bg) 45%, var(--hl-bg) 90%, transparent 90%); }
.era-ibm .hl-era { --hl-bg: var(--era-ibm); }
.era-certent .hl-era { --hl-bg: var(--era-certent); }
.era-isw .hl-era { --hl-bg: var(--era-isw); }
.era-pm .hl-era { --hl-bg: var(--era-pm); }
.tl-role { margin: 4px 0 6px; font: 13px var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); }
.tl-body p { margin: 0; max-width: 60ch; }
.tl-next::before { border-style: dashed; }
.tl-next .tl-year { color: var(--ink-soft); }
[data-reveal].tl, .lessons [data-reveal], .cards [data-reveal] { opacity: 0; translate: 0 10px; transition: opacity 0.6s ease, translate 0.6s ease; }
[data-reveal].tl.in, .lessons [data-reveal].in, .cards [data-reveal].in { opacity: 1; translate: 0 0; }

/* ------------------------------------------------------------ p.4–6 Sketch → Ship */
.case { margin-top: 44px; padding-top: 36px; border-top: 2px dashed var(--rule-strong); }
.case-head { margin-bottom: 20px; }
.kicker { font: 700 12px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
.case-head h3 { font-size: 40px; line-height: 1.05; margin-top: 4px; }
.case-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 40px; align-items: start; }
.case-notes dl { margin: 0; }
.case-notes dt { font: 700 25px/1 var(--hand); color: var(--blue-pen); margin-top: 12px; }
.case-notes dd { margin: 4px 0 0; font-size: 16px; line-height: 1.6; }
.kpis { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 16px 22px; }
.kpis li { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.circled {
  font: 700 32px/1 var(--hand); color: var(--ink);
  padding: 8px 16px 6px; border: 2.5px solid var(--red-pen); border-radius: var(--wobbly);
}
.kpis span { font: 12px var(--mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); max-width: 16ch; }
.viewer {
  position: relative; aspect-ratio: 600 / 380; container-type: inline-size;
  background: var(--paper); border-radius: 6px; overflow: hidden;
  box-shadow: 0 0 0 1.5px var(--rule-strong), 0 14px 30px -18px rgba(0, 0, 0, 0.5);
  cursor: ew-resize; touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.viewer.focus { outline: 3px solid var(--hl); outline-offset: 4px; }
.v-sketch, .v-mock { position: absolute; inset: 0; }
.v-sketch svg { display: block; width: 100%; height: 100%; }
.v-mock { clip-path: inset(0 calc(100% - var(--v) * 1%) 0 0); }
.v-handle {
  position: absolute; top: 0; bottom: 0; left: calc(var(--v) * 1%); width: 2.5px; margin-left: -1.25px;
  background: var(--red-pen); pointer-events: none;
}
.v-handle span {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 38px; height: 38px; display: grid; place-items: center;
  background: var(--red-pen); color: #fff; border-radius: 50%;
  font: 700 22px/1 var(--mono); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}
.viewer.dragging .v-handle span { transform: translate(-50%, -50%) scale(1.12); }
.stamp {
  position: absolute; right: 4%; bottom: 6%; z-index: 3; pointer-events: none;
  font: 700 4.2cqw/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--stamp); border: 0.6cqw solid currentColor; border-radius: 0.8cqw; padding: 0.8cqw 1.6cqw;
  background: rgba(255, 255, 255, 0.75);
  opacity: 0; transform: rotate(-9deg) scale(1.8);
  transition: opacity 0.2s, transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.viewer.is-shipped .stamp { opacity: 0.92; transform: rotate(-9deg) scale(1); }
.v-range { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.viewer-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; font: 13px var(--mono); color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.08em; }
.ship-btn {
  font: 700 22px/1 var(--hand); text-transform: none; letter-spacing: 0;
  background: var(--paper); color: var(--ink); cursor: pointer;
  border: 2px solid var(--ink); border-radius: var(--wobbly); padding: 6px 18px 8px;
  box-shadow: 3px 3px 0 var(--ink); transition: transform 0.12s, box-shadow 0.12s;
}
.ship-btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.ship-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.margin-quote { margin: 18px 0 0; transform: rotate(-1.5deg); color: var(--red-pen); font-size: 26px; }

/* Shipped product mocks: clean UI, always a light screen */
.mock {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: #fff; color: #1d2433;
  font: 2.1cqw/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.mock-bar { flex: none; height: 9%; display: flex; align-items: center; gap: 2.4cqw; padding: 0 3cqw; background: #f1f3f7; border-bottom: 1px solid #e3e7ee; font-size: 1.05em; }
.mock-bar .dots { display: flex; gap: 0.9cqw; }
.mock-bar .dots i { width: 1.4cqw; height: 1.4cqw; border-radius: 50%; background: #ff5f57; }
.mock-bar .dots i:nth-child(2) { background: #febc2e; }
.mock-bar .dots i:nth-child(3) { background: #28c840; }
.mock-body { flex: 1; padding: 3.4cqw 4cqw; min-height: 0; }
.mock-signal .mock-body { display: grid; grid-template-columns: 1.9fr 1fr; gap: 4cqw; }
.themes { list-style: none; margin: 0; padding: 0; }
.themes li { display: grid; grid-template-columns: 10.6em 1fr 1.9em 6.6em; align-items: center; gap: 0.7em; padding: 0.62em 0; border-bottom: 1px solid #eef0f4; }
.th-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-bar { height: 0.7em; background: #eef1f6; border-radius: 4px; overflow: hidden; }
.th-bar i { display: block; height: 100%; background: #2a78d6; border-radius: 0 4px 4px 0; }
.th-n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.tag { justify-self: start; font-size: 0.74em; padding: 0.2em 0.65em; border-radius: 999px; background: #f1f3f7; color: #5b6473; white-space: nowrap; }
.tag.ok { background: #e3f6ee; color: #13744f; }
.mock-kpi { align-self: start; display: flex; flex-direction: column; gap: 0.3em; border: 1px solid #e3e7ee; border-radius: 0.6em; padding: 1.1em; }
.mock-kpi b { font-size: 3.4em; line-height: 1; }
.mock-kpi span { color: #5b6473; }
.mock-kpi em { font-style: normal; font-weight: 600; color: #13744f; margin-top: 0.4em; }
.mock-integration .cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.6cqw; }
.mock-integration .col { border: 1px solid #e3e7ee; border-radius: 0.6em; padding: 0.9em; }
.mock-integration h4 { font-size: 1.12em; margin: 0 0 0.45em; }
.mock-integration ul { list-style: none; margin: 0; padding: 0; }
.mock-integration li { display: flex; gap: 0.5em; align-items: flex-start; margin: 0.5em 0; }
.cb { flex: none; width: 1.25em; height: 1.25em; border-radius: 0.3em; background: #1baf7a; color: #fff; font-size: 0.8em; display: grid; place-items: center; margin-top: 0.15em; }
.gauge { display: flex; align-items: center; gap: 1.2em; margin-top: 3.2cqw; }
.gauge svg { width: 9em; height: auto; }
.g-track, .g-fill { fill: none; stroke-width: 11; stroke-linecap: round; }
.g-track { stroke: #eef1f6; }
.g-fill { stroke: #1baf7a; }
.gauge b { display: block; font-size: 2.2em; line-height: 1; }
.gauge span { color: #5b6473; }
.mock-ai table { width: 100%; border-collapse: collapse; }
.mock-ai th { text-align: left; font-size: 0.85em; font-weight: 600; color: #5b6473; padding: 0 0.4em 0.6em; border-bottom: 1px solid #e3e7ee; }
.mock-ai td { padding: 0.7em 0.4em; border-bottom: 1px solid #eef0f4; }
.mock-ai .num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { font-size: 0.85em; padding: 0.2em 0.7em; border-radius: 999px; background: #f1f3f7; color: #5b6473; white-space: nowrap; }
.pill.on { background: #e8f0fc; color: #1d5bb0; }
.mock-total { margin: 1em 0 0; font-weight: 700; font-size: 1.3em; color: #13744f; }

/* ------------------------------------------------------------ p.7 Principles */
.cards { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 34px 30px; }
.cards li { transform: rotate(var(--tilt)); }
.card { position: relative; display: block; width: 100%; aspect-ratio: 5 / 3.1; padding: 0; border: 0; background: none; cursor: pointer; perspective: 900px; text-align: left; }
.tape {
  position: absolute; z-index: 3; top: -12px; left: 50%; width: 88px; height: 26px;
  transform: translateX(-50%) rotate(-3deg);
  background: rgba(255, 248, 215, 0.62); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.card-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1); }
.card.flipped .card-inner { transform: rotateY(180deg); }
.card-front, .card-back {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  padding: 44px 18px 16px; color: #1f2a44; border-radius: 2px;
  background:
    linear-gradient(to bottom, transparent 0 32px, rgba(214, 88, 88, 0.55) 32px 34px, transparent 34px),
    repeating-linear-gradient(to bottom, transparent 0 57px, rgba(70, 120, 185, 0.25) 57px 58px, transparent 58px 82px),
    #fffdf8;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15), 0 14px 22px -14px rgba(0, 0, 0, 0.5);
}
.card-front .hand { display: block; font-size: 30px; line-height: 1.05; }
.card-no { position: absolute; top: 8px; left: 12px; font: 700 12px var(--mono); color: #b33a22; }
.card-back { transform: rotateY(180deg); font: 16px/1.5 var(--serif); display: flex; align-items: center; }
.card:hover .card-inner { transform: rotate(-1deg) translateY(-3px); }
.card.flipped:hover .card-inner { transform: rotateY(180deg) translateY(-3px); }

/* ------------------------------------------------------------ p.8 Pencil chart */
.figure { margin: 0; }
.figure figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; color: var(--ink-soft); font-size: 15px; }
.pencil-box { width: 100%; }
.pencils { display: block; width: 100%; overflow: visible; }
.pencils .grid { stroke: var(--rule-strong); stroke-width: 1; }
.pencils .axis { font: 12px var(--mono); fill: var(--ink-soft); }
.pencils .label { font: 15px var(--serif); fill: var(--ink); }
.pencils .value { font: 700 14px var(--mono); fill: var(--ink); }
.pencils .sharpening { font: 600 20px var(--hand); fill: var(--red-pen); }
.pencils .hit { fill: transparent; }
.pencil:focus { outline: none; }
.pencil:focus-visible .hit { stroke: var(--hl); stroke-width: 2; }
.pencil .eraser { fill: #f19aa8; stroke: #3a2a2a; stroke-width: 0.8; }
.pencil .ferrule { fill: #b9bcc2; stroke: #5d6168; stroke-width: 0.8; }
.pencil .ferrule-line { stroke: #7d828a; stroke-width: 1; }
.pencil .wood-paint { fill: #f2c230; stroke: #8a6a10; stroke-width: 1; }
.pencil .facet { stroke: rgba(0, 0, 0, 0.14); stroke-width: 1.5; }
.pencil .wood { fill: #e9c9a0; stroke: #8a6a10; stroke-width: 1; stroke-linejoin: round; }
.pencil .lead { fill: #2d2d2d; }
.pencil-body { transform-box: fill-box; transform-origin: left center; transform: scaleX(0); }
.pencil .value, .pencil .sharpening { opacity: 0; }
.pencil-box.drawn .pencil-body { transform: scaleX(1); transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) calc(var(--i) * 90ms); }
.pencil-box.drawn .pencil .value, .pencil-box.drawn .pencil .sharpening { opacity: 1; transition: opacity 0.4s ease calc(var(--i) * 90ms + 700ms); }
.pencil.hover .pencil-body { filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.3)); }
.data-table { width: 100%; border-collapse: collapse; font-size: 15px; background: var(--paper); }
.data-table th, .data-table td { padding: 8px 10px; border-bottom: 1px solid var(--rule-strong); text-align: left; }
.data-table th { font: 700 12px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ p.9 Lessons */
.lessons { list-style: none; margin: 0; padding: 0; }
.lessons li { margin: 0 0 22px; }
.wrong { text-decoration: none; color: var(--ink-soft); font-size: 18px; line-height: 32px; }
.wrong span {
  background: linear-gradient(var(--red-pen), var(--red-pen)) no-repeat 0 58% / 0% 2.5px;
  transition: background-size 0.8s ease 0.35s;
}
.lessons li.in .wrong span { background-size: 100% 2.5px; }
.right { display: block; font: 700 30px/1.1 var(--hand); color: var(--blue-pen); opacity: 0; transition: opacity 0.6s ease 0.9s; }
.right::before { content: "→ "; color: var(--red-pen); }
.lessons li.in .right { opacity: 1; }
.secret-wrap { position: relative; max-width: 220px; margin: 26px auto 0; }
.secret {
  margin: 0; min-height: 132px; padding: 18px 16px; display: grid; place-items: center; text-align: center;
  font: 600 22px/1.2 var(--hand); color: var(--red-pen);
  border: 2px dashed var(--rule-strong); border-radius: 6px;
}
.secret.revealed { animation: pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes pop { from { transform: scale(0.85); } }
.secret-sticky { position: absolute; inset: 0; margin: 0; max-width: none; min-height: 0; }

/* ------------------------------------------------------------ p.10 Side quests */
.quests { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 34px; align-items: start; }
.quest h3 { font-size: 32px; }
.quest p { margin: 6px 0 14px; }
.board {
  display: grid; grid-template-columns: repeat(5, 1fr); width: min(100%, 290px);
  border: 2.5px solid var(--ink); border-radius: 6px 10px 5px 9px; overflow: hidden;
}
.board-row { display: contents; }
.sq { aspect-ratio: 1; border: 0; padding: 0; font-size: 30px; line-height: 1; color: var(--ink); background: transparent; cursor: default; }
.sq.dark { background: color-mix(in srgb, var(--ink) 13%, transparent); }
.sq.legal { cursor: pointer; background-image: radial-gradient(circle, var(--blue-pen) 0 5px, transparent 6px); }
.sq.legal:hover, .sq.legal:focus-visible { background-color: var(--hl-bg); }
.board-status { font: 700 14px var(--mono); margin: 10px 0 2px !important; }
.doodle-btn { display: block; background: none; border: 0; padding: 0; cursor: pointer; width: 140px; }
.doodle-btn svg { width: 100%; height: auto; overflow: visible; }
#atom ellipse { fill: none; stroke: var(--ink); stroke-width: 2.2; }
#atom .e { fill: var(--red-pen); }
#atom .nucleus { fill: var(--blue-pen); }
#atom .orbit { transform-origin: 60px 60px; }
#atom .o2 { transform: rotate(60deg); }
#atom .o3 { transform: rotate(-60deg); }
#atom.spin .o1 { animation: orbit1 2.6s linear infinite; }
#atom.spin .o2 { animation: orbit2 3.1s linear infinite; }
#atom.spin .o3 { animation: orbit3 3.7s linear infinite; }
@keyframes orbit1 { to { transform: rotate(360deg); } }
@keyframes orbit2 { from { transform: rotate(60deg); } to { transform: rotate(420deg); } }
@keyframes orbit3 { from { transform: rotate(-60deg); } to { transform: rotate(300deg); } }
#mug .mug { fill: var(--paper); stroke: var(--ink); stroke-width: 2.4; stroke-linejoin: round; }
#mug .coffee { stroke: #7a4a2a; stroke-width: 6; stroke-linecap: round; }
#mug .steam path { fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-linecap: round; opacity: 0; }
#mug.refill .steam path { animation: steam 1.8s ease-out; }
#mug.refill .steam path:nth-child(2) { animation-delay: 0.15s; }
#mug.refill .steam path:nth-child(3) { animation-delay: 0.3s; }
@keyframes steam { 20% { opacity: 0.9; } to { opacity: 0; transform: translateY(-14px); } }
.coffee-ring {
  position: absolute; z-index: 1 !important; width: 118px; height: 118px; pointer-events: none;
  border-radius: 50% 48% 52% 50%; border: 7px solid rgba(122, 74, 42, 0.16);
  box-shadow: inset 0 0 0 2px rgba(122, 74, 42, 0.12);
}

/* ------------------------------------------------------------ p.11 Scratch pad */
.pad-wrap { position: relative; }
.pad {
  display: block; width: 100%; height: 380px; touch-action: none; cursor: crosshair;
  background: color-mix(in srgb, var(--paper) 60%, transparent);
  border: 2px dashed var(--rule-strong); border-radius: 6px;
}
.pad-tools { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--paper); cursor: pointer; box-shadow: 0 0 0 2px var(--rule-strong); }
.swatch.on { box-shadow: 0 0 0 3px var(--ink); }
.swatch.ink { background: var(--ink); }
.swatch.red { background: var(--red-pen); }
.swatch.hl { background: var(--hl); }
.pad-wrap.torn { animation: tear 0.45s ease; }
@keyframes tear { 30% { transform: rotate(1.4deg) translateY(-6px); } 60% { transform: rotate(-0.8deg); } }

/* ------------------------------------------------------------ Back pocket */
.page.pocket {
  padding: 56px 40px 40px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .2 0 0 0 0 .1 0 0 0 .3 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(170deg, #c79a66, var(--kraft) 50%, var(--kraft-dark));
  color: #2a1d10;
}
[data-theme="blueprint"] .page.pocket { background: linear-gradient(170deg, #26548f, #1a3c69); color: var(--ink); }
.page.pocket::before { display: none; }
.pocket-sleeve { position: relative; padding-top: 10px; }
.envelope {
  max-width: 580px; margin: 0 auto; padding: 38px 40px 30px; transform: rotate(-1.2deg);
  background: #fbf8f0; color: #1f2a44; border-radius: 3px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08), 0 22px 40px -20px rgba(0, 0, 0, 0.6);
}
.envelope::before {
  content: ""; position: absolute; top: -13px; left: 50%; width: 110px; height: 28px;
  transform: translateX(-50%) rotate(2deg); background: rgba(255, 248, 215, 0.7); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.envelope h2 { font-size: 40px; line-height: 1; color: #1f2a44; }
.pocket-name { font: 600 28px/1.2 var(--serif); margin: 10px 0 6px; }
.pocket-avail { margin: 0 0 22px; color: #4d566b; }
.pocket-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; padding: 8px 18px 9px;
  font: 700 22px/1 var(--hand); color: #1f2a44; text-decoration: none; cursor: pointer;
  background: #fbf8f0; border: 2px solid #1f2a44; border-radius: var(--wobbly); box-shadow: 3px 3px 0 #1f2a44;
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 #1f2a44; }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #1f2a44; }
.btn.primary { background: #1f2a44; color: #fbf8f0; }
.fine { margin: 20px 0 0; font: 12px var(--mono); color: #6b7385; }
.other-editions { text-align: center; margin-top: 40px; }
.other-editions .hand-note { color: inherit; font-size: 28px; margin: 0 0 8px; }
.other-editions ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.other-editions a { color: inherit; font-weight: 600; text-decoration-style: wavy; text-decoration-thickness: 1.5px; }
.other-editions span { font: 13px var(--mono); opacity: 0.75; }
.colophon { margin: 26px 0 0; font: 12px var(--mono); opacity: 0.7; }

/* ------------------------------------------------------------ Overlays */
.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(10, 8, 6, 0.5); animation: fade 0.25s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; z-index: 60; top: 0; right: 0; bottom: 0; width: min(460px, 100vw);
  padding: 22px 24px 30px; overflow-y: auto;
  background: var(--paper); color: var(--ink);
  background-image: radial-gradient(var(--rule-strong) 1.2px, transparent 1.6px); background-size: 22px 22px;
  box-shadow: -20px 0 50px -20px rgba(0, 0, 0, 0.7);
  animation: slide 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes slide { from { transform: translateX(100%); } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { font: 700 42px/1 var(--hand); }
.x { background: none; border: 0; font-size: 34px; line-height: 1; cursor: pointer; color: var(--ink); padding: 4px 8px; }
.sheet-intro { color: var(--ink-soft); margin: 8px 0 22px; }
.sheet-grid { list-style: none; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px 18px; }
.sheet-item { text-align: center; }
.sheet-item .sticker {
  width: 86px; height: 86px; margin: 0 auto 8px; display: grid; place-items: center;
  border-radius: 50%; border: 4px solid #fff; transform: rotate(var(--tilt));
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
}
.sheet-item .sticker svg { width: 56px; height: 56px; }
.sheet-item.off .sticker { border: 2.5px dashed var(--ink-soft); box-shadow: none; opacity: 0.6; }
.sheet-item b { display: block; font: 700 24px/1.1 var(--hand); }
.sheet-item .desc { display: block; font-size: 14px; line-height: 1.45; color: var(--ink-soft); margin-top: 2px; }
.sheet-item.fresh .sticker { animation: slap 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes slap { from { transform: scale(1.6) rotate(-20deg); opacity: 0; } }

.toasts { position: fixed; z-index: 70; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px 10px 10px; max-width: 360px;
  background: #fbf8f0; color: #1f2a44; border-radius: 10px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1), 0 16px 30px -12px rgba(0, 0, 0, 0.6);
  animation: slap-toast 0.5s cubic-bezier(0.3, 1.5, 0.5, 1);
  transition: opacity 0.4s, transform 0.4s;
}
.toast.plain { padding: 12px 18px; }
.toast.out { opacity: 0; transform: translateY(12px); }
@keyframes slap-toast { from { transform: scale(1.25) rotate(-6deg); opacity: 0; } }
.toast-sticker { flex: none; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25); background: var(--sticky-yellow); font-size: 26px; transform: rotate(-8deg); }
.toast-sticker svg { width: 36px; height: 36px; }
.toast b { display: block; font: 700 24px/1.05 var(--hand); }
.toast .sub { display: block; font: 12px var(--mono); color: #4d566b; margin-top: 2px; }
.tooltip {
  position: fixed; z-index: 80; pointer-events: none; max-width: 240px;
  background: #1f2a44; color: #fbf8f0; padding: 7px 11px; border-radius: 7px;
  font: 14px/1.4 var(--serif); box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.6);
}
[data-theme="blueprint"] .tooltip { background: #f1f6ff; color: #0d1828; }
.draft-banner {
  position: fixed; z-index: 50; left: 18px; bottom: 18px; max-width: calc(100vw - 36px);
  background: var(--red-pen); color: #fff; padding: 10px 14px; border-radius: 8px;
  font: 13px var(--mono); box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.6);
}
[data-theme="blueprint"] .draft-banner { color: #0d1828; }
.draft-banner button { background: none; border: 0; color: inherit; font: 700 13px var(--mono); text-decoration: underline; cursor: pointer; margin-left: 6px; }

/* ------------------------------------------------------------ Eggs: highlighter and draft mode */
body.hl-mode .page {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24'%3E%3Cpath d='M6 17 L15 5 L20 9 L11 21 Z' fill='%23ffe45c' stroke='%231f2a44' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M6 17 L4 20.5 H9' fill='none' stroke='%231f2a44' stroke-width='1.6'/%3E%3C/svg%3E") 4 28, text;
}
body.hl-mode .page ::selection { background: var(--hl-bg); }
mark.hl {
  color: inherit; padding: 0 2px; border-radius: 0.35em 0.15em 0.4em 0.2em;
  background: linear-gradient(100deg, transparent 0.1em, var(--hl-bg) 0.25em, var(--hl-bg) 96%, transparent) no-repeat 0 0 / 100% 100%;
  animation: sweep 0.35s ease-out;
}
@keyframes sweep { from { background-size: 0 100%; } }

body.draft { --serif: var(--hand); }
body.draft .main-col p, body.draft .case-notes dd, body.draft .tl-body p, body.draft .lede, body.draft .lessons .wrong, body.draft .card-back { font-size: 22px; }
body.draft .mock { filter: url(#wobble) grayscale(1) contrast(1.15); font-family: var(--hand); }
body.draft .page-head h2, body.draft .case-head h3, body.draft .pencils, body.draft .card-front { filter: url(#wobble); }
body.draft .page { transform: rotate(-0.6deg); }

/* ------------------------------------------------------------ Responsive */
@media (min-width: 1180px) { .tabs { display: flex; opacity: 0; pointer-events: none; transition: opacity .3s; } body.past-cover .tabs { opacity: 1; pointer-events: auto; } }
@media (max-width: 1000px) {
  .case-grid { grid-template-columns: 1fr; gap: 24px; }
  .case-view { order: -1; }
  .quests { grid-template-columns: 1fr 1fr; }
  .quest.chess { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  :root { --margin-x: 30px; }
  .page { padding: 44px 24px 46px calc(var(--margin-x) + 22px); }
  .page-body { grid-template-columns: 1fr; gap: 10px; }
  .margin-col { display: flex; flex-wrap: wrap; gap: 0 20px; justify-content: center; }
  .margin-col .doodle { flex: 1 1 100%; }
  .margin-col .sticky { flex: 0 1 200px; margin: 14px 0; }
  .page-head h2 { font-size: 44px; }
  .page-no { right: -10px; top: -28px; }
  .tl { grid-template-columns: 56px 1fr; gap: 0 36px; }
  .timeline::before { left: 66px; }
  .tl::before { left: 63px; }
  .tl-year { font-size: 30px; }
  .case-head h3 { font-size: 34px; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .topbar { padding: 0 12px; }
  .brand-sub, .tool-label { display: none; }
  .tool { padding: 6px 9px; }
  .book { padding: 0 8px; }
  .page { padding: 40px 18px 40px calc(var(--margin-x) + 14px); }
  .page::before { left: 6px; transform: scale(0.8); }
  :root { --margin-x: 24px; }
  .page-head h2 { font-size: 40px; }
  .main-col p { line-height: 30px; }
  .quests { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; gap: 26px; }
  .card { aspect-ratio: 5 / 2.3; }
  .pad { height: 300px; }
  .envelope { padding: 30px 22px 24px; }
  .page.pocket { padding: 48px 16px 32px; }
  .cover-title { font-size: 58px; }
  .cover-front { padding: 24px 22px 22px 30px; }
  .cs-1 { width: 64px; height: 64px; bottom: 86px; }
  .toasts { left: 12px; right: 12px; align-items: stretch; }
  .toast { max-width: none; }
}

/* ------------------------------------------------------------ Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal].tl, .lessons [data-reveal], .cards [data-reveal] { opacity: 1; translate: none; }
  .right { opacity: 1; }
  .wrong span { background-size: 100% 2.5px; }
  .pencil-body { transform: none; }
  .pencil .value, .pencil .sharpening { opacity: 1; }
}

/* ------------------------------------------------------------ Print */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  .topbar, .tabs, .toasts, .sheet, .scrim, .tooltip, .draft-banner, .cover-hint, .open-btn, .pad-tools, .ship-btn, .link-btn, .v-handle, .pocket-actions button, .page::before, .page::after { display: none !important; }
  .cover { min-height: auto; padding: 0; break-after: page; }
  .cover-board { animation: none; transform: none; }
  .page { transform: none !important; box-shadow: none; break-inside: avoid-page; margin: 0 0 10mm; padding: 10mm 8mm; }
  .case { break-inside: avoid; }
  .viewer { --v: 100 !important; box-shadow: 0 0 0 1px #ccc; }
  .viewer .stamp { opacity: 0.9; transform: rotate(-9deg); }
  .rough .ink { stroke-dashoffset: 0 !important; }
  .sk-label { opacity: 1 !important; }
  .pencil-body { transform: none !important; }
  .pencil .value, .pencil .sharpening, [data-reveal], .right { opacity: 1 !important; translate: none !important; }
  .wrong span { background-size: 100% 2.5px !important; }
  .page.scratch-hide, #scratch { display: none; }
}

/* Phones: a taller screen and larger type in the product mocks */
@media (max-width: 560px) {
  .viewer { aspect-ratio: 600 / 450; }
  .v-sketch svg { object-fit: contain; }
  .mock { font-size: 2.55cqw; }
  .themes li { grid-template-columns: 1fr 5em 1.9em; }
  .themes .tag { display: none; }
  .mock-signal .mock-body { grid-template-columns: 1.6fr 1fr; gap: 3cqw; }
  .mock-kpi b { font-size: 2.6em; }
}
