:root {
  --paper: #f3ebdd;
  --ink: #3d352f;
  --accent: #6f3034;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #e8e0d5;
  color: var(--ink);
  font:
    15px/1.7 'Yu Gothic',
    Meiryo,
    sans-serif;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  cursor: pointer;
}
a {
  color: inherit;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
[hidden] {
  display: none !important;
}
#ch4u-book {
  position: relative;
  max-width: 1120px;
  margin: auto;
  padding: 0 18px;
  background: var(--paper);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 45px #53403015;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}
.brand {
  font:
    32px Georgia,
    serif;
  letter-spacing: 3px;
  text-decoration: none;
  color: var(--accent);
}
sup {
  font-size: 0.55em;
}
button {
  border: 1px solid #b7a48d;
  background: #faf5e9;
  color: var(--accent);
  padding: 10px 16px;
  border-radius: 4px;
  min-height: 44px;
}
#settings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0;
}
.book-area {
  width: 100%;
  max-width: 760px;
  margin: auto;
  perspective: 1100px;
  position: relative;
}
#cover {
  position: relative;
  width: 100%;
  max-width: 350px;
  aspect-ratio: 346 / 612;
  margin: 12px auto 24px;
  perspective: 1100px;
  transform-style: preserve-3d;
}
#cover-hinge {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform-style: preserve-3d;
  color: #f3ebdd;
}
.cover-body,
.cover-still-body {
  position: absolute;
  inset: 0;
  padding: 30px 24px 90px;
  text-align: center;
  background: #71343c;
  border: 1px solid #9c6970;
  backface-visibility: hidden;
  transform: translateZ(1px);
}
.cover-rule {
  position: absolute;
  inset: 12px;
  border: 1px solid #b98a89;
  pointer-events: none;
}
.cherry-seal {
  display: block;
  margin: 16px 0 10px;
  font-size: 24px;
}
.brand-label {
  position: relative;
  padding: 10px;
  background: #fffdf8;
  box-shadow: 0 2px 3px #0003;
  margin-bottom: 22px;
}
.cover-logo {
  display: block;
  width: 100%;
  height: 64px;
}
.cover-exterior {
  position: relative;
  border: 3px solid #a46d65;
  transform-style: preserve-3d;
}
.cover-exterior img {
  display: block;
  width: 100%;
  height: 165px;
  object-fit: cover;
  object-position: 50% 60%;
}
.exterior-relief {
  position: absolute;
  inset: 2px;
  box-shadow: 0 1px 2px #412b2330;
  transform: translateZ(1px);
  pointer-events: none;
}
.round-sign-relief {
  position: absolute;
  left: 60%;
  top: 46%;
  width: 12%;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: 1px 2px 2px #412b2335;
  transform: translateZ(2px);
  pointer-events: none;
}
.cover-copy {
  font-family: 'Yu Mincho', serif;
  font-size: 13px;
  letter-spacing: 2px;
  margin: 20px 0 0;
}
.book-spine {
  position: absolute;
  left: -8px;
  top: 1px;
  bottom: 0;
  width: 10px;
  background: #553139;
  border-radius: 3px 0 0 3px;
}
.page-stack {
  position: absolute;
  inset: 6px -5px -7px 4px;
  background: repeating-linear-gradient(
    90deg,
    #eadcc2 0px,
    #eadcc2 3px,
    #c9b795 4px
  );
  border: 1px solid #c9b795;
}
.page-bottom {
  position: absolute;
  left: 3px;
  right: -5px;
  bottom: -10px;
  height: 9px;
  background: repeating-linear-gradient(
    0deg,
    #dfcfae 0px,
    #dfcfae 1px,
    #f7edda 2px
  );
  transform: skewX(-15deg);
  transform-origin: left top;
}
.binding-shadow {
  position: absolute;
  left: -2px;
  top: 0;
  bottom: 0;
  width: 18px;
  background: linear-gradient(90deg, #34211e60, transparent);
  pointer-events: none;
}
.bookmark-end {
  position: absolute;
  bottom: -22px;
  left: 25px;
  width: 18px;
  height: 32px;
  background: #7b3439;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 77%, 0 100%);
  transform-origin: 50% 0;
}
#cover-menu {
  position: absolute;
  top: 13px;
  right: 14px;
  font-size: 12px;
  padding: 5px 9px;
  min-height: 44px;
}
#open-book {
  position: absolute;
  bottom: 22px;
  left: 12%;
  width: 76%;
  min-height: 48px;
  background: #f2e5c9;
}
#open-book:active {
  transform: translateY(1px);
  transition: transform 90ms;
}
#open-book span {
  float: right;
}
.cover-poster {
  display: none;
  position: absolute;
  inset: 0;
  padding: 78px 24px 90px;
  background: #71343c;
  border: 13px double #9c6970;
  text-align: center;
  backface-visibility: hidden;
  transform: translateZ(2px);
}
.cover-poster img {
  width: 100%;
  height: 165px;
  object-fit: cover;
  object-position: 50% 60%;
  border: 3px solid #a46d65;
}
.poster-brand {
  background: #fffdf8;
  color: #6f3034;
  font:
    36px Georgia,
    serif;
  padding: 12px 0;
  margin: 0 0 22px;
}
h1,
h2 {
  font-family: 'Yu Mincho', Georgia, serif;
  font-weight: 500;
}
h1 {
  font-size: 27px;
  margin: 0;
}
.scene-copy {
  text-align: center;
}
.scene-copy p {
  margin: 5px;
}
.eyebrow {
  letter-spacing: 2px;
  font: 10px Georgia;
  color: #8a7762;
}
.store-stage {
  position: relative;
  margin: 20px auto 16px;
  max-width: 540px;
  border: 7px solid #e5d8c2;
  box-shadow: 1px 3px 7px #49372220;
}
.store-stage > img {
  width: 100%;
  height: min(48dvh, 430px);
  min-height: 260px;
  object-fit: cover;
  display: block;
}
.sign {
  position: absolute;
  background: #fcf5e4;
  box-shadow: 1px 3px 0 #b7a58a;
  padding: 8px 14px;
  min-height: 44px;
  text-decoration: none;
  border: 1px solid #ac9270;
  font-size: 14px;
}
.cakes {
  left: 3%;
  top: 36%;
}
.baked {
  right: 3%;
  bottom: 12%;
}
.cafe {
  right: 3%;
  top: 13%;
}
.custom-sign {
  display: block;
  padding: 12px 16px;
  max-width: 540px;
  margin: auto;
  text-align: center;
  background: #e8dcc6;
  border: 1px solid #cfbca2;
  text-decoration: none;
}
.access-link {
  display: block;
  text-align: center;
  padding: 15px;
}
nav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  border-top: 1px solid #cdbfae;
  padding: 12px 0;
  margin-top: 12px;
}
nav a,
nav button {
  font-size: 12px;
  letter-spacing: 0;
  padding: 9px 1px;
  min-width: 0;
  text-align: center;
  text-decoration: none;
  min-height: 46px;
  background: #fcf6ea;
  border: 1px solid #c9b697;
  border-radius: 2px;
}
nav [aria-current],
nav [aria-expanded='true'] {
  color: #fff;
  background: var(--accent);
}
.preview-note {
  text-align: center;
  font-size: 10px;
  color: #796751;
  margin: 0 0 7px;
}
.paper-sheet {
  position: absolute;
  z-index: 20;
  left: 18px;
  right: 18px;
  bottom: 100px;
  background: #faf2df;
  border: 1px solid #c2ac86;
  box-shadow:
    0 4px 0 #c7b494,
    0 8px 25px #31251933;
  padding: 18px;
  max-height: 65dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.paper-sheet h2 {
  font-size: 21px;
  margin: 0 35px 14px 0;
}
#close-sheet {
  position: absolute;
  right: 8px;
  top: 8px;
  padding: 4px 12px;
  background: transparent;
  border: 0;
  font-size: 24px;
}
.paper-link {
  display: block;
  min-height: 50px;
  border-top: 1px solid #ddd0bb;
  padding: 12px 6px;
  text-decoration: none;
}
.paper-link small {
  display: block;
  color: #796751;
  font-size: 12px;
}
.paper-link span {
  float: right;
}
#chapter {
  padding: 15px 0;
  min-height: 60dvh;
}
#chapter h1 {
  margin: 20px 0;
}
#chapter img {
  max-width: 100%;
  max-height: 45dvh;
  object-fit: cover;
  display: block;
  margin: 15px auto;
}
#chapter p {
  max-width: 650px;
}
.sr-only {
  position: absolute;
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.readable .store-stage {
  border: 0;
}
.readable .store-stage > img {
  display: none;
}
.readable .sign {
  position: static;
  display: block;
  margin: 12px 0;
}
.readable .book-area {
  margin: 0 auto;
}
.readable #cover {
  transform: none !important;
}
@media (min-width: 1024px) and (min-height: 680px) {
  #ch4u-book {
    padding: 0 40px;
  }
  .paper-sheet {
    width: 430px;
    left: auto;
    right: 40px;
  }
  #home {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: center;
  }
  #home .store-stage {
    grid-column: 1;
    grid-row: 1/5;
    width: 100%;
  }
  .scene-copy {
    grid-column: 2;
  }
  .custom-sign,
  .access-link {
    grid-column: 2;
    width: 100%;
  }
  nav {
    max-width: 580px;
    width: 100%;
    align-self: center;
  }
  .store-stage > img {
    height: 460px;
  }
}
@media (max-width: 360px) {
  #ch4u-book {
    padding: 0 10px;
  }
  .sign {
    padding: 8px;
    font-size: 13px;
  }
  #cover {
    padding: 16px 20px 78px;
  }
  .cover-body h1 {
    margin: 15px 0;
  }
  .cover-body img {
    height: 150px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
/* Illustrated paper stage. Transforms belong to hinges, masks to leaf images. */
.store-stage {
  background: #e8dcc5;
  isolation: auto;
  border: 8px solid #e4d6bd;
}
.stage-clip {
  position: relative;
  overflow: clip;
  aspect-ratio: 1087/1446;
}
.room-camera {
  position: absolute;
  inset: 0;
  perspective: 1100px;
  perspective-origin: 50% 43%;
  transform-style: preserve-3d;
}
.part-layout,
.entry-hinge {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  pointer-events: none;
}
.part-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  backface-visibility: hidden;
  pointer-events: none;
}
.part-plane {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.part-front-plane {
  transform: translateZ(0.02px);
}
.part-back-plane {
  transform: rotateY(180deg) translateZ(0.02px);
}
.paper-back-ink {
  filter: brightness(0) saturate(0) invert(0.91) sepia(0.2);
}

.room-poster {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
}
.parts-ready .room-poster {
  visibility: hidden;
}
.cover-back {
  position: absolute;
  inset: -1px;
  background: repeating-linear-gradient(
    0deg,
    #f0e5d1 0px,
    #f0e5d1 5px,
    #ebdfc9 6px
  );
  transform: rotateY(180deg) translateZ(1px);
  backface-visibility: hidden;
}
.opening .book-area {
  min-height: 650px;
}
.opening #cover {
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: max(-175px, calc(-50% + 10px));
  width: min(350px, calc(100% - 20px));
  z-index: 8;
}
.opening #home {
  display: block !important;
}
.opening .store-stage {
  max-width: 350px;
}
#skip-opening {
  position: fixed;
  z-index: 30;
  bottom: 90px;
  right: 20px;
}
.art-debug {
  font-size: 12px;
  border-top: 1px solid #c7b393;
  padding: 8px 0;
  color: #6c5846;
}
.art-debug summary {
  cursor: pointer;
  min-height: 36px;
}
#part-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 8px;
}
#part-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
}
#part-controls input {
  width: 18px;
  height: 18px;
  accent-color: #6f3034;
}
#home {
  padding: 12px 0;
}
.store-stage .cakes {
  top: 58%;
  left: 2%;
}
.store-stage .cafe {
  top: 49%;
  right: 2%;
}
.store-stage .baked {
  bottom: 18%;
  right: 2%;
}
@media (min-width: 1024px) and (min-height: 680px) {
  .store-stage {
    max-width: 420px;
  }
  .book-area {
    max-width: 900px;
  }
  #home {
    grid-template-columns: 1.1fr 1fr;
  }
  .opening #home {
    max-width: 450px;
    margin: auto;
  }
}
@media (max-height: 740px) {
  #ch4u-book {
    min-height: 100dvh;
  }
  .store-stage {
    max-width: 290px;
  }
  .scene-copy h1 {
    font-size: 23px;
  }
  .store-stage {
    margin: 10px auto;
  }
  .access-link {
    padding: 8px;
  }
  #home {
    padding: 2px 0;
  }
  header {
    min-height: 54px;
  }
  #cover {
    padding-top: 20px;
  }
  .cover-body img {
    height: 165px;
  }
  .cover-body h1 {
    margin: 20px 0;
  }
  .preview-note {
    margin-bottom: 4px;
  }
}
@media (max-width: 360px) {
  .store-stage {
    max-width: 290px;
  }
  #part-controls {
    grid-template-columns: 1fr;
  }
}
#ch4u-book {
  padding-bottom: 90px;
}
#ch4u-book > nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 36px);
  max-width: 1040px;
  z-index: 40;
  background: var(--paper);
  margin: 0;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -6px 15px #65503b0d;
}
.paper-sheet {
  position: fixed;
  left: max(18px, calc((100vw - 1120px) / 2 + 40px));
  right: max(18px, calc((100vw - 1120px) / 2 + 40px));
  bottom: 90px;
  max-height: calc(100dvh - 165px);
  z-index: 35;
}
#ch4u-book #skip-opening {
  bottom: 90px;
}
@media (min-width: 1024px) and (min-height: 680px) {
  .paper-sheet {
    left: auto;
    width: 430px;
  }
}
h1:focus {
  outline: none;
}
@media (max-width: 700px) {
  .art-debug {
    margin-bottom: 10px;
  }
}
.opening .sign,
.leaving .sign,
.leaving .custom-sign,
.leaving .access-link,
.opening .custom-sign,
.opening .access-link {
  visibility: hidden;
  pointer-events: none;
}

