:root {
  --paper: #fff;
  --ink: #737373;
  --cursor-ink: #edb6c5;
  --english: "Baskerville", "Times New Roman", "Noto Serif", serif;
  --chinese: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
}
* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); transition: background-color 200ms ease, color 200ms ease; }
body { margin: 0; min-height: 100svh; }
[hidden] { display: none !important; }
#content-root { padding: 24px 0 90px; }
.story-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  padding: 0 28px;
  color: inherit;
}
.story-header h2 {
  margin: 0;
  font-family: var(--chinese);
  font-weight: 400;
  font-size: clamp(19px, 1.65vw, 32px);
  line-height: 1.55;
}
.story-header p, .story-header .story-track {
  margin: 0;
  font-family: var(--english);
  font-size: clamp(21px, 1.9vw, 36px);
  line-height: 1.4;
  white-space: nowrap;
}
.story-header .story-track {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: right;
  cursor: pointer;
}
.story-header .story-track:disabled { color: inherit; opacity: 1; cursor: default; }
.story-header .story-track:focus-visible { outline: 1px solid currentColor; outline-offset: 5px; }
.story-stage {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  min-height: calc(100svh - 160px);
  padding: 56px 0;
}
.story-image-link {
  position: absolute;
  z-index: 0;
  pointer-events: auto;
  --photo-ratio: 0.5623;
  --photo-width: min(40vw, calc(58svh * var(--photo-ratio)));
  width: var(--photo-width);
  height: calc(var(--photo-width) / var(--photo-ratio));
  top: calc(16px + (100% - var(--photo-width) / var(--photo-ratio) - 32px) * var(--photo-y, 0.15));
  left: calc(16px + (100% - var(--photo-width) - 32px) * var(--photo-x, 0.1));
  aspect-ratio: var(--image-ratio, 1904 / 3386);
  display: block;
}
.story-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}
.story-image-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 5px; }
.story-image-link[href] { cursor: grab; touch-action: none; }
.story-image-link.is-dragging { cursor: grabbing; z-index: 2; }
.story-track { font-family: var(--chinese) !important; }

