@charset "UTF-8";

:root {
  color-scheme: light;
  font-family: "Kaiti SC", KaiTi, "Songti SC", "Noto Serif CJK SC", "Noto Serif SC", serif;
  --ink: #34352c;
  --base: #f7edd9;
  --accent: #78563a;
  --wood: #b5a080;
  --flower: #b96d54;
  --quiet: #6c614e;
  --page-paper: #f7edd9;
  --fast: 230ms;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  color: var(--ink);
  background: #e1d7bf radial-gradient(ellipse at 50% 20%, #faf0db, #d7c9ad);
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}
p, figure, h1, ul { margin: 0; }
button { color: inherit; font: inherit; cursor: pointer; }
button:focus-visible, #page-title:focus-visible { outline: 2px solid #68462f; outline-offset: 3px; }
.book {
  width: min(100%, 514px);
  overflow: hidden;
  margin-inline: auto;
  background: var(--page-paper);
  min-height: 100vh;
  min-height: 100svh;
  box-shadow: 0 0 54px #513e2428;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  touch-action: pan-y pinch-zoom;
}
.book[data-paper="cool"] { --page-paper: #eef0ed; --accent: #506178; }
.book[data-paper="green"] { --page-paper: #f4f0da; --accent: #516642; }
.book[data-paper="evening"] { --page-paper: #f9efda; --accent: #846044; }
.page {
  display: grid;
  grid-template-rows: auto minmax(155px, 1fr) auto;
  min-width: 0;
  min-height: 0;
  position: relative;
  text-align: center;
}
@media (min-height: 590px) {
  .book { height: 100vh; height: 100svh; }
}
.page-heading { position: relative; z-index: 2; padding: max(14px, env(safe-area-inset-top, 0px)) 16px 6px; }
.timestamp {
  font-family: system-ui, sans-serif;
  color: var(--accent);
  font-weight: 650;
  letter-spacing: .09em;
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 5px;
}
h1 { font-weight: 700; font-size: clamp(27px, 7.2vw, 37px); line-height: 1.16; letter-spacing: .045em; text-wrap: balance; }
.page-heading h1 + p, .page-heading h1 + div { margin-top: 8px; }
.page-heading p:not(.timestamp), .ending p { line-height: 1.34; font-size: clamp(16px, 4.1vw, 19px); }
.page-heading p + p, .ending p + p { margin-top: 3px; }
.deck { color: var(--quiet); }
.art { position: relative; isolation: isolate; min-height: 0; overflow: hidden; }
.scene { position: absolute; inset: 0; }
.painting {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 58%;
  user-select: none;
  -webkit-user-drag: none;
}
.art .scene {
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 9%, black 92%, transparent);
  mask-image: linear-gradient(to bottom, transparent, black 9%, black 92%, transparent);
}
.page-01 .art { margin-top: -2px; -webkit-mask-image: linear-gradient(#0000, #000 6%, #000 91%, #0000); mask-image: linear-gradient(#0000, #000 6%, #000 91%, #0000); }
.page-01 h1 { font-size: clamp(38px, 11.2vw, 59px); line-height: 1.02; letter-spacing: .04em; color: #354735; }
.page-01 .page-heading { padding: max(23px, env(safe-area-inset-top, 0px)) 12px 1px; }
.page-01 .deck { margin-top: 12px; }
.page-01 .painting { object-position: center 57%; }
.ending { z-index: 2; padding: 5px 14px 6px; }
.ending .accent { color: var(--accent); }
.ending .key-line { font-weight: 700; font-size: clamp(27px, 7.3vw, 37px); letter-spacing: .06em; margin: 3px 0; }
.ending .final-line { font-size: clamp(22px, 6.3vw, 34px); color: #635039; letter-spacing: .015em; }
.controls {
  padding: 1px max(14px, env(safe-area-inset-right, 0px)) 7px max(14px, env(safe-area-inset-left, 0px));
  min-height: 53px;
  display: grid;
  align-items: center;
  grid-template-columns: minmax(44px, auto) 1fr minmax(44px, auto);
  gap: 6px;
}
.controls.on-cover { display: flex; justify-content: center; padding: 5px 14px 12px; }
.turn {
  min-width: 45px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid #83714d66;
  background: #fff9e9bb;
  font-family: system-ui, sans-serif;
  font-size: 26px;
  line-height: 1;
  padding: 0 9px;
  transition: background var(--fast), color var(--fast);
}
.turn:active { background: #deca9e; }
.turn.start { font-family: inherit; font-size: 20px; font-weight: 750; padding-inline: 25px; background: #4d6045; color: #fff8e7; }
.turn.reread { font-family: inherit; font-weight: 700; font-size: 17px; padding-inline: 12px; }
.progress { display: flex; justify-content: center; align-items: center; gap: 7px; min-width: 0; }
.step { width: 5px; height: 7px; border-radius: 55% 48% 52% 47%; transform: rotate(17deg); background: #918068; opacity: .51; }
.step.seen { background: #76684d; opacity: .76; }
.step.current { width: 10px; height: 10px; border-radius: 40% 54% 45% 50%; background: #a85d40; opacity: 1; }
.chat { max-width: 395px; margin-inline: auto; display: grid; justify-items: start; gap: 4px; }
.chat.follow { gap: 3px; }
.voice {
  width: fit-content;
  max-width: 100%;
  padding: 4px 9px;
  border-radius: 10px 10px 10px 3px;
  background: #e2e5e1;
  color: #343a38;
  text-align: start;
}
.voice.self { justify-self: end; border-radius: 10px 10px 3px 10px; background: #e0e7ee; color: #303b48; }
.voice small { display: inline-block; margin-right: .45em; color: #4e5e69; font: 600 11px system-ui, sans-serif; vertical-align: 1px; }
.page-02 .voice { margin-inline: auto; }
.page-02 .ping { animation: ping 540ms ease-out; }
.page-03 .painting { object-position: center 65%; }
.paper-sign {
  position: absolute;
  left: var(--sign-x, 82%);
  top: var(--sign-y, 68%);
  color: #523c25;
  font-size: var(--sign-font, 11px);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transform: translate(-50%, -50%) rotate(14deg);
  pointer-events: none;
}
.page-05 .voice { background: #eee4d2; }
.page-05 .voice.self { background: #e7e8dc; }
.page-05 .painting { object-fit: contain; }
.depart-times { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 2px 13px; }
.depart-times p { font-size: clamp(14px, 3.8vw, 17px); }
.depart-times p + p { margin-top: 0; }
.depart-times time { color: #815336; font: 700 11px system-ui, sans-serif; }
.inventory { margin: 4px 0 1px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 3px 10px; list-style: none; color: #615547; font-size: 12px; }
.page-07 .painting { object-position: center 51%; }
.page-08 .painting { object-position: center 56%; }
.page-09 .art { min-height: 180px; }
.page-09 .painting { object-position: center 66%; }
.page-09 .file-meta { font-size: 13px; color: var(--accent); }
.file-target { padding: 2px 0 1px; }
.record { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 9px; padding: 1px 0 5px; list-style: none; text-align: start; margin: auto; width: fit-content; font-size: clamp(13px, 3.6vw, 17px); }
.record li::before { content: "✓"; color: #576d4a; font-family: system-ui, sans-serif; font-size: .91em; margin-right: .34em; }
.ending .file-status { font-size: 15px; color: #58654a; }
.spot {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  min-width: 46px;
  min-height: 46px;
  border: 1px solid #70593d50;
  border-radius: 999px;
  padding: 2px 14px;
  background: #fff4dbea;
  color: #4b422f;
  transition: background var(--fast);
}
.spot:active { background: #e8d1a3; }
.seastar { right: 6%; bottom: 9%; width: clamp(53px, 14vw, 72px); aspect-ratio: 1; padding: 0; border: 0; background: none; filter: drop-shadow(0 3px 1px #4b421546); }
.seastar img { display: block; width: 100%; height: auto; }
.seastar:active { background: none; filter: drop-shadow(0 3px 1px #4b421580) brightness(1.08); }
.route-toggle { left: 5%; bottom: 10%; }
.route-plate { position: absolute; z-index: 4; left: 5%; bottom: calc(10% + 52px); width: min(180px, 60%); background: #fcf1db; border-radius: 13px; border: 1px solid #735d3a66; box-shadow: 0 3px 16px #382a1c29; padding: 4px; font-size: 13px; }
.route-plate img { display: block; width: 100%; height: auto; }
.route-plate figcaption { padding: 2px 0 6px; color: #5b5743; }
.closed-frame, .sunwash { position: absolute; inset: 0; pointer-events: none; }
.closed-frame { opacity: calc(1 - var(--reveal, 0)); }
.sunwash { opacity: var(--sun-tint, 0); object-fit: cover; width: 100%; height: 100%; mix-blend-mode: screen; }
.curtain-motion {
  position: absolute;
  top: 0;
  right: 0;
  width: 29%;
  height: 100%;
  pointer-events: none;
  opacity: var(--fold-opacity, 0);
  transform: translateX(var(--fold-slide, 0%));
  background: url(assets/fabric.webp) right center/cover no-repeat;
  -webkit-mask-image: linear-gradient(to right, transparent, black 19%);
  mask-image: linear-gradient(to right, transparent, black 19%);
}
.curtain-toggle { right: 8%; bottom: 9%; touch-action: pan-y; }
.on-reveal { visibility: hidden; opacity: 0; transition: opacity 500ms ease-out; }
.opened .on-reveal { visibility: visible; opacity: 1; }
.page.arrive { animation: turn-in 360ms cubic-bezier(.22,.61,.36,1) both; }
.page.arrive.backward { --turn-from: -9px; }
.stagger { animation: appear 440ms ease-out both; animation-delay: var(--beat, 0ms); }
.script-note { padding: 12px; text-align: center; }
@keyframes turn-in { from { opacity: .25; transform: translateX(var(--turn-from, 9px)); } }
@keyframes appear { from { opacity: 0; transform: translateY(5px); } }
@keyframes ping { 35% { transform: rotate(-1deg); } 60% { transform: rotate(1deg); } }
@media (max-width: 359px), (max-height: 680px) {
  .page-heading { padding-top: max(8px, env(safe-area-inset-top, 0px)); }
  h1 { font-size: 25px; }
  .page-01 h1 { font-size: clamp(34px, 10vw, 48px); }
  .page-heading p:not(.timestamp), .ending p { font-size: 15px; }
  .ending .key-line { font-size: 26px; }
  .ending .final-line { font-size: clamp(19px, 6vw, 25px); }
  .page-09 .file-meta { font-size: 12px; }
  .page-09 .file-status { font-size: 13px; }
  .controls { min-height: 48px; padding-bottom: 3px; }
}
@media (max-height: 560px) {
  .page { grid-template-rows: auto minmax(285px, 1fr) auto; }
  .page-01 .page-heading { padding-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
