:root {
  /* 背景は端末の設定によらず常にダークグリーン（NFR-LOOK-001）。ライトモードの配色を足さない */
  --bg: #1b2220;
  --bg-glow: #222b28;
  --surface: #242d2a;
  --ink: #e9e5dc;
  --muted: #a39e94;
  --line: #36423d;
  --leaf: #94b59c;
  --leaf-deep: #a9c7b0;
  --leaf-soft: #2c3a33;
  --gold: #d8bd86;
  --on-leaf: #1b2220;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  --radius: 22px;
  --font: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(120% 70% at 50% 0%, var(--bg-glow) 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.9;
  letter-spacing: 0.04em;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative; /* 背景画像（.home-bg）をページ全体に貼るため */
}

button, textarea { font: inherit; color: inherit; letter-spacing: inherit; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- S-01・S-02 の背景（FR-LOOK-007・010） ----
   左右の金の木を画面の下まで伸ばした画像に、ダークグリーンを薄く重ねる。S-03 ではふわっと消して元の背景に戻す。
   画面ではなくページ全体に貼るので、スクロールしても背景と文字がずれない */
.home-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden; /* 揺れる葉の層が画面の横へはみ出さないように */
  opacity: 0;
  transition: opacity 0.8s ease;
  /* ページが縦に長くても左右の幹が見えるよう横を少し縮め、上12%を切って葉の帯を細くする。葉の揺れの層も同じ絵を使う */
  --forest:
    linear-gradient(180deg, rgba(27, 34, 32, 0.1) 0%, rgba(27, 34, 32, 0.3) 35%, rgba(27, 34, 32, 0.3) 70%, rgba(27, 34, 32, 0.1) 100%),
    url("img/home-forest.webp") center bottom / max(125%, 100vw) 112% no-repeat;
  background: var(--forest), var(--bg);
}
body.on-forest .home-bg { opacity: 1; }
/* 「書いた内容は…」から「…大切にしてくださいね。」までの背景（金言記録の一覧を含む）だけ、
   光る根っこをぼかして薄いダークグリーンの膜を重ね、文字を際立たせる。上の端はなじませる（2026-11-16 TOSHI指示） */
.home-bg::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: var(--veil-top, calc(100% - 240px)); /* app.js が「書いた内容は…」の60px上に合わせる */
  bottom: 0;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  background: rgba(27, 34, 32, 0.25); /* 膜は薄め（2026-11-16 TOSHI指示で 0.45 → 0.25） */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 60px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 60px);
}

/* 上の葉の茂み（左右）だけを、風に吹かれるようにゆっくり揺らす（FR-LOOK-013）。
   同じ絵を上の帯だけ切り出して重ね、枝の付け根を中心にわずかに回す。下へ向かってぼかし、根っこは動かさない */
.leaves-sway {
  position: absolute;
  inset: 0;
  background: var(--forest);
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 8%, transparent 14%);
  mask-image: linear-gradient(to bottom, #000 0, #000 8%, transparent 14%);
  will-change: transform;
}
.leaves-sway--left {
  clip-path: inset(0 50% 0 0);
  transform-origin: 6% 13%;
  animation: leaves-sway-left 5s ease-in-out infinite alternate;
}
.leaves-sway--right {
  clip-path: inset(0 0 0 50%);
  transform-origin: 94% 13%;
  animation: leaves-sway-right 6.2s ease-in-out infinite alternate;
  animation-delay: -2s;
}
@keyframes leaves-sway-left {
  from { transform: rotate(-0.5deg); }
  to { transform: rotate(0.6deg); }
}
@keyframes leaves-sway-right {
  from { transform: rotate(0.5deg); }
  to { transform: rotate(-0.6deg); }
}

/* 上の葉から吊り下げた、内側から光るプレゼントボックス（FR-LOOK-013）。
   黒い背景の絵を screen で重ね、光だけを見せる。紐の付け根を中心にゆっくり揺らす。題字には重ねない */
