/* The Forestbook. Paper UI: bookmarks, pull-tabs, inset slips, die-cut windows, pressed seals. */
:root {
  --red: #D90B1C; --scarlet: #B90D1C; --crimson: #790F19; --cream: #F2E9D8; --ivory: #FFF8E9;
  --grey: #A49F99; --crease: #69635F; --ink: #292522;
  --edge: #E2D6BF; --shade: rgba(60, 38, 22, .16);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .15 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans); font-size: 16px; line-height: 1.5; color: var(--ink); overflow: hidden;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
  /* the red seamless studio floor: exact charter red, lit from the upper left */
  background:
    radial-gradient(120% 90% at 22% 8%, rgba(255, 120, 110, .20), transparent 55%),
    radial-gradient(140% 120% at 50% 45%, transparent 45%, rgba(90, 0, 10, .38) 100%),
    var(--red);
}
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

#stage { position: fixed; inset: 0; z-index: 0; }

/* ---------- top ---------- */
.top { position: fixed; z-index: 5; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 28px 0; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 30px; letter-spacing: .01em; color: var(--ivory); text-decoration: none; line-height: 1; text-shadow: 0 1px 0 rgba(90, 0, 10, .35); }
.brand span { font-size: .62em; letter-spacing: .14em; text-transform: uppercase; font-family: var(--sans); font-weight: 600; display: block; margin-bottom: 2px; opacity: .85; }
.top-right { display: flex; gap: 14px; align-items: flex-start; }

/* chapter bookmark: spells the phase on every spread */
.chapter {
  position: relative; margin-top: -18px; padding: 26px 18px 20px; min-width: 170px; background: var(--ivory) var(--grain); color: var(--ink);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 14px), 0 100%); display: grid; gap: 0;
  filter: drop-shadow(0 6px 8px rgba(70, 0, 8, .35));
}
.chapter-k { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--crease); }
.chapter-v { font-family: var(--serif); font-weight: 600; font-size: 28px; line-height: 1.05; }
.chapter-t { font-size: 12.5px; color: var(--crease); padding-bottom: 8px; }
.chapter::before { content: ""; position: absolute; left: 18px; right: 18px; top: 12px; height: 4px; border-radius: 2px; background: var(--scarlet); }
.chapter[data-phase="rescue"]::before { background: repeating-linear-gradient(115deg, var(--ink) 0 6px, var(--ivory) 6px 12px); height: 6px; }
.chapter[data-phase="settlement"]::before { background: linear-gradient(90deg, var(--ink) 0 42%, transparent 42% 58%, var(--ink) 58%); }

