/* 如果 · IF
   月白 paper, 黛 ink, one 胭脂 thread.
   宋 (Noto Serif SC) is the app's voice; 楷 (LXGW WenKai) is your future self's handwriting.
   Motion follows breath: slow in, slow out, nothing snaps. */

:root {
  --paper: #e8edef;
  --paper-deep: #dbe2e5;
  --ink: #1f2a33;
  --ink-soft: #52606b;
  --ink-faint: #8b979f;
  --rule: rgba(31, 42, 51, 0.14);
  --rouge: #b3263e;
  --card: #f4f6f4;

  --song: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
  --kai: "LXGW WenKai", "Kaiti SC", "STKaiti", "KaiTi", serif;

  /* modular scale, ratio 1.25 on 16px */
  --t-small: 0.875rem;
  --t-body: 1.0625rem;
  --t-lead: 1.3rem;
  --t-h2: 1.56rem;
  --t-num: 2.44rem;
  --t-hero: 4.77rem;

  --col: min(100vw, 440px);
  --gutter: 24px;
  --breath: cubic-bezier(0.45, 0, 0.55, 1);

  --grain: 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 .12 0 0 0 0 .16 0 0 0 0 .2 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  background: var(--paper-deep);
}
body {
  margin: 0;
  font-family: var(--song);
  font-size: var(--t-body);
  line-height: 1.8;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.app {
  position: relative;
  width: var(--col);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--paper);
  overflow-x: hidden;
  isolation: isolate;
}
/* paper grain over everything, never catching taps */
.app::after {
  content: "";
  position: fixed;
  inset: 0;
  width: var(--col);
  margin: 0 auto;
  background-image: var(--grain);
  opacity: 0.1;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 50;
}

.screen {
  padding: 56px var(--gutter) 48px;
  min-height: 100dvh;
}
h1,
h2,
h3,
p {
  margin: 0;
}
button,
input,
textarea {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--rouge);
  outline-offset: 3px;
}
.muted {
  color: var(--ink-soft);
}
.small {
  font-size: var(--t-small);
  line-height: 1.7;
}

/* screen changes dissolve like ink in water */
::view-transition-old(root) {
  animation: ink-out 0.35s var(--breath) both;
}
::view-transition-new(root) {
  animation: ink-in 0.6s var(--breath) both;
}
@keyframes ink-out {
  to {
    opacity: 0;
    filter: blur(6px);
  }
}
@keyframes ink-in {
  from {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(6px);
  }
}

/* ---------- buttons ---------- */