.gift {
  position: absolute;
  top: -12px;
  background: center top / 100% 100% no-repeat;
  mix-blend-mode: screen;
  transform-origin: 50% 0;
  animation: gift-sway 4.6s ease-in-out infinite alternate;
}
.gift--1 { left: 5%; width: 34px; aspect-ratio: 200 / 371; background-image: url("img/gift-1.webp"); animation-duration: 4.2s; }
.gift--2 { left: 27%; width: 36px; aspect-ratio: 200 / 535; background-image: url("img/gift-2.webp"); animation-duration: 5.1s; animation-delay: -1.3s; }
.gift--3 { right: 6%; width: 38px; aspect-ratio: 200 / 330; background-image: url("img/gift-3.webp"); animation-duration: 4.7s; animation-delay: -2.4s; }
@keyframes gift-sway {
  from { transform: rotate(-4deg); }
  to { transform: rotate(4deg); }
}
/* 光る木や根っこの上でも読めるよう、文字に濃い影を付ける */
body.on-forest .hero-presents,
body.on-forest .question,
body.on-forest .lead,
body.on-forest .privacy,
body.on-forest .saved-entry,
body.on-forest .breath-text { text-shadow: 0 0 3px rgba(10, 16, 13, 0.95), 0 1px 10px rgba(10, 16, 13, 0.9); }
body.on-forest .privacy { color: #e8e2d4; }
/* 題字が大きくなったぶん、題字と問いの間を詰める */
body.on-forest main { padding-top: 24px; }
body.on-forest .question { margin-top: 0; }
body.on-forest .site-footer {
  color: #e8e2d4;
  text-shadow: 0 0 3px rgba(10, 16, 13, 0.95), 0 1px 10px rgba(10, 16, 13, 0.95), 0 0 18px rgba(10, 16, 13, 0.8);
}

/* ---- header / footer ---- */
.site-header {
  text-align: center;
  padding: calc(28px + env(safe-area-inset-top)) 20px 0;
  position: relative;
  z-index: 1;
}
/* 画面上部: 枠はなく、背景の左右の金の木の間に文字を置く（FR-LOOK-007）。位置と大きさは変えない */
.hero {
  position: relative;
  min-height: 184px;
  padding: 68px 0 0; /* 背景の葉にかからないよう、元より28px下げる。下の問い・入力欄・注記も一緒に動く（2026-11-16 TOSHI指示） */
}
.hero > p { position: relative; z-index: 1; }
.hero p { margin: 0; }
.hero-presents {
  display: inline-block;
  font-size: 13.5px; /* 上部の3行は元の約1.5倍（2026-11-16 TOSHI指示） */
  letter-spacing: 0.22em;
}
.hero-title {
  display: block;
  width: fit-content;
  margin: 0 auto !important;
  padding: 0.1em 0.1em 0.14em;
  font-family: "Great Vibes", cursive;
  font-size: clamp(36px, 11.7vw, 51px);
  font-weight: 400;
  white-space: nowrap;
  line-height: 1.2;
  letter-spacing: 0;
}
.hero-name {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.18em;
}

/* 光沢のある金の文字（FR-LOOK-002）。色は The Golden Wood の画像の文字から実測 */
.gold-foil {
  color: #f9c153;
}
@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  .gold-foil {
    background-image:
      linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, 0.95) 50%, transparent 58%),
      linear-gradient(180deg, #fff3b6 0%, #fde18b 24%, #f9c153 48%, #e59f2c 72%, #fde18b 100%);
    background-repeat: no-repeat, repeat;
    background-size: 300% 100%, 100% var(--foil-line, 100%);
    background-position: 160% 0, 0 0;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 5px rgba(249, 193, 83, 0.4)) drop-shadow(0 1px 1px rgba(0, 0, 0, 0.55));
    animation: gold-shine 6s ease-in-out infinite;
  }
}
/* 上部の「AIよつば」と同じ金の色・影で、光を流さない（金言記録の入口、金言の見出し、Special Hint） */
.gold-still {
  color: #f9c153;
}
@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  .gold-still {
    background-image: linear-gradient(180deg, #fff3b6 0%, #fde18b 24%, #f9c153 48%, #e59f2c 72%, #fde18b 100%);
    /* 見出しが2行になっても、行ごとに同じ金のグラデーションにする（gold-foil と同じ） */
    background-repeat: repeat;
    background-size: 100% var(--foil-line, 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 5px rgba(249, 193, 83, 0.4)) drop-shadow(0 1px 1px rgba(0, 0, 0, 0.55));
  }
}
@keyframes gold-shine {
  0%, 62% { background-position: 160% 0, 0 0; }
  100% { background-position: -60% 0, 0 0; }
}