/* ---------- bookmarks: index tabs on the fore-edge of the screen; the selected one extends farther ---------- */
.bookmarks { position: fixed; z-index: 4; right: 0; top: 150px; display: grid; gap: 7px; justify-items: end; transition: transform .5s var(--ease), opacity .4s; }
.bookmark {
  border: 0; cursor: pointer; background: var(--cream) var(--grain); color: var(--ink); min-height: 44px; width: 118px; padding: 10px 14px 10px 24px; text-align: left;
  font-weight: 600; font-size: 14px; letter-spacing: .02em;
  clip-path: polygon(12px 0, 100% 0, 100% 100%, 12px 100%, 0 50%);
  transform: translateX(14px); transition: transform .22s var(--ease), width .22s var(--ease), background-color .2s;
  filter: drop-shadow(-3px 3px 3px rgba(70, 0, 8, .3));
}
.bookmark:hover { transform: translateX(12px) translateY(-2px); }
.bookmark[aria-current="page"] { background-color: var(--ivory); width: 156px; transform: translateX(0); }
.bookmark[aria-current="page"] span { border-bottom: 2px solid var(--scarlet); padding-bottom: 2px; }
.bookmark:focus-visible, .tab:focus-visible, .role:focus-visible, .gather:focus-visible, .nudge:focus-visible, .field:focus-visible, .pick:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ---------- the sheet (left page column) ---------- */
.sheet {
  position: fixed; z-index: 3; left: clamp(14px, 1.6vw, 28px); top: 96px; bottom: auto; max-height: calc(100vh - 120px); width: clamp(300px, 23.5vw, 340px);
  background: var(--cream) var(--grain); border-radius: 3px; display: grid; grid-template-rows: auto minmax(0, 1fr);
  box-shadow: 0 1px 0 var(--ivory) inset, 0 0 0 1px rgba(120, 90, 50, .10), 2px 3px 0 var(--edge), 4px 6px 0 #d8cbb2, 14px 22px 34px rgba(60, 0, 8, .38);
  transform: rotate(-.35deg); transition: transform .6s var(--ease), opacity .45s;
}
.sheet-grip { display: none; }
.sheet-scroll { overflow-y: auto; min-height: 0; padding: 22px 20px 26px; scrollbar-width: thin; scrollbar-color: var(--edge) transparent; overscroll-behavior: contain; }
.panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.kicker { margin: 0 0 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--scarlet); }
.head h1 { font-family: var(--serif); font-weight: 600; font-size: 35px; line-height: 1.02; margin: 0 0 10px; letter-spacing: -.005em; }
.lede, .body { margin: 0; color: #4a433d; }
.sec { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding-top: 16px; border-top: 1px dashed rgba(105, 99, 95, .45); border-radius: 2px; }
.sec h3 { font-family: var(--serif); font-weight: 600; font-size: 23px; line-height: 1.1; margin: 0; }
.sec.ping { animation: ping .9s var(--ease); }
@keyframes ping { 0% { background: rgba(185, 13, 28, .13); box-shadow: 0 0 0 8px rgba(185, 13, 28, .13); } 100% { background: transparent; box-shadow: 0 0 0 8px transparent; } }
.fine { margin: 0; font-size: 13px; line-height: 1.45; color: var(--crease); }
.sim-note { padding-top: 10px; border-top: 1px dashed rgba(105, 99, 95, .3); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.lede { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
/* "More": a quiet paper fold that expands in place */
.more { border-top: 1px dashed rgba(105, 99, 95, .45); padding-top: 4px; }
.more > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--crease); user-select: none; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: ""; width: 14px; height: 14px; background: var(--ivory); box-shadow: inset 0 0 0 1px rgba(120, 90, 50, .3); clip-path: polygon(0 0, 100% 0, 100% 100%, 45% 100%, 0 55%); transition: transform .22s var(--ease); }
.more[open] > summary::before { transform: rotate(180deg); }
.more > summary:hover { color: var(--ink); }
.more > summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.more .more-open, .more[open] .more-closed { display: none; }
.more[open] .more-open { display: inline; }
.more-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 4px 0 8px; animation: unfold .22s var(--ease); transform-origin: 50% 0; }
.more-body h3 { font-family: var(--serif); font-weight: 600; font-size: 21px; line-height: 1.1; margin: 6px 0 0; }
@keyframes unfold { from { opacity: 0; transform: perspective(600px) rotateX(-28deg); } to { opacity: 1; transform: none; } }

