/* Button the Bear — watercolour storybook */
:root {
  --paper: #f4ecdd;
  --paper-2: #fbf6ec;
  --paper-3: #efe3cd;
  --ink: #4a3b33;
  --ink-soft: #7c6a5d;
  --rose: #e3a196;
  --sage: #a7c09f;
  --sky: #9fbdd6;
  --butter: #f0d389;
  --thread: #c8574a;
  --button: #7ea6c9;
  --nav-h: 64px;
  --grain: 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='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .32 0 0 0 0 .24 0 0 0 0 .18 0 0 0 .11 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --fibre: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.006 .04' numOctaves='3' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .42 0 0 0 0 .3 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--paper);
  background-image: var(--grain), var(--fibre);
  color: var(--ink);
  font: 400 17px/1.6 "Literata", Georgia, serif;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 6px; text-decoration: none; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2.5px dashed var(--thread); outline-offset: 3px; border-radius: 6px; }
.hand { font-family: "Caveat", "Segoe Print", cursive; }

/* ---------------- nav ---------------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 clamp(16px, 3vw, 36px);
  background: linear-gradient(var(--paper) 55%, rgba(244, 236, 221, 0));
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 600 22px/1 "Fraunces", serif; letter-spacing: -.01em; }
.brand svg { width: 32px; height: 32px; transition: transform .6s cubic-bezier(.3, 1.6, .5, 1); }
.brand:hover svg { transform: rotate(90deg); }
.links { display: flex; gap: 4px; }
.links a { text-decoration: none; padding: 6px 12px; border-radius: 99px; font-size: 15px; color: var(--ink-soft); transition: color .2s, background .2s; }
.links a:hover { color: var(--ink); background: rgba(74, 59, 51, .07); }
.nav-right { display: flex; align-items: center; gap: 8px; }
.music, .xbtn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border: 1.5px solid var(--ink); border-radius: 99px; background: var(--paper-2); color: var(--ink);
  font: 600 14px/1 "Literata", serif; cursor: pointer; text-decoration: none;
  box-shadow: 2px 2px 0 rgba(74, 59, 51, .85);
  transition: transform .15s, box-shadow .15s, background .2s;
}
.music svg, .xbtn svg { width: 17px; height: 17px; }
.music:hover, .xbtn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.music:active, .xbtn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.xbtn { background: var(--ink); color: var(--paper-2); }
.music[aria-pressed="true"] { background: var(--butter); }
.music[aria-pressed="true"] svg { animation: bob 1.1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-2px) rotate(-6deg); } }
[hidden] { display: none !important; }

/* ---------------- storybook ---------------- */
.story { position: relative; padding-top: calc(var(--nav-h) + 12px); }
.stage { position: relative; }
.book { position: relative; width: min(760px, calc(100% - 32px)); margin: 0 auto; display: grid; gap: 28px; }
.endpaper { display: none; }
.leaf { position: relative; }
.face {
  position: relative; background-color: var(--paper-2); background-image: var(--grain);
  border-radius: 4px 14px 14px 4px; box-shadow: 0 1px 0 rgba(74, 59, 51, .08), 0 18px 40px -22px rgba(74, 59, 51, .45);
  padding: clamp(18px, 3vw, 30px);
}
.back { display: none; }
.front { display: flex; flex-direction: column; gap: 14px; }
.art { width: 100%; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; }
.art svg { width: 100%; height: 100%; }
.words h2 { font: 600 clamp(24px, 2.4vw, 30px)/1.1 "Fraunces", serif; margin: 2px 0 8px; letter-spacing: -.015em; }
.words p { margin: 0 0 8px; font-size: clamp(15px, 1.15vw, 16.5px); line-height: 1.58; }
.chap { font: italic 600 14px/1 "Fraunces", serif !important; color: var(--thread); letter-spacing: .08em; text-transform: uppercase; }
.the-end { font-size: 24px !important; color: var(--ink-soft); text-align: center; margin-top: 10px !important; }

