:root {
  /* Typography compliance tokens from DESIGN.md: Mono** domain lettering stamped fragments */
  --ink: #241B16;
  --paper: #F4E8D6;
  --husk: #E6D2B8;
  --terra: #B85C38;
  --clay: #7A3324;
  --bubble: #FFF6E8;
  --olive: #6F7358;
  --red: #D13F2F;
  --mono: "IBM Plex Mono", "Space Mono", ui-monospace, SFMono-Regular, monospace;
  --sans: "Noto Sans JP", Inter, system-ui, sans-serif;
  --space: "Space Mono", "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  overflow-x: hidden;
}

.paper-field {
  position: relative;
  min-height: 100vh;
  padding: 0 clamp(16px, 4vw, 56px);
  background:
    radial-gradient(circle at 18% 12%, rgba(184, 92, 56, 0.13), transparent 22rem),
    radial-gradient(circle at 82% 40%, rgba(111, 115, 88, 0.12), transparent 18rem),
    linear-gradient(90deg, rgba(122, 51, 36, 0.06), transparent 18%, transparent 82%, rgba(122, 51, 36, 0.05)),
    var(--paper);
}

.grain-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    repeating-linear-gradient(0deg, rgba(36, 27, 22, 0.05) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(90deg, rgba(255, 246, 232, 0.28) 0 2px, transparent 2px 7px);
  mix-blend-mode: multiply;
}

.clay-smudge {
  position: fixed;
  border-radius: 50%;
  filter: blur(22px);
  pointer-events: none;
  opacity: 0.2;
}

.smudge-one { width: 220px; height: 90px; left: 7vw; top: 25vh; background: #B85C38; transform: rotate(-19deg); }
.smudge-two { width: 180px; height: 120px; right: 5vw; bottom: 14vh; background: #6F7358; transform: rotate(16deg); }

.coordinate-rail {
  position: fixed;
  top: 50%;
  left: clamp(10px, 3vw, 42px);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: translateY(-50%);
  font-family: var(--space);
  font-size: 11px;
}

.coordinate-rail a {
  color: var(--clay);
  text-decoration: none;
  border-left: 1px solid rgba(122, 51, 36, 0.35);
  padding-left: 8px;
  opacity: 0.55;
  transition: opacity 220ms ease, color 220ms ease, transform 220ms ease;
}

.coordinate-rail a.active { opacity: 1; color: var(--red); transform: translateX(4px); }

.receipt-strip {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(255, 246, 232, 0.52), rgba(230, 210, 184, 0.24));
  box-shadow: inset 0 0 0 1px rgba(122, 51, 36, 0.16), 0 26px 80px rgba(122, 51, 36, 0.15);
}

.receipt-strip::before,
.receipt-strip::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  background: repeating-linear-gradient(180deg, transparent 0 12px, rgba(122, 51, 36, 0.18) 12px 13px);
}

.receipt-strip::before { left: -8px; }
.receipt-strip::after { right: -8px; }

.scene {
  position: relative;
  min-height: 100vh;
  padding: clamp(52px, 9vw, 92px) clamp(24px, 6vw, 62px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-bottom: 1px solid rgba(122, 51, 36, 0.22);
  overflow: visible;
}

.scene:nth-child(even) { transform: translateX(clamp(-10px, -1vw, -4px)); }
.scene:nth-child(odd) { transform: translateX(clamp(4px, 1vw, 12px)); }

.scene-label,
.section-rule {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 34px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(122, 51, 36, 0.28);
  color: var(--olive);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

h1, h2 {
  margin: 0 0 30px;
  font-family: var(--mono);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.055em;
}

h1 { font-size: clamp(40px, 9vw, 76px); }
h2 { font-size: clamp(32px, 7vw, 56px); }

p { line-height: 1.75; }

.intro-object {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 350px;
}

.intro-bubble {
  position: absolute;
  width: clamp(150px, 34vw, 280px);
  aspect-ratio: 1;
  border-radius: 48% 52% 55% 45%;
  background: radial-gradient(circle at 34% 28%, rgba(255, 246, 232, 0.92), rgba(255, 246, 232, 0.58) 56%, rgba(184, 92, 56, 0.16));
  border: 1px solid rgba(184, 92, 56, 0.36);
  box-shadow: inset -18px -26px 40px rgba(230, 210, 184, 0.7), 0 22px 70px rgba(184, 92, 56, 0.18);
  transform: scale(0.24);
  animation: inflate 5.8s cubic-bezier(.22,.72,.18,1) forwards, blob 8s ease-in-out infinite 5.8s;
}

.wordmark {
  position: relative;
  z-index: 1;
  font-family: var(--mono);
  font-size: clamp(22px, 5vw, 42px);
  letter-spacing: -0.08em;
  transform: translateY(10px);
  animation: suspend 5.8s ease forwards;
}

.tiny-coordinate {
  position: absolute;
  bottom: 54px;
  right: 40px;
  color: var(--clay);
  font-family: var(--space);
  font-size: 10px;
  transform: rotate(-3deg);
}

.quiet-line,
.field-note,
.closing-copy {
  max-width: 420px;
  margin: 0;
  color: rgba(36, 27, 22, 0.72);
  font-size: 15px;
}

.receipt-edge {
  width: 84px;
  height: 16px;
  margin-top: 56px;
  background: repeating-linear-gradient(90deg, var(--clay) 0 4px, transparent 4px 10px);
  opacity: 0.34;
}

.kit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  counter-reset: kit;
}

.kit-item {
  counter-increment: kit;
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 58px;
  padding: 10px 12px;
  border-top: 1px solid rgba(122, 51, 36, 0.18);
  font-family: var(--mono);
}

.kit-item::after {
  content: "0" counter(kit);
  margin-left: auto;
  color: rgba(122, 51, 36, 0.45);
  font-family: var(--space);
  font-size: 11px;
}

.kit-item p { margin: 0; font-size: 14px; }

.pictogram {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--terra);
  border: 1px solid rgba(184, 92, 56, 0.5);
  background: rgba(255, 246, 232, 0.45);
  font-family: var(--mono);
  font-size: 12px;
}