/* inset paper slips */
.slips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.slips.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.slip { background: var(--ivory); padding: 9px 11px 8px; border-radius: 2px; display: grid; gap: 1px; min-width: 0; box-shadow: inset 0 2px 3px var(--shade), inset 0 0 0 1px rgba(120, 90, 50, .10), 0 1px 0 #fff; }
.slip.wide { grid-column: 1 / -1; grid-template-columns: 1fr auto; align-items: baseline; }
.slip-k { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--crease); font-weight: 600; }
.slip-n { display: flex; gap: 5px; align-items: baseline; min-width: 0; }
.slip-v { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slip-u { font-size: 11.5px; color: var(--crease); font-weight: 600; }

/* die-cut windows */
.win { display: grid; gap: 6px; }
.win-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.win-k { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--crease); font-weight: 700; }
.win-val { font-weight: 700; font-size: 15px; text-align: right; }
.win-cut { position: relative; height: 26px; border-radius: 13px; background: #e9dfca; overflow: hidden; box-shadow: inset 0 3px 5px rgba(60, 38, 22, .30), inset 0 -1px 0 #fff, 0 1px 0 #fff; }
.win-fill { position: absolute; inset: 0 auto 0 0; width: var(--p, 0%); background: var(--scarlet) var(--grain); transition: width .42s var(--ease); box-shadow: 2px 0 0 var(--ivory), 4px 0 5px rgba(60, 38, 22, .3); }
.win-cut.rope { border-radius: 3px; }
.win-cut.rope .win-fill { background: repeating-linear-gradient(115deg, var(--ivory) 0 9px, var(--ink) 9px 12px, var(--ivory) 12px 21px, var(--cream) 21px 22px); box-shadow: 3px 0 0 var(--scarlet); }

/* pressed seals */
.seal { display: inline-flex; align-items: center; min-height: 34px; padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; letter-spacing: .03em; background: var(--cream); color: var(--crease); box-shadow: inset 0 2px 4px rgba(60, 38, 22, .28), inset 0 0 0 1px rgba(120, 90, 50, .16), 0 1px 0 #fff; }
.seal.on { background: var(--scarlet); color: var(--ivory); box-shadow: inset 0 2px 4px rgba(60, 0, 8, .5), 0 0 0 3px var(--ivory), 0 0 0 4px rgba(120, 90, 50, .25); }
.seal.go { background: var(--ink); color: var(--ivory); box-shadow: 0 0 0 3px var(--ivory), 0 0 0 4px rgba(120, 90, 50, .25); }
.seal.favor { background: var(--ivory); color: var(--ink); box-shadow: inset 0 0 0 2px var(--scarlet), 0 0 0 3px var(--ivory), 0 0 0 4px rgba(120, 90, 50, .25); }

/* pull-tabs */
.tab-wrap { display: grid; gap: 6px; }
.tab {
  position: relative; border: 0; cursor: pointer; text-align: left; min-height: 52px; padding: 10px 46px 10px 18px; width: 100%;
  background: var(--ivory); color: var(--ink); border-radius: 3px 26px 26px 3px; display: grid; gap: 0; align-content: center;
  box-shadow: 0 0 0 1px rgba(120, 90, 50, .18), 0 2px 0 var(--edge), 0 5px 9px rgba(60, 38, 22, .2);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.tab::after { content: ""; position: absolute; right: 12px; top: 50%; width: 20px; height: 20px; margin-top: -10px; border-radius: 50%; background: var(--cream); box-shadow: inset 0 2px 3px rgba(60, 38, 22, .38), 0 1px 0 #fff; }
.tab::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 5px; background: var(--scarlet); border-radius: 0 2px 2px 0; }
.tab:hover:not(:disabled) { transform: translate(2px, -2px); box-shadow: 0 0 0 1px rgba(120, 90, 50, .18), 0 3px 0 var(--edge), 0 9px 14px rgba(60, 38, 22, .24); }
.tab:active:not(:disabled) { transform: translate(5px, 0); background: #f6ecd6; }
.tab.primary { background: var(--red); color: var(--ivory); box-shadow: 0 0 0 1px rgba(90, 0, 10, .3), 0 2px 0 var(--crimson), 0 6px 12px rgba(90, 0, 10, .3); }
.tab.primary::before { background: var(--ivory); }
.tab.primary::after { background: var(--crimson); box-shadow: inset 0 2px 3px rgba(40, 0, 5, .6); }
.tab.primary:active:not(:disabled) { background: var(--crimson); }
.tab:disabled { cursor: not-allowed; background: #e9dfca; color: var(--crease); box-shadow: inset 0 0 0 1px rgba(120, 90, 50, .2); }
.tab:disabled::before { background: var(--grey); }
.tab-label { font-weight: 700; font-size: 16px; line-height: 1.25; }
.tab-meta { font-size: 12.5px; opacity: .8; }
.tab-meta:empty { display: none; }
.tab.small { min-height: 44px; width: auto; padding: 8px 40px 8px 16px; }
.tab.small .tab-label { font-size: 14px; }
.why { margin: 0; font-size: 13px; color: var(--crease); padding-left: 18px; }
.tx { margin: 0; font-size: 13.5px; font-weight: 700; padding: 7px 12px; border-radius: 999px; background: var(--ivory); justify-self: start; box-shadow: inset 0 2px 3px var(--shade), 0 1px 0 #fff; }
.tx::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; background: var(--grey); vertical-align: baseline; }
.tx[data-stage="wallet"]::before { background: transparent; box-shadow: inset 0 0 0 2px var(--ink); }
.tx[data-stage="submitted"]::before { background: var(--grey); box-shadow: 0 0 0 2px var(--ink); }
.tx[data-stage="confirmed"]::before { background: var(--ink); }
.tx[data-stage="failed"] { color: var(--crimson); }
.tx[data-stage="failed"]::before { background: var(--crimson); border-radius: 1px; transform: rotate(45deg); }

.field { width: 100%; min-height: 48px; padding: 10px 14px; border: 0; border-radius: 2px; background: var(--ivory); box-shadow: inset 0 2px 4px rgba(60, 38, 22, .25), 0 1px 0 #fff; font-weight: 600; }
.field::placeholder { color: #9a9087; font-weight: 500; }

/* roles */
.roles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.role { border: 0; cursor: pointer; text-align: left; padding: 12px 12px 10px; min-height: 78px; border-radius: 3px; background: var(--ivory); display: grid; gap: 4px; align-content: start; box-shadow: 0 0 0 1px rgba(120, 90, 50, .16), 0 2px 0 var(--edge), 0 5px 9px rgba(60, 38, 22, .16); transition: transform .18s var(--ease); }
.role b { font-family: var(--serif); font-weight: 600; font-size: 26px; line-height: 1; }
.role span { font-size: 13px; line-height: 1.35; color: var(--crease); }
.role:hover:not(:disabled) { transform: translateY(-2px); }
.role[aria-pressed="true"] { background: var(--scarlet); color: var(--ivory); box-shadow: 0 0 0 3px var(--ivory), 0 0 0 4px rgba(120, 90, 50, .3), 0 6px 10px rgba(90, 0, 10, .25); }
.role[aria-pressed="true"] span { color: #ffe3d8; }
.role:disabled { cursor: default; }
.role:disabled:not([aria-pressed="true"]) { opacity: .55; }

.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14.5px; color: #4a433d; }
.log li { padding-left: 16px; position: relative; min-height: 1px; }
.log li:empty { display: none; }
.log li::before { content: ""; position: absolute; left: 0; top: .62em; width: 7px; height: 2px; background: var(--scarlet); }

/* mission steps */
.step { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.timing { position: relative; height: 40px; border-radius: 3px; background: #e9dfca; box-shadow: inset 0 3px 5px rgba(60, 38, 22, .3), 0 1px 0 #fff; overflow: hidden; }
.timing-zone { position: absolute; left: 38%; width: 24%; top: 0; bottom: 0; background: var(--ivory); box-shadow: inset 0 0 0 2px var(--scarlet); }
.timing-mark { position: absolute; top: 4px; bottom: 4px; width: 6px; margin-left: -3px; background: var(--ink); border-radius: 2px; }
.gathers { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.gather { aspect-ratio: 1; min-height: 48px; border: 0; cursor: pointer; border-radius: 50%; background: var(--ivory); box-shadow: 0 0 0 1px rgba(120, 90, 50, .18), 0 3px 0 var(--edge); position: relative; transition: transform .18s var(--ease); }
.gather::after { content: ""; position: absolute; inset: 28%; background: var(--scarlet); clip-path: polygon(50% 0, 78% 45%, 60% 45%, 88% 100%, 12% 100%, 40% 45%, 22% 45%); }
.gather:hover { transform: translateY(-2px); }
.gather[aria-pressed="true"] { background: #e9dfca; box-shadow: inset 0 3px 5px rgba(60, 38, 22, .3); transform: none; }
.gather[aria-pressed="true"]::after { background: var(--grey); }

/* prides */
.prides { display: grid; gap: 8px; }
.pride-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, auto); gap: 10px; align-items: center; padding: 8px 0; }
.pride-row b { display: block; font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.1; }
.niches { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.niche { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; background: var(--ivory); border-radius: 2px; box-shadow: inset 0 2px 3px var(--shade); font-size: 14.5px; }
.niche[data-on] .niche-n { font-weight: 700; }
.niche:not([data-on]) { color: var(--crease); background: transparent; box-shadow: inset 0 0 0 1px rgba(105, 99, 95, .35); }
.niche-v { font-weight: 600; }

.epoch { display: flex; align-items: center; gap: 10px; }
.epoch-label { font-family: var(--serif); font-size: 26px; font-weight: 600; min-width: 108px; text-align: center; }
.nudge { width: 44px; height: 44px; border: 0; border-radius: 50%; cursor: pointer; background: var(--ivory); font-size: 22px; line-height: 1; box-shadow: 0 0 0 1px rgba(120, 90, 50, .18), 0 2px 0 var(--edge); }
.nudge:disabled { opacity: .4; cursor: default; }
.epoch .seal { margin-left: auto; }

/* ---------- stage furniture: prompt tab, chapter card, joystick, hints, intro ---------- */
.prompt { position: fixed; z-index: 3; left: 0; top: 0; border: 0; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; min-height: 44px; padding: 8px 16px 8px 10px; background: var(--ivory) var(--grain); color: var(--ink); font-weight: 700; font-size: 14px; border-radius: 3px 22px 22px 3px; box-shadow: 0 2px 0 var(--edge), 0 8px 14px rgba(60, 0, 8, .3); will-change: transform; white-space: nowrap; }
.prompt::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; background: var(--scarlet); }
.prompt kbd, .hints kbd { font: 700 12px var(--sans); display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 4px; background: var(--cream); box-shadow: inset 0 -2px 0 var(--edge), 0 0 0 1px rgba(120, 90, 50, .25); margin-left: 6px; }
.hints { position: fixed; z-index: 2; left: calc(clamp(300px, 23.5vw, 340px) + 60px); bottom: 14px; margin: 0; font-size: 12.5px; color: #ffe3d8; opacity: .85; pointer-events: none; transition: opacity .4s; }
.hints kbd { margin: 0 1px; color: var(--ink); height: 20px; min-width: 20px; font-size: 11px; }
.card { position: fixed; z-index: 6; left: 50%; top: 22%; display: grid; gap: 2px; justify-items: center; padding: 26px 38px 30px; background: var(--ivory) var(--grain); color: var(--ink); text-align: center; pointer-events: none; opacity: 0; transform: translate(-50%, -50%) scale(.9); transform-origin: 50% 50%; box-shadow: 0 3px 0 var(--edge), 0 24px 44px rgba(60, 0, 8, .4); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 16px), 0 100%); }
.card-k { font-size: 12px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--scarlet); }
.card-v { font-family: var(--serif); font-weight: 600; font-size: clamp(34px, 4.4vw, 60px); line-height: 1.05; }
.card.show { opacity: 1; transform: translate(-50%, -50%) scale(1); transition: opacity .35s ease, transform .5s var(--ease); }
.card.dock { opacity: 0; transition: transform .65s var(--ease), opacity .5s ease .2s; }
.stick { display: none; }
.sound-seal { width: 44px; height: 44px; border: 0; border-radius: 50%; cursor: pointer; background: var(--ivory) var(--grain); display: grid; place-items: center; box-shadow: inset 0 0 0 3px var(--ivory), inset 0 0 0 4px rgba(185, 13, 28, .55), 0 2px 0 var(--edge), 0 6px 10px rgba(60, 0, 8, .3); }
.sound-seal svg { width: 22px; height: 22px; fill: var(--scarlet); stroke: var(--scarlet); stroke-width: 1.6; stroke-linecap: round; }
.sound-seal svg .waves, .sound-seal svg .cross { fill: none; }
.sound-seal[aria-pressed="true"] .cross, .sound-seal[aria-pressed="false"] .waves { display: none; }
.sound-seal[aria-pressed="false"] { box-shadow: inset 0 2px 4px rgba(60, 38, 22, .3), 0 1px 0 #fff; }
.sound-seal[aria-pressed="false"] svg { fill: var(--crease); stroke: var(--crease); }
.sound-seal:focus-visible, .prompt:focus-visible, .skip:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.intro-ui { position: fixed; z-index: 7; left: 0; right: 0; bottom: 12vh; display: grid; justify-items: center; gap: 14px; }
.intro-ui .tab { width: min(360px, calc(100vw - 48px)); min-height: 64px; }
.intro-ui .tab-label { font-family: var(--serif); font-size: 26px; font-weight: 600; }
.skip { border: 0; background: none; cursor: pointer; color: #ffe3d8; font-weight: 600; font-size: 14px; min-height: 44px; padding: 0 16px; text-decoration: underline; text-underline-offset: 4px; }
body.intro .sheet { transform: translateX(-120%) rotate(-2deg); opacity: 0; }
body.intro .bookmarks { transform: translateX(110%); opacity: 0; }
body.intro .hints, body.intro .preview, body.intro .chapter, body.intro .prompt { opacity: 0; pointer-events: none; }
.chapter, .preview { transition: opacity .5s ease; }

/* preview ribbon */
.preview { position: fixed; z-index: 4; right: 22px; bottom: 20px; display: flex; gap: 10px; align-items: center; padding: 8px 10px 8px 14px; background: var(--ivory) var(--grain); border-radius: 3px; font-size: 12.5px; color: var(--crease); box-shadow: 0 2px 0 var(--edge), 0 8px 16px rgba(60, 0, 8, .3); max-width: min(560px, calc(100vw - 44px)); }
.preview b { color: var(--ink); letter-spacing: .14em; text-transform: uppercase; font-size: 11px; }
.preview button { border: 0; cursor: pointer; min-height: 32px; padding: 4px 10px; border-radius: 999px; background: var(--cream); font-weight: 700; font-size: 12px; color: var(--ink); box-shadow: inset 0 0 0 1px rgba(120, 90, 50, .25); white-space: nowrap; }
.preview button:hover { background: #fff; }

/* wallet picker */
.picker { border: 0; border-radius: 4px; padding: 24px; width: min(380px, calc(100vw - 32px)); background: var(--cream) var(--grain); color: var(--ink); box-shadow: 0 30px 60px rgba(40, 0, 5, .5); }
.picker::backdrop { background: rgba(90, 0, 10, .45); }
.picker h3 { font-family: var(--serif); font-size: 28px; margin: 0 0 12px; }
#pickerList { display: grid; gap: 8px; margin-bottom: 12px; }
.pick { display: flex; gap: 12px; align-items: center; min-height: 52px; padding: 8px 14px; border: 0; cursor: pointer; border-radius: 3px; background: var(--ivory); font-weight: 700; box-shadow: 0 2px 0 var(--edge); }
.pick img { width: 28px; height: 28px; border-radius: 6px; }
.picker .tab { margin-top: 12px; }

.boot { position: fixed; inset: 0; z-index: 9; display: grid; place-items: center; background: var(--red); color: var(--ivory); font-family: var(--serif); font-size: 26px; transition: opacity .5s ease .1s, visibility 0s linear .6s; }
.boot.gone { opacity: 0; visibility: hidden; }

/* ---------- phone: stage above (58svh), cream drawer below; the drawer drags from a peek up to full ---------- */
@media (max-width: 820px) {
  :root { --sheet-h: 45svh; }
  body.sheet-low { --sheet-h: 104px; }
  #stage { inset: 0 0 auto 0; height: 58svh; }
  body.sheet-low #stage { height: calc(100svh - 84px); }
  .top { padding: 10px 12px 0; }
  .brand { font-size: 21px; }
  .brand span { font-size: .55em; }
  .top-right { gap: 8px; }
  .chapter { margin-top: -10px; padding: 18px 12px 16px; min-width: 0; }
  .chapter::before { left: 12px; right: 12px; top: 8px; }
  .chapter-v { font-size: 20px; }
  .chapter-k { font-size: 10px; }
  .chapter-t { font-size: 11px; padding-bottom: 6px; }
  #walletBtn { display: none; }
  .sound-seal { width: 40px; height: 40px; }
  .sheet { left: 0; right: 0; bottom: 0; top: auto; width: auto; height: var(--sheet-h); max-height: calc(100svh - 56px); transform: none; border-radius: 16px 16px 0 0; box-shadow: 0 -8px 24px rgba(60, 0, 8, .35); transition: height .28s var(--ease); }
  .sheet.dragging { transition: none; }
  body.intro .sheet { transform: translateY(110%); }
  .sheet-grip { display: block; height: 46px; cursor: grab; position: relative; touch-action: none; }
  .sheet-grip::after { content: ""; position: absolute; left: 50%; top: 8px; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: var(--edge); box-shadow: inset 0 1px 2px rgba(60, 38, 22, .3); }
  .sheet-scroll { padding: 0 18px 34px; }
  .head h1 { font-size: 30px; }
  .bookmarks { display: flex; justify-items: start; top: auto; bottom: var(--sheet-h); left: 0; right: 0; padding: 0 10px; overflow-x: auto; align-items: flex-end; scrollbar-width: none; gap: 4px; transition: bottom .28s var(--ease), opacity .4s; z-index: 2; }
  .bookmarks::-webkit-scrollbar { display: none; }
  .bookmark { flex: 0 0 auto; width: auto; text-align: center; padding: 10px 12px 14px; font-size: 13px; clip-path: polygon(0 100%, 0 8px, 8px 0, calc(100% - 8px) 0, 100% 8px, 100% 100%); transform: translateY(8px); filter: drop-shadow(0 -2px 3px rgba(70, 0, 8, .25)); }
  .bookmark:hover { transform: translateY(8px); }
  .bookmark[aria-current="page"] { width: auto; padding: 14px 14px 16px; transform: translateY(2px); }
  /* PREVIEW: one compact pill tucked into the drawer's top edge, clear of the chapter tab and of the bookmarks */
  .preview { left: auto; right: 10px; top: auto; bottom: calc(var(--sheet-h) - 42px); padding: 3px 4px 3px 10px; gap: 5px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(120, 90, 50, .22); background: var(--ivory); z-index: 4; transition: bottom .28s var(--ease), opacity .5s; }
  .preview span { display: none; }
  .preview b { font-size: 10px; }
  .preview button { min-height: 28px; padding: 2px 9px; font-size: 11px; }
  .hints { display: none; }
  .stick { display: block; position: fixed; z-index: 3; left: 12px; bottom: calc(var(--sheet-h) + 50px); width: 76px; height: 76px; border-radius: 50%; background: rgba(255, 248, 233, .2); box-shadow: inset 0 0 0 2px rgba(255, 248, 233, .5); touch-action: none; transition: bottom .28s var(--ease), opacity .4s; }
  .stick i { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; background: var(--ivory); box-shadow: inset 0 0 0 3px var(--ivory), inset 0 0 0 5px rgba(185, 13, 28, .6), 0 3px 6px rgba(60, 0, 8, .35); will-change: transform; }
  body.intro .stick { opacity: 0; pointer-events: none; }
  .card { top: 17%; padding: 18px 24px 24px; width: max-content; max-width: 86vw; }
  .prompt { min-height: 40px; font-size: 13px; padding: 6px 14px 6px 8px; }
  .slips.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* film mode: only the canvas, on the same studio floor */
body.cine { width: 1920px; height: 1080px; background-size: 1920px 1080px; background-repeat: no-repeat; }

@media (prefers-reduced-motion: reduce) { * { transition-duration: .1s !important; animation-duration: .1s !important; } }
