:root {
  /* Roboto Sla* Slab* Slab** from Google Fonts at cinematic scale for the opening `확률.com` */
  --loam: #2F2418;
  --moss: #6F8A42;
  --violet: #7D6AAE;
  --clay: #C47A3A;
  --mist: #ECE3D0;
  --rain: #6FA7B8;
  --pollen: #D9B957;
  --display: "Roboto Slab", Georgia, serif;
  --serif: "Gowun Batang", "Times New Roman", serif;
  --utility: "Noto Sans KR", Inter, Roboto, Lato, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--loam);
  background: var(--mist);
  font-family: var(--utility);
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 22% 12%, rgba(217, 185, 87, 0.34), transparent 24%),
    radial-gradient(circle at 82% 18%, rgba(111, 167, 184, 0.32), transparent 28%),
    linear-gradient(180deg, #ECE3D0 0%, #d8d2bd 26%, #6F8A42 45%, #2F2418 72%, #ECE3D0 100%);
  transition: filter 800ms ease, background 900ms ease;
  z-index: 0;
}

.field-grid {
  position: absolute;
  inset: -8%;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(47, 36, 24, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 36, 24, 0.14) 1px, transparent 1px),
    repeating-linear-gradient(6deg, transparent 0 72px, rgba(196, 122, 58, 0.13) 73px, transparent 76px);
  background-size: 72px 72px, 72px 72px, 240px 240px;
  transform: rotate(-1.5deg) scale(1.04);
  animation: gridBreathe 15s ease-in-out infinite alternate;
}

.fog {
  position: absolute;
  left: -20%;
  width: 140%;
  height: 24vh;
  border-radius: 50%;
  filter: blur(28px);
  opacity: 0.42;
  background: linear-gradient(90deg, transparent, rgba(236, 227, 208, 0.82), rgba(111, 167, 184, 0.34), transparent);
}

.fog-one { top: 8%; animation: fogDrift 24s ease-in-out infinite alternate; }
.fog-two { top: 44%; animation: fogDrift 31s ease-in-out infinite alternate-reverse; opacity: 0.28; }

.pollen-layer { position: absolute; inset: 0; overflow: hidden; }
.pollen {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--pollen);
  box-shadow: 0 0 16px rgba(217, 185, 87, 0.85);
  opacity: 0.66;
  animation: pollenFloat linear infinite;
}

.story-column {
  position: relative;
  z-index: 1;
  width: min(100%, 1080px);
  margin: 0 auto;
}

.story-column::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(62vw, 560px);
  transform: translateX(-50%);
  border-left: 1px solid rgba(47, 36, 24, 0.2);
  border-right: 1px solid rgba(47, 36, 24, 0.16);
  background: linear-gradient(90deg, transparent, rgba(236, 227, 208, 0.13), transparent);
  pointer-events: none;
}

.chapter {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 8vh 22px;
}

.chapter-field {
  position: relative;
  width: min(88vw, 760px);
  min-height: 78vh;
  display: grid;
  place-items: center;
  text-align: center;
}

.field-note, .chapter-kicker, .fraction-mark, .seed-label, .clay-plaque {
  font-family: var(--utility);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.76rem;
}

.hero-copy { align-self: end; padding-bottom: 8vh; position: relative; z-index: 3; }

h1, h2 {
  font-family: var(--display);
  margin: 0;
  letter-spacing: -0.045em;
  line-height: 0.92;
}

h1 {
  font-size: clamp(4.8rem, 17vw, 13rem);
  color: var(--loam);
  text-shadow: 0 10px 40px rgba(236, 227, 208, 0.52);
}

h2 {
  font-size: clamp(3.2rem, 9vw, 7.4rem);
  max-width: 820px;
}

.poem, .chapter-text, .weather-note {
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2.1vw, 1.55rem);
  line-height: 1.78;
}

.poem { color: rgba(47, 36, 24, 0.82); }
.chapter-text { max-width: 620px; margin: 34px auto 0; }
.chapter-kicker { color: var(--clay); margin-bottom: 26px; font-weight: 700; }

.chance-stage {
  position: fixed;
  top: 50%;
  left: 50%;
  width: clamp(120px, 18vw, 220px);
  height: clamp(150px, 22vw, 270px);
  transform: translate(-50%, -58%);
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 25px 46px rgba(47, 36, 24, 0.28));
}