.text-btn {
  justify-self: start;
  border: 0;
  background: none;
  padding: 6px 0;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
  cursor: pointer;
}
.primary,
.ghost {
  display: block;
  width: 100%;
  min-height: 52px;
  border-radius: 26px;
  font-size: var(--t-body);
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  cursor: pointer;
  transition:
    transform 0.2s var(--breath),
    background 0.3s,
    opacity 0.3s;
}
.primary {
  border: 0;
  background: var(--ink);
  color: var(--paper);
}
.primary.rouge {
  background: var(--rouge);
}
.ghost {
  border: 1px solid var(--ink);
  background: transparent;
}
.primary:active,
.ghost:active {
  transform: scale(0.98);
}
.primary:disabled {
  opacity: 0.35;
  cursor: default;
}
.sheet-actions {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

/* ---------- ① ask ---------- */

.vtitle {
  writing-mode: vertical-rl;
  font-size: var(--t-hero);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.18em;
  float: right;
  margin: -8px -4px 0 12px;
}
.vtitle span {
  display: inline-block;
  animation: ink-bleed 1.8s var(--breath) both;
}
.vtitle span + span {
  animation-delay: 0.45s;
}
@keyframes ink-bleed {
  from {
    opacity: 0;
    filter: blur(14px);
    transform: scale(1.12);
  }
  60% {
    opacity: 1;
    filter: blur(2px);
  }
}

.lede {
  font-size: var(--t-lead);
  line-height: 1.9;
  margin-top: 96px;
  max-width: 11em;
  animation: ink-in 1.2s 0.9s var(--breath) both;
}

.voice-hero {
  clear: both;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 56px 0 8px;
  animation: ink-in 1.2s 1.2s var(--breath) both;
}
.mic-hint {
  font-size: var(--t-small);
  color: var(--ink-soft);
  letter-spacing: 0.08em;
  min-height: 1.5em;
}
.heard {
  font-family: var(--kai);
  font-size: var(--t-lead);
  line-height: 1.8;
  text-align: center;
  max-width: 18em;
  animation: ink-in 0.8s var(--breath) both;
}

.mic {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: transparent;
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  transition:
    background 0.3s var(--breath),
    color 0.3s,
    transform 0.3s var(--breath);
}
.mic svg {
  width: 42%;
  height: 42%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}
.mic-large {
  width: 92px;
  height: 92px;
}
.mic-small {
  width: 44px;
  height: 44px;
  flex: none;
}
.mic-ripple {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  pointer-events: none;
}
.mic[data-state="recording"] {
  background: var(--ink);
  color: var(--paper);
  transform: scale(1.06);
}
.mic[data-state="recording"] .mic-ripple {
  animation: ripple 1.6s var(--breath) infinite;
  box-shadow: 0 0 0 0 rgba(31, 42, 51, 0.35);
}
@keyframes ripple {
  to {
    box-shadow: 0 0 0 28px rgba(31, 42, 51, 0);
  }
}
.mic[data-state="working"] .mic-ripple {
  border: 1px solid transparent;
  border-top-color: var(--ink);
  inset: -6px;
  animation: spin 1.4s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.ask {
  display: grid;
  gap: 28px;
  padding-top: 40px;
}
.voice-hero:not([hidden]) + .ask::before {
  content: "或者，写下来";
  font-size: var(--t-small);
  color: var(--ink-faint);
  text-align: center;
  letter-spacing: 0.1em;
  margin-bottom: -8px;
}

.field {
  display: grid;
  gap: 8px;
  border: 0;
  padding: 0;
  margin: 0;
}
.field-label {
  font-size: var(--t-small);
  color: var(--ink-soft);
  letter-spacing: 0.08em;
}
.field-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

textarea,
.option-input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: 6px 0 10px;
  font-size: var(--t-lead);
  line-height: 1.7;
  resize: none;
  border-radius: 0;
  transition: border-color 0.3s;
}
textarea:focus,
.option-input:focus {
  outline: none;
  border-bottom-color: var(--ink);
}
textarea::placeholder,
.option-input::placeholder {
  color: var(--ink-faint);
}
.ask.filled textarea,
.ask.filled .option-input {
  animation: ink-in 0.8s var(--breath) both;
}

.option-list {
  display: grid;
  gap: 4px;
}
.option-row {
  display: grid;
  grid-template-columns: 1.6em 1fr auto;
  align-items: baseline;
  gap: 6px;
}
.option-row .fork {
  color: var(--ink-faint);
  font-size: var(--t-small);
}
.option-row .remove {
  border: 0;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px;
}
.form-error {
  color: var(--rouge);
  font-size: var(--t-small);
  min-height: 1.4em;
  margin-bottom: -16px;
}

.examples {
  margin-top: 56px;
}
.examples ul {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: grid;
  gap: 10px;
}
.examples li button {
  display: grid;
  grid-template-columns: 4.6em 1fr;
  gap: 10px;
  align-items: baseline;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  padding: 10px 0;
  text-align: left;
  line-height: 1.6;
  cursor: pointer;
  color: var(--ink);
}
.examples li button:hover {
  color: var(--rouge);
}
.ex-tag {
  font-size: var(--t-small);
  color: var(--ink-faint);
}
.examples ul {
  gap: 0 !important;
}
#moreExamples {
  margin-top: 8px;
}

/* ---------- ② cards ---------- */

