:root {
  --ink: #f4efe4;
  --muted: rgba(244, 239, 228, 0.68);
  --faint: rgba(244, 239, 228, 0.48);
  --line: rgba(244, 239, 228, 0.16);
  --gold: #f0c27a;
  --ink-deep: #2a2116;
  --vvh: 100dvh;
  --vvt: 0px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #0c1020;
  color: var(--ink);
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button, textarea { font: inherit; color: inherit; }
button {
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}
textarea { user-select: text; -webkit-user-select: text; }

h1, h2, .phase-word, .card-line, .title-word, .choice b {
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", "Songti SC", "STSong", "Noto Serif SC", serif;
  font-weight: 500;
  margin: 0;
}

canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.ui {
  position: fixed;
  z-index: 1;
  left: 0;
  right: 0;
  top: var(--vvt);
  height: var(--vvh);
  display: flex;
  flex-direction: column;
  padding:
    calc(8px + env(safe-area-inset-top))
    calc(18px + env(safe-area-inset-right))
    calc(8px + env(safe-area-inset-bottom))
    calc(18px + env(safe-area-inset-left));
  pointer-events: none;
}

.ui, .ui * { pointer-events: none; }
.ui button, .ui a, .ui textarea, .ui .card, .backdrop, .backdrop * { pointer-events: auto; }
#hapticsBtn.is-off { opacity: 0.38; }

.bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  pointer-events: none;
}

.grow { flex: 1; min-height: 12px; pointer-events: none; }

.stack {
  width: min(480px, 100%);
  margin: 0 auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  scrollbar-width: none;
}
.stack::-webkit-scrollbar { display: none; }

.screen {
  display: none;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  gap: 12px;
  animation: rise 0.55s ease both;
}
.for-weather { justify-content: center; }

body[data-phase="title"] .for-title,
body[data-phase="weather"] .for-weather,
body[data-phase="breathe"] .for-breathe,
body[data-phase="gather"] .for-gather,
body[data-phase="bloom"] .for-bloom,
body[data-phase="garden"] .for-garden {
  display: flex;
}

.top-copy { padding-top: 4px; }
.center { text-align: center; }
.bottom-copy { padding-bottom: 4px; }

.title-word {
  font-size: clamp(64px, 18vw, 92px);
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  line-height: 1;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.phase-word {
  font-size: clamp(44px, 12vw, 68px);
  letter-spacing: 0.12em;
  line-height: 1.05;
  min-height: 1.1em;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

h2 {
  font-size: clamp(28px, 7vw, 36px);
  letter-spacing: 0.06em;
  line-height: 1.25;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 16px;
  letter-spacing: 0.04em;
}

.quiet, .micro {
  margin: 8px 0 0;
  color: var(--faint);
  font-size: 13px;
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: auto;
}
.actions.slim { margin-top: 4px; }
.actions button { width: 100%; }

.gold, .quiet-btn, .ghost, .choice {
  transition: transform 0.18s ease, filter 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.gold {
  min-height: 54px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f7e1b8, #e4b15e);
  color: var(--ink-deep);
  font-weight: 650;
  letter-spacing: 0.06em;
  box-shadow: 0 12px 30px rgba(228, 177, 94, 0.22);
}

.quiet-btn {
  min-height: 50px;
  border-radius: 999px;
  background: rgba(14, 18, 32, 0.72);
  border: 1px solid var(--line);
  letter-spacing: 0.04em;
}

.ghost {
  min-height: 46px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.ghost.left { text-align: left; padding-left: 2px; }

.gold:active, .quiet-btn:active, .choice:active { transform: scale(0.985); }

.weather-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.choice {
  min-height: 108px;
  border-radius: 22px;
  background: rgba(12, 16, 30, 0.82);
  border: 1px solid var(--line);
  text-align: left;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
}
.choice b { font-size: 34px; letter-spacing: 0.08em; }
.choice span { color: var(--muted); font-size: 13px; }

.dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}
.dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(244, 239, 228, 0.28);
  display: block;
}
.dots i.on { background: var(--gold); }
.dots i.now {
  box-shadow: 0 0 0 4px rgba(240, 194, 122, 0.16);
  background: #fff6dc;
}

.icon-btn, .textish {
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
  color: var(--ink);
  display: grid;
  place-items: center;
  background: rgba(12, 16, 30, 0.45);
  border: 1px solid transparent;
}
.textish {
  padding: 0 12px;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.icon-btn .icon-off { display: none; }
.icon-btn.is-off .icon-on { display: none; }
.icon-btn.is-off .icon-off { display: block; }

.card {
  position: fixed;
  z-index: 4;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: min(86vw, 400px);
  padding: 26px 22px 18px;
  border-radius: 28px;
  background: rgba(10, 12, 22, 0.78);
  border: 1px solid var(--line);
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.card-line {
  font-size: clamp(22px, 5.6vw, 30px);
  line-height: 1.45;
  letter-spacing: 0.03em;
  margin-bottom: 16px;
}
.kicker {
  margin: 0 0 8px;
  color: var(--gold);
  letter-spacing: 0.12em;
  font-size: 13px;
}
.echo {
  font-family: "Iowan Old Style", Palatino, "Songti SC", serif;
  font-size: 18px;
  line-height: 1.5;
  margin: 12px 0 0;
  color: var(--muted);
}

.hint {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 3;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(12, 16, 30, 0.72);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  letter-spacing: 0.08em;
  animation: pulse 1.8s ease-in-out infinite;
}

textarea {
  width: 100%;
  margin-top: 8px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(8, 10, 20, 0.76);
  padding: 14px 16px;
  font-size: 16px;
  line-height: 1.5;
  resize: none;
  color: var(--ink);
}
.row { display: flex; gap: 8px; margin-top: 10px; }
.row .gold { flex: 1.4; }
.row .quiet-btn { flex: 1; }

.desktop-hint { display: none; }

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 6;
  background: rgba(6, 8, 16, 0.64);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.sheet {
  width: min(520px, 100%);
  max-height: min(82dvh, 680px);
  overflow: auto;
  background: #161a28;
  border-radius: 24px;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sheet-lead { margin: 8px 0 14px; line-height: 1.6; color: var(--muted); }
.hotline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  padding: 12px 14px;
  margin-top: 8px;
  border-radius: 16px;
  background: #222838;
  color: inherit;
  text-decoration: none;
}
.hotline span { color: var(--muted); font-size: 14px; }
.hotline b {
  font-size: 20px;
  letter-spacing: 0.03em;
  font-weight: 650;
}
.sheet-note { margin: 14px 0; }
.noscript {
  position: fixed;
  inset: auto 16px 24px;
  z-index: 8;
  padding: 16px;
  border-radius: 16px;
  background: #161a28;
}
.noscript a { color: var(--gold); }

button:focus-visible, a:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

@media (hover: hover) and (pointer: fine) {
  .desktop-hint { display: block; }
  .gold:hover { filter: brightness(1.04); }
  .choice:hover, .quiet-btn:hover, .hotline:hover { border-color: rgba(240, 194, 122, 0.45); }
  .hotline:hover { border: 1px solid rgba(240, 194, 122, 0.45); }
}

@media (max-height: 520px) {
  .choice { min-height: 74px; }
  .choice b { font-size: 26px; }
  .title-word { font-size: 48px; }
  .phase-word { font-size: 36px; }
  .for-weather { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
