body {
  --room-image-depth: calc(36% + var(--safe-top, 0px) * .67);
  --room-table-edge: calc(34.6% + var(--safe-top, 0px) * .654 - var(--safe-bottom, 0px) * .346);
}
.afternoon-album {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  height: var(--app-height, 100vh);
  overflow: hidden;
  color: #51372a;
  background: #c3976b;
  -webkit-user-select: none;
  user-select: none;
}
.afternoon-album::before,
.afternoon-album::after {
  position: absolute;
  right: 0;
  left: 0;
  content: "";
  pointer-events: none;
}
.afternoon-album::before {
  top: 0;
  height: var(--room-image-depth);
  background: url("./assets/afternoon-room.webp") 0 0 / 100% 100% no-repeat;
}
.afternoon-album::after {
  top: var(--room-table-edge);
  bottom: 0;
  background: radial-gradient(ellipse at 12% 5%, rgba(255, 235, 192, .24), transparent 70%),
    linear-gradient(155deg, transparent 25%, rgba(77, 45, 31, .28)),
    url("./assets/afternoon-wood.webp") center / 110% auto repeat;
}
.album-center {
  position: absolute;
  z-index: 1;
  top: calc(52px + var(--safe-top, 0px));
  right: var(--safe-right, 0px);
  bottom: calc(16px + var(--safe-bottom, 0px));
  left: var(--safe-left, 0px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.afternoon-album button { touch-action: manipulation; }
.afternoon-album button:focus { outline: 3px solid #fff1c2; outline-offset: 4px; }
.afternoon-album button:focus:not(:focus-visible) { outline: none; }
.afternoon-album button:focus-visible { outline: 3px solid #fff1c2; outline-offset: 4px; }

.album-crate {
  position: relative;
  width: 78vw;
  max-width: 454px;
  height: 54vw;
  max-height: 314px;
  perspective: 510px;
  transform: rotate(-6deg) translateY(4vh);
}
.album-crate-front, .album-crate-lining, .album-lid {
  position: absolute;
  border-radius: 11px;
}
.album-crate-front {
  right: 1px;
  bottom: 0;
  left: 1px;
  height: 34%;
  border: 1px solid #603823;
  box-shadow: 8px 12px 18px rgba(72, 41, 28, .37), inset 0 1px rgba(254, 211, 142, .28);
  background: linear-gradient(180deg, rgba(116, 70, 44, .19), rgba(100, 57, 39, .48)),
    url("./assets/afternoon-wood.webp") center 45% / 120% auto repeat #845233;
}
.album-crate-lining {
  top: 10%;
  right: 0;
  bottom: 12%;
  left: 0;
  border: 8px solid #9e6b43;
  background: #59352a;
  box-shadow: inset 0 2px 16px #362216;
  transform: rotateX(25deg);
}
.album-lid {
  top: 0;
  right: 1px;
  bottom: 15%;
  left: 1px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #896048;
  cursor: pointer;
  color: #342015;
  background: linear-gradient(155deg, rgba(255, 232, 189, .35) 15%, transparent 58%, rgba(105, 52, 32, .17)),
    url("./assets/afternoon-wood.webp") center / 104% auto repeat #bd875c;
  box-shadow: inset 0 0 0 6px rgba(244, 209, 162, .24),
    inset 0 0 0 7px rgba(91, 56, 34, .31), 0 5px 0 #6b442d, 0 7px 0 #a9774b, 0 9px 0 #5a3626;
  transform: rotateX(28deg);
  -webkit-tap-highlight-color: transparent;
}
.album-lid:active { transform: rotateX(26deg) translateY(2px); }
.album-lid-inscription {
  display: none;
  width: 80%;
  height: auto;
  filter: drop-shadow(1px 3px 2px rgba(55, 31, 17, .43));
  transform: rotate(-4deg);
}
.album-lid[data-note-ready="true"] .album-lid-inscription { display: block; }
.album-lid[data-note-ready="true"] .album-lid-fallback { display: none; }
.album-lid-fallback {
  display: block;
  padding: 10px 14px;
  background: linear-gradient(139deg, #f1dfb2 5%, #eddaa7 48%, #d5b982);
  border: 1px solid #ae8f5d;
  color: #523122;
  font: 600 21px/1.5 "STKaiti", "KaiTi", "Kaiti SC", serif;
  letter-spacing: .09em;
  box-shadow: 1px 3px 4px rgba(55, 31, 17, .36);
  transform: rotate(-4deg);
}
.album-lid-latch {
  position: absolute;
  right: calc(50% - 19px);
  bottom: -17px;
  width: 38px;
  height: 24px;
  border: 1px solid #533720;
  border-radius: 2px 2px 7px 7px;
  background: radial-gradient(circle at 50% 55%, #5b472b 0, #5b472b 1px, transparent 2px),
    linear-gradient(140deg, #cfad6f, #956336 64%, #b4854f);
  box-shadow: 0 2px 3px rgba(38, 23, 14, .65), inset 0 1px #e8ce91;
}

.album-book {
  --album-width: 86vw;
  position: relative;
  width: var(--album-width);
  max-width: 438px;
  transform: translateY(-1vh);
}
.album-paper {
  position: relative;
  margin: 0;
  padding: 4.3% 4.3% 6%;
  border: 1px solid #b39c79;
  border-radius: 2px 7px 5px 3px;
  background: linear-gradient(112deg, #dbc49c 0, #f2e5cb 3%, #f8ecd4 48%, #ebd7b2 100%);
  box-shadow: 0 1px 0 #dfc6a1, 2px 3px 0 #bfaa85, 3px 5px 0 #d2b48d,
    4px 7px 0 #a17350, 5px 9px 0 #855b40, 7px 13px 20px rgba(75, 47, 31, .35);
}
.album-paper::before,
.album-paper::after {
  position: absolute;
  z-index: 1;
  width: 23px;
  height: 23px;
  content: "";
  background: linear-gradient(133deg, #86623c 18%, #b59263 46%, rgba(255, 235, 194, .72) 50%, transparent 52%);
  pointer-events: none;
}
.album-paper::before { top: 3.5%; left: 3.7%; }
.album-paper::after { right: 3.6%; bottom: 4.9%; transform: rotate(180deg); }
.album-photo {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(125, 96, 56, .31);
  background: #dcca9d;
  color: #59392a;
}
.album-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 15px;
}
.album-page-turn, .album-close {
  min-width: 48px;
  min-height: 45px;
  border: 1px solid #ac926d;
  border-radius: 30px;
  padding: 5px 15px;
  background: #f3e4c8;
  color: #503629;
  box-shadow: 0 3px 8px rgba(43, 27, 18, .33);
  font: 600 14px/1 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  cursor: pointer;
}
.album-page-turn:active, .album-close:active {
  background: #d9c39e;
  box-shadow: 0 1px 3px rgba(43, 27, 18, .34);
}
.album-page-turn:disabled { visibility: hidden; }
.album-page-turn i {
  display: block;
  width: 9px;
  height: 9px;
  margin: auto;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}
.album-prev i { transform: rotate(-135deg); }
.album-position {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(50, 32, 24, .78);
  color: #f3e4c8;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}
.album-actions .album-close:not([hidden]) { margin-left: 5px; }
.album-actions .album-next:not([hidden]) { margin-left: auto; }
.album-next:not([hidden]) + .album-close:not([hidden]) {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
}
.album-live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (max-height: 615px) {
  .album-book { --album-width: 78vw; max-width: 55vh; }
  .album-crate { max-width: 64vh; max-height: 45vh; }
}
@media (prefers-reduced-motion: no-preference) {
  .album-lid { transition: transform 160ms ease; }
  .album-book { animation: album-arrive 190ms ease-out both; }
  @keyframes album-arrive {
    from { opacity: 0; transform: translateY(2vh) rotate(-2deg); }
    to { opacity: 1; transform: translateY(-1vh); }
  }
}