.cover { text-align: center; align-items: center; justify-content: space-between; background-color: #f6ead6; }
.cover::before { content: ""; position: absolute; inset: 12px; border: 1.5px dashed rgba(200, 87, 74, .55); border-radius: 4px 10px 10px 4px; pointer-events: none; }
.eyebrow { margin: 4px 0 0; font: italic 400 15px/1.2 "Fraunces", serif; color: var(--ink-soft); }
.title { margin: 0; display: grid; gap: 2px; }
.title span { font: 700 clamp(64px, 9vw, 112px)/.9 "Fraunces", serif; letter-spacing: -.04em; color: var(--ink); }
.title span::first-letter { color: var(--thread); }
.title em { font: 700 clamp(22px, 2.4vw, 30px)/1 "Caveat", cursive; color: #5f87ab; font-style: normal; }
.art-cover { aspect-ratio: 1 / 1; max-width: 340px; }
.cover-foot { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ticker-chip { font: 600 14px/1 "Literata", serif; padding: 7px 14px; border-radius: 99px; background: var(--butter); border: 1.5px solid var(--ink); }
.scroll-hint { font: 500 19px/1 "Caveat", cursive; color: var(--ink-soft); }
.scroll-hint i { display: inline-block; font-style: normal; animation: hint 1.8s ease-in-out infinite; }
@keyframes hint { 50% { transform: translateY(5px); } }

.book-ui { display: none; }

/* --- book mode (JS on, motion allowed) --- */
.book-on .story { height: calc(var(--turns, 5) * 92vh + 100vh); padding-top: 0; }
.book-on .stage {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding-top: calc(var(--nav-h) - 4px); gap: 14px; overflow: hidden;
}
.book-on .book {
  display: block; width: min(1080px, calc(100vw - 48px));
  height: min(calc(100svh - var(--nav-h) - 96px), 700px);
  perspective: 2400px; transform-style: preserve-3d;
  transform: translateX(var(--shift, 0px));
  margin: 0;
}
.book-on .book::before { /* soft table shadow */
  content: ""; position: absolute; left: 4%; right: 4%; bottom: -26px; height: 40px;
  background: radial-gradient(closest-side, rgba(74, 59, 51, .28), transparent); filter: blur(6px); z-index: -1;
}
.book-on .endpaper {
  display: grid; place-items: center; position: absolute; left: 0; top: 0; width: 50%; height: 100%;
  background-color: #e6efe3;
  background-image: var(--grain), radial-gradient(circle at 12px 12px, rgba(126, 166, 201, .55) 4.5px, transparent 5.5px), radial-gradient(circle at 36px 36px, rgba(227, 161, 150, .5) 4.5px, transparent 5.5px);
  background-size: auto, 48px 48px, 48px 48px;
  border-radius: 14px 4px 4px 14px;
  box-shadow: inset -18px 0 30px -18px rgba(74, 59, 51, .35), 0 18px 40px -22px rgba(74, 59, 51, .45);
  opacity: var(--endp, 0);
}
.endpaper .hand { background: var(--paper-2); padding: 18px 26px; border-radius: 6px; text-align: center; font-size: 20px; color: var(--ink-soft); transform: rotate(-3deg); box-shadow: 0 6px 18px -10px rgba(74, 59, 51, .5); }
.endpaper .hand span { font-size: 28px; color: var(--ink); }
.book-on .leaf {
  position: absolute; top: 0; left: 50%; width: 50%; height: 100%;
  transform-origin: left center; transform-style: preserve-3d;
  transform: rotateY(calc(var(--p, 0) * -180deg));
  will-change: transform;
}
.book-on .face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 4px 14px 14px 4px; overflow: hidden;
  box-shadow: inset 22px 0 26px -22px rgba(74, 59, 51, .35), 0 18px 40px -24px rgba(74, 59, 51, .5);
}
.book-on .front::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(74, 59, 51, .0), rgba(74, 59, 51, .28));
  opacity: var(--shade, 0);
}
.book-on .back {
  display: block; transform: rotateY(180deg);
  border-radius: 14px 4px 4px 14px;
  box-shadow: inset -22px 0 26px -22px rgba(74, 59, 51, .35), 0 18px 40px -24px rgba(74, 59, 51, .5);
  background-color: var(--paper-3);
}
.book-on .front { gap: 10px; }
.book-on .front .art { flex: 1 1 auto; min-height: 0; aspect-ratio: auto; }
.book-on .front .words { flex: none; }
.book-on .cover .art-cover { flex: 1 1 auto; min-height: 0; width: 100%; max-width: none; aspect-ratio: auto; }

/* note pages on the back of each leaf */
.note { position: absolute; inset: 0; padding: 34px 40px; display: flex; flex-direction: column; justify-content: center; gap: 18px;
  background-image: repeating-linear-gradient(transparent 0 33px, rgba(126, 166, 201, .35) 33px 34px);
  background-position: 0 20px; }
.note p { font: 500 clamp(22px, 2.3vw, 30px)/1.13 "Caveat", cursive; margin: 0; color: var(--ink); transform: rotate(-1.2deg); }
.note small { font: italic 400 14px/1.4 "Fraunces", serif; color: var(--ink-soft); }
.note svg { width: 46%; max-width: 220px; align-self: center; }

