.region:has(.board > .physical-book) .region-heading {
  width:1px;
  height:1px;
  overflow:hidden;
  clip-path:inset(50%);
  white-space:nowrap;
}
.region:has(.board > .physical-book) .board {
  inset:max(76px,8.7%) 4.15% max(16%,var(--dock-safe,0px));
}
.game[data-art="manuscript"] .region {
  background:radial-gradient(ellipse at 53% 15%,#52352b 0%,#302021 53%,#21171c 88%);
}
.game[data-art="popup"] .region {
  background:radial-gradient(ellipse at 58% 12%,#2b5a55 0%,#223d3b 54%,#172629 89%);
}
.game[data-art="atelier"] .region {
  background:radial-gradient(ellipse at 24% 17%,#47564d 0%,#2b3939 53%,#1e2c2f 98%);
}
.game:is([data-art="manuscript"],[data-art="popup"],[data-art="atelier"]) .day-dock::before {
  background:linear-gradient(0deg,var(--base) 5%,color-mix(in srgb,var(--base) 78%,transparent) 48%,transparent 81%);
}

.physical-book {
  --paper:#ebd2a4;
  --paper-light:#f3e2bd;
  --paper-edge:#a77f51;
  --paper-ink:#342517;
  --cover:#471f21;
  --cover-edge:#8a4934;
  --cover-deep:#2a1118;
  --thread:#983d2d;
  --spine-depth:7%;
  --book-outer:inset 5px 0 18px #69432121,inset 0 -2px 3px #69432137;
  position:absolute;
  inset:0;
  color:var(--paper-ink);
  isolation:isolate;
  pointer-events:none;
}
.physical-book[data-book="popup"] {
  --paper:#dcc8a4;
  --paper-light:#f6e9cc;
  --paper-edge:#967f59;
  --paper-ink:#212e2a;
  --cover:#243d39;
  --cover-edge:#517364;
  --cover-deep:#142322;
  --thread:#a54633;
  --spine-depth:5.5%;
}
.physical-book[data-book="atelier"] {
  --paper:#dfddd0;
  --paper-light:#f2eed8;
  --paper-edge:#a39a78;
  --paper-ink:#173737;
  --cover:#38494e;
  --cover-edge:#788274;
  --cover-deep:#1a2c30;
  --thread:#a44540;
  --spine-depth:4.2%;
}

.book-volume {
  position:absolute;
  inset:.3% .85% 4.15%;
  isolation:isolate;
}
.book-casing,.book-sheets,.book-gutter {
  position:absolute;
  pointer-events:none;
}
.book-casing {
  inset:-4px -10px -17px;
  border:2px solid var(--cover-edge);
  border-radius:24px 24px 25px 25px / 22px 22px 18px 18px;
  background:
    linear-gradient(90deg,transparent 46%,#0004 49%,#0007 51%,transparent 55%),
    linear-gradient(161deg,var(--cover-edge),var(--cover) 15%,var(--cover) 74%,var(--cover-deep));
  box-shadow:0 5px 1px var(--cover-deep),0 19px 20px #0b0a0a82,0 37px 44px #0b0a0a7a;
}
.book-casing::after {
  content:"";
  position:absolute;
  inset:5px;
  border:1px solid color-mix(in srgb,var(--cover-edge) 70%,#ddbf8e);
  border-radius:inherit;
}
.book-sheets {
  --left-stack:calc(98.8% + (var(--gatherings,1) - 1) * .38%);
  --right-stack:calc(100% - (var(--gatherings,1) - 1) * .37%);
  inset:2px -2px -10px;
  border-radius:12px 12px 14px 14px / 12px 12px 23px 23px;
  clip-path:polygon(0 0,100% 0,100% 97.8%,97% var(--right-stack),56% var(--right-stack),50% 97.1%,44% var(--left-stack),2% var(--left-stack),0 97.7%);
  background:
    linear-gradient(90deg,#4b2d1e58 0%,transparent 5% 44%,#372010b7 49.85%,#5c452580 50.1%,transparent 54% 92%,#74482575 100%),
    repeating-linear-gradient(3deg,#7e573d91 0 .65px,transparent .85px 2.35px),
    linear-gradient(165deg,var(--paper-light) 5% 45%,var(--paper-edge));
  box-shadow:inset 0 -3px 3px #75472587;
}
.book-leaf {
  position:absolute;
  inset-block:0;
  width:50%;
  padding:0;
}
.book-leaf[data-leaf="left"] { left:0; }
.book-leaf[data-leaf="right"] { right:0; }
.book-paper {
  position:absolute;
  inset:0;
  overflow:hidden;
  background:
    radial-gradient(ellipse at 12% 24%,#bc8b5524,transparent 39%),
    radial-gradient(ellipse at 75% 70%,#b6804624,transparent 32%),
    radial-gradient(ellipse at 28% 92%,#8d603526,transparent 36%),
    linear-gradient(148deg,var(--paper-light),var(--paper-light) 19%,var(--paper) 94%);
  box-shadow:var(--book-outer);
  transform:translateZ(0);
}
.book-paper::after {
  content:"";
  position:absolute;
  z-index:4;
  inset:0;
  border-radius:inherit;
  pointer-events:none;
}
.book-leaf[data-leaf="left"] .book-paper {
  border-radius:18px 4% 4% 19px / 25px 6px 11px 22px;
  clip-path:polygon(0 0,92% 0,100% 1.4%,100% 98.5%,91% 100%,0 100%);
}
.book-leaf[data-leaf="right"] .book-paper {
  border-radius:4% 18px 19px 4% / 6px 25px 22px 11px;
  clip-path:polygon(0 1.4%,8% 0,100% 0,100% 100%,9% 100%,0 98.5%);
}
.book-leaf[data-leaf="left"] .book-paper::after {
  background:linear-gradient(90deg,#7651222e,transparent 4% 87%,#fff1 93%,#513324b0 99.9%);
}
.book-leaf[data-leaf="right"] .book-paper::after {
  background:linear-gradient(90deg,#5a3d29ac,transparent var(--spine-depth) 91%,#fff1 96%,#84603628);
}
.book-gutter {
  z-index:5;
  top:2.1%;
  bottom:1.7%;
  left:50%;
  width:1px;
  color:#6b4e38;
  background:linear-gradient(0deg,transparent,#4e2b20b3 12% 89%,transparent);
  box-shadow:-2px 0 4px #5e3d2860,3px 0 6px #f6e8bb56;
}
.book-folio {
  position:absolute;
  z-index:2;
  bottom:3.2%;
  color:color-mix(in srgb,var(--paper-ink) 75%,#b08451);
  font:400 clamp(.74rem,1.15cqw,1.05rem)/1 Oranienbaum,Georgia,serif;
  font-variant-numeric:lining-nums;
}
.book-leaf[data-leaf="left"] .book-folio { left:6%; }
.book-leaf[data-leaf="right"] .book-folio { right:6%; }
.book-ribbon {
  position:absolute;
  z-index:1;
  left:calc(47.6% + var(--gatherings, 1) * .45%);
  bottom:-20px;
  width:clamp(9px,1.2cqw,18px);
  height:35px;
  transform:rotate(calc(-24deg + var(--gatherings,1) * 5deg));
  background:linear-gradient(90deg,#541c20,var(--thread) 37%,#d48c6575 52%,var(--thread) 83%,#541c20);
  clip-path:polygon(0 0,100% 0,100% 100%,50% 78%,0 100%);
}

.book-paper h2 {
  margin:0 0 .6em;
  font:400 clamp(1.85rem,4.1cqw,4.3rem)/.98 Oranienbaum,Georgia,serif;
  letter-spacing:-.024em;
  text-wrap:balance;
}
.book-paper p {
  max-width:43ch;
  font:400 clamp(.98rem,1.75cqw,1.5rem)/1.38 Oranienbaum,Georgia,serif;
  text-wrap:pretty;
}
.book-copy-short { display:none; }
.book-paper figure { margin:0; }
.book-paper figcaption {
  color:var(--paper-ink);
  font:400 clamp(.83rem,1.38cqw,1.3rem)/1.1 Oranienbaum,Georgia,serif;
}
.book-print {
  width:100%;
  height:100%;
  object-fit:cover;
  mix-blend-mode:multiply;
}

[data-book="manuscript"] .book-casing::before {
  content:"";
  position:absolute;
  inset:0;
  border-radius:inherit;
  background:
    linear-gradient(135deg,#815835 0%,#e1b378 15%,transparent 16%) top left / 9% 12% no-repeat,
    linear-gradient(225deg,#815835 0%,#d6a36a 15%,transparent 16%) top right / 9% 12% no-repeat,
    linear-gradient(45deg,#704a2f 0%,#e2af6b 15%,transparent 16%) bottom left / 9% 12% no-repeat,
    linear-gradient(315deg,#70482d 0%,#ba8955 15%,transparent 16%) bottom right / 9% 12% no-repeat;
}
[data-book="manuscript"] .book-sheets {
  background:
    linear-gradient(90deg,#4b2d1e58,transparent 5% 44%,#372010b7 49.85%,#5c452580 50.1%,transparent 54% 92%,#74482575),
    repeating-linear-gradient(3deg,#68431780 0 .6px,transparent .8px 2.4px),
    linear-gradient(161deg,#c58339,#eccc81 34%,#968043 73%,#cb984c);
}
.book-manuscript-copy { position:absolute; z-index:1; top:12%; left:13%; right:10%; }
.book-manuscript-copy h2 { color:#702c25; }
.book-initial::first-letter {
  float:left;
  margin:.03em .09em -.06em 0;
  color:#812d2b;
  font:400 2.55em/.82 Yeseva,Georgia,serif;
  text-shadow:0 0 1px #b67736,1px 1px #d5af66;
}
.book-scrollwork {
  position:absolute;
  inset:5.4% 5.2%;
  width:89.6%;
  height:89.2%;
  fill:none;
  stroke:#9a713a84;
  stroke-width:1.3px;
  border:1px solid #bd934873;
  outline:1px solid #9e6d353f;
  outline-offset:3px;
}
.book-seal {
  position:absolute;
  top:50%;
  left:10%;
  width:19%;
  aspect-ratio:1.25;
  padding:3px;
  border:2px double #9a682f;
  border-radius:48% 47% 39% 39%;
  overflow:hidden;
  opacity:.84;
}
.book-illumination {
  position:absolute;
  left:12%;
  right:10%;
  top:9.5%;
  height:49%;
  padding:5px;
  border:3px double #a57433;
  background:#bb955847;
  box-shadow:0 2px 0 #6e49274a,0 0 0 1px #f4de98 inset;
}
.book-illumination .book-print { display:block; }
.book-illumination figcaption { margin-top:.65em; text-align:center; font-style:italic; }

[data-book="popup"] .book-leaf[data-leaf="left"] .book-paper {
  background:radial-gradient(ellipse at 5% 12%,#f3efcf,transparent 72%),var(--paper-light);
}
[data-book="popup"] .book-leaf[data-leaf="right"] .book-paper {
  background:linear-gradient(163deg,#e6edd4,#f2edce 62%,#e3d4a9);
}
[data-book="popup"] .book-casing {-webkit-text-size-adjust:100%; border-radius:10px;}
[data-book="popup"] .book-ribbon { display:none; }
.book-popup-copy { position:absolute; z-index:1; top:12%; left:13%; right:9%; }
.book-popup-copy h2 { color:#204641; font-family:Yeseva,Georgia,serif; font-size:clamp(1.65rem,3.55cqw,3.7rem); }
.book-popup-stage {
  position:absolute;
  left:6.7%;
  right:5%;
  top:7%;
  height:59%;
  isolation:isolate;
}
.book-popup-stage::before {
  content:"";
  position:absolute;
  inset:56% 4% 12%;
  background:radial-gradient(ellipse at center,#2d443f85,transparent 70%);
  transform:skewX(-21deg);
}
.book-popup-stage figcaption { position:absolute; left:8%; bottom:1%; color:#324b40; font-style:italic; }
.book-pop-fold {
  --fold-scale:1;
  --cut:polygon(0 100%,0 66%,13% 47%,22% 47%,28% 31%,43% 42%,51% 17%,65% 32%,89% 47%,100% 58%,100% 100%);
  position:absolute;
  left:4%;
  right:3%;
  bottom:16%;
  height:76%;
  transform-origin:50% 96%;
  transform:scaleY(var(--fold-scale));
  filter:drop-shadow(7px 11px 6px #25373568);
}
.book-pop-cut {
  position:absolute;
  inset:0 0 7%;
  clip-path:var(--cut);
  background:#bfac83;
  padding:1px 2px 1px 1px;
}
.book-pop-cut .book-print { mix-blend-mode:normal; }
.book-pop-hinge {
  position:absolute;
  inset:auto 0 0;
  height:11%;
  background:linear-gradient(0deg,transparent 13%,#6b6b4a31 15% 25%,transparent 38%);
}
.book-pop-hinge::before,.book-pop-hinge::after {
  content:"";
  position:absolute;
  top:0;
  bottom:0;
  width:33%;
  background:linear-gradient(180deg,#665d47 0%,#d9c79b 29%,#efe2b8 63%,#9d8d69);
  clip-path:polygon(6% 0,96% 0,100% 81%,18% 100%,0 24%);
}
.book-pop-hinge::before { left:9%; transform:skewX(-22deg); }
.book-pop-hinge::after { right:9%; transform:skewX(22deg) scaleX(-1); }
.book-pop-fold-back {
  --cut:polygon(0 100%,0 46%,7% 36%,14% 49%,21% 21%,27% 34%,38% 15%,47% 29%,58% 0,67% 23%,82% 37%,89% 18%,100% 36%,100% 100%);
  bottom:24%;
  height:81%;
}
.book-pop-fold-middle {
  --cut:polygon(0 100%,0 70%,13% 55%,23% 69%,31% 32%,41% 45%,48% 28%,63% 50%,69% 30%,78% 55%,91% 41%,100% 66%,100% 100%);
  left:1%;
  right:6%;
  height:77%;
  bottom:17%;
}
.book-pop-fold-middle .book-print { filter:brightness(.9) saturate(1.1); }
.book-pop-fold-front {
  --cut:polygon(0 100%,0 83%,14% 73%,21% 81%,34% 63%,49% 75%,60% 56%,73% 73%,89% 69%,100% 79%,100% 100%);
  left:2%;
  right:5%;
  height:59%;
  bottom:11%;
}
.book-pop-fold-narrow {
  --cut:polygon(0 100%,0 71%,13% 52%,28% 58%,36% 27%,56% 47%,69% 32%,84% 59%,100% 64%,100% 100%);
  left:13%;
  right:59%;
  height:22%;
  bottom:24%;
  transform:rotate(-4deg) scaleY(var(--fold-scale));
}
.book-pop-fold .book-print { object-fit:cover; }
.map-scroll .book-pop-fold {
  --fold-scale:.13;
  transition:transform .26s cubic-bezier(.43,.07,.72,.62), filter .26s;
}
.map-scroll .region[data-active="true"] .book-pop-fold {
  --fold-scale:1;
  transition:transform .68s cubic-bezier(.16,.78,.22,1.08), filter .55s;
}
.map-scroll[data-turning="true"] .region[data-active="true"] .book-pop-fold {
  --fold-scale:.32;
  transition-duration:.26s;
  filter:drop-shadow(2px 2px 2px #25373586);
}
.map-scroll:not([data-turning]) .region[data-active="true"] .book-pop-fold-middle { transition-delay:.05s; }
.map-scroll:not([data-turning]) .region[data-active="true"] .book-pop-fold-front { transition-delay:.11s; }
@media (prefers-reduced-motion:reduce) {
  .map-scroll .book-pop-fold,.map-scroll .region[data-active="true"] .book-pop-fold { transition:none; }
}

[data-book="atelier"] .book-casing {
  border-radius:11px 14px 13px 12px;
  background:
    repeating-linear-gradient(0deg,transparent 0 2px,#c8b6932e 2px 3px),
    repeating-linear-gradient(90deg,transparent 0 2px,#c8b69332 2px 3px),
    linear-gradient(145deg,var(--cover-edge),var(--cover) 16%,var(--cover) 74%,var(--cover-deep));
}
[data-book="atelier"] .book-casing::after { border-style:dashed; border-color:#c7bd94; }
[data-book="atelier"] .book-gutter {
  width:2px;
  background:repeating-linear-gradient(0deg,#602b27 0 8px,#d19a6f 8px 10px,#dcaf8524 10px 34px);
}
[data-book="atelier"] .book-paper {
  background:
    repeating-linear-gradient(0deg,#476b6d0e 0 1px,transparent 1px 23px),
    repeating-linear-gradient(90deg,#476b6d0e 0 1px,transparent 1px 23px),var(--paper-light);
}
[data-book="atelier"] .book-leaf[data-leaf="right"] .book-paper {
  background:radial-gradient(ellipse at 60% 20%,#c9d1bc,#b7c5b1 53%,#9eafa2);
}
.book-atelier-copy { position:absolute; top:10%; left:12%; right:10%; }
.book-atelier-copy h2 { font-family:Tenor,Oranienbaum,serif; font-weight:400; line-height:1.02; font-size:clamp(1.62rem,3.1cqw,3.25rem); }
.book-pattern-sheet {
  position:absolute;
  inset:38% 13% 38% 12%;
  padding:1.4% 3%;
  transform:rotate(-3deg);
  border:1px solid #7d9a8b6e;
  background:#eceddbb5;
  box-shadow:2px 4px 9px #435b4c25;
}
.book-pattern-sheet::before,
.book-atelier-print::before {
  content:"";
  position:absolute;
  z-index:1;
  width:21%;
  height:10%;
  background:#d3bf90ad;
  transform:rotate(-8deg);
  top:-4.5%;
  left:39%;
  clip-path:polygon(1% 0,100% 4%,98% 100%,0 93%,2% 67%,0 57%);
}
.book-pattern { width:100%; height:100%; }
.book-pattern-grid,.book-pattern-mark,.book-pattern-cut,.book-pattern-seam { fill:none; stroke:#2d6363; stroke-width:.5px; }
.book-pattern-grid { opacity:.37; }
.book-pattern-cut { stroke-width:1.1px; fill:#bbcec2aa; }
.book-pattern-seam { transform-box:fill-box; transform-origin:center; transform:scale(.86); stroke:#8b3b36; stroke-dasharray:2 2; }
.book-pattern-sheet figcaption { position:absolute; left:5%; bottom:6%; color:#244941; }
.book-atelier-print {
  position:absolute;
  inset:10% 11% 34% 12%;
  padding:3% 3% 6%;
  background:#f4f0dc;
  border:1px solid #62766582;
  box-shadow:1px 6px 12px #274a4356;
  transform:rotate(2.7deg);
}
.book-atelier-print figcaption { margin-top:.2em; color:#374736; }
.book-fabric {
  position:absolute;
  top:44%;
  right:8.3%;
  width:34%;
  aspect-ratio:1.55;
  transform:rotate(-9deg);
  isolation:isolate;
  filter:drop-shadow(2px 5px 4px #243b3c6d);
}
.book-fabric .book-print {
  border:3px solid #6a4c47;
  outline:1px dashed #fcdeba;
  outline-offset:-6px;
  mix-blend-mode:normal;
}
.book-fabric i {
  position:absolute;
  width:10px;
  height:10px;
  border:1px solid #5a4145;
  border-radius:50%;
  background:#c89a69;
  box-shadow:1px 1px 2px #291c2166;
  top:-4px;
  left:47%;
}
.book-fabric > span {
  position:absolute;
  left:5%;
  bottom:5%;
  padding:2px 4px;
  color:#302825;
  background:#f1e3c8ed;
  font:400 clamp(.66rem,1cqw,1rem)/1.2 Oranienbaum,Georgia,serif;
}

@container game (min-width:621px) {
  [data-book="manuscript"][data-book-spread="1"] .book-illumination { inset:10% 8% auto 10%; height:50%; }
  [data-book="manuscript"][data-book-spread="2"] .book-illumination { inset:8% 16% auto 17%; height:49%; }
  [data-book="manuscript"][data-book-spread="3"] .book-illumination { inset:13% 7% auto 12%; height:45%; }
  [data-book="atelier"][data-book-spread="1"] .book-atelier-print { transform:rotate(-2.7deg); }
  [data-book="atelier"][data-book-spread="2"] .book-atelier-print { inset:8% 18% 32% 15%; transform:rotate(-2deg); }
  [data-book="atelier"][data-book-spread="3"] .book-atelier-print { inset:12% 9% 39% 9%; transform:rotate(1deg); }
}

[data-map="manuscript"] .route-shadow,[data-map="popup"] .route-shadow,[data-map="atelier"] .route-shadow {
  stroke:#ecdcbcbd;
  stroke-width:4.5px;
}
[data-map="manuscript"] .route-line { stroke:#873932; stroke-width:2.15; stroke-dasharray:1 6; }
[data-map="popup"] .route-line { stroke:#2d625b; stroke-width:2.55; stroke-dasharray:5 4; }
[data-map="atelier"] .route-line { stroke:#a13c35; stroke-width:2.55; stroke-dasharray:7 3; }
[data-map="manuscript"] .marker { border-radius:47% 53% 45% 55%; }
[data-map="popup"] .marker { border-radius:12px 14px 6px 8px; }
[data-map="atelier"] .marker { border-radius:4px 6px 4px 6px; }
:is([data-map="manuscript"],[data-map="popup"],[data-map="atelier"]) .marker {
  box-shadow:0 3px 7px #3c2b2378;
}
:is([data-map="manuscript"],[data-map="popup"],[data-map="atelier"]) .marker[aria-pressed="true"] {
  outline-color:#4d382c;
}
:is([data-map="manuscript"],[data-map="popup"],[data-map="atelier"]) .marker:focus-visible {
  outline:2px solid #211e1e;
  outline-offset:5px;
}

@container game (max-height:700px) {
  .book-paper h2 { font-size:clamp(1.5rem,5.1cqh,3.15rem); }
  .book-paper p { font-size:clamp(.88rem,2.6cqh,1.25rem); }
  .book-popup-copy h2 { font-size:clamp(1.34rem,4.7cqh,2.95rem); }
  .book-atelier-copy h2 { font-size:clamp(1.34rem,4.45cqh,2.7rem); }
  .book-seal { top:51%; width:17%; }
}
@container game (max-width:620px) {
  .region:has(.board > .physical-book) .board { inset:63px 4.2% max(23%,var(--dock-safe,0px)); }
  .book-volume { inset:0 0 2.7%; }
  .book-casing { inset:-3px -5px -8px; border-radius:13px; }
  .book-casing::after { inset:2px; }
  .book-sheets { inset:1px -1px -5px; }
  .book-leaf[data-leaf="left"] .book-paper { border-radius:10px 4% 4% 10px / 15px 4px 8px 14px; }
  .book-leaf[data-leaf="right"] .book-paper { border-radius:4% 10px 10px 4% / 4px 15px 14px 8px; }
  .book-ribbon { height:22px; bottom:-13px; }
  .book-paper h2 { font-size:clamp(.97rem,5.15cqw,1.61rem); margin-bottom:.47em; }
  .book-paper p { font-size:clamp(.73rem,3.2cqw,.97rem); line-height:1.27; }
  .book-paper figcaption { font-size:clamp(.65rem,2.8cqw,.85rem); }
  .book-manuscript-copy,.book-popup-copy,.book-atelier-copy { top:8.5%; left:11%; right:12%; }
  .book-illumination { top:7%; left:12%; right:10%; height:38%; padding:2px; }
  .book-illumination figcaption { margin-top:.45em; }
  .book-seal,.book-pop-fold-narrow { display:none; }
  .book-scrollwork { stroke-width:.85px; }
  .book-popup-stage { top:8%; height:39%; }
  .book-pop-fold { filter:drop-shadow(3px 5px 4px #25373575); }
  .book-popup-stage figcaption { left:4%; bottom:-3%; }
  .book-pattern-sheet { display:none; }
  .book-atelier-print { inset:7% 11% 57% 11%; padding-bottom:10%; }
  .book-atelier-print figcaption { margin-top:.15em; }
  .book-fabric { top:13%; right:8%; width:29%; }
  .book-fabric .book-print { border-width:2px; outline-offset:-4px; }
  .book-fabric i { width:6px; height:6px; top:-2px; }
  .book-fabric > span { display:none; }
}
@container game (max-width:620px) and (max-height:570px) {
  .book-copy-full { display:none; }
  .book-copy-short { display:block; }
  .book-paper h2 { font-size:clamp(.97rem,4.85cqw,1.27rem); }
  .book-illumination figcaption { margin-top:.3em; }
}