.chance-seed { width: 100%; height: 100%; overflow: visible; }
#morphShape {
  fill: rgba(196, 122, 58, 0.86);
  stroke: rgba(47, 36, 24, 0.55);
  stroke-width: 2;
  transition: d 900ms cubic-bezier(.6,0,.2,1), fill 900ms ease, filter 900ms ease;
}
.seed-line { fill: none; stroke: rgba(236, 227, 208, 0.76); stroke-width: 3; stroke-linecap: round; transition: opacity 600ms ease; }
.seed-eye { fill: var(--pollen); transition: transform 800ms ease, fill 800ms ease; transform-origin: center; }

.rain-rings {
  position: absolute;
  top: 18%;
  left: 50%;
  width: min(64vw, 420px);
  transform: translateX(-50%);
  opacity: 0.46;
}
.rain-rings ellipse { fill: none; stroke: var(--rain); stroke-width: 2; stroke-dasharray: 8 12; animation: ringPulse 7s ease-in-out infinite; }

.fraction-mark {
  position: absolute;
  color: rgba(47, 36, 24, 0.54);
  border-bottom: 1px solid rgba(47, 36, 24, 0.24);
}
.mark-a { top: 20%; left: 16%; }
.mark-b { top: 33%; right: 20%; }
.mark-c { bottom: 34%; left: 24%; }

.ledger { color: var(--mist); }
.ledger-field {
  background: radial-gradient(circle at center, rgba(196, 122, 58, 0.26), transparent 60%);
  color: var(--mist);
}
.ledger h2 { color: var(--mist); }
.soil-strata {
  position: absolute;
  inset: 7% 12%;
  border-radius: 48% 52% 44% 56%;
  background: repeating-linear-gradient(180deg, rgba(47, 36, 24, 0.18) 0 16px, rgba(196, 122, 58, 0.18) 17px 19px, transparent 20px 44px);
  opacity: 0.68;
  transform: rotate(2deg);
}
.ledger-field > *:not(.soil-strata) { position: relative; z-index: 2; }

