body[data-world^="story-"] {
  --base:#31241c; --accent:#f0cb81; --dark:#432c1e; --panel:#49352a; --line:#a5815f;
}
body[data-world="story-walnut"] { --base:#2e1e19; --accent:#efc391; --dark:#42271e; --panel:#4c3228; }
body[data-world="story-birch"] { --base:#352d1e; --accent:#efd293; --dark:#423321; --panel:#4e422e; }
body[data-world^="story-"] #toolbar {
  min-height:58px; gap:8px;
  background:linear-gradient(180deg,#4c3527,#33251d); border-bottom:1px solid #d0a86f59;
  box-shadow:0 4px 12px #23160f4d;
}
.story-home {
  position:relative; display:grid; grid-template-rows:minmax(0,1fr); place-items:center; width:clamp(113px,14cqw,171px); height:45px;
  padding:3px 11px; border-radius:2px 2px 9px 9px;
  background:linear-gradient(#faf0d8,#f3ddb3); color:#402c1e;
  border:1px solid #c89e65; box-shadow:0 3px 6px #22150e80;
}
.story-home::before {
  content:""; position:absolute; z-index:1; width:20px; height:6px; top:-5px; left:calc(50% - 10px);
  border:1px solid #845c37; border-radius:4px 4px 2px 2px; background:#e7b34f; box-shadow:0 2px 3px #69432073;
}
.story-home img { width:100%; height:100%; min-height:0; object-fit:contain; }
.story-progress {
  width:max-content; display:grid; grid-template-columns:32px auto; gap:7px;
  align-items:center; padding:4px 10px 4px 6px; min-height:44px; border-radius:4px;
  color:#fff0d8; background:#493327;
  border:1px solid #cfac745f; box-shadow:inset 0 0 0 2px #2d1c193d;
  text-align:left; line-height:1.13;
}
.story-progress span { display:grid; }
.story-progress strong { font-size:.78rem; white-space:nowrap; }
.story-progress small { font-size:.61rem; color:#ecd8b5; }
.story-progress-ring {
  display:grid; width:31px; height:31px; place-items:center; border-radius:50%;
  background:conic-gradient(#f2cb83 var(--completed),#725744 var(--completed) 100%);
}
.story-progress-ring .icon {
  width:25px; height:25px; padding:5px; border-radius:50%; color:#f5d79f; background:#543a2c;
}
body[data-world^="story-"] .toolbar .tool {
  background:#4b3429; border-color:#a7875c8c; color:#f5dcad;
}
body[data-world^="story-"] .toolbar :is(.tool,.story-progress):hover { background:#634737; }
.story-device-choices { display:grid; gap:8px; max-width:460px; }
.story-device-choices button {
  display:flex; align-items:center; gap:12px; min-height:50px; text-align:left;
  padding:8px 11px; border:1px solid #b4956a7a; border-radius:4px;
  color:#fff1d1; background:#39271e;
}
.story-device-choices button[aria-pressed="true"] { background:#725337; border-color:#daba7d; }
.story-device-choices small { display:block; color:#f0d4a3; font-size:.73rem; }
.story-progress-bar { width:min(360px,100%); height:10px; accent-color:#d4a467; }

.stage[data-paper-index][data-paper-ui^="story-"] {
  --edge:clamp(17px,4cqw,62px);
  --bound-head:73px; --book-foot:calc(var(--dock-safe,84px) + 43px);
  --tab-fill:#76503a; --tab-active:#ebc988; --trail:#76513d;
}
.stage[data-paper-ui="story-honey"] .region { background:radial-gradient(ellipse at 51% 18%,#836245,#3a271d 79%); }
.stage[data-paper-ui="story-walnut"] .region { background:radial-gradient(ellipse at 38% 18%,#6e3f31,#382521 81%); }
.stage[data-paper-ui="story-birch"] .region { background:radial-gradient(ellipse at 41% 16%,#81704d,#3d3220 82%); }
.stage[data-paper-index][data-paper-ui="story-walnut"] {
  --tab-fill:#714233; --tab-active:#edbc87; --trail:#853f2e;
  --bookmark-base:52px; --bookmark-step:6px;
  --book-foot:calc(var(--dock-safe,84px) + var(--bookmark-base) + 3 * var(--bookmark-step) - 7px);
}
.stage[data-paper-ui="story-birch"] { --tab-fill:#625139; --tab-active:#dfc797; --trail:#6c5b38; }
.stage[data-paper-index][data-paper-ui^="story-"] #paper-contents {
  inset:auto max(calc(var(--edge) + 18px),calc((100cqw - 1280px)/2)) var(--dock-safe,84px); gap:9px;
}
.stage[data-paper-index][data-paper-ui^="story-"] #paper-contents::before {
  content:""; position:absolute; z-index:2; pointer-events:none;
  inset:0 -11px auto; height:7px; border-radius:0 0 7px 7px;
  background:repeating-linear-gradient(#98744d 0 1px,#edcf93 1px 2.3px);
  box-shadow:0 3px 0 #694529,0 6px 8px #26180f68;
}
.stage[data-paper-index][data-paper-ui^="story-"] .region-tab {
  min-height:48px; padding:9px 5px 7px; border-inline:1px dashed #e9cba57f;
  background-image:repeating-linear-gradient(90deg,#482d2218 0 1px,transparent 1px 3px);
  box-shadow:inset 0 10px 7px #2e1b147b;
}
.stage[data-paper-ui="story-walnut"] #paper-contents { align-items:start; }
.stage[data-paper-index][data-paper-ui="story-walnut"] #paper-contents::before { content:none; }
.stage[data-paper-index][data-paper-ui="story-walnut"] .region-tab {
  min-height:calc(var(--bookmark-base) + var(--bookmark-step) * var(--bookmark-order,0));
  padding:11px 5px 8px; align-content:start; border-radius:0 0 9px 9px; clip-path:none;
  border-inline:1px solid #e9cba566;
  background-image:linear-gradient(180deg,#28190f65,transparent 15px),repeating-linear-gradient(90deg,#2c1a171c 0 1px,transparent 1px 4px);
  box-shadow:0 3px 4px #2417118c;
}
.stage[data-paper-ui="story-walnut"] .region-tab[data-go="1"] { --bookmark-order:1; --tab-fill:#754b37; }
.stage[data-paper-ui="story-walnut"] .region-tab[data-go="2"] { --bookmark-order:2; --tab-fill:#64463a; }
.stage[data-paper-ui="story-walnut"] .region-tab[data-go="3"] { --bookmark-order:3; --tab-fill:#59392f; }
.stage[data-paper-ui="story-walnut"] .region-tab span { font-size:clamp(.78rem,1.1cqw,1rem); }
.stage[data-paper-ui="story-walnut"] .region-tab small { font-size:clamp(.67rem,.85cqw,.78rem); }
.stage[data-paper-ui="story-birch"] .region-tab { clip-path:none; border-radius:0 0 15% 15% / 0 0 27% 27%; }
.stage[data-paper-index][data-paper-ui^="story-"] .day-meta { font-size:.78rem; }
.stage[data-paper-index][data-paper-ui^="story-"] .day-controls .primary { font-size:.84rem; }
.stage[data-paper-ui^="story-"] .marker { border-radius:9px 9px 4px 4px; }
.stage[data-paper-ui="story-walnut"] .marker { border-radius:49% 49% 4px 4px; }
.stage[data-paper-ui="story-birch"] .marker { border-radius:5px 14px 5px 14px; }
.stage[data-paper-ui^="story-"] .marker-locked { color:#f1ddbc; background:#4a392d; border-color:#977d5e; }
.stage[data-paper-ui^="story-"] .marker-missed { color:#fff0d6; background:#754333; border-color:#c88564; }
.stage[data-paper-ui^="story-"] .marker-done { color:#fff2d0; background:#54614a; border-color:#889373; }
.stage[data-paper-ui^="story-"] .marker-open { color:#4a3420; background:#f2dfaf; }
.stage[data-paper-ui^="story-"] .marker-today-label { pointer-events:none; background:#422a1d; color:#fff0cc; }
.stage[data-paper-ui^="story-"] .route-line { stroke-dasharray:3 4; }
.stage[data-paper-ui="story-walnut"] .route-line { stroke-dasharray:1 3; stroke-width:2.5px; }
.stage[data-paper-ui="story-birch"] .route-line { stroke-dasharray:7 3; }
.stage[data-paper-ui^="story-"] .actor { width:clamp(65px,7.3cqw,102px); height:clamp(88px,9.2cqw,132px); }

.physical-book[data-book^="story-"] {
  --paper:#dfb888; --paper-light:#f7e3ba; --paper-edge:#977548; --paper-ink:#543826;
  --cover:#795035; --cover-deep:#493025; --cover-edge:#a77a4e;
  --paper-shadow:#44261474;
  --stage-box:4% 4% auto 29%; --stage-height:69%;
  --copy-left:6%; --copy-top:16%; --copy-width:19%;
  --plinth-width:80%;
}
.physical-book[data-book="story-walnut"] {
  --paper:#d6a880; --paper-light:#f2d2a9; --paper-ink:#563226; --paper-edge:#9a6c4d;
  --cover:#663d2b; --cover-deep:#3c2520; --cover-edge:#af7c59;
  --stage-box:5% 40% auto 4%; --stage-height:min(67%,35cqw);
  --copy-left:65%; --copy-top:13%; --copy-width:28%; --plinth-width:94%;
}
.physical-book[data-book="story-birch"] {
  --paper:#d9bb8a; --paper-light:#f5e7c0; --paper-ink:#53402c; --paper-edge:#ac9058;
  --cover:#796142; --cover-deep:#4a3a26; --cover-edge:#a48c5e;
  --stage-box:2.5% 26.5% auto 21%; --stage-height:75%;
  --copy-left:76%; --copy-top:12%; --copy-width:20%; --plinth-width:72%;
}
.physical-book[data-book^="story-"] .book-leaf .book-paper {
  background:
    radial-gradient(ellipse at 42% 28%,#fff2ce78,transparent 65%),
    radial-gradient(ellipse at 12% 86%,#9b684d32,transparent 63%),
    linear-gradient(135deg,var(--paper-light) 15%,var(--paper));
}
.physical-book[data-book="story-walnut"] .book-leaf .book-paper {
  background:radial-gradient(ellipse at 42% 21%,#ffe0b289,transparent 67%),linear-gradient(153deg,#ebc498,#c8926d);
}
.physical-book[data-book^="story-"] .book-casing {
  border-color:#6e4b32; box-shadow:0 7px 0 #4f3322,0 16px 22px #2719109e;
}
.physical-book[data-book^="story-"] .book-sheets {
  background:repeating-linear-gradient(1deg,#9a764d 0 1px,#e3c391 1px 3px);
}
.physical-book[data-book="story-walnut"] .book-casing {
  inset:-2px -5px -9px; border-width:1px; border-radius:14px;
  box-shadow:0 4px 0 #4b2e21,0 12px 18px #25170f9c;
}
.physical-book[data-book="story-walnut"] .book-casing::after { content:none; }
.physical-book[data-book="story-walnut"] .book-sheets {
  inset:1px -2px -6px; border-radius:13px; clip-path:none;
}
.physical-book[data-book^="story-"] .paper-landscape {
  opacity:.42; mask-image:linear-gradient(transparent,#000 58%,#000 80%,transparent);
  filter:sepia(.47) saturate(.69); inset:42% 0 0;
}
.physical-book[data-book="story-walnut"] .paper-landscape {
  inset:0; opacity:.52; border-radius:0 0 13px 13px;
  background-position:center bottom;
  mask-image:linear-gradient(180deg,transparent 25%,#000 61% 91%,#0006 100%);
}
.physical-book[data-book="story-birch"] .paper-landscape { inset-inline:0 12%; opacity:.46; }
.physical-book[data-book^="story-"] .edition-copy h2 { font-size:clamp(1.55rem,3.55cqw,3.75rem); line-height:1; }
.physical-book[data-book^="story-"] .edition-copy p { font-size:clamp(1rem,1.57cqw,1.25rem); line-height:1.27; }
.story-theatre figcaption { min-height:34px; padding:6px 8% 0; font-size:clamp(.82rem,1.4cqw,1.08rem); }
.story-picture {
  isolation:isolate; perspective:1280px; perspective-origin:50% 60%;
}
.story-picture .story-plane {
  inset:0; width:auto; transform-origin:50% 100%;
  filter:drop-shadow(0 1px 0 #f7e3bdc4) drop-shadow(0 7px 4px var(--paper-shadow));
}
.story-picture .story-plane img {
  display:block; width:100%; height:100%; mix-blend-mode:normal; object-fit:cover;
}
.story-picture .story-plane[data-plane="horizon"] {
  --layer-z:-34px; --layer-tilt:7deg; z-index:1; inset:4% 1% 7%;
}
[data-plane="horizon"] img {
  clip-path:polygon(0 100%,0 31%,3% 20%,9% 16%,14% 9%,22% 10%,29% 3%,39% 7%,48% 1%,58% 6%,69% 4%,80% 9%,89% 14%,97% 19%,100% 27%,100% 100%);
}
.story-picture .story-plane[data-plane="woods"] {
  --layer-z:-8px; --layer-tilt:2deg; z-index:2; inset:1% 1% 4%;
}
[data-plane="woods"] img {
  clip-path:polygon(0 100%,0 45%,4% 33%,6% 25%,8% 39%,11% 47%,13% 66%,18% 78%,22% 100%,78% 100%,85% 76%,90% 57%,92% 33%,95% 23%,97% 37%,100% 43%,100% 100%);
  filter:brightness(.86);
}
.story-picture .story-plane[data-plane="action"] {
  --layer-z:16px; --layer-tilt:0deg; z-index:3;
  inset:2% 6% 4%;
}
.story-picture [data-plane="action"] img {
  object-fit:contain; object-position:50% 75%;
  clip-path:polygon(0 100%,0 17%,11% 11%,20% 15%,32% 9%,42% 6%,53% 4%,67% 13%,75% 10%,89% 10%,100% 18%,100% 100%);
}
.story-sheet-content:is([data-story-day="4"],[data-story-day="5"]) .story-picture [data-plane="action"] img { clip-path:none; }
.story-sheet-content[data-story-day="5"] .story-picture .story-plane[data-plane="action"] { inset:0 6% 1%; --layer-z:21px; }
.story-sheet-content[data-story-day="4"] .story-plane:not([data-plane="action"]) img {
  filter:grayscale(.4) sepia(.69) saturate(.91);
}
.story-sheet-content:is([data-story-day="1"],[data-story-day="2"],[data-story-day="3"],[data-story-day="6"]) .story-plane img {
  filter:saturate(1.1) contrast(1.045);
}
.story-sheet-content[data-story-day="0"] .story-plane img {
  filter:sepia(.23) saturate(1.01) contrast(1.03);
}
.story-sheet-content[data-story-day="7"] .story-plane img {
  filter:grayscale(.18) sepia(.46) saturate(.81);
}
.story-picture .story-plane[data-plane="ground"] {
  --layer-z:37px; --layer-tilt:-2deg; z-index:4; inset:1% 1% 0;
}
[data-plane="ground"] img {
  clip-path:polygon(0 100%,0 84%,8% 81%,14% 85%,25% 86%,31% 89%,41% 86%,48% 89%,54% 86%,62% 88%,68% 84%,76% 86%,84% 82%,91% 83%,100% 78%,100% 100%);
}
.story-picture .story-plane[data-plane="near"] {
  --layer-z:54px; --layer-tilt:-3deg; z-index:5; inset:1% 0 0;
}
[data-plane="near"] img {
  clip-path:polygon(0 100%,0 68%,3% 62%,6% 71%,9% 79%,15% 92%,27% 100%,80% 100%,86% 88%,90% 67%,93% 56%,96% 63%,100% 46%,100% 100%);
  filter:sepia(.33) brightness(.82) saturate(.81);
}
.story-picture .story-plane[data-plane="stems"] {
  --layer-z:62px; --layer-tilt:-4deg; z-index:6; inset:1% 0 0;
}
[data-plane="stems"] img {
  clip-path:polygon(0 100%,0 86%,4% 88%,7% 79%,10% 92%,14% 88%,18% 100%,86% 100%,91% 89%,94% 91%,97% 77%,100% 83%,100% 100%);
  filter:sepia(.48) brightness(.82);
}
.physical-book[data-book="story-walnut"] .story-picture .story-plane[data-plane="horizon"] { inset-inline:3%; }
.physical-book[data-book="story-birch"] .story-picture [data-plane="horizon"] img {
  clip-path:polygon(0 100%,0 54%,9% 44%,16% 31%,23% 29%,28% 17%,39% 12%,45% 4%,51% 0,58% 9%,69% 15%,73% 26%,82% 31%,91% 46%,100% 48%,100% 100%);
}
.physical-book[data-book="story-birch"] .story-picture .story-plane[data-plane="action"] { inset-inline:1%; }
.physical-book[data-book="story-birch"] .story-sheet-content[data-story-day="4"] .story-plane:is([data-plane="woods"],[data-plane="near"],[data-plane="stems"]) img {
  mask-image:linear-gradient(90deg,#000 0 73%,transparent 85%);
}
.story-plinth {
  position:absolute; z-index:7; left:50%; bottom:-2%; transform:translateX(-50%);
  width:var(--plinth-width); height:clamp(22px,11%,70px); object-fit:fill;
  filter:drop-shadow(0 9px 4px #48301d72);
}
.physical-book[data-book="story-walnut"] .story-plinth { filter:sepia(.24) brightness(.69) drop-shadow(0 10px 7px #3c201b89); }
.physical-book[data-book="story-birch"] .story-plinth { bottom:0; height:14%; filter:sepia(.28) brightness(1.09) drop-shadow(0 6px 5px #3d2d2371); }
.story-brace {
  position:absolute; z-index:5; bottom:0; left:15%; width:12%; height:12%;
  background:linear-gradient(175deg,#92704a,#dcb887 35%,#ead1a4 54%,#9f7a52);
  clip-path:polygon(18% 1%,92% 0,100% 74%,78% 100%,0 98%,0 68%);
  transform:rotate(-4deg);
}
.story-brace + .story-brace { left:auto; right:16%; transform:rotate(4deg) scaleX(-1); }
.book-turn .book-turn-scene { inset:auto; }
.book-turn .book-turn-scene .story-plane {
  transform:none; filter:none; animation:none!important;
}
.book-turn .book-turn-scene .story-plinth { filter:none; }
.stage[data-paper-ui^="story-"] .book-turn-ink .route { transform:none; }
.book-turn[data-single-leaf] .book-turn-back .book-paper {
  background:radial-gradient(ellipse at 71% 28%,#fff0cc,var(--paper) 88%);
}

@container game (width > 700px) {
  .physical-book[data-book="story-walnut"] .book-leaf .book-paper { clip-path:none; }
  .physical-book[data-book="story-walnut"] [data-leaf="left"] .book-paper { border-radius:14px 0 0 13px; }
  .physical-book[data-book="story-walnut"] [data-leaf="right"] .book-paper { border-radius:0 14px 13px 0; }
  .physical-book[data-book="story-walnut"] [data-leaf="left"] .book-paper::after {
    background:linear-gradient(90deg,transparent 87%,#faddb634 94%,#74493278 100%);
  }
  .physical-book[data-book="story-walnut"] [data-leaf="right"] .book-paper::after {
    background:linear-gradient(90deg,#74493278,#ca976728 2%,transparent 8%);
  }
  .physical-book[data-book="story-walnut"] .book-gutter {
    inset-block:0; opacity:.48; background:#80523b; box-shadow:none;
  }
}
@container game (max-width:700px) {
  body[data-world^="story-"] #toolbar { min-height:54px; padding-inline:8px; }
  .story-home { width:107px; height:42px; padding:2px 7px; }
  .story-progress { gap:4px; padding-inline:4px 7px; }
  .story-progress strong { font-size:.74rem; }
  .story-progress small { font-size:.59rem; }
  .stage[data-paper-index][data-paper-ui^="story-"] { --edge:11px; --bound-head:62px; --book-foot:calc(var(--dock-safe,84px) + 42px); }
  .stage[data-paper-index][data-paper-ui="story-walnut"] {
    --bookmark-base:48px; --bookmark-step:4px;
    --book-foot:calc(var(--dock-safe,84px) + var(--bookmark-base) + 3 * var(--bookmark-step) - 7px);
  }
  .stage[data-paper-index][data-paper-ui^="story-"] #paper-contents { inset-inline:17px; gap:5px; }
  .stage[data-paper-index][data-paper-ui="story-walnut"] .region-tab { padding:9px 3px 7px; }
  .stage[data-paper-ui="story-walnut"] .region-tab span { font-size:.79rem; }
  .stage[data-paper-ui^="story-"] .actor { width:clamp(46px,14.4cqw,61px); height:clamp(62px,19cqw,83px); }
  .physical-book[data-book^="story-"] {
    --stage-box:2% 2% auto; --stage-height:min(57%,76cqw);
    --copy-left:7%; --copy-top:min(60%,82cqw); --copy-width:86%;
  }
  .physical-book[data-book="story-walnut"] {
    --stage-box:0% 1.5% auto; --stage-height:min(60%,82cqw); --copy-top:min(62%,86cqw);
    --plinth-width:92%;
  }
  .physical-book[data-book="story-walnut"] .paper-landscape { inset-block-start:38%; }
  .physical-book[data-book="story-birch"] {
    --stage-box:15.5% 1.8% auto; --stage-height:min(54%,83cqw); --copy-top:3.1%;
  }
  .physical-book[data-book^="story-"] .edition-copy h2 { font-size:clamp(1.4rem,6.4cqw,2.25rem); margin-bottom:.23em; }
  .physical-book[data-book^="story-"] .edition-copy .book-copy-short { display:block; font-size:clamp(.91rem,3.8cqw,1.06rem); }
  .story-theatre figcaption { min-height:24px; padding-top:5px; }
  .physical-book[data-book="story-walnut"] .story-theatre figcaption { padding-inline:10.7%; }
  .story-picture { perspective:1250px; }
}
@container game (max-width:700px) and (max-height:600px) {
  .physical-book[data-book^="story-"] { --stage-height:51%; --copy-top:54%; }
  .physical-book[data-book="story-walnut"] { --stage-height:53%; --copy-top:55%; }
  .physical-book[data-book="story-birch"] { --stage-box:15% 1.8% auto; --stage-height:56%; --copy-top:2.25%; }
  .physical-book[data-book="story-birch"] .edition-copy .book-copy-short { display:none; }
  .physical-book[data-book^="story-"] .edition-copy h2 { font-size:clamp(1.25rem,6.1cqw,1.6rem); margin-bottom:.12em; }
  .physical-book[data-book^="story-"] .edition-copy .book-copy-short { font-size:clamp(.81rem,3.65cqw,.94rem); line-height:1.15; }
  .story-theatre figcaption { min-height:19px; font-size:.76rem; padding-top:4px; }
  .stage[data-paper-ui^="story-"] .waypoint { top:calc(29% + var(--y) * .68); }
  .stage[data-paper-ui^="story-"] .route { transform:translateY(29%) scaleY(.68); transform-origin:top; }
  .stage[data-paper-ui="story-walnut"] .waypoint { top:calc(30% + var(--y) * .62); }
  .stage[data-paper-ui="story-walnut"] .route { transform:translateY(30%) scaleY(.62); }
  .stage[data-paper-ui^="story-"] .marker[aria-current="date"] { align-content:center; row-gap:0; }
  .stage[data-paper-ui^="story-"] .marker[aria-current="date"] .marker-today-label {
    position:static; translate:none; padding:0; border:0; background:none; box-shadow:none; color:inherit; font-size:.49rem;
  }
}
@container game (max-width:355px) {
  body[data-world^="story-"] .toolbar [data-action="back"] span { display:none; }
  .stage[data-paper-index][data-paper-ui^="story-"] .day-dock { inset-block-end:var(--dock-floor); }
  .stage[data-paper-ui^="story-"] .actor { width:43px; height:59px; }
}