main {
  flex: 1;
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: 32px 20px 24px;
  position: relative;
  z-index: 1;
}

.site-footer {
  max-width: 34rem;
  margin: 0 auto;
  padding: 8px 20px calc(28px + env(safe-area-inset-bottom));
  font-size: 11px;
  line-height: 1.8;
  color: var(--muted);
  text-align: left;
  position: relative;
  z-index: 1;
}
.site-footer p { margin: 0; }

/* ---- screens ---- */
.screen { display: none; }
.screen.is-active {
  display: block;
  animation: fade-in 0.9s ease both;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---- S-01 ---- */
.question {
  margin: 24px 0 0;
  text-align: center;
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 500;
  line-height: 1.7;
  letter-spacing: 0.08em;
}
.question:focus { outline: none; }
.lead {
  margin: 18px 0 36px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.ask-form { display: flex; flex-direction: column; }

textarea {
  width: 100%;
  min-height: 9.5em;
  resize: vertical;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  line-height: 1.9;
  font-size: 16px; /* iOSのズーム防止 */
  transition: border-color 0.3s, box-shadow 0.3s;
}
textarea::placeholder { color: var(--muted); opacity: 0.75; }
textarea:focus {
  outline: none;
  border-color: var(--leaf);
  box-shadow: 0 0 0 4px var(--leaf-soft), var(--shadow);
}

.length-warning {
  margin: 6px 8px 0 0;
  text-align: right;
  font-size: 13px;
  color: #fde18b;
}

/* 入力欄と送信ボタンは4対1のまま、スクロールなしでボタンが見える高さに合わせる（FR-LOOK-005）。
   458px は入力欄より上の高さ＋隙間＋画面下の余白。svh 未対応の端末は vh で代用する */
.ask-form { --ask-unit: clamp(44px, calc((100vh - 458px) / 5), 72px); }
@supports (height: 100svh) {
  .ask-form { --ask-unit: clamp(44px, calc((100svh - 458px) / 5), 72px); }
}
.ask-form textarea { height: calc(var(--ask-unit) * 4); }
.ask-form .btn-primary {
  min-height: var(--ask-unit);
  margin-top: 20px;
  font-size: 18px;
}

/* スマホ幅では問いと補足文を縮めて上に寄せる（FR-LOOK-006） */
@media (max-width: 759px) {
  .question {
    margin-top: 8px;
    font-size: 25px; /* 1行の長さを補足文の1行目「うまく…大丈夫。」とそろえる（2026-11-16 TOSHI指示） */
    line-height: 1.5;
  }
  .lead {
    margin: 10px 0 20px;
    font-size: 13px;
  }
}

.btn-primary, .btn-soft, .btn-text {
  min-height: 52px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.3s, opacity 0.3s, transform 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary {
  width: 100%;
  border: 0;
  background: var(--leaf);
  color: var(--on-leaf);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.14em;
}
.btn-primary:hover:not(:disabled) { background: var(--leaf-deep); }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.45; cursor: default; }
.btn-primary:focus-visible, .btn-soft:focus-visible, .btn-text:focus-visible {
  outline: 3px solid var(--leaf-soft);
  outline-offset: 3px;
}

/* 「言葉を受け取る」の光り方（FR-LOOK-009）。押せないときは静かにほのかに、押せるときは白いネオンがゆっくり脈打つ */
.ask-form .btn-primary {
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  background: #3a5745;
  color: #ffffff;
  text-shadow:
    0 0 3px rgba(255, 255, 255, 0.6),
    0 0 8px rgba(225, 255, 238, 0.35);
  box-shadow:
    0 0 4px rgba(255, 255, 255, 0.35),
    0 0 12px rgba(190, 245, 215, 0.2),
    inset 0 0 6px rgba(255, 255, 255, 0.12);
  animation: neon-pulse 2.8s ease-in-out infinite;
}
.ask-form .btn-primary:hover:not(:disabled) { background: #43644f; }
.ask-form .btn-primary:disabled {
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.07);
  background: #2a3a32;
  color: rgba(240, 250, 244, 0.8);
  text-shadow:
    0 0 4px rgba(255, 255, 255, 0.35),
    0 0 10px rgba(200, 240, 215, 0.22);
  box-shadow: none;
  animation: none;
}
@keyframes neon-pulse {
  0%, 100% {
    border-color: rgba(255, 255, 255, 0.75);
    text-shadow:
      0 0 3px rgba(255, 255, 255, 0.7),
      0 0 9px rgba(225, 255, 238, 0.4);
    box-shadow:
      0 0 5px rgba(255, 255, 255, 0.45),
      0 0 14px rgba(190, 245, 215, 0.25),
      inset 0 0 7px rgba(255, 255, 255, 0.15);
  }
  50% {
    border-color: rgba(255, 255, 255, 0.4);
    text-shadow:
      0 0 2px rgba(255, 255, 255, 0.4),
      0 0 5px rgba(225, 255, 238, 0.15);
    box-shadow:
      0 0 2px rgba(255, 255, 255, 0.18),
      0 0 6px rgba(190, 245, 215, 0.08),
      inset 0 0 3px rgba(255, 255, 255, 0.05);
  }
}

.privacy {
  margin: 20px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ---- S-02 ---- */
.breath {
  min-height: 52vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
}
.breath-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--leaf) 45%, #ffffff) 0%, var(--leaf) 75%);
  /* 縁は金の砂粒と同じ色の輝く線。外側に金の光をにじませ、ネオンのようにまたたかせる（FR-LOOK-014） */
  box-shadow:
    0 0 0 3px #f9c153,
    0 0 6px 3px rgba(255, 243, 182, 0.85),
    0 0 18px 6px rgba(249, 193, 83, 0.6),
    0 0 36px 12px rgba(229, 159, 44, 0.35),
    inset 0 0 10px rgba(253, 225, 139, 0.55);
  animation: breathe 3.2s ease-in-out both, breath-glow 1.6s ease-in-out infinite alternate;
}
@keyframes breath-glow {
  from {
    box-shadow:
      0 0 0 3px #f9c153,
      0 0 4px 2px rgba(255, 243, 182, 0.6),
      0 0 12px 4px rgba(249, 193, 83, 0.4),
      0 0 24px 8px rgba(229, 159, 44, 0.2),
      inset 0 0 8px rgba(253, 225, 139, 0.4);
  }
  to {
    box-shadow:
      0 0 0 3px #fde18b,
      0 0 8px 4px rgba(255, 243, 182, 1),
      0 0 24px 8px rgba(249, 193, 83, 0.75),
      0 0 48px 16px rgba(229, 159, 44, 0.45),
      inset 0 0 14px rgba(253, 225, 139, 0.7);
  }
}
@keyframes breathe {
  0% { transform: scale(0.7); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.75); opacity: 0.7; }
}
.breath-text {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
  letter-spacing: 0.2em;
  transition: opacity 0.6s;
}