.progress {
  height: 1px;
  background: var(--rule);
  margin: -24px 0 40px;
}
.progress span {
  display: block;
  height: 1px;
  width: 0;
  background: var(--ink);
  transition: width 0.6s var(--breath);
}
.step-hint {
  font-size: var(--t-small);
  letter-spacing: 0.08em;
}
.card {
  margin-top: 56px;
}
.card.enter {
  animation: ink-in 0.6s var(--breath) both;
}
.card-count {
  font-size: var(--t-small);
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  margin-bottom: 8px;
}
.card h2 {
  font-size: var(--t-h2);
  font-weight: 600;
  line-height: 1.5;
  min-height: 3em;
}
.card .answers {
  display: grid;
  gap: 14px;
  margin-top: 40px;
}
.card .answer {
  text-align: left;
  border: 1px solid var(--rule);
  background: var(--card);
  border-radius: 14px;
  padding: 18px 20px;
  font-size: var(--t-lead);
  cursor: pointer;
  transition:
    background 0.3s var(--breath),
    color 0.3s var(--breath),
    border-color 0.3s;
}
.card .answer:hover {
  border-color: var(--ink);
}
.card .answer.chosen {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.card .skip {
  margin-top: 24px;
}
.note-step {
  margin-top: 64px;
  display: grid;
  gap: 40px;
  animation: ink-in 0.6s var(--breath) both;
}

/* ---------- breathing overlay ---------- */

.ritual {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 28px;
  padding: 0 var(--gutter);
  background: rgba(232, 237, 239, 0.94);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: ink-in 0.6s var(--breath) both;
}
.ritual.leaving {
  animation: ink-out 0.5s var(--breath) both;
}
/* over the tree: transparent, so the threads grow beneath the orb */
.ritual.over-stage {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  place-content: start center;
  padding-top: min(16dvh, 130px);
  pointer-events: none;
}
.ritual.over-stage .ritual-skip {
  pointer-events: auto;
}

.orb {
  position: relative;
  width: 220px;
  height: 220px;
  transform: scale(0.5);
  will-change: transform;
}
.ritual.over-stage .orb {
  width: 180px;
  height: 180px;
}
.orb-core,
.orb-halo {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}
.orb-core {
  background: radial-gradient(
    circle,
    rgba(31, 42, 51, 0.92) 0 14%,
    rgba(31, 42, 51, 0.5) 36%,
    rgba(31, 42, 51, 0.12) 60%,
    transparent 70%
  );
  transition: opacity 1.2s var(--breath);
}
.orb-halo {
  border: 1px solid rgba(31, 42, 51, 0.18);
  transform: scale(1.18);
}
.orb[data-phase="hold"] .orb-halo {
  animation: halo 2s var(--breath) infinite;
}
@keyframes halo {
  50% {
    transform: scale(1.26);
    opacity: 0.4;
  }
}
.orb-arc {
  position: absolute;
  inset: -14%;
  width: 128%;
  height: 128%;
  transform: rotate(-90deg);
}
.orb-arc circle {
  fill: none;
  stroke: var(--ink);
  stroke-width: 0.5;
  stroke-dasharray: 301.6;
  stroke-dashoffset: 301.6;
  opacity: 0.6;
}
.ritual.over-stage .orb[data-phase="out"] .orb-core {
  opacity: 0.25;
}
@keyframes tremble {
  25% {
    transform: translateX(-1.5px);
  }
  75% {
    transform: translateX(1.5px);
  }
}

.ritual-text {
  font-size: var(--t-lead);
  line-height: 1.8;
  letter-spacing: 0.12em;
  text-align: center;
  min-height: 3.6em;
  max-width: 14em;
  opacity: 0;
}
.ritual-text.show {
  animation: ink-in 1s var(--breath) both;
  opacity: 1;
}
.ritual-skip {
  justify-self: center;
  font-size: var(--t-small);
}

/* ---------- ④ futures ---------- */

.screen.futures {
  padding: 52px 0 48px;
}
.stage {
  position: relative;
  height: min(64dvh, 560px);
  transition: height 0.7s var(--breath);
}
.futures.exploring .stage {
  height: min(36dvh, 320px);
}
.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
  cursor: pointer;
}