/* Shared screen-space controls stay outside every 3D hinge. */
.home-page-stack {
  position: absolute;
  left: -3px;
  right: -3px;
  bottom: -12px;
  height: 7px;
  background: repeating-linear-gradient(
    0deg,
    #eee2cf 0px,
    #eee2cf 1px,
    #ccbfa8 2px
  );
  border: 1px solid #d2c2a8;
}
.home-actions-inner {
  display: block;
}
.static-view .room-camera,
.readable .stage-clip {
  display: none;
}
.static-view .room-poster {
  visibility: visible;
}
.static-view .cover-body {
  visibility: hidden;
}
.static-view .cover-poster {
  display: block;
}
.readable .store-stage {
  background: transparent;
  box-shadow: none;
  max-width: none;
}
.readable .home-page-stack {
  display: none;
}
.readable .sign {
  position: static;
  display: block;
  margin: 8px 0;
}
.recovery {
  border: 1px solid #b48c74;
  padding: 12px;
  margin: 12px 0;
  background: #fff9ed;
}
.recovery p {
  margin-top: 0;
}
.recovery button {
  margin: 4px;
}
.chapter-navigation {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 8px;
  flex-wrap: wrap;
}
.chapter-navigation a {
  min-height: 44px;
  padding: 10px 12px;
  text-decoration: none;
  border: 1px solid #c9b697;
}
.chapter-position {
  font-size: 0.8rem;
  color: #6c5846;
}
.debug-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
}
.debug-tools button {
  font-size: 12px;
}
#ch4u-book {
  padding-bottom: calc(var(--nav-height, 80px) + 16px);
}
.paper-sheet,
#ch4u-book #skip-opening {
  bottom: calc(var(--nav-height, 80px) + 12px);
}
.paper-sheet {
  max-height: calc(100dvh - var(--nav-height, 80px) - 42px);
}
nav a,
nav button {
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}
.sign {
  font-size: 0.9rem;
}
@media (min-width: 1024px) and (min-height: 680px) {
  .home-actions,
  .home-actions-inner {
    display: contents;
  }
  #home .store-stage {
    grid-row: 1/5;
  }
  .opening .home-actions,
  .opening .home-actions-inner {
    display: block;
  }
  .readable .home-actions,
  .readable .home-actions-inner {
    display: block;
    grid-column: 1/3;
  }
}
@media (max-width: 360px) {
  .cover-body,
  .cover-still-body {
    padding: 20px 18px 85px;
  }
  .cherry-seal {
    margin-top: 12px;
    font-size: 20px;
  }
  .brand-label {
    margin-bottom: 15px;
  }
  .cover-logo {
    height: 52px;
  }
  .cover-exterior img,
  .cover-poster img {
    height: 140px;
  }
  .cover-copy {
    margin-top: 14px;
    font-size: 12px;
  }
  #cover-menu {
    font-size: 11px;
    right: 10px;
    top: 10px;
  }
}
@media (max-height: 520px) and (min-width: 600px) {
  #home {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: center;
  }
  .home-actions,
  .home-actions-inner {
    display: contents;
  }
  #home .store-stage {
    grid-column: 1;
    grid-row: 1/5;
    width: 210px;
  }
  .scene-copy,
  .custom-sign,
  .access-link {
    grid-column: 2;
  }
}
@media (prefers-reduced-motion: reduce) {
  #ch4u-book:not(.allow-motion) * {
    animation: none !important;
    transition: none !important;
  }
}