/* ---- S-03 / S-04 ---- */
.echo { margin: 8px 0 28px; }
.echo figcaption {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.14em;
  margin-bottom: 6px;
}
.echo blockquote {
  margin: 0;
  padding: 2px 0 2px 16px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card {
  padding: 32px 26px 26px;
  border-radius: calc(var(--radius) + 6px);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: opacity 0.5s;
}
.card.is-changing { opacity: 0; }
.card-eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--leaf-deep);
}
.card-topic {
  margin: 6px 0 18px;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.7;
}
.card-topic:focus { outline: none; }
#message-topic { --foil-line: 1.7em; }
.card-body {
  margin: 0;
  font-size: 15.5px;
  line-height: 2.1;
}

.practice {
  margin: 26px 0 0;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--leaf-soft);
}
.practice-label {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--leaf-deep);
}
.special-hint {
  font-family: "Dancing Script", cursive;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.02em;
  padding: 0 0.2em;
}
.practice-text { margin: 0; font-size: 14.5px; line-height: 1.9; }
.meditation {
  margin: 12px 0 0;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
}
.meditation-text { margin: 0; font-size: 14.5px; line-height: 1.9; }
.meditation-name { display: block; font-weight: 500; }
.meditation-purpose { display: block; font-size: 13.5px; color: var(--muted); }