.stage-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-size: var(--t-small);
  --ridge: 0;
}
.stage-labels span {
  position: absolute;
  white-space: nowrap;
  text-shadow:
    0 0 6px var(--paper),
    0 0 3px var(--paper);
}
.stage-labels .opt {
  font-size: var(--t-body);
  font-weight: 600;
  transform: translateY(-120%);
  animation: ink-in 1s 1.5s var(--breath) both;
}
.stage-labels .time {
  color: var(--ink-soft);
}
.stage-labels .axis {
  color: var(--ink-soft);
  font-size: 0.7rem;
  opacity: 0;
  transition: opacity 0.8s;
}
.stage-labels.show-axis .axis {
  opacity: 1;
}
.stage-labels .count {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  opacity: var(--ridge);
}
.stage-labels .count.up {
  color: var(--ink);
  font-weight: 600;
}
.stage-labels .count.down {
  color: var(--ink-faint);
}

.guide {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  top: calc(100% + 12px); /* below the tree, so it never covers a path */
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  padding: 14px 16px;
  background: rgba(244, 246, 244, 0.93);
  border-radius: 12px;
  box-shadow: 0 10px 30px -20px rgba(31, 42, 51, 0.6);
}
.guide.show {
  animation: ink-in 0.7s var(--breath) both;
}
.guide p {
  font-size: var(--t-body);
  line-height: 1.8;
}
.guide b {
  font-weight: 900;
  font-size: 1.15em;
}
.guide .text-btn {
  padding: 0;
  white-space: nowrap;
}

.results {
  padding: 8px var(--gutter) 0;
}
.results.reveal {
  animation: ink-in 1s var(--breath) both;
}
.option-result {
  padding: 40px 0 8px;
  border-top: 1px solid var(--rule);
}
.option-result:first-child {
  border-top: 0;
  padding-top: 24px;
}
.option-result h2 {
  font-size: var(--t-h2);
  font-weight: 600;
}
.verdict {
  margin-top: 14px;
  font-size: var(--t-lead);
  line-height: 2;
}
.verdict .count {
  font-size: var(--t-num);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  padding: 0 0.12em;
  vertical-align: -0.12em;
  transition: color 0.4s;
}
.verdict .count.shifted {
  color: var(--rouge);
}
.spread {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: var(--t-small);
}