.book-on .book-ui { display: flex; align-items: center; gap: 12px; }
.pg { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--paper-2); color: var(--ink); font: 600 24px/1 "Fraunces", serif; cursor: pointer; display: grid; place-items: center; padding-bottom: 3px; transition: transform .15s; }
.pg:hover:not(:disabled) { transform: scale(1.08); }
.pg:disabled { opacity: .35; cursor: default; }
.thread { list-style: none; margin: 0; padding: 0 6px; display: flex; gap: 18px; position: relative; }
.thread::before { content: ""; position: absolute; left: 14px; right: 14px; top: 50%; border-top: 2px dashed rgba(200, 87, 74, .55); }
.thread button {
  position: relative; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--ink); cursor: pointer; padding: 0;
  background: var(--paper-2) radial-gradient(circle at 35% 35%, var(--ink) 1.3px, transparent 1.8px), radial-gradient(circle at 65% 35%, var(--ink) 1.3px, transparent 1.8px);
  transition: transform .25s, background-color .25s;
}
.thread button::after { content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 65%, var(--ink) 1.3px, transparent 1.8px), radial-gradient(circle at 65% 65%, var(--ink) 1.3px, transparent 1.8px); }
.thread button[aria-current="step"] { background-color: var(--button); transform: scale(1.25); }
.thread button.read { background-color: var(--rose); }