.premise-note {
  margin: 22px 0 0;
  font-size: 13px;
  line-height: 1.9;
  color: var(--muted);
}
.care-note {
  margin: 22px 0 0;
  font-size: 13.5px;
  line-height: 1.9;
}

/* S-05 ご案内（FR-SAFE-005〜007）：金言の要素を隠し、案内の一言だけを話す */
.is-guide .card-eyebrow,
.is-guide #message-topic,
.is-guide .practice,
.is-guide .meditation,
.is-guide .care-note,
.is-guide .premise-note,
.is-guide .sample-note,
.is-guide #another,
.is-guide #keep { display: none; }
.is-guide .card-body { white-space: pre-line; }
#message-body:focus { outline: none; }

.sample-note {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 28px;
}
.btn-soft {
  width: 100%;
  border: 1px solid var(--leaf);
  background: transparent;
  color: var(--leaf-deep);
  font-size: 15px;
  letter-spacing: 0.1em;
}
.btn-soft:hover { background: var(--leaf-soft); }
.btn-text {
  padding: 0 20px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-color: var(--line);
}

.card-care .card-topic { margin-top: 0; }

/* ---- 残した金言（FR-SAVE-001〜003）---- */
.btn-keep { min-height: 44px; font-size: 13px; letter-spacing: 0.06em; }
.btn-keep:disabled { cursor: default; text-decoration: none; }
.saved-box { margin: 14px 0 0; }
.saved-box[hidden] { display: none; }
.saved-entry {
  display: block;
  min-height: 44px;
  margin: 0 auto;
  font-size: 13.5px;
  letter-spacing: 0.06em;
}
.saved-arrow { display: inline-block; font-size: 10px; transition: transform 0.25s; }
.saved-entry[aria-expanded="true"] .saved-arrow { transform: rotate(180deg); }
.saved-panel { margin: 6px 0 0; }
.saved-panel[hidden] { display: none; }
.saved-lead {
  margin: 0 0 8px;
  text-align: center;
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
}
.saved-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.saved-row { border-bottom: 1px solid var(--line); }
.saved-row-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 8px 4px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.saved-row-head:focus-visible { outline: 3px solid var(--leaf-soft); outline-offset: -3px; }
.saved-date { flex: none; font-size: 12px; letter-spacing: 0.04em; color: var(--muted); }
.saved-topic { flex: 1; min-width: 0; font-size: 14px; line-height: 1.6; }
.saved-chev { flex: none; color: var(--muted); transition: transform 0.25s; }
.saved-row-head[aria-expanded="true"] .saved-chev { transform: rotate(90deg); }
.saved-detail { padding: 2px 4px 12px; }
.saved-detail[hidden] { display: none; }
.saved-detail .card-body { font-size: 14.5px; line-height: 2; }
.saved-detail .practice { margin-top: 14px; }
.saved-small { min-height: 44px; font-size: 13px; }
.saved-remove { display: block; margin: 4px 0 0 auto; padding: 0 4px; }
.saved-clear { display: flex; flex-direction: column; align-items: center; margin-top: 4px; }
.clear-confirm { width: 100%; text-align: center; }
.clear-confirm[hidden] { display: none; }
.clear-question { margin: 8px 0 10px; font-size: 14px; }
.clear-buttons { display: flex; flex-direction: column; align-items: center; gap: 6px; }