.postcards {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 80%;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  margin: 24px calc(-1 * var(--gutter)) 0;
  padding: 8px 10% 14px; /* lets the first and last card sit in the centre */
  scrollbar-width: none;
  perspective: 900px;
}
.postcards .postcard {
  scroll-snap-align: center;
  transform-origin: center;
  will-change: transform, opacity;
}
.carousel-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 4px;
}
.carousel-nav button.arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.carousel-nav button.arrow:disabled {
  opacity: 0.3;
  cursor: default;
}
.carousel-dots {
  display: flex;
  gap: 8px;
}
.carousel-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--rule);
  cursor: pointer;
  transition: background 0.3s, transform 0.3s;
}
.carousel-dots button[aria-current="true"] {
  background: var(--ink);
  transform: scale(1.25);
}
.postcards::-webkit-scrollbar {
  display: none;
}
.postcard {
  scroll-snap-align: start;
  background: var(--card);
  border-radius: 4px;
  padding: 18px 20px 20px;
  box-shadow:
    0 1px 0 var(--rule),
    0 10px 24px -18px rgba(31, 42, 51, 0.5);
  display: grid;
  gap: 10px;
  align-content: start;
}
.postcard .kind {
  font-size: var(--t-small);
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.postcard h3 {
  font-family: var(--kai);
  font-size: var(--t-lead);
  font-weight: 400;
}
.postcard .body {
  font-family: var(--kai);
  font-size: 1.06rem;
  line-height: 1.95;
}
.postcard .facts {
  font-size: 0.72rem;
  color: var(--ink-faint);
  line-height: 1.7;
}
.postcard.pending .body,
.postcard.pending h3 {
  color: var(--ink-faint);
  animation: pulse 2.4s var(--breath) infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}

.levers {
  margin-top: 20px;
}
.levers h3 {
  font-size: var(--t-body);
  font-weight: 600;
}
.levers p.muted {
  font-size: var(--t-small);
  margin-top: 2px;
}
.levers ul {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}
.lever {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: baseline;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  padding: 12px 0;
  cursor: pointer;
  transition: color 0.3s;
}
.lever .gain {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  white-space: nowrap;
}
.lever[aria-pressed="true"],
.lever[aria-pressed="true"] .gain {
  color: var(--rouge);
}

.explore-cta {
  margin: 48px 0 0;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  display: grid;
  gap: 20px;
}

/* explore: the tree shrinks to the top, a paper sheet rises from below */
.futures.exploring .results {
  display: none;
}
.sheet-panel {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: var(--col);
  height: calc(100dvh - min(36dvh, 320px) - 40px);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -18px 40px -28px rgba(31, 42, 51, 0.55);
  z-index: 20;
  overflow: hidden;
  animation: rise 0.7s var(--breath) both;
}
.sheet-scroll {
  flex: 1;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 22px var(--gutter) 16px;
  overscroll-behavior: contain;
}
@keyframes rise {
  from {
    transform: translate(-50%, 40%);
    opacity: 0;
  }
}
.sheet-panel .postcard {
  box-shadow: none;
  background: transparent;
  padding: 0;
}
.feel,
.chip-btn {
  border: 1px solid var(--rule);
  background: var(--card);
  border-radius: 18px;
  padding: 6px 14px;
  font-size: 0.92rem;
  cursor: pointer;
  transition:
    background 0.3s var(--breath),
    color 0.3s,
    border-color 0.3s;
}
.feel:hover,
.chip-btn:hover {
  border-color: var(--ink);
}
.feel[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.chip-btn.rouge {
  color: var(--rouge);
  border-color: rgba(179, 38, 62, 0.4);
}
.tray {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px var(--gutter) calc(14px + env(safe-area-inset-bottom));
  background: var(--paper);
}
.tray p {
  font-size: var(--t-small);
  color: var(--ink-soft);
}
.tray .primary {
  width: auto;
  min-height: 44px;
  padding: 0 22px;
  opacity: 0.55;
}
.tray .primary.ready {
  opacity: 1;
}

/* ---------- step indicator ---------- */

.topbar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--col);
  z-index: 45;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 10px var(--gutter) 8px;
  background: linear-gradient(var(--paper) 70%, rgba(232, 237, 239, 0));
}
.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sound-toggle {
  width: 32px;
  height: 32px;
  margin-top: -4px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
}
.sound-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sound-toggle .mute,
.sound-toggle[aria-pressed="false"] .waves {
  display: none;
}
.sound-toggle[aria-pressed="false"] .mute {
  display: inline;
}
.steps li {
  counter-increment: step;
  display: grid;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}
.steps li::before {
  content: "";
  height: 2px;
  border-radius: 1px;
  background: var(--rule);
  transition: background 0.5s var(--breath);
}
.steps li.done::before,
.steps li.current::before {
  background: var(--ink);
}
.steps li.current {
  color: var(--ink);
  font-weight: 600;
}
.screen {
  padding-top: 64px;
}

/* ---------- reading a future ---------- */

.want {
  display: grid;
  gap: 8px;
  padding: 12px var(--gutter);
  border-top: 1px solid var(--rule);
  box-shadow: 0 -12px 20px -16px rgba(31, 42, 51, 0.35);
}
.want-q {
  font-size: var(--t-body);
  font-weight: 600;
}
.want-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* seven feelings: four, then three */
  gap: 8px;
}
.want-btn {
  display: grid;
  place-items: center;
  line-height: 1.2;
  min-height: 44px;
  padding: 0 4px;
  white-space: nowrap;
  border: 1px solid var(--rule);
  background: var(--card);
  border-radius: 14px;
  font-size: var(--t-body);
  cursor: pointer;
  transition: background 0.3s var(--breath), color 0.3s, border-color 0.3s;
}
.want-btn:hover {
  border-color: var(--ink);
}
.want-btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 var(--gutter);
}
.more-q {
  font-size: var(--t-small);
  color: var(--ink-soft);
}
.more-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.more-btn {
  border: 1px solid var(--ink);
  background: transparent;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: var(--t-body);
  cursor: pointer;
  transition: background 0.3s var(--breath), color 0.3s;
}
.more-btn:hover {
  background: var(--ink);
  color: var(--paper);
}
.more-btn.rouge {
  border-color: var(--rouge);
  color: var(--rouge);
}
.more-btn.rouge:hover {
  background: var(--rouge);
  color: var(--paper);
}

