:root {
  --paper: #ece5d6;      /* rice paper */
  --mist: #f6f2e9;       /* fog highlight */
  --ink: #1d211f;        /* green-black ink */
  --ink-soft: #4a514c;
  --stone: #5e6560;     /* 4.5:1+ on paper and footer */
  --jade: #2e7d6b;       /* held land, from the app */
  --jade-wash: rgba(46, 125, 107, .3);
  --cinnabar: #b33a2b;   /* seal red */
  --rival: #6e5a8e;
  --rival-wash: rgba(110, 90, 142, .22);

  --serif: "Libre Caslon Text", "Iowan Old Style", Georgia, serif;
  --display: "Libre Caslon Display", "Libre Caslon Text", Georgia, serif;
  --brush: "Ma Shan Zheng", "Kaiti SC", "STKaiti", "KaiTi", serif;

  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* rice-paper grain over everything */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: .22;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .42 0 0 0 0 .36 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { display: block; max-width: 100%; }
h1, h2 { text-wrap: balance; font-family: var(--display); font-weight: 400; line-height: 1.05; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--cinnabar); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: fixed; left: 12px; top: -60px; z-index: 200;
  background: var(--ink); color: var(--mist); padding: .6rem 1rem; border-radius: 6px;
}
.skip:focus { top: 12px; }

/* ---------- seal (the app's stamp) ---------- */
.seal {
  display: inline-grid; place-items: center;
  background: var(--cinnabar);
  border-radius: 18%;
  transform: rotate(-3deg);
  box-shadow: 0 6px 18px rgba(179, 58, 43, .25);
  color: var(--mist);
  font-family: var(--brush);
  line-height: 1;
}
.seal > span {
  display: grid; place-items: center;
  width: 100%; height: 100%;
  border: 2px solid rgba(246, 242, 233, .9);
  border-radius: 14%;
}
.seal--sm { width: 30px; height: 30px; padding: 3px; font-size: 17px; }
.seal--sm > span { border-width: 1.5px; }
.seal--lg { width: 76px; height: 76px; padding: 6px; font-size: 44px; }
.seal--num { width: 34px; height: 34px; padding: 3px; font-size: 19px; box-shadow: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: 700 1rem/1 var(--serif);
  text-decoration: none;
  border-radius: 999px;
  padding: 1rem 1.9rem;
  border: 0;
  cursor: pointer;
  transition: transform .2s ease, background-color .2s ease, box-shadow .2s ease;
}
.btn--seal { background: var(--cinnabar); color: var(--mist); box-shadow: 0 10px 28px rgba(179, 58, 43, .28); }
.btn--seal:hover { background: #9e3024; transform: translateY(-1px); }
.btn--seal:active { transform: translateY(1px); }
.btn--ghost {
  padding: .7rem 1.2rem; font-size: .9rem;
  background: rgba(246, 242, 233, .92);
  color: var(--ink);
  border: 1px solid rgba(29, 33, 31, .18);
}
.btn--ghost:hover { background: var(--mist); border-color: rgba(29, 33, 31, .35); }
.btn--wide { width: 100%; }

/* ---------- top bar ---------- */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) 14px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(246, 242, 233, .85), rgba(246, 242, 233, 0));
}
.top > * { pointer-events: auto; }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; }
.brand__name { font-family: var(--display); font-size: 1.5rem; }