#cover-menu,
#open-book {
  z-index: 12;
  transform: translateZ(8px);
}
#open-book:active {
  transform: translateZ(8px) translateY(1px);
}
.opening #cover-menu,
.opening #open-book {
  visibility: hidden;
  pointer-events: none;
}

header {
  flex-wrap: wrap;
  gap: 8px;
}
header button {
  max-width: 100%;
}

.cover-poster {
  padding: 0;
  border: 0;
  background: transparent;
}

.opening .page-stack {
  background: transparent;
  border-width: 0 4px 0 1px;
  box-shadow: inset -2px 0 #c9b795;
}

.part-reaction {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  pointer-events: none;
}
.paper-contact-shadow {
  filter: brightness(0) blur(3px);
  opacity: 0.16;
  transform: translate3d(3px, 3px, -1px);
}
.entry-replay {
  display: inline-block;
  font-size: 0.8rem;
  padding: 8px;
  min-height: 44px;
}
.cake-spread {
  max-width: 650px;
  margin: 24px auto 36px;
  padding: 30px 18px;
  background: #eadbc0;
  perspective: 1100px;
  transform-style: preserve-3d;
  border: 1px solid #c5ae8c;
  box-shadow: 0 5px 0 #ccbb9e;
}
.cake-shelf {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 24px 8px 8px;
  border-bottom: 12px solid #ad8055;
  transform-origin: 50% 100%;
  transform-style: preserve-3d;
  box-shadow: 0 5px 4px #48302030;
}
.cake-standee {
  height: 110px;
  position: relative;
  transform-origin: 50% 100%;
  transform-style: preserve-3d;
}
.cake-cutout {
  position: absolute;
  inset: 0;
  overflow: hidden;
  filter: drop-shadow(2px 3px 2px #48302040);
}
#chapter .cake-cutout img {
  position: absolute;
  max-width: none;
  max-height: none;
  margin: 0;
  object-fit: fill;
}
.static-view .cake-standee,
.readable .cake-standee {
  transform: none !important;
}
@media (max-width: 360px) {
  .cake-standee {
    height: 85px;
  }
  .cake-shelf {
    gap: 6px;
    padding-left: 0;
    padding-right: 0;
  }
  .cake-spread {
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* Open book: permanent paper volume, independent of entrance animation. */
#home {
  --page-light: #fbefdb;
  --page-edge: #c59967;
  position: relative;
  display: block;
  isolation: isolate;
  max-width: 480px;
  margin: 24px auto 42px;
  padding: 30px 14px 24px 24px;
  border: 1px solid #d9b98d;
  border-radius: 38px 9px 36px 12px / 18px 12px 50px 10px;
  background:
    radial-gradient(ellipse at 50% 20%, #fff8e9, transparent 75%),
    linear-gradient(
      90deg,
      #b08b61 0,
      #ead1ad 3%,
      #fff3dd 7%,
      #f7e6c9 97%,
      #dbb887
    );
  box-shadow:
    0 2px 0 #c09767,
    0 5px 0 #f1dab3,
    0 7px 0 #b88c5a,
    0 10px 0 #e8cca1,
    0 12px 0 #a77b4f,
    0 15px 0 #ecd0a7,
    -6px 18px 0 2px #71383b,
    0 24px 20px -8px #46281f65;
}
#home::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  border-radius: inherit;
  box-shadow:
    inset 2px 0 2px #fff9eb,
    inset 12px 0 15px -12px #593421b0,
    inset -2px 0 3px #94633845;
  background: repeating-linear-gradient(
    8deg,
    #9b743206 0 1px,
    transparent 1px 4px
  );
}
.spread-binding {
  position: absolute;
  left: -8px;
  top: 13px;
  bottom: -12px;
  width: 22px;
  z-index: -1;
  border: 1px solid #9e6c41;
  border-radius: 9px 1px 1px 14px;
  background: repeating-linear-gradient(
    90deg,
    #bf925f 0 1px,
    #f4dfb8 2px 3px,
    #e6c79b 4px 5px
  );
  transform: skewY(7deg);
  box-shadow: -6px 3px 0 #763b3e;
}
.spread-ribbon {
  position: absolute;
  bottom: -36px;
  left: 38px;
  width: 23px;
  height: 44px;
  z-index: -1;
  background: linear-gradient(90deg, #6f3034, #ad6060 50%, #733337);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 86%, 0 100%);
}
#home .scene-copy {
  position: relative;
  z-index: 4;
  padding: 0 8px 12px;
  color: #643131;
}
#home .spread-chapter {
  font:
    11px/1.5 Georgia,
    serif;
  letter-spacing: 3px;
  margin: 0 0 10px;
}
#home .spread-chapter::before,
#home .spread-chapter::after {
  content: '—';
  padding: 0 12px;
  color: #aa8158;
}
#home .scene-copy h1 {
  font:
    25px/1.5 'Yu Mincho',
    'Hiragino Mincho ProN',
    serif;
  letter-spacing: 2px;
}
#home .scene-copy > p:last-child {
  font-size: 11px;
  letter-spacing: 1px;
  margin-top: 7px;
}
#home .home-actions,
#home .home-actions-inner {
  display: block;
}
#home .store-stage {
  width: 100%;
  max-width: none;
  margin: 0;
  border: 0;
  background: #b78558;
  box-shadow: inset 0 0 20px #58381f;
}
#home .stage-clip {
  /* Crop only the excess ceiling, preserving the accepted illustration. */
  aspect-ratio: 1087 / 1180;
  border-radius: 48% 48% 4px 4px / 12% 12% 4px 4px;
}
#home .room-camera {
  top: -22.5424%;
  bottom: auto;
  height: 122.5424%;
}
#home .room-poster {
  margin-top: -24.471%;
  top: 0;
}
#home .stage-clip {
  /* A positioned poster must not collapse the frame through its margin. */
  display: flow-root;
}
#home .home-page-stack {
  display: none;
}
.paper-arch,
.paper-foreground {
  position: absolute;
  width: calc(100% + 2px);
  left: -1px;
  pointer-events: none;
  overflow: visible;
  fill: var(--page-light);
  z-index: 2;
  filter: drop-shadow(0 5px 3px #4f301d50);
}
.paper-arch {
  top: -2px;
  height: 22%;
}
.paper-arch-back {
  fill: #e8c99e;
  transform: translateY(7px);
}
.paper-arch-front {
  fill: #fcf0da;
}
.paper-contour {
  fill: none;
  stroke: #c79c68;
  stroke-width: 0.7;
}
.paper-foreground {
  bottom: -2px;
  height: 12%;
  filter: drop-shadow(0 -5px 4px #54321c65);
}
.paper-foreground .foreground-back {
  fill: #dfba89;
}
#home .sign {
  z-index: 3;
  background: linear-gradient(#fff5e1, #f0d8b2);
  border: 1px solid #bd8d5b;
  border-radius: 3px 10px 3px 10px;
  box-shadow:
    inset 0 0 0 3px #fff4df,
    0 3px 0 #af8153,
    0 7px 7px #3b251a45;
  font-family: 'Yu Mincho', serif;
  font-size: 13px;
  padding: 7px 12px;
  color: #542f29;
}
#home .store-stage .cakes {
  top: 46%;
  left: 2%;
}
#home .store-stage .cafe {
  top: 35%;
  right: 2%;
}
#home .store-stage .baked {
  bottom: 18%;
  right: 2%;
}
.home-footer {
  position: relative;
  z-index: 3;
  padding: 8px 12px 0;
  text-align: center;
  color: #613b2a;
}
.spread-kicker {
  font:
    9px/1.7 Georgia,
    serif;
  letter-spacing: 1.5px;
  margin: 4px 0 12px;
}
.spread-story {
  font:
    16px/1.9 'Yu Mincho',
    serif;
  letter-spacing: 1px;
  margin: 0 0 20px;
}
#home .custom-sign {
  padding: 10px 12px;
  background: linear-gradient(110deg, #793439, #633033);
  color: #fff0db;
  border: 3px double #efd1a8;
  border-radius: 25px 8px;
  box-shadow:
    0 2px 0 #af7c52,
    0 5px 7px #70432935;
  font-size: 12px;
  text-wrap: balance;
}
#home .access-link {
  font-size: 12px;
  padding: 14px 6px;
  text-underline-offset: 4px;
}
.spread-page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  margin-top: 8px;
}
.spread-page-nav a {
  padding: 10px 0;
  min-height: 44px;
  text-underline-offset: 4px;
}
.spread-page-nav span {
  font:
    10px Georgia,
    serif;
  color: #916b47;
  white-space: nowrap;
}
.page-curl {
  position: absolute;
  pointer-events: none;
  bottom: -23px;
  right: -13px;
  width: 44px;
  height: 47px;
  border-radius: 85% 0 85% 0;
  background: linear-gradient(
    137deg,
    #b17b4a 0,
    #f8dcac 38%,
    #fff5de 52%,
    #cf9f6b 57%,
    transparent 59%
  );
  filter: drop-shadow(-3px -2px 2px #69442140);
}
@media (min-width: 800px) and (min-height: 540px) {
  #home {
    max-width: 870px;
    display: grid;
    grid-template-columns: 1.12fr 1fr;
    grid-template-rows: auto 1fr;
    gap: 0 32px;
    padding: 30px 30px 28px;
    border-radius: 38px 24px 30px 12px / 16px 20px 22px 10px;
    background: linear-gradient(
      90deg,
      #ead1ad,
      #fff3dd 4%,
      #f7e7cd 48%,
      #d2b58d 52%,
      #a7825c 53%,
      #f0d9b6 54%,
      #fff3dd 58%,
      #f4dfbe 98%,
      #d3ac7c
    );
  }
  #home .home-actions,
  #home .home-actions-inner {
    display: contents;
  }
  #home .scene-copy {
    grid-column: 1;
    grid-row: 1;
  }
  #home .store-stage {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
  }
  #home .home-footer {
    grid-column: 2;
    grid-row: 1 / 3;
    padding: 45px 10px 12px;
    align-self: center;
  }
  #home .spread-story {
    font-size: 22px;
    line-height: 2.1;
    margin: 24px 0 34px;
  }
  #home .spread-kicker {
    font-size: 10px;
  }
  #home .spread-page-nav {
    margin-top: 50px;
  }
  #home .page-curl {
    right: -26px;
    bottom: -35px;
    width: 65px;
    height: 65px;
  }
}
/* Opening keeps the same portrait book behind the turning cover. */
.opening #home {
  max-width: 420px;
}
.opening #home .home-actions,
.opening #home .home-actions-inner {
  display: block;
}
.opening #home .home-footer {
  padding: 8px 12px 0;
}
@media (max-width: 360px) {
  #home {
    padding: 24px 10px 18px 18px;
  }
  #home .scene-copy h1 {
    font-size: 21px;
    letter-spacing: 1px;
  }
  #home .sign {
    font-size: 12px;
    padding: 7px 9px;
  }
  .home-footer {
    padding: 8px 5px 0;
  }
  .spread-story {
    font-size: 14px;
  }
}
.readable #home {
  display: block;
  max-width: 640px;
}
.readable #home .home-actions,
.readable #home .home-actions-inner {
  display: block;
}
.readable #home .store-stage {
  background: none;
  box-shadow: none;
}
.readable .paper-arch,
.readable .paper-foreground {
  display: none;
}
.readable #home .sign {
  position: static;
}
.readable #home .home-footer {
  padding: 12px;
}
.readable #home .stage-clip {
  display: none;
}
/* Portrait composition: a complete illustrated page with one primary action. */
.mobile-home-title,
.mobile-cafe-link,
.paper-sprig {
  display: none;
}
.page-dots {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.page-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d1ac7a;
  box-shadow: inset 0 1px 1px #82502530;
}
.page-dots i.current {
  background: #853c3e;
  width: 7px;
  height: 7px;
}
@media (max-width: 799px) {
  #ch4u-book:has(#home:not([hidden])) {
    background: radial-gradient(ellipse at 30% 20%, #88494a, #4f252a);
    padding-left: 15px;
    padding-right: 12px;
  }
  #ch4u-book:has(#home:not([hidden])) > header {
    min-height: 43px;
  }
  #ch4u-book:has(#home:not([hidden])) > header .brand {
    color: #f2dfba;
    font-size: 21px;
    letter-spacing: 1px;
  }
  #ch4u-book:has(#home:not([hidden])) #settings-toggle {
    font-size: 11px;
    min-height: 36px;
    padding: 4px 9px;
    background: #f6e8ce;
  }
  #ch4u-book:has(#home:not([hidden])) .preview-note,
  #ch4u-book:has(#home:not([hidden])) .art-debug {
    color: #f2dfba;
  }
  #home {
    margin: 6px auto 30px;
    padding: 21px 8px 10px 17px;
    border-radius: 38px 26px 35px 10px / 16px 12px 45px 8px;
  }
  #home .scene-copy {
    padding: 0 12px 9px;
  }
  #home .spread-chapter {
    font-size: 9px;
    letter-spacing: 2px;
    margin-bottom: 7px;
  }
  #home .scene-copy h1 {
    font-size: 27px;
    letter-spacing: 4px;
    line-height: 1.4;
  }
  .desktop-home-title {
    display: none;
  }
  .mobile-home-title {
    display: inline;
  }
  #home .scene-copy > p:last-child {
    display: none;
  }
  #home .store-stage {
    container-type: inline-size;
  }
  #home .stage-clip {
    height: clamp(245px, 40svh, 355px);
    aspect-ratio: auto;
  }
  #home .room-camera {
    width: 100%;
    height: 133.0267cqw;
    top: calc(100% - 133.0267cqw + 18px);
  }
  #home .room-poster {
    position: absolute;
    width: 100%;
    height: auto;
    margin: 0;
    top: calc(100% - 133.0267cqw + 18px);
  }
  #home .paper-arch {
    height: 21%;
  }
  #home .paper-foreground {
    height: 14%;
  }
  #home .sign {
    padding: 3px 8px;
    min-height: 44px;
    display: flex;
    align-items: center;
    font-size: 11px;
    background: #fcebd2eb;
    border-radius: 8px 2px;
    box-shadow:
      inset 0 0 0 2px #fff4df,
      0 2px 0 #af8153,
      0 3px 4px #3b251a35;
  }
  #home .store-stage .cakes {
    top: 50%;
  }
  #home .store-stage .cafe {
    top: 33%;
  }
  #home .store-stage .baked {
    bottom: 17%;
  }
  #home .home-footer {
    padding: 3px 13px 0;
  }
  #home .spread-kicker {
    display: none;
  }
  #home .spread-story {
    font-size: 13px;
    line-height: 1.85;
    letter-spacing: 0.7px;
    margin: 5px 0 12px;
  }
  #home .custom-sign,
  #home .access-link {
    display: none;
  }
  #home .mobile-cafe-link {
    display: block;
    min-height: 46px;
    padding: 8px 18px;
    width: 83%;
    margin: auto;
    font:
      16px/1.6 'Yu Mincho',
      serif;
    letter-spacing: 2px;
    text-decoration: none;
    color: #fff0db;
    border: 3px double #efcfa0;
    border-radius: 24px 8px;
    background: linear-gradient(110deg, #84383c, #642b30);
    box-shadow:
      0 2px 0 #a9754e,
      0 5px 6px #70432940;
  }
  #home .mobile-cafe-link span {
    padding-left: 12px;
    font-size: 20px;
    line-height: 1;
  }
  #home .spread-page-nav {
    margin-top: 5px;
    font-size: 10px;
  }
  #home .page-curl {
    width: 47px;
    height: 47px;
    right: -20px;
    bottom: -10px;
    z-index: -1;
  }
  .paper-sprig {
    display: block;
    position: absolute;
    pointer-events: none;
    width: 68px;
    height: 64px;
    filter: drop-shadow(1px 3px 2px #56341f50);
  }
  .paper-sprig svg {
    display: block;
    width: 100%;
    height: 100%;
  }
  .sprig-top {
    right: -3px;
    top: -9px;
    z-index: 5;
    transform: rotate(-8deg);
  }
  .sprig-bottom {
    left: -23px;
    top: -39px;
    z-index: 4;
    transform: rotate(79deg) scale(0.8);
  }
  .readable #home .sign {
    display: block;
  }
  .readable #home .paper-sprig {
    display: none;
  }
  .readable #home .custom-sign,
  .readable #home .access-link {
    display: block;
  }
}
@media (max-width: 360px) {
  #home .scene-copy h1 {
    font-size: 24px;
  }
  #home .spread-story {
    font-size: 12px;
  }
  #home .mobile-cafe-link {
    font-size: 14px;
    width: 91%;
  }
  .sprig-top {
    width: 58px;
  }
}