.ledger-objects {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.natural-token {
  position: absolute;
  display: grid;
  place-items: center;
  min-width: 62px;
  min-height: 44px;
  padding: 12px 14px;
  font-family: var(--utility);
  font-size: 0.86rem;
  color: var(--loam);
  background: var(--clay);
  border: 1px solid rgba(236, 227, 208, 0.34);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
  animation: tokenSway 8s ease-in-out infinite alternate;
}
.seed-token { top: 15%; left: 14%; border-radius: 54% 46% 48% 52%; }
.droplet-token { top: 20%; right: 12%; border-radius: 58% 58% 62% 12%; background: var(--rain); transform: rotate(45deg); }
.stone-token { bottom: 20%; left: 18%; border-radius: 48% 52% 42% 58%; background: #8a7255; color: var(--mist); }
.leaf-token { bottom: 15%; right: 16%; border-radius: 82% 0 82% 0; background: var(--moss); color: var(--mist); }

.weather { color: var(--loam); }
.weather-field { overflow: visible; }
.branch-svg { position: absolute; inset: 2% 10%; width: 80%; height: 92%; opacity: 0.95; }
.stem, .branch {
  fill: none;
  stroke: var(--moss);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 760;
  stroke-dashoffset: 760;
  transition: stroke-dashoffset 1200ms ease;
}
.chapter.visible .stem, .chapter.visible .branch { stroke-dashoffset: 0; }
.branch { stroke-width: 7; }
.branch.small { stroke-width: 5; opacity: 0.75; }
.node { fill: var(--pollen); stroke: var(--loam); stroke-width: 2; }
.weather h2, .weather .chapter-kicker, .weather-note { position: relative; z-index: 2; }
.weather h2 { margin-top: -34vh; }
.weather-note { align-self: end; max-width: 560px; color: rgba(47, 36, 24, 0.76); }

.roots {
  color: var(--mist);
  background: radial-gradient(circle at 50% 48%, rgba(125, 106, 174, 0.22), transparent 44%);
}
.roots h2 { color: var(--mist); position: relative; z-index: 2; text-shadow: 0 20px 40px rgba(0,0,0,0.35); }
.root-svg { position: absolute; width: min(82vw, 680px); height: min(78vh, 700px); inset: 10% 50% auto auto; transform: translateX(50%); }
.root {
  fill: none;
  stroke: var(--moss);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 820;
  stroke-dashoffset: 820;
  transition: stroke-dashoffset 1400ms ease;
}
.chapter.visible .root { stroke-dashoffset: 0; }
.root.fine { stroke-width: 4; stroke: var(--pollen); opacity: 0.62; }
.stone { fill: rgba(236, 227, 208, 0.22); stroke: rgba(236, 227, 208, 0.24); }
.clay-plaque {
  position: absolute;
  padding: 14px 18px;
  color: var(--mist);
  background: rgba(196, 122, 58, 0.78);
  border: 1px solid rgba(236, 227, 208, 0.26);
  border-radius: 38% 44% 40% 48%;
  box-shadow: 0 18px 40px rgba(0,0,0,0.25);
}
.plaque-one { left: 12%; top: 24%; transform: rotate(-5deg); }
.plaque-two { right: 10%; top: 49%; transform: rotate(4deg); }
.plaque-three { left: 24%; bottom: 16%; transform: rotate(2deg); }

.harvest { color: var(--loam); }
.harvest h2 { color: var(--loam); }
.pod-halo {
  position: absolute;
  width: min(66vw, 520px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 185, 87, 0.46), rgba(111, 167, 184, 0.17) 46%, transparent 68%);
  filter: blur(8px);
  animation: haloPulse 6s ease-in-out infinite alternate;
}
.harvest-field > *:not(.pod-halo) { position: relative; z-index: 2; }
.seed-label {
  display: inline-block;
  margin-top: 34px;
  padding: 10px 18px;
  color: var(--loam);
  text-decoration: none;
  border-bottom: 1px solid var(--clay);
  background: rgba(236, 227, 208, 0.38);
}

.seed-nav {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 14px;
  z-index: 5;
}
.seed-dot {
  width: 15px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(47, 36, 24, 0.44);
  border-radius: 50% 48% 46% 52%;
  background: rgba(236, 227, 208, 0.55);
  cursor: pointer;
  transition: transform 300ms ease, background 300ms ease, box-shadow 300ms ease;
}
.seed-dot span { display: none; }
.seed-dot.active { background: var(--pollen); transform: scale(1.22); box-shadow: 0 0 0 8px rgba(217, 185, 87, 0.18); }
.seed-dot.pulse { animation: seedPulse 650ms ease; }

body[data-scene="ledger"] .atmosphere { filter: saturate(0.92) brightness(0.76); }
body[data-scene="weather"] .atmosphere { filter: saturate(1.08) brightness(0.95); }
body[data-scene="roots"] .atmosphere { filter: saturate(0.78) brightness(0.45); }
body[data-scene="harvest"] .atmosphere { filter: saturate(1.04) brightness(1.1); }
body[data-form="droplet"] #morphShape { fill: rgba(111, 167, 184, 0.9); }
body[data-form="leaf"] #morphShape { fill: rgba(111, 138, 66, 0.92); }
body[data-form="root"] #morphShape { fill: rgba(125, 106, 174, 0.84); filter: brightness(0.86); }
body[data-form="pod"] #morphShape { fill: rgba(217, 185, 87, 0.94); filter: drop-shadow(0 0 22px rgba(217, 185, 87, 0.7)); }
body[data-form="pod"] .seed-eye { fill: var(--clay); transform: scale(1.6); }

@keyframes gridBreathe { from { transform: rotate(-1.5deg) scale(1.04) skewY(0deg); } to { transform: rotate(1deg) scale(1.08) skewY(-1.2deg); } }
@keyframes fogDrift { from { transform: translateX(-5%) translateY(0); } to { transform: translateX(8%) translateY(18px); } }
@keyframes pollenFloat { from { transform: translate3d(0, 12vh, 0); } to { transform: translate3d(var(--drift), -112vh, 0); } }
@keyframes ringPulse { 50% { stroke-dashoffset: 22; opacity: 0.35; } }
@keyframes tokenSway { to { transform: translateY(-18px) rotate(3deg); } }
@keyframes haloPulse { to { transform: scale(1.12); opacity: 0.74; } }
@keyframes seedPulse { 50% { box-shadow: 0 0 0 18px rgba(111, 167, 184, 0.26); } }

@media (max-width: 720px) {
  .seed-nav { right: 12px; }
  .chance-stage { opacity: 0.82; }
  .chapter-field { width: 92vw; }
  .story-column::before { width: 78vw; }
  .weather h2 { margin-top: -28vh; }
  .clay-plaque { font-size: 0.64rem; }
}
