:root {
  color: #252722;
  background: #d8d2c7;
  font-family: ui-serif, "Songti SC", "STSong", Georgia, serif;
  font-synthesis: none;
  --page-width: 384;
  --page-height: 640;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 12%, rgb(255 255 255 / 52%), transparent 33rem),
    linear-gradient(145deg, #e0dbd2 0%, #c5beb2 100%);
}

button {
  color: inherit;
  font: inherit;
}

.room {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 100dvh;
  padding: 22px clamp(14px, 3vw, 44px) 18px;
}

.book-header,
.controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  width: min(100%, 1180px);
  margin: 0 auto;
}

.book-header {
  grid-template-columns: 1fr 1fr;
}

.book-header span {
  color: #5f5d55;
  font: 600 10px/1.2 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.16em;
}

.book-header span:last-child {
  text-align: right;
}

.stage {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
  padding: 18px 0;
  perspective: 1800px;
}

.stage::after {
  position: absolute;
  bottom: 7%;
  left: 50%;
  z-index: -1;
  width: min(82vw, 1000px);
  height: 10%;
  border-radius: 50%;
  background: rgb(35 31 25 / 28%);
  content: "";
  filter: blur(28px);
  transform: translateX(-50%);
}

.book-rig {
  display: grid;
  width: min(100%, 980px);
  height: min(69dvh, 640px);
  place-items: center;
}

.book {
  position: relative;
  isolation: isolate;
  filter: drop-shadow(0 24px 28px rgb(31 28 22 / 24%));
}

.book-page {
  position: relative;
  overflow: hidden;
  background: #c9c2b6;
}

.book-page > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-page.--left::before,
.book-page.--right::before {
  position: absolute;
  inset-block: 0;
  z-index: 3;
  width: clamp(14px, 4%, 28px);
  content: "";
  pointer-events: none;
}

.book-page.--left::before {
  right: 0;
  background: linear-gradient(to left, rgb(24 22 19 / 25%), rgb(24 22 19 / 7%) 44%, transparent);
}

.book-page.--right::before {
  left: 0;
  background: linear-gradient(to right, rgb(24 22 19 / 25%), rgb(24 22 19 / 7%) 44%, transparent);
}

.controls {
  grid-template-columns: 48px 1fr 48px;
  max-width: 440px;
}

.controls button {
  width: 48px;
  height: 42px;
  border: 1px solid rgb(38 37 31 / 24%);
  border-radius: 50%;
  background: rgb(244 241 234 / 48%);
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.controls button:not(:disabled):hover {
  background: rgb(255 253 248 / 78%);
  transform: translateY(-1px);
}

.controls button:disabled {
  cursor: default;
  opacity: 0.28;
}

.status {
  display: grid;
  gap: 4px;
  text-align: center;
}

.status span {
  font: 600 11px ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.12em;
}

.status small {
  color: #655f55;
  font: 10px ui-sans-serif, system-ui, sans-serif;
}

@media (max-width: 700px) {
  .room {
    padding-inline: 10px;
  }

  .book-header {
    grid-template-columns: 1fr;
  }

  .book-header span:first-child {
    display: none;
  }

  .book-rig {
    height: min(66dvh, 640px);
  }
}

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

@media print {
  body {
    overflow: visible;
    background: white;
  }

  .book-header,
  .controls {
    display: none;
  }
}