/* ---------- the one breath ---------- */

/* on the exhale everything but the circle fades at once; the circle flows into 今天 */
.ritual.releasing .ritual-hint,
.ritual.releasing .ritual-text,
.ritual.releasing .ritual-skip {
  opacity: 0 !important;
  transition: opacity 0.6s ease 0.5s; /* "呼气" stays readable for a beat */
}
.ritual.releasing .orb {
  opacity: 0;
}
.ritual.releasing .orb-arc,
.ritual.releasing .orb-halo {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.ritual-hint {
  font-size: var(--t-body);
  color: var(--ink-soft);
  letter-spacing: 0.12em;
  text-align: center;
}
.orb.waiting .orb-core {
  animation: rest 3s var(--breath) infinite;
}
@keyframes rest {
  50% {
    opacity: 0.55;
  }
}

/* ---------- destiny moments ---------- */

/* the drawn stick lands: the tree takes a small breath */
.stage.land canvas {
  animation: land 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
@keyframes land {
  30% {
    transform: scale(1.025);
  }
}
/* the seal slams down */
.app.shake {
  animation: shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
@keyframes shake {
  15% {
    transform: translate(-3px, 2px);
  }
  30% {
    transform: translate(3px, -2px);
  }
  45% {
    transform: translate(-2px, 1px);
  }
  60% {
    transform: translate(1px, 0);
  }
}
.stamp-wrap {
  position: relative;
}
.stamp-wrap .stamp {
  position: relative;
  z-index: 1;
}
.speck {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  margin: -3.5px;
  border-radius: 50%;
  background: var(--rouge);
  opacity: 0;
  animation: speck 0.9s cubic-bezier(0.1, 0.7, 0.3, 1) forwards;
}
@keyframes speck {
  0% {
    opacity: 0.9;
    transform: translate(0, 0) scale(var(--s));
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(calc(var(--s) * 0.4));
  }
}

/* 抽一签 in progress */
.drawing {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: var(--t-lead);
  color: var(--ink-soft);
  padding: 18px 0;
}
.stick {
  display: grid;
  place-items: center;
  width: 30px;
  height: 64px;
  border-radius: 4px;
  background: var(--rouge);
  color: var(--paper);
  font-weight: 900;
  font-size: 1rem;
  writing-mode: vertical-rl;
  animation: rattle 0.28s ease-in-out infinite;
}
@keyframes rattle {
  25% {
    transform: rotate(-9deg) translateY(-3px);
  }
  75% {
    transform: rotate(9deg) translateY(-3px);
  }
}
.sheet-panel.spinning .want-btn,
.sheet-panel.spinning .more-btn,
.sheet-panel.spinning #toDecide {
  opacity: 0.4;
  pointer-events: none;
}

/* poster preview */
.poster-preview {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  background: rgba(31, 42, 51, 0.72);
  backdrop-filter: blur(4px);
  animation: ink-in 0.5s var(--breath) both;
}
.poster-preview img {
  max-height: 74dvh;
  max-width: min(88vw, 420px);
  border-radius: 6px;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6);
}
.poster-preview .muted {
  color: rgba(232, 237, 239, 0.75);
}
.poster-actions {
  display: flex;
  gap: 18px;
  align-items: center;
}
.poster-actions .primary {
  display: grid;
  place-items: center;
  width: auto;
  padding: 0 28px;
  text-decoration: none;
  background: var(--paper);
  color: var(--ink);
}
.poster-actions .text-btn {
  color: rgba(232, 237, 239, 0.85);
}

/* ---------- remind + check-in ---------- */

.remind-box {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--card);
}
.remind-box p:first-child {
  font-size: var(--t-lead);
}
.checkin-then {
  color: var(--ink-soft);
  line-height: 1.9;
}
.level-buttons {
  display: grid;
  gap: 8px;
}
.level-buttons button {
  text-align: left;
  border: 1px solid var(--rule);
  background: var(--card);
  border-radius: 12px;
  padding: 12px 18px;
  font-size: var(--t-body);
  cursor: pointer;
  transition: background 0.3s var(--breath), color 0.3s, border-color 0.3s;
}
.level-buttons button[aria-checked="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.level-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  color: var(--ink-faint);
  letter-spacing: 0.2em;
}
.level-line::before,
.level-line::after {
  content: "";
  flex: 1;
  border-top: 1px dashed var(--ink-faint);
}
.checkin-verdict {
  font-size: var(--t-lead);
  line-height: 1.9;
}
.archive li .text-btn {
  justify-self: start;
  font-size: var(--t-small);
  padding: 2px 0;
}