.clay { border-radius: 50%; background: radial-gradient(circle at 35% 30%, #E6D2B8, #B85C38); }
.sticker { width: 42px; height: 28px; background: #D13F2F; transform: rotate(-7deg) skew(-8deg); border-color: #7A3324; }
.seed { width: 24px; height: 38px; border-radius: 80% 20% 70% 30%; background: #6F7358; }
.terminal { width: 52px; height: 24px; transform: rotate(4deg); }
.bubble { border-radius: 50%; background: rgba(255, 246, 232, 0.72); }

.stamp {
  width: max-content;
  max-width: 100%;
  margin-top: 40px;
  padding: 9px 12px;
  color: var(--red);
  border: 2px solid var(--red);
  font-family: var(--space);
  font-size: 12px;
  transform: rotate(-4deg) translateX(-20px);
  opacity: 0.72;
}

.scene.in-view .misfire { animation: stampMisfire 900ms steps(2, end) 260ms both; }

.escape-bubble {
  position: absolute;
  right: -46px;
  bottom: 15vh;
  width: 116px;
  height: 116px;
}

.bubble,
.large-bubble {
  border-radius: 50%;
  border: 1px solid rgba(184, 92, 56, 0.5);
  background: rgba(255, 246, 232, 0.62);
  box-shadow: inset -12px -18px 30px rgba(230, 210, 184, 0.7);
}

.escape-bubble span,
.large-bubble span {
  font-family: var(--space);
  font-size: 10px;
  color: var(--clay);
}

.folded-strip {
  position: relative;
  margin: 8vh 0 22px;
  padding: 28px;
  background: #FFF6E8;
  border: 1px solid rgba(122, 51, 36, 0.28);
  transform: perspective(700px) rotateX(6deg) rotateZ(-1.5deg);
  box-shadow: 0 22px 48px rgba(122, 51, 36, 0.14);
}

.fold-shadow {
  position: absolute;
  inset: 0 0 auto 0;
  height: 44%;
  background: linear-gradient(180deg, rgba(230, 210, 184, 0.5), transparent);
  pointer-events: none;
}

pre { margin: 0; white-space: pre-wrap; font: 13px/1.85 var(--mono); color: var(--ink); }
.caption-note { margin: 0; color: var(--terra); font: 12px/1.6 var(--space); }

.cursor-seed {
  position: absolute;
  right: 62px;
  top: 20vh;
  width: 18px;
  height: 28px;
  border-radius: 80% 20% 70% 30%;
  background: #6F7358;
  box-shadow: 0 8px 16px rgba(111, 115, 88, 0.28);
}

.scene.in-view .cursor-seed { animation: seedRoll 2.8s cubic-bezier(.18,.8,.28,1) both; }

.interrupted { position: relative; }
.interrupted::after {
  content: "";
  position: absolute;
  right: 10%;
  bottom: -3px;
  width: 92px;
  height: 6px;
  background: #D13F2F;
  transform: rotate(-7deg);
}

.incident-stage {
  position: relative;
  min-height: 360px;
  margin: 2vh 0 26px;
}

.large-bubble {
  position: absolute;
  left: 50%;
  top: 48%;
  display: grid;
  place-items: center;
  width: min(330px, 78vw);
  aspect-ratio: 1;
  transform: translate(-50%, -50%) scale(0.78);
}

.scene.in-view .large-bubble { animation: nudgeBubble 3.8s cubic-bezier(.2,.78,.2,1) both; }

.divider-stick {
  position: absolute;
  left: 6%;
  right: 8%;
  height: 1px;
  background: rgba(122, 51, 36, 0.32);
}

.divider-stick.one { top: 35%; }
.divider-stick.two { bottom: 30%; }
.scene.in-view .divider-stick.one { animation: stickNudge 3.8s ease both; }
.scene.in-view .divider-stick.two { animation: stickNudge 3.8s ease 160ms both reverse; }

.red-slash {
  position: absolute;
  right: 13%;
  top: 15%;
  width: 10px;
  height: 118px;
  background: #D13F2F;
  transform: rotate(32deg);
}

.dot-matrix {
  position: absolute;
  left: 16px;
  bottom: 34px;
  display: grid;
  grid-template-columns: repeat(3, 8px);
  gap: 7px;
}

.dot-matrix i { width: 8px; height: 8px; border-radius: 50%; background: #B85C38; opacity: 0.55; }

.burst-field {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 410px;
}

.final-mark {
  position: relative;
  z-index: 1;
  padding: 18px 24px;
  border: 1px solid rgba(122, 51, 36, 0.3);
  background: rgba(255, 246, 232, 0.55);
  font: 600 clamp(56px, 16vw, 118px)/1 var(--mono);
  letter-spacing: -0.12em;
}

.clay-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #D13F2F;
  transform: translate(-50%, -50%);
}

.scene.in-view .d1 { animation: burst1 1.8s ease both; }
.scene.in-view .d2 { animation: burst2 1.8s ease 70ms both; }
.scene.in-view .d3 { animation: burst3 1.8s ease 120ms both; }
.scene.in-view .d4 { animation: burst4 1.8s ease 40ms both; }
.scene.in-view .d5 { animation: burst5 1.8s ease 90ms both; }
.scene.in-view .d6 { animation: burst6 1.8s ease 150ms both; }

.bottom-stamp {
  width: max-content;
  margin-top: 54px;
  padding: 7px 10px;
  border: 1px solid #B85C38;
  color: #7A3324;
  font: 11px/1 var(--space);
  transform: rotate(2deg);
}

@keyframes inflate { to { transform: scale(1); } }
@keyframes blob { 0%,100% { border-radius: 48% 52% 55% 45%; } 50% { border-radius: 57% 43% 46% 54%; } }
@keyframes suspend { to { transform: translateY(0); } }
@keyframes stampMisfire { 0% { transform: rotate(-4deg) translateX(-70px); opacity: 0; } 45% { transform: rotate(5deg) translateX(18px); opacity: 1; } 100% { transform: rotate(-4deg) translateX(-20px); opacity: 0.72; } }
@keyframes seedRoll { 0% { transform: translateY(-40px) rotate(0deg); } 45% { transform: translateY(180px) rotate(230deg); } 58% { transform: translateY(150px) translateX(-16px) rotate(260deg); } 100% { transform: translateY(230px) translateX(24px) rotate(420deg); } }
@keyframes nudgeBubble { 0% { transform: translate(-50%, -50%) scale(0.78); } 55% { transform: translate(-43%, -50%) scale(1.06); } 70% { transform: translate(-56%, -50%) scale(0.98); } 100% { transform: translate(-50%, -50%) scale(1); } }
@keyframes stickNudge { 0%,100% { transform: translateX(0); } 55% { transform: translateX(32px) rotate(2deg); } }
@keyframes burst1 { to { transform: translate(-155px, -120px); } }
@keyframes burst2 { to { transform: translate(138px, -96px); } }
@keyframes burst3 { to { transform: translate(188px, 62px); } }
@keyframes burst4 { to { transform: translate(-130px, 120px); } }
@keyframes burst5 { to { transform: translate(70px, 160px); } }
@keyframes burst6 { to { transform: translate(-205px, 28px); } }

@media (max-width: 720px) {
  .coordinate-rail { display: none; }
  .scene:nth-child(even), .scene:nth-child(odd) { transform: none; }
  .escape-bubble { right: -20px; }
  .tiny-coordinate { right: 18px; }
}