/* animated bits inside art */
.mote { animation: mote 7s ease-in-out infinite; }
.mote:nth-child(2n) { animation-duration: 9s; animation-delay: -3s; }
.mote:nth-child(3n) { animation-duration: 11s; animation-delay: -5s; }
@keyframes mote { 0%, 100% { transform: translate(0, 0); opacity: .2; } 50% { transform: translate(8px, -14px); opacity: .9; } }
.twinkle { animation: tw 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.twinkle:nth-of-type(2n) { animation-delay: -1.4s; }
.twinkle:nth-of-type(3n) { animation-delay: -2.2s; }
@keyframes tw { 50% { opacity: .35; transform: scale(.8); } }
.wave-arm { animation: wave 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: 85% 85%; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-16deg); } 80% { transform: rotate(6deg); } 90% { transform: rotate(-12deg); } }
.lamp-glow { animation: flick 4s ease-in-out infinite; }
@keyframes flick { 50% { opacity: .78; } 52% { opacity: .9; } }
.sway { animation: sway 5s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 0; }
@keyframes sway { 50% { transform: rotate(3deg); } }
.breathe { animation: breathe 4.5s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes breathe { 50% { transform: scale(1.015, .99); } }
.pulse { animation: pulse 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 50% { opacity: .55; transform: scale(1.08); } }

/* ---------------- sections ---------------- */
.sec { padding: clamp(72px, 10vw, 130px) 0; position: relative; }
.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.wrap.narrow { width: min(760px, calc(100% - 32px)); }
.two { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(32px, 6vw, 80px); align-items: center; }
.kicker { margin: 0 0 4px; font-size: 26px; color: var(--thread); }
.h2 { font: 600 clamp(36px, 5vw, 60px)/1.02 "Fraunces", serif; letter-spacing: -.025em; margin: 0 0 22px; }
.lead { font-size: clamp(19px, 1.7vw, 22px); line-height: 1.5; }
.small { font-size: 15px; color: var(--ink-soft); }

.lore { background: linear-gradient(transparent, rgba(167, 192, 159, .18) 30%, rgba(167, 192, 159, .18) 70%, transparent); }
.letter { margin: 0; position: relative; background: var(--paper-2); background-image: var(--grain); padding: 44px 34px 28px; border-radius: 4px; transform: rotate(2deg);
  box-shadow: 0 22px 40px -26px rgba(74, 59, 51, .55); }
.letter blockquote { margin: 0 0 14px; font-size: 31px; line-height: 1.12; }
.letter figcaption { font: italic 14px/1.4 "Fraunces", serif; color: var(--ink-soft); }
.tape { position: absolute; top: -14px; left: 50%; width: 120px; height: 30px; transform: translateX(-50%) rotate(-4deg); background: rgba(240, 211, 137, .72); box-shadow: 0 2px 6px rgba(74, 59, 51, .15); }

.patches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; margin-top: 14px; }
.patch { position: relative; padding: 34px 28px 28px; border-radius: 18px; background-image: var(--grain); }
.patch::before { content: ""; position: absolute; inset: 9px; border: 2px dashed rgba(74, 59, 51, .45); border-radius: 12px; pointer-events: none; }
.patch.p1 { background-color: #f3d6cf; transform: rotate(-1.5deg); }
.patch.p2 { background-color: #d8e5d3; transform: rotate(1deg) translateY(12px); }
.patch.p3 { background-color: #d6e3ee; transform: rotate(-.6deg); }
.patch h3 { font: 600 24px/1.15 "Fraunces", serif; margin: 10px 0 8px; }
.patch p { margin: 0; font-size: 16px; }
.num { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--paper-2); border: 1.5px solid var(--ink); font: 700 26px/1 "Caveat", cursive; }

.big-button svg { width: min(100%, 380px); margin: 0 auto; animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.x-thread { stroke-dasharray: 8 6; }
.facts { margin: 0 0 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.facts div { background: var(--paper-2); background-image: var(--grain); padding: 16px 18px; border-radius: 12px; border: 1.5px solid rgba(74, 59, 51, .2); }
.facts dt { font: 600 13px/1 "Literata", serif; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 8px; }
.facts dd { margin: 0; font: 600 21px/1.2 "Fraunces", serif; }

.chapters { background: linear-gradient(transparent, rgba(159, 189, 214, .2) 30%, rgba(159, 189, 214, .2) 70%, transparent); }
.road { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; position: relative; }
.road::before { content: ""; position: absolute; left: 0; right: 0; top: 22px; border-top: 2px dashed rgba(200, 87, 74, .5); }
.road li { position: relative; padding-top: 56px; }
.road li::before { content: ""; position: absolute; left: 0; top: 8px; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--paper-2); }
.road li.done::before { background: var(--rose); }
.road li.next::before { background: var(--butter); }
.road h3 { font: 600 23px/1.15 "Fraunces", serif; margin: 6px 0 6px; }
.road p { margin: 0; font-size: 15.5px; color: var(--ink-soft); }
.tag { font: 700 20px/1 "Caveat", cursive; color: var(--thread); }

.faq details { border-bottom: 1.5px dashed rgba(74, 59, 51, .3); padding: 4px 0; }
.faq summary { cursor: pointer; list-style: none; padding: 16px 40px 16px 0; font: 600 20px/1.3 "Fraunces", serif; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 6px; top: 12px; font: 400 28px/1 "Fraunces", serif; color: var(--thread); transition: transform .3s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 18px; color: var(--ink-soft); }

.label-tag { position: relative; max-width: 760px; margin: 0 auto; text-align: center; padding: 50px clamp(20px, 5vw, 56px) 40px; background: #fbf3e4; background-image: var(--grain);
  border-radius: 10px; box-shadow: 0 30px 50px -34px rgba(74, 59, 51, .6); }
.label-tag::before { content: ""; position: absolute; inset: 10px; border: 2px dashed var(--thread); border-radius: 6px; opacity: .6; pointer-events: none; }
.tag-hole { position: absolute; top: 18px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--paper); box-shadow: inset 0 2px 3px rgba(74, 59, 51, .4); }
.ca-row { display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.ca-row code { font: 600 15px/1.4 ui-monospace, "SFMono-Regular", Menlo, monospace; padding: 12px 16px; border-radius: 8px; background: var(--paper-2); border: 1.5px solid rgba(74, 59, 51, .25); word-break: break-all; max-width: 100%; }
.ca-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.knob { display: inline-flex; align-items: center; justify-content: center; height: 46px; padding: 0 22px; border-radius: 99px; border: 1.5px solid var(--ink); background: var(--paper-2); color: var(--ink);
  font: 600 15px/1 "Literata", serif; text-decoration: none; cursor: pointer; box-shadow: 3px 3px 0 var(--ink); transition: transform .15s, box-shadow .15s; }
.knob:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.knob:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.knob--ink { background: var(--thread); color: #fff8ee; }

.foot { padding: 50px 0 40px; border-top: 1.5px dashed rgba(74, 59, 51, .3); }
.foot-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.foot-brand { font-size: 28px; }
.disclaimer { font-size: 14px; color: var(--ink-soft); max-width: 820px; }
.tiny { font-size: 12.5px; color: var(--ink-soft); opacity: .8; }

/* ---------------- responsive ---------------- */
@media (max-width: 980px) {
  .links { display: none; }
}
@media (max-width: 860px) {
  .two { grid-template-columns: 1fr; }
  .patches { grid-template-columns: 1fr; }
  .patch.p2 { transform: rotate(1deg); }
  .road { grid-template-columns: 1fr 1fr; row-gap: 30px; }
  .road::before { display: none; }
  .big-button svg { width: min(70%, 300px); }
}
@media (max-width: 760px) {
  .book-on .book { width: min(460px, calc(100vw - 32px)); transform: none; }
  .book-on .leaf { left: 0; width: 100%; transform: rotateY(calc(var(--p, 0) * -165deg)); opacity: var(--o, 1); }
  .book-on .endpaper { display: none; }
  .book-on .back { display: none; }
  .note { padding: 26px; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .music-label, .xbtn span { display: none; }
  .music, .xbtn { width: 40px; padding: 0; justify-content: center; }
  .foot .xbtn { width: auto; padding: 0 14px; }
  .foot .xbtn span { display: inline; }
  .brand { font-size: 20px; }
  .road { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .letter blockquote { font-size: 27px; }
  .book-on .face { padding: 16px; }
  .words p { font-size: 14.5px; line-height: 1.5; }
  .words h2 { font-size: 23px; }
  .title span { font-size: 64px; }
}
@media (max-height: 640px) and (max-width: 760px) {
  .words p { font-size: 13.5px; line-height: 1.45; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ================= V2: the quilt ================= */
.quilt-sec { background: radial-gradient(70% 60% at 50% 10%, rgba(240, 211, 137, .22), transparent 70%), linear-gradient(transparent, rgba(227, 161, 150, .12) 40%, transparent); }
.q-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 26px; }
.q-intro { max-width: 640px; font-size: clamp(16px, 1.3vw, 18px); color: var(--ink-soft); margin: 0; }
.q-status { display: inline-flex; align-items: center; gap: 10px; margin: 0; padding: 10px 16px; border-radius: 99px; background: var(--paper-2); border: 1.5px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); font: 600 13.5px/1.3 "Literata", serif; max-width: 520px; }
.q-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-soft); flex: none; }
.q-status[data-mode="live"] .q-dot { background: #6aa36f; box-shadow: 0 0 0 0 rgba(106, 163, 111, .6); animation: qpulse 1.8s infinite; }
.q-status[data-mode="preview"] { background: #fbecc4; }
.q-status[data-mode="preview"] .q-dot { background: var(--butter); border: 1.5px solid var(--ink); }
@keyframes qpulse { 70% { box-shadow: 0 0 0 10px rgba(106, 163, 111, 0); } 100% { box-shadow: 0 0 0 0 rgba(106, 163, 111, 0); } }
.q-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 26px; align-items: start; }
.q-frame { position: relative; border-radius: 20px; padding: 10px; background: #f7eedd; box-shadow: 0 40px 80px -40px rgba(74, 59, 51, .55), 0 2px 0 rgba(74, 59, 51, .08); transform: perspective(1400px) rotateX(var(--qrx, 0deg)) rotateY(var(--qry, 0deg)); transition: transform .4s cubic-bezier(.2, .8, .2, 1); }
.q-frame canvas { display: block; width: 100%; border-radius: 14px; touch-action: manipulation; }
.q-tip { position: absolute; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: var(--ink); color: var(--paper-2); font: 600 12.5px/1.2 "Literata", serif; white-space: nowrap; z-index: 2; }
.q-side { display: grid; gap: 16px; }
.q-card { position: relative; padding: 22px 20px 18px; border-radius: 6px 14px 14px 6px; background: var(--paper-2); background-image: var(--grain); box-shadow: 0 18px 36px -24px rgba(74, 59, 51, .6); min-height: 150px; transform: rotate(-.6deg); }
.q-card::before { content: ""; position: absolute; inset: 7px; border: 1.5px dashed rgba(200, 87, 74, .5); border-radius: 4px 10px 10px 4px; pointer-events: none; }
.q-card-empty { margin: 34px 0; text-align: center; font-size: 24px; color: var(--ink-soft); }
.q-card-k { margin: 0; font-size: 20px; color: var(--thread); }
.q-card h3 { margin: 0 0 8px; font: 600 24px/1.1 "Fraunces", serif; }
.q-card .mono { font-family: ui-monospace, Menlo, monospace; font-size: 19px; }
.q-card dl { margin: 0 0 8px; display: grid; gap: 6px; }
.q-card dl div { display: grid; grid-template-columns: 82px 1fr; gap: 8px; font-size: 14px; }
.q-card dt { color: var(--ink-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; padding-top: 2px; }
.q-card dd { margin: 0; }
.q-card dd span { color: var(--ink-soft); }
.q-card p { margin: 6px 0 0; font-size: 14.5px; }
.q-card a { color: var(--thread); font-weight: 600; }
.q-sample-note { color: #9a6d1c; font-style: italic; }
.q-stats { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.q-stats div { padding: 10px 12px; border-radius: 12px; background: rgba(251, 246, 236, .8); border: 1.5px solid rgba(74, 59, 51, .15); }
.q-stats div:first-child { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; }
.q-stats dt { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.q-stats dd { margin: 2px 0 0; font: 600 19px/1.15 "Fraunces", serif; font-variant-numeric: tabular-nums; }
.q-logh { margin: 4px 0 -6px; font-size: 24px; color: var(--thread); }
.q-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; max-height: 230px; overflow: hidden; }
.q-log li { padding: 7px 10px; border-left: 3px solid var(--rose); background: rgba(251, 246, 236, .7); border-radius: 0 8px 8px 0; animation: logIn .5s cubic-bezier(.2, .9, .3, 1.2); }
.q-log li:first-child { border-left-color: var(--thread); }
.q-sample { font-size: 11px; color: #9a6d1c; font-style: normal; border: 1px solid currentColor; border-radius: 99px; padding: 0 6px; margin-left: 4px; }
@keyframes logIn { from { opacity: 0; transform: translateX(-10px); } }
.q-ledger { margin-top: 22px; }
.q-ledger summary { cursor: pointer; font: 600 16px/1.3 "Fraunces", serif; }
.q-ledger ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 12px 0 0; margin: 0; }
.q-ledger button { font: 500 13px/1 "Literata", serif; padding: 7px 10px; border-radius: 99px; border: 1.5px solid rgba(74, 59, 51, .35); background: var(--paper-2); color: var(--ink); cursor: pointer; }
.q-ledger button:hover { border-color: var(--ink); }
.q-fine { margin: 16px 0 0; font-size: 13.5px; color: var(--ink-soft); max-width: 860px; }

/* ================= V2.1: launchpad ================= */
.stitch { background: radial-gradient(60% 50% at 80% 30%, rgba(159, 189, 214, .28), transparent 70%), radial-gradient(50% 40% at 10% 80%, rgba(167, 192, 159, .25), transparent 70%); }
.st-grid { display: grid; grid-template-columns: .95fr 1.05fr; gap: clamp(30px, 5vw, 70px); align-items: start; }
.st-facts { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 10px; }
.st-facts li { position: relative; padding-left: 30px; font-size: 15.5px; }
.st-facts li::before { content: ""; position: absolute; left: 0; top: 4px; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--button) radial-gradient(circle at 35% 35%, var(--ink) 1.1px, transparent 1.6px), radial-gradient(circle at 65% 65%, var(--ink) 1.1px, transparent 1.6px); }
.st-purse { margin-bottom: 26px; }
.purse { position: relative; display: inline-block; }
.purse-main { height: 44px; padding: 0 20px; border-radius: 99px; border: 1.5px solid var(--ink); background: var(--paper-2); color: var(--ink); font: 600 15px/1 "Literata", serif; cursor: pointer; box-shadow: 3px 3px 0 var(--ink); transition: transform .15s, box-shadow .15s; }
.purse-main:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.purse-main--on { background: #dcebd8; }
.purse-main--on::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: #3f7a45; vertical-align: middle; }
.purse-pop { position: absolute; left: 0; top: calc(100% + 8px); z-index: 30; min-width: 250px; padding: 10px; border-radius: 12px; background: var(--paper-2); border: 1.5px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); display: grid; gap: 4px; animation: purse-in .22s cubic-bezier(.2,.9,.3,1.2); transform-origin: top left; }
@keyframes purse-in { from { opacity: 0; transform: scale(.92) translateY(-4px); } }
.purse-row { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 8px; border: 0; background: transparent; color: var(--ink); font: 500 14px/1.2 "Literata", serif; text-align: left; cursor: pointer; text-decoration: none; }
.purse-row:hover { background: rgba(74, 59, 51, .07); }
.purse-key { font: 600 12px/1.4 ui-monospace, Menlo, monospace; word-break: break-all; padding: 4px 10px; }
.purse-hint { font-size: 12.5px; color: var(--ink-soft); padding: 2px 10px; }
.shelf { position: relative; padding: 22px 20px 16px; border-radius: 16px; background: linear-gradient(#e9d8bb, #dcc6a3); box-shadow: inset 0 -14px 0 #c7a983, inset 0 2px 0 rgba(255, 255, 255, .5), 0 26px 40px -30px rgba(74, 59, 51, .7); }
.shelf-h { margin: 0 0 12px; font-size: 28px; display: flex; align-items: baseline; gap: 10px; }
.shelf-h span { font: 600 12px/1 "Literata", serif; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.shelf-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 380px; overflow: auto; }
.shelf-list a { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; border-radius: 12px; background: var(--paper-2); text-decoration: none; transition: transform .2s, box-shadow .2s; box-shadow: 0 6px 14px -10px rgba(74, 59, 51, .6); }
.shelf-list a:hover { transform: translateY(-2px) rotate(-.4deg); box-shadow: 0 12px 20px -12px rgba(74, 59, 51, .7); }
.shelf-list img, .shelf-knot { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; border: 1.5px solid var(--ink); }
.shelf-knot { display: block; background: var(--button) radial-gradient(circle at 35% 35%, var(--ink) 2px, transparent 2.6px), radial-gradient(circle at 65% 65%, var(--ink) 2px, transparent 2.6px); border-radius: 50%; }
.shelf-t { font-size: 14px; line-height: 1.25; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.shelf-t small { display: block; color: var(--ink-soft); font-size: 12px; }
.shelf-m { font: 600 15px/1 "Fraunces", serif; }
.shelf-empty { padding: 18px; text-align: center; font: 500 22px/1.2 "Caveat", cursive; color: var(--ink-soft); background: rgba(251, 246, 236, .6); border-radius: 12px; }
.sewcard { position: relative; display: grid; gap: 14px; padding: 46px clamp(18px, 3vw, 34px) 30px; border-radius: 12px; background: #fbf3e4; background-image: var(--grain); box-shadow: 0 40px 70px -40px rgba(74, 59, 51, .7); transform: rotate(.4deg); }
.sewcard::before { content: ""; position: absolute; inset: 10px; border: 2px dashed rgba(200, 87, 74, .55); border-radius: 6px; pointer-events: none; }
.sewcard-pin { position: absolute; top: -12px; left: 50%; width: 26px; height: 26px; margin-left: -13px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f1a093, var(--thread) 60%, #8e3329); box-shadow: 0 4px 6px rgba(74, 59, 51, .4); }
.sewcard label { display: grid; gap: 6px; font: 600 13px/1.2 "Literata", serif; letter-spacing: .04em; color: var(--ink-soft); }
.sewcard label small { font-weight: 400; letter-spacing: 0; }
.sewcard input, .sewcard textarea { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1.5px solid rgba(74, 59, 51, .3); background: var(--paper-2); color: var(--ink); font: 400 16px/1.3 "Literata", serif; transition: border-color .2s, box-shadow .2s; }
.sewcard input:focus, .sewcard textarea:focus { outline: none; border-color: var(--ink); box-shadow: 3px 3px 0 var(--rose); }
.sewcard [aria-invalid="true"] { border-color: var(--thread); box-shadow: 3px 3px 0 rgba(200, 87, 74, .35); }
.sewcard-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sewcard-top { display: flex; align-items: center; gap: 16px; }
.swatch { display: flex !important; align-items: center; gap: 14px; cursor: pointer; }
.swatch-prev { width: 86px; height: 86px; border-radius: 50%; border: 2px dashed var(--thread); background: var(--paper-2) center / cover no-repeat; flex: none; display: grid; place-items: center; transition: transform .3s; }
.swatch-prev::after { content: "+"; font: 400 34px/1 "Fraunces", serif; color: var(--thread); }
.swatch-prev.has-pic { border-style: solid; border-color: var(--ink); animation: swatch-pop .5s cubic-bezier(.2,.9,.3,1.4); }
.swatch-prev.has-pic::after { content: none; }
@keyframes swatch-pop { 0% { transform: scale(.6) rotate(-20deg); } 100% { transform: none; } }
.swatch:hover .swatch-prev { transform: rotate(-8deg) scale(1.04); }
.swatch-txt { display: grid; font: 600 15px/1.3 "Fraunces", serif; color: var(--ink); letter-spacing: 0; }
.swatch-txt small { font: 400 12.5px/1.3 "Literata", serif; color: var(--ink-soft); }
.hangtag { margin: 0 0 0 auto; }
#st-tag { display: inline-block; font: 700 30px/1 "Caveat", cursive; color: var(--thread); transform: rotate(-4deg); padding: 6px 12px; border: 2px dashed currentColor; border-radius: 8px; transition: transform .3s; }
.sewcard:focus-within #st-tag { transform: rotate(3deg) scale(1.05); }
.spools { display: flex; gap: 8px; flex-wrap: wrap; }
.spools input { flex: 1 1 100px; width: auto; }
.spools button { padding: 0 14px; height: 46px; border-radius: 10px; border: 1.5px solid rgba(74, 59, 51, .35); background: var(--paper-2); font: 600 14px/1 "Literata", serif; color: var(--ink); cursor: pointer; transition: transform .15s, border-color .15s; }
.spools button:hover { border-color: var(--ink); background: #fff8ec; transform: translateY(-2px); }
.bill { display: grid; font-size: 13.5px; }
.bill-row { display: grid; grid-template-columns: 38% 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px dashed rgba(74, 59, 51, .2); }
.bill-row > span:first-child { font-weight: 600; color: var(--ink-soft); }
.bill-total { font-weight: 700; color: var(--ink); font-size: 15px; border-bottom: 0; }
.bill-total > span:first-child { color: var(--ink); }
.bill-fine { font-size: 12.5px; color: var(--ink-soft); margin: 8px 0 0; }
.sew-closed { margin: 0; padding: 10px 14px; border-radius: 10px; background: #fbecc4; font-size: 14px; }
.sew-err { margin: 0; padding: 10px 14px; border-radius: 10px; background: #f6d5cf; color: #7e2a20; font-size: 14px; }
.sew-go { width: 100%; height: 54px; font-size: 17px; }
.sew-go.is-busy { background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,.14) 0 10px, transparent 10px 20px); background-size: 28px 28px; animation: sew-busy 1s linear infinite; }
@keyframes sew-busy { to { background-position: 28px 0; } }
.seam { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; counter-reset: seam; }
.seam li { counter-increment: seam; padding: 5px 10px 5px 6px; border-radius: 99px; background: rgba(74, 59, 51, .06); color: var(--ink-soft); display: inline-flex; align-items: center; gap: 6px; transition: background .3s; }
.seam li::before { content: counter(seam); width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-2); border: 1px solid rgba(74, 59, 51, .3); font-size: 10.5px; }
.seam li.now { background: var(--butter); color: var(--ink); }
.seam li.now::before { animation: seam-spin 1.2s linear infinite; border-style: dashed; }
@keyframes seam-spin { to { transform: rotate(360deg); } }
.seam li.done { background: #dcebd8; color: var(--ink); }
.seam li.done::before { content: "✓"; }
.seam li.fail { background: #f6d5cf; color: #7e2a20; }
.sew-note { padding: 14px 16px; border-radius: 12px; background: var(--paper-2); border: 1.5px solid rgba(74, 59, 51, .2); font-size: 14px; }
.note-h { margin: 0 0 6px; font: 600 17px/1.3 "Fraunces", serif; }
.note-good { color: #3f7a45; } .note-bad { color: #9b3428; }
.note-links { display: flex; gap: 14px; flex-wrap: wrap; margin: 6px 0; }
.note-links a { color: var(--thread); font-weight: 600; }
.note-mint { font-family: ui-monospace, Menlo, monospace; word-break: break-all; font-size: 12px; margin: 0; }
@media (max-width: 980px) { .q-grid { grid-template-columns: 1fr; } .q-side { grid-template-columns: 1fr 1fr; } .q-side .q-logh, .q-side .q-log { grid-column: 2; } .q-card { grid-row: span 2; } }
@media (max-width: 860px) { .st-grid { grid-template-columns: 1fr; } }
@media (max-width: 620px) { .q-side { grid-template-columns: 1fr; } .q-side .q-logh, .q-side .q-log { grid-column: auto; } .q-card { grid-row: auto; } .sewcard-pair { grid-template-columns: 1fr; } .sewcard-top { flex-wrap: wrap; } .q-frame { padding: 6px; } }

/* ---------- 3D book ---------- */
.book-gl { position: absolute; inset: 0; z-index: 0; opacity: 0; transition: opacity .9s ease; pointer-events: none; }
.book-3d-ready .book-gl { opacity: 1; }
.book-3d .stage > :not(.book-gl) { position: relative; z-index: 1; }
.book-3d-ready .book { opacity: 0; pointer-events: none; }
.book-3d-ready .book-ui { margin-top: auto; margin-bottom: 18px; }
.book-3d .stage::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(ellipse 60% 45% at 50% 30%, rgba(255, 240, 205, .35), transparent 70%); }

/* ---------- finishing touches ---------- */
.rise { opacity: 0; transform: translateY(26px); transition: opacity .8s cubic-bezier(.2, .7, .2, 1) var(--d, 0ms), transform .9s cubic-bezier(.2, .7, .2, 1) var(--d, 0ms); }
.rise--in { opacity: 1; transform: none; }
.tilt { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .35s cubic-bezier(.2, .8, .3, 1), box-shadow .3s; will-change: transform; }
.tilt.rise:not(.rise--in) { transform: translateY(26px); }
.tilt:hover { box-shadow: 0 30px 50px -30px rgba(74, 59, 51, .55); }
.knob, .xbtn, .music, .pg, .purse-main { transition: translate .25s cubic-bezier(.2, .8, .3, 1.4), transform .15s, box-shadow .15s, background .2s; }
.thread-trail { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 90; }
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 120; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { padding: 11px 18px 11px 40px; border-radius: 99px; background: var(--ink); color: var(--paper-2); font: 600 14.5px/1.2 "Literata", serif; box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .55); position: relative; animation: toast-in .45s cubic-bezier(.2, .9, .3, 1.3); }
.toast::before { content: ""; position: absolute; left: 14px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%; background: var(--button) radial-gradient(circle at 35% 35%, var(--ink) 1.6px, transparent 2px), radial-gradient(circle at 65% 65%, var(--ink) 1.6px, transparent 2px); }
.toast--out { opacity: 0; transform: translateY(10px); transition: opacity .4s, transform .4s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.9); } }
@media (prefers-reduced-motion: reduce) { .rise { opacity: 1; transform: none; transition: none; } .tilt { transform: none; } }
