:root {
  --paper: #f2ecdf;
  --ink: #342f29;
  --muted: #81786d;
  --red: #e60012;
  --warm: #d3a24d;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); font-family: "Yu Mincho", "游明朝", "Hiragino Mincho ProN", Georgia, serif; letter-spacing: 0; }
button { font: inherit; }
main { overflow: hidden; }
.act { position: relative; min-height: 100svh; padding: clamp(52px, 8vw, 112px) clamp(18px, 5vw, 72px); }
.act + .act { border-top: 1px solid rgba(52, 47, 41, .09); }
.act-label { width: min(1120px, 100%); margin: 0 auto 24px; display: flex; align-items: baseline; gap: 18px; color: var(--muted); font-size: 12px; }
.act-label strong { color: var(--ink); font-size: 17px; font-weight: 400; }
.title-mark { position: absolute; z-index: 4; left: clamp(20px, 5vw, 76px); top: clamp(116px, 15vw, 200px); writing-mode: vertical-rl; }
.title-mark h1 { margin: 0; font-size: clamp(28px, 3.4vw, 50px); font-weight: 400; line-height: 1.5; }
.title-mark p { margin: 26px 10px 0 0; color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.art-frame { position: relative; margin: 0 auto; isolation: isolate; }
.portrait-frame { width: min(820px, 82vw); aspect-ratio: 2 / 3; }
.landscape-frame { width: min(1320px, 94vw); aspect-ratio: 3 / 2; }
.art-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 3%, #000 97%, transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 3%, #000 97%, transparent 100%); }

.sea-breath { position: absolute; inset: 0; z-index: 1; background: url("assets/act1-world-gates.webp") center / contain no-repeat; clip-path: inset(8% 8% 76% 8%); opacity: .38; animation: sea-breath 9s ease-in-out infinite; }
.flow-lines { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }
.flow-lines path { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 4 15; opacity: .12; animation: river-flow 20s linear infinite; }
.drop-stage { position: absolute; z-index: 5; left: 50%; top: 83.2%; width: 1px; height: 7%; }
#data-drop { position: absolute; left: -2px; top: 0; width: 4px; height: 6px; border-radius: 60% 60% 70% 70%; background: var(--red); opacity: 0; }
#data-drop.is-falling { animation: drop-fall 1.2s ease-in forwards; }
#drop-ripple { position: absolute; left: -8px; bottom: -2px; width: 16px; height: 7px; border: 1px solid var(--red); border-radius: 50%; opacity: 0; }
#drop-ripple.is-rippling { animation: ripple .75s ease-out forwards; }

.resident { position: absolute; z-index: 7; appearance: none; border: 0; background: transparent; padding: 0; cursor: pointer; color: var(--ink); }
.resident-one { left: 57%; top: 82%; width: clamp(62px, 8%, 92px); aspect-ratio: .72; }
.resident-motion { position: absolute; inset: 0; animation: resident-breathe 3.2s ease-in-out infinite; transform-origin: 50% 100%; }
.resident-motion img { width: 100%; height: 100%; object-fit: contain; }
.resident.is-hopping .resident-motion { animation: resident-hop .3s ease-out 1; }
.blink { position: absolute; top: 43%; width: 17%; height: 4%; border-radius: 50%; background: #fff2d6; opacity: 0; }
.blink-left { left: 25%; }.blink-right { right: 24%; }
.resident.is-blinking .blink { opacity: 1; }
.speech { position: absolute; left: 50%; bottom: calc(100% + 8px); width: max-content; max-width: 150px; transform: translate(-50%, 5px); padding: 7px 10px; border: 1px solid rgba(52,47,41,.36); background: rgba(242,236,223,.94); color: var(--ink); font-family: "Hannotate SC", "Klee", "Yu Kyokasho", cursive; font-size: 11px; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.speech::after { content: ""; position: absolute; left: 50%; top: 100%; width: 6px; height: 6px; border-right: 1px solid rgba(52,47,41,.36); border-bottom: 1px solid rgba(52,47,41,.36); background: var(--paper); transform: translate(-50%, -3px) rotate(45deg); }
.show-speech .speech { opacity: 1; transform: translate(-50%, 0); }

#time-tick { position: absolute; z-index: 5; width: 3px; height: 14px; background: var(--red); transform: translate(-50%, -50%); transform-origin: 50% 50%; box-shadow: 0 0 8px rgba(230,0,18,.22); }
.night-lights i { position: absolute; z-index: 3; left: var(--x); top: var(--y); width: 8px; height: 8px; border-radius: 50%; background: radial-gradient(circle, rgba(240,186,86,.72) 0, rgba(211,162,77,.24) 45%, transparent 72%); opacity: .25; animation: lamp-breathe var(--d) ease-in-out infinite; }
.steam { position: absolute; z-index: 5; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.steam path { fill: none; stroke: var(--ink); stroke-width: .12; opacity: 0; animation: steam-rise 8s ease-out infinite; }
.steam path + path { animation-delay: 3.6s; }
.resident-hotspot { position: absolute; z-index: 8; appearance: none; border: 0; background: transparent; padding: 0; cursor: pointer; }
.resident-two { left: 45.2%; top: 45%; width: 9.5%; height: 15%; }
.resident-three { left: 43.6%; top: 78.2%; width: 12.8%; height: 10%; }
.resident-hotspot .speech { bottom: 100%; }
.data-line { margin: 20px auto 0; text-align: center; color: var(--ink); font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 13px; font-variant-numeric: tabular-nums; }

.tower-frame { width: min(760px, 80vw); }
#number-rain { position: absolute; z-index: 3; left: 54%; top: 14%; width: 13%; height: 48%; overflow: hidden; mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent); }
.falling-number { position: absolute; left: var(--left); top: -10%; color: rgba(52,47,41,.24); font-size: clamp(9px, 1vw, 14px); font-variant-numeric: tabular-nums; animation: number-fall 40s linear forwards; }
.tower-heart { position: absolute; z-index: 5; left: 49.9%; top: 39.7%; width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 rgba(230,0,18,.2); animation: heart-beat 4s ease-in-out infinite; }
footer { width: min(880px, 88vw); margin: 12px auto 0; padding: 28px 0 0; border-top: 1px solid rgba(52,47,41,.15); display: flex; justify-content: center; align-items: center; gap: 18px; text-align: center; }
footer p { margin: 0; font-size: 14px; }
footer time { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; }
footer img { width: 34px; height: 46px; object-fit: contain; }

@keyframes sea-breath { 0%,100% { transform: translateX(-2px); } 50% { transform: translateX(2px); } }
@keyframes river-flow { to { stroke-dashoffset: -76; } }
@keyframes drop-fall { 0% { opacity: 0; transform: translateY(0) scale(.8); } 10% { opacity: 1; } 88% { opacity: 1; } 100% { opacity: 0; transform: translateY(580%) scale(1); } }
@keyframes ripple { 0% { opacity: .7; transform: scale(.2); } 100% { opacity: 0; transform: scale(2.2); } }
@keyframes resident-breathe { 0%,100% { transform: translateY(0); } 50% { transform: translateY(1.5px); } }
@keyframes resident-hop { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes lamp-breathe { 0%,100% { opacity: .25; } 50% { opacity: .5; } }
@keyframes steam-rise { 0%,20% { opacity: 0; transform: translateY(2px); } 35% { opacity: .3; } 75% { opacity: .12; } 100% { opacity: 0; transform: translateY(-7px); } }
@keyframes number-fall { from { transform: translateY(0); opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } to { transform: translateY(620px); opacity: 0; } }
@keyframes heart-beat { 0%,100% { opacity: .6; transform: scale(.92); box-shadow: 0 0 0 0 rgba(230,0,18,.2); } 48% { opacity: .72; } 54% { opacity: 1; transform: scale(1.08); box-shadow: 0 0 0 6px rgba(230,0,18,0); } 60% { transform: scale(.97); } }

@media (max-width: 700px) {
  .act { min-height: auto; padding: 58px 14px 78px; }
  .act-label { margin-bottom: 14px; padding-left: 4px; }
  .title-mark { left: 20px; top: 104px; }
  .title-mark h1 { font-size: 25px; }
  .title-mark p { font-size: 8px; }
  .portrait-frame, .tower-frame { width: 100%; }
  .landscape-frame { width: 110%; margin-left: -5%; }
  .resident-one { width: 9%; min-width: 38px; }
  .data-line { margin-top: 12px; font-size: 11px; }
  footer { width: 94%; padding-top: 22px; }
  footer p { font-size: 12px; line-height: 1.8; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  #data-drop, #drop-ripple, .blink, .falling-number { display: none !important; }
  .night-lights i { opacity: .35; }
  .steam path { opacity: .18; }
}