/* ---- 降ってくる砂金（FR-LOOK-003）---- */
.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.sky span {
  position: absolute;
  top: -10px;
  width: 4px;
  height: 4px;
  animation: fall linear infinite;
}
.sky span::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, #fff3b6 0%, #fde18b 35%, #f9c153 65%, #e59f2c 100%);
  box-shadow: 0 0 6px 1px rgba(249, 193, 83, 0.7);
  animation: gold-twinkle 2.6s ease-in-out infinite;
}
.sky span:nth-child(2n)::before { animation-duration: 1.9s; animation-delay: -0.7s; }
.sky span:nth-child(3n)::before { animation-duration: 3.3s; animation-delay: -1.6s; }
.sky span:nth-child(1) { left: 6%; animation-duration: 22s; animation-delay: -2s; }
.sky span:nth-child(2) { left: 14%; animation-duration: 28s; animation-delay: -15s; width: 3px; height: 3px; }
.sky span:nth-child(3) { left: 22%; animation-duration: 25s; animation-delay: -8s; }
.sky span:nth-child(4) { left: 31%; animation-duration: 31s; animation-delay: -20s; width: 5px; height: 5px; }
.sky span:nth-child(5) { left: 39%; animation-duration: 24s; animation-delay: -4s; width: 3px; height: 3px; }
.sky span:nth-child(6) { left: 47%; animation-duration: 29s; animation-delay: -12s; }
.sky span:nth-child(7) { left: 55%; animation-duration: 26s; animation-delay: -18s; width: 3px; height: 3px; }
.sky span:nth-child(8) { left: 63%; animation-duration: 33s; animation-delay: -6s; width: 5px; height: 5px; }
.sky span:nth-child(9) { left: 71%; animation-duration: 23s; animation-delay: -10s; }
.sky span:nth-child(10) { left: 78%; animation-duration: 30s; animation-delay: -25s; width: 3px; height: 3px; }
.sky span:nth-child(11) { left: 85%; animation-duration: 27s; animation-delay: -3s; }
.sky span:nth-child(12) { left: 92%; animation-duration: 32s; animation-delay: -16s; width: 3px; height: 3px; }
.sky span:nth-child(13) { left: 10%; animation-duration: 35s; animation-delay: -28s; width: 2px; height: 2px; }
.sky span:nth-child(14) { left: 68%; animation-duration: 36s; animation-delay: -22s; width: 2px; height: 2px; }
.sky span:nth-child(15) { left: 3%; animation-duration: 26s; animation-delay: -12s; width: 3px; height: 3px; }
.sky span:nth-child(16) { left: 18%; animation-duration: 21s; animation-delay: -6s; width: 2px; height: 2px; }
.sky span:nth-child(17) { left: 27%; animation-duration: 34s; animation-delay: -24s; }
.sky span:nth-child(18) { left: 35%; animation-duration: 24s; animation-delay: -13s; width: 2px; height: 2px; }
.sky span:nth-child(19) { left: 43%; animation-duration: 30s; animation-delay: -1s; width: 6px; height: 6px; }
.sky span:nth-child(20) { left: 51%; animation-duration: 22s; animation-delay: -27s; width: 3px; height: 3px; }
.sky span:nth-child(21) { left: 59%; animation-duration: 35s; animation-delay: -9s; width: 2px; height: 2px; }
.sky span:nth-child(22) { left: 67%; animation-duration: 25s; animation-delay: -20s; }
.sky span:nth-child(23) { left: 75%; animation-duration: 28s; animation-delay: -5s; width: 2px; height: 2px; }
.sky span:nth-child(24) { left: 82%; animation-duration: 23s; animation-delay: -17s; width: 5px; height: 5px; }
.sky span:nth-child(25) { left: 89%; animation-duration: 31s; animation-delay: -11s; width: 2px; height: 2px; }
.sky span:nth-child(26) { left: 96%; animation-duration: 26s; animation-delay: -23s; width: 3px; height: 3px; }
.sky span:nth-child(27) { left: 25%; animation-duration: 37s; animation-delay: -31s; width: 2px; height: 2px; }
.sky span:nth-child(28) { left: 50%; animation-duration: 33s; animation-delay: -16s; }
@keyframes gold-twinkle {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
@keyframes fall {
  0%   { transform: translate3d(0, 0, 0); opacity: 0; }
  10%  { opacity: 1; }
  50%  { transform: translate3d(14px, 55vh, 0); }
  90%  { opacity: 1; }
  100% { transform: translate3d(-6px, 110vh, 0); opacity: 0; }
}

.file-warning {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 10;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--gold);
  font-size: 13px;
  text-align: center;
}