.story-comment {
  position: relative;
  z-index: 1;
  margin: 0 auto;
  width: 92%;
  max-width: 1900px;
  font-family: var(--chinese);
  font-size: clamp(23px, 2.2vw, 44px);
  font-weight: 400;
  line-height: 1.65;
  text-align: center;
  overflow-wrap: anywhere;
  white-space: pre-line;
  pointer-events: none;
}
.story-comment strong { font-weight: 700; }
.short-story .story-comment { font-size: clamp(28px, 3.5vw, 64px); line-height: 1.5; }
.story-image-link:not([href]) { cursor: pointer; }
@media (max-width: 700px) {
  #content-root { padding-top: 20px; }
  .story-header { padding-inline: 18px; gap: 18px; }
  .story-header h2 { max-width: 65%; font-size: 17px; }
  .story-header p, .story-header .story-track { max-width: 35%; font-size: 20px; white-space: normal; text-align: right; }
  .story-stage { padding: 44px 0; min-height: calc(100svh - 190px); }
  .story-comment { width: calc(100% - 36px); font-size: 23px; line-height: 1.7; }
  .short-story .story-comment { font-size: 28px; line-height: 1.6; }
  .story-image-link {
    position: fixed;
    --photo-width: min(65vw, calc(55svh * var(--photo-ratio)));
    left: calc(12px + (100vw - var(--photo-width) - 24px) * var(--photo-x, 0.1));
    top: calc(110px + max(0px, (100svh - 200px - var(--photo-width) / var(--photo-ratio))) * var(--photo-y, 0.15));
  }
}
.bottom-nav {
  position: fixed;
  z-index: 5;
  background: var(--paper);
  transition: background-color 200ms ease;
  inset: auto 0 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px max(20px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  font-family: var(--english);
  font-size: clamp(18px, 2.05vw, 40px);
  line-height: 1.2;
}
.bottom-nav button, #about button, #track-info button {
  appearance: none;
  border: 0;
  padding: 4px 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.bottom-nav button { min-height: 44px; }
#color { justify-self: start; }
#info { justify-self: end; }
.nav-title { text-align: center; white-space: nowrap; }
button:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#about, #track-info { width: min(480px, calc(100% - 40px)); border: 1px solid currentColor; padding: 32px; background: var(--paper); color: var(--ink); font-family: var(--english); text-align: center; }
#about h2, #track-info h2 { font-weight: 400; }
#about p { line-height: 1.8; }
#about::backdrop, #track-info::backdrop { background: rgb(0 0 0 / 12%); }
@media (max-width: 400px) { .bottom-nav { padding-inline: 12px; font-size: 16px; } }
@media (prefers-reduced-motion: reduce) { html { transition: none; } }
.story-transition {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--transition-paper, #000);
  color: var(--transition-ink, #d6c5c9);
  opacity: 1;
  transition: opacity 220ms ease, background-color 220ms ease, color 220ms ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.story-transition.is-leaving { opacity: 0; }
.transition-hearts {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 5vw, 76px);
  font-family: var(--english);
  font-size: clamp(58px, 8vw, 116px);
  font-weight: 400;
  line-height: 1;
}
.transition-heart {
  display: block;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 300ms ease, transform 300ms ease;
  color: var(--transition-ink, #e6cbd2);
}
.transition-heart.is-visible { opacity: 1; transform: translateY(0); }
.transition-click-heart {
  position: absolute;
  color: var(--transition-ink, #a9a1a4);
  filter: saturate(.32);
  opacity: .78;
  font: 400 clamp(30px, 4vw, 54px)/1 var(--english);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: click-heart-fade 1200ms ease-out forwards;
}
@keyframes click-heart-fade {
  0% { opacity: .78; transform: translate(-50%, -50%) scale(.86); }
  35% { opacity: .68; transform: translate(-50%, calc(-50% - 12px)) scale(1); }
  100% { opacity: 0; transform: translate(-50%, calc(-50% - 30px)) scale(1.05); }
}
@media (prefers-reduced-motion: reduce) {
  .story-transition, .transition-heart { transition: none; }
  .transition-click-heart { animation: none; opacity: .68; }
}
@media (hover: hover) and (pointer: fine) {
  html.cursor-active.transition-active,
  html.cursor-active.transition-active *,
  html.cursor-active.transition-active *::before,
  html.cursor-active.transition-active *::after { cursor: pointer !important; }
  html.transition-active #feeling-cursor { display: none !important; }
}
#welcome {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  padding: max(32px, calc(47svh - clamp(21px, 3vw, 62px))) 24px 48px;
}
.intro { text-align: center; margin-inline: auto; width: 100%; }
h1 {
  margin: 0;
  font-family: var(--english);
  font-size: clamp(36px, 5.25vw, 108px);
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: 0.025em;
}
.subtitle {
  margin: 4px 0 0;
  font-family: var(--english);
  font-size: clamp(17px, 1.35vw, 28px);
  font-weight: 400;
  line-height: 1.25;
}
.instructions {
  margin: clamp(27px, 2vw, 42px) auto 0;
  max-width: 800px;
  font-family: var(--english);
  font-size: clamp(16px, 1.3vw, 27px);
  line-height: 1.48;
}
.instructions p { margin: 0; text-wrap: pretty; }
#enter {
  display: inline-block;
  padding: 0 4px;
  margin: 1px 0 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  border-radius: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#enter:focus-visible { outline: 1px solid currentColor; outline-offset: 6px; }
#feeling-cursor {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  pointer-events: none;
  user-select: none;
  font-family: var(--english);
  font-size: clamp(24px, 2vw, 38px);
  color: var(--ink);
  transition: color 200ms ease;
  line-height: 1.2;
  white-space: nowrap;
}
#love-trail {
  position: fixed;
  inset: 0;
  z-index: 9;
  overflow: hidden;
  pointer-events: none;
}
.love-trail-word {
  position: absolute;
  font-family: var(--english);
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  transform: translate(-50%, -50%);
  animation: love-trail-fade 1.8s ease-out forwards;
}
@keyframes love-trail-fade {
  0% { opacity: 0.68; transform: translate(-50%, -50%) translateY(0) rotate(var(--love-rotation)); }
  100% { opacity: 0; transform: translate(-50%, -50%) translateY(-20px) rotate(var(--love-rotation)); }
}
@media (hover: hover) and (pointer: fine) {
  /* A transparent native cursor also handles webviews that retain the arrow for `none`. */
  html.cursor-active,
  html.cursor-active *,
  html.cursor-active *::before,
  html.cursor-active *::after {
    cursor: url("./transparent-cursor.png") 0 0, none !important;
  }
  html.cursor-active #feeling-cursor { display: block; }
}
@media (max-width: 600px) {
  #welcome { padding-inline: 20px; }
  h1 { font-size: clamp(30px, 8.4vw, 50px); letter-spacing: 0.025em; }
  .instructions { max-width: 350px; }
}

.nav-left { display: flex; align-items: center; gap: 12px; justify-self: start; }
@media (max-width: 400px) { .nav-left { gap: 4px; } .bottom-nav { gap: 4px; } }

.story-track.english-track { font-family: var(--english) !important; }

.two-photos .story-image-link { --photo-width: min(34vw, calc(36svh * var(--photo-ratio))); }
@media (max-width: 700px) { .two-photos .story-image-link { --photo-width: min(62vw, calc(30svh * var(--photo-ratio))); } }