/* ---------- ⑤ decide ---------- */

.sheet {
  display: grid;
  align-content: start;
  gap: 20px;
  padding-top: 72px;
}
.sheet-title {
  font-size: var(--t-h2);
  font-weight: 600;
  line-height: 1.5;
}
.weigh {
  display: grid;
  gap: 18px;
}
.weigh-row {
  display: grid;
  gap: 8px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}
.weigh-row h3 {
  font-size: var(--t-lead);
  font-weight: 600;
}
.weigh-line {
  display: grid;
  grid-template-columns: 4.5em 1fr;
  gap: 12px;
  align-items: baseline;
  font-size: var(--t-body);
}
.weigh-line b {
  font-weight: 900;
  font-size: 1.2em;
}
.weigh-label {
  color: var(--ink-soft);
  font-size: var(--t-small);
}
.weigh-verdict {
  font-size: var(--t-lead);
  line-height: 1.9;
}
.choose-title {
  font-size: var(--t-body);
  font-weight: 600;
  margin-top: 12px;
}
.commit-options {
  display: grid;
  gap: 12px;
}
.commit-options button {
  text-align: left;
  border: 1px solid var(--rule);
  background: var(--card);
  border-radius: 14px;
  padding: 16px 20px;
  font-size: var(--t-lead);
  cursor: pointer;
  transition:
    box-shadow 0.3s,
    border-color 0.3s;
}
.commit-options button[aria-checked="true"] {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

/* ---------- ⑥ sealed ---------- */

.stamp-wrap {
  display: grid;
  place-items: center;
  padding: 24px 0 8px;
}
.stamp {
  --per: 2;
  width: 136px;
  height: 136px;
  display: flex;
  flex-direction: row-reverse; /* first column on the right, as seals are read */
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 12px;
  background: var(--rouge);
  color: var(--paper);
  font-weight: 900;
  font-size: calc(104px / max(2, var(--per)));
  line-height: 1.02;
  border-radius: 6px;
  box-shadow: inset 0 0 0 4px rgba(232, 237, 239, 0.25);
  opacity: 0;
  transform: scale(1.8) rotate(-12deg);
}
.stamp span {
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 0.02em;
}
.stamp.down {
  animation: stamp 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards;
}
@keyframes stamp {
  0% {
    opacity: 0;
    transform: scale(1.8) rotate(-12deg);
  }
  70% {
    opacity: 1;
    transform: scale(0.96) rotate(-4deg);
  }
  100% {
    opacity: 0.94;
    transform: scale(1) rotate(-4deg);
  }
}
.check {
  display: flex;
  gap: 10px;
  align-items: center;
}
.check input {
  accent-color: var(--ink);
  width: 18px;
  height: 18px;
}
.archive {
  margin-top: 24px;
}
.archive h3 {
  font-size: var(--t-body);
  font-weight: 600;
}
.archive ol {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.archive li {
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  display: grid;
  gap: 2px;
}
.archive li span {
  font-size: var(--t-small);
  color: var(--ink-soft);
}

.mode-badge {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--col);
  padding: 4px var(--gutter);
  font-size: 0.68rem;
  line-height: 1.6;
  color: var(--ink-faint);
  background: rgba(232, 237, 239, 0.92);
  pointer-events: none;
  z-index: 60;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .stamp {
    opacity: 0.94;
    transform: rotate(-4deg);
  }
}