/* NFR-A11Y-001 */
@media (prefers-reduced-motion: reduce) {
  .sky { display: none; }
  .leaves-sway, .gift { animation: none; }
  .site-header { transition: none; }
  .ask-form .btn-primary { animation: none; }
  .gold-foil { animation: none; }
  .screen.is-active, .breath-circle { animation: none; }
  .card { transition: none; }
}


/* 言葉の画面では上部の金の木と題字をふわっと消して、その場所を詰める */
.site-header {
  max-height: 320px;
  transition: opacity 0.7s ease 0.1s, max-height 0.8s ease 0.2s, padding-top 0.8s ease 0.2s;
}
body.on-message .site-header {
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  pointer-events: none;
}

/* 「あなたの言葉」を大きくして、白みがかった緑の細いフレームで囲む */
.echo {
  padding: 14px 16px 16px;
  border: 1px solid rgba(200, 232, 210, 0.55);
  border-radius: 18px;
  /* 砂金が透けないよう、背景色を不透明に塗る */
  background: linear-gradient(rgba(200, 232, 210, 0.04), rgba(200, 232, 210, 0.04)), var(--bg);
  box-shadow: 0 0 14px rgba(200, 232, 210, 0.08);
}
.echo figcaption {
  font-size: 13px;
  color: #f3d48a;
  margin-bottom: 8px;
}
.echo blockquote {
  padding: 0;
  border-left: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.7;
}

/* 言葉の画面は上の余白を詰めて、アバターを上へ寄せる */
body.on-message main { padding-top: 12px; }

/* 狭い画面ではよつばアバターを大きく（幅393pxで約220px）。左の透明な余白は「あなたの言葉」に重ねる。
   「あなたの言葉」はアバターの頭の高さまで上へ伸ばし、金言の吹き出しとの間を空ける */
@media (max-width: 759px) {
  .screen .echo-row { gap: 0; align-items: stretch; }
  .screen .echo-row .echo { margin: calc(min(56vw, 230px) * 0.1) 18px 20px 0; }
  .echo-row .avatar-slot .avatar {
    width: min(56vw, 230px);
    margin-left: calc(min(56vw, 230px) * -0.22);
    margin-right: -18px; /* 「あなたの言葉」との間を空けるため右へ寄せる（絵の右側は透明な余白） */
  }
}

/* 画面の上で下に引っ張ったときの再読み込みを止める（iPhone の Chrome で効くかは実機で確認） */
html, body { overscroll-behavior-y: none; }