/* ---------- journey stage ---------- */
.journey { position: relative; }
.stage {
  position: relative;
  height: 100vh; height: 100svh;
  overflow: hidden;
  background: linear-gradient(to bottom, #e9e2d2 0%, var(--mist) 62%, var(--paper) 100%);
  isolation: isolate;
}
.backdrop {
  position: absolute; left: 50%; top: 0;
  width: max(100%, calc(100svh * 2.333));
  max-width: none;
  height: 100%;
  object-fit: cover;
  transform: translateX(-50%);
  transform-origin: 50% 40%;
  opacity: .9;
  z-index: 0;
}
/* canvases: the fly-through and the territory board are drawn, not composited as layers */
.depth, .board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.depth { z-index: 1; }
.board { z-index: 4; }

.mist { position: absolute; inset: 0; pointer-events: none; }
.mist--low {
  z-index: 3;
  background: linear-gradient(to top, var(--paper) 0%, rgba(236, 229, 214, .85) 14%, rgba(246, 242, 233, 0) 45%);
}
.mist--sea {
  z-index: 3; opacity: 0;
  background: linear-gradient(to top, var(--paper) 0%, rgba(240, 234, 222, .97) 42%, rgba(246, 242, 233, .75) 56%, rgba(246, 242, 233, 0) 74%);
}
.mist--veil { z-index: 9; background: var(--paper); opacity: 0; }
.mist--intro { z-index: 10; background: var(--paper); pointer-events: none; animation: lift 1.8s ease-in-out .15s forwards; }
@keyframes lift { to { opacity: 0; visibility: hidden; } }
.js .hero > * { animation: rise 1.1s cubic-bezier(.2, .7, .2, 1) both; }
.js .hero > :nth-child(1) { animation-delay: .7s; }
.js .hero > :nth-child(2) { animation-delay: .82s; }
.js .hero > :nth-child(3) { animation-delay: .94s; }
.js .hero > :nth-child(4) { animation-delay: 1.06s; }
.js .hero > :nth-child(5) { animation-delay: 1.18s; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
html:not(.js) .mist--intro { display: none; }

/* ---------- hero ---------- */
.hero {
  position: absolute; inset: 0; z-index: 6;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 7rem var(--gutter) 6rem;
}
.hero .seal { margin-bottom: 1.4rem; }
.hero__title {
  font-size: clamp(5.5rem, 17vw, 13.5rem);
  line-height: .85;
  letter-spacing: -.035em;
  text-shadow: 0 0 40px var(--mist), 0 0 80px var(--mist);
}
.hero__lede {
  text-wrap: balance;
  margin-top: 1.4rem;
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
  font-style: italic;
  line-height: 1.3;
}
.hero__sub {
  margin: .9rem 0 2rem;
  max-width: 34rem;
  color: var(--ink-soft);
  text-shadow: 0 0 18px var(--mist), 0 0 6px var(--mist);
}
.cue {
  position: absolute; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); z-index: 6;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: .6rem;
  font-size: .85rem; color: var(--ink-soft);
}
.cue__line { width: 1px; height: 44px; background: linear-gradient(var(--ink), transparent); transform-origin: top; animation: drip 2.4s ease-in-out infinite; }
@keyframes drip { 0% { transform: scaleY(0); opacity: 1; } 70% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------- chapters ---------- */
.chapter {
  position: absolute; z-index: 7;
  top: 50%;
  width: min(36rem, calc(100% - 2 * var(--gutter)));
  display: flex; gap: 1.4rem; align-items: flex-start;
  opacity: 0;
  pointer-events: none;
}
.chapter--left { left: calc(var(--gutter) + 3vw); }
.chapter--right { right: calc(var(--gutter) + 6vw); }
.chapter::before {
  content: ""; position: absolute; inset: -3rem -4rem; z-index: -1;
  background: radial-gradient(closest-side, rgba(246, 242, 233, .92), rgba(246, 242, 233, .6) 60%, rgba(246, 242, 233, 0));
}
.inscription {
  display: flex; flex-direction: column; align-items: center; gap: .7rem;
  flex: none;
}
.glyph {
  font-family: var(--brush);
  font-size: clamp(4rem, 7vw, 6.5rem);
  line-height: .9;
  color: var(--ink);
}
.chapter h2 { font-size: clamp(2rem, 3.2vw, 2.75rem); margin: .3rem 0 1rem; }
.chapter p { color: var(--ink-soft); max-width: 27rem; }

/* ---------- HUD + chapter nav ---------- */
.hud {
  position: absolute; z-index: 8;
  left: var(--gutter); bottom: max(20px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: .8rem;
  padding: .45rem 1.3rem .45rem .45rem;
  border-radius: 999px;
  background: rgba(246, 242, 233, .94);
  box-shadow: 0 8px 30px rgba(29, 33, 31, .08);
  opacity: 0;
}
.hud__ring { width: 48px; height: 48px; transform: rotate(-90deg); }
.hud__track { fill: var(--ink); stroke: rgba(46, 125, 107, .25); stroke-width: 4; }
.hud__fill { fill: none; stroke: var(--jade); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 132; stroke-dashoffset: 132; }
.hud__level {
  position: absolute; left: .45rem; width: 48px; text-align: center;
  color: var(--mist); font-size: 1.15rem;
}
.hud__impulse { display: inline-flex; align-items: center; gap: .4rem; font-size: 1.6rem; font-variant-numeric: tabular-nums; min-width: 4.2ch; }
.bolt { width: 11px; height: 17px; fill: var(--cinnabar); }

.chapters-nav {
  position: absolute; z-index: 8;
  right: calc(var(--gutter) - 14px); top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 0;
  opacity: 0;
}
.chapters-nav button {
  width: 44px; height: 32px; padding: 0; border: 0; background: none; cursor: pointer;
  display: grid; place-items: center;
}
.chapters-nav button::before {
  content: "";
  width: 14px; height: 16px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: #858279;
  transition: background-color .3s, transform .3s;
}
.chapters-nav button:hover::before { background: var(--ink); }
.chapters-nav button.is-on::before { background: var(--jade); transform: scale(1.2); }

/* ---------- beta form ---------- */
.beta {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 28rem);
  gap: clamp(2.5rem, 7vw, 7rem);
  align-items: start;
  max-width: 1120px;
  margin: 0 auto;
  min-height: 100vh; min-height: 100svh;
  padding: clamp(6rem, 14vh, 10rem) var(--gutter) clamp(16rem, 34vw, 28rem);
  overflow: hidden;
  isolation: isolate;
}
.beta__intro { position: relative; }
.beta__intro h2 { font-size: clamp(2.8rem, 6vw, 4.8rem); margin: 1.6rem 0 1.2rem; }
.beta__intro p { max-width: 26rem; color: var(--ink-soft); font-size: 1.15rem; }
.beta__horizon {
  position: absolute; left: 50%; bottom: -4vw; z-index: -1;
  width: max(1400px, 120vw); max-width: none;
  transform: translateX(-50%);
  opacity: .45;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 35%, #000 70%, transparent);
          mask-image: linear-gradient(to bottom, transparent, #000 35%, #000 70%, transparent);
}

.form { display: grid; gap: 1.35rem; }
.field { display: grid; gap: .45rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.field label, .field legend { font-weight: 700; font-size: .95rem; padding: 0; }
.opt { font-weight: 400; color: var(--stone); font-style: italic; margin-left: .3rem; }
.field input[type="email"], .field input[type="text"] {
  font: inherit;
  color: var(--ink);
  background: rgba(246, 242, 233, .7);
  border: 1px solid #8b8579;
  border-radius: 12px;
  padding: .85rem 1rem;
  min-height: 48px;
  width: 100%;
  transition: border-color .2s, background-color .2s;
}
.field input::placeholder { color: #6f746f; }
.field input:hover { border-color: var(--ink-soft); }
.field input:focus { outline: none; border-color: var(--jade); background: var(--mist); box-shadow: 0 0 0 3px rgba(46, 125, 107, .18); }
.field input[aria-invalid="true"] { border-color: var(--cinnabar); }
.field__err { color: var(--cinnabar); font-size: .9rem; min-height: 0; }
.field__err:empty { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .45rem; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-grid; place-items: center;
  min-height: 44px; padding: .5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid #8b8579;
  background: rgba(246, 242, 233, .6);
  transition: background-color .2s, border-color .2s, color .2s;
}
.chip:hover span { border-color: var(--ink-soft); }
.chip input:checked + span { background: var(--jade); border-color: var(--jade); color: var(--mist); }
.chip input:focus-visible + span { outline: 2px solid var(--cinnabar); outline-offset: 3px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form__note { font-size: .88rem; color: var(--stone); margin-top: -.5rem; text-align: center; }
.form__status:empty { display: none; }
.form__status { padding: 1rem 1.1rem; border-radius: 12px; background: rgba(179, 58, 43, .08); color: #8a2a1f; }
.form__status.is-ok { background: var(--jade-wash); color: #1f5a4c; }
.form.is-done .field, .form.is-done .btn, .form.is-done .form__note { display: none; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- faq ---------- */
.faq { max-width: 46rem; margin: 0 auto; padding: 3rem var(--gutter) 6rem; }
.faq h2 { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: 1.5rem; }
.faq details { border-top: 1px solid rgba(29, 33, 31, .15); }
.faq details:last-of-type { border-bottom: 1px solid rgba(29, 33, 31, .15); }
.faq summary {
  cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1.15rem 0;
  font-size: 1.15rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 12px; height: 14px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: rgba(29, 33, 31, .3);
  transition: background-color .2s, transform .3s;
}
.faq details[open] summary::after { background: var(--jade); transform: rotate(90deg); }
.faq details p { padding: 0 0 1.3rem; color: var(--ink-soft); max-width: 40rem; }

/* ---------- footer ---------- */
.foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem;
  padding: 2.5rem var(--gutter) max(2.5rem, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(29, 33, 31, .12);
  background: #e6dfcf;
}
.foot__brand { display: flex; align-items: center; gap: .6rem; font-family: var(--display); font-size: 1.4rem; }
.foot__contact p { font-size: .9rem; color: var(--ink-soft); }
.foot__contact a { font-size: 1.15rem; text-underline-offset: 4px; text-decoration-color: rgba(179, 58, 43, .5); }
.foot__contact a:hover { text-decoration-color: var(--cinnabar); }
.foot__copy { font-size: .85rem; color: var(--stone); }

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .brand__name { font-size: 1.3rem; }
  .chapter, .chapter--left, .chapter--right {
    left: var(--gutter); right: var(--gutter); width: auto;
    top: auto; bottom: 96px;
    gap: 1rem;
  }
  .chapter::before { inset: -2.5rem -2rem -1.5rem; background: radial-gradient(closest-side, rgba(246, 242, 233, .97), rgba(246, 242, 233, .85) 65%, rgba(246, 242, 233, 0)); }
  .glyph { font-size: 3.4rem; }
  .seal--num { width: 28px; height: 28px; font-size: 15px; }
  .chapter h2 { font-size: 1.75rem; margin: .1rem 0 .6rem; }
  .chapter p { font-size: 1rem; line-height: 1.55; }
  .hud { padding-right: 1rem; }
  .hud__ring { width: 40px; height: 40px; }
  .hud__level { width: 40px; font-size: 1rem; }
  .hud__impulse { font-size: 1.3rem; }
  .chapters-nav button { height: 44px; }
  .chapters-nav { top: 4.4rem; transform: none; flex-direction: row; right: auto; left: 50%; translate: -50% 0; }
  .beta { grid-template-columns: 1fr; }
  .beta { padding-bottom: 19rem; }
  .beta__horizon { width: 200vw; min-width: 0; bottom: -2rem; }
}

/* no JS: show everything as a plain page */
html:not(.js) .stage { height: auto; overflow: visible; }
html:not(.js) .chapter { position: relative; inset: auto; opacity: 1; visibility: visible; margin: 3rem auto; }
html:not(.js) .hero { position: relative; min-height: 100svh; }
html:not(.js) .depth, html:not(.js) .board, html:not(.js) .hud, html:not(.js) .chapters-nav, html:not(.js) .cue { display: none; }

@media (prefers-reduced-motion: reduce) {
  .cue__line, .mist--intro, .js .hero > * { animation: none; }
  .mist--intro { display: none; }
  .btn { transition: none; }
}
