/* ============================================================
   ICHIMONJI KAI — one hanging-scroll painting.
   Materials: paper, ink, seal-vermilion, five pigments. Nothing else.
   ============================================================ */

:root {
  --paper-hi: #f5f2ea;
  --paper: #ece9e0;
  --paper-shade: #dfdbce;
  --ink: #262320;
  --ink-mid: #56524a;
  --ink-faint: #8d877b;
  --shu: #a8402e;
  --shu-deep: #8c3222;
  --t-ao: #a9c6c0;
  --t-beni: #e3b3b4;
  --t-ki: #e9d9a0;
  --t-shiro: #f7f5ee;
  --t-murasaki: #c4b3cd;
  --t-ao-deep: #5b7f8a;
  --t-beni-deep: #b06a66;
  --t-ki-deep: #a98b3f;
  --t-shiro-deep: #c9c2ae;
  --t-murasaki-deep: #7d6b96;
  --t-ink: #262320;
  --pigment-blend: multiply;
  --grain-opacity: 0.5;
  --band-ink: rgba(38, 35, 32, 0.045);
  --ease-brush: cubic-bezier(0.22, 0.9, 0.3, 1);
}

[data-theme="dark"] {
  --paper-hi: #21252b;
  --paper: #171a1f;
  --paper-shade: #101318;
  --ink: #e9e5da;
  --ink-mid: #a9a399;
  --ink-faint: #6b665c;
  --shu: #e0705a;
  --shu-deep: #c25640;
  --t-ao: #7fa39c;
  --t-beni: #c08487;
  --t-ki: #cbb273;
  --t-shiro: #ddd8cb;
  --t-murasaki: #9c8aac;
  --t-ink: #1b1916;
  --pigment-blend: screen;
  --grain-opacity: 0.3;
  --band-ink: rgba(233, 229, 218, 0.07);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: "Zen Kaku Gothic New", sans-serif;
  font-weight: 400;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.4s;
}

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

/* ---------- Paint layers ---------- */

#grain {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--pigment-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.35 0 0 0 0 0.32 0 0 0 0 0.28 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wash-band {
  position: fixed;
  top: 4%;
  left: -12%;
  width: 124%;
  height: 46%;
  z-index: 0;
  pointer-events: none;
  transform: rotate(-11deg);
  background: linear-gradient(178deg, transparent 8%, var(--band-ink) 42%, var(--band-ink) 58%, transparent 92%);
  animation: kasumi 90s ease-in-out infinite alternate;
}

@keyframes kasumi {
  from { transform: rotate(-11deg) translateX(0); }
  to { transform: rotate(-11deg) translateX(40px); }
}

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: none;
}
[data-theme="dark"] #sky { display: block; }

#blot-field {
  position: fixed;
  top: 12%;
  left: 0;
  width: 100%;
  height: 42%;
  z-index: 0;
  pointer-events: none;
  mix-blend-mode: var(--pigment-blend);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  opacity: 1;
  transition: opacity 2s;
}
[data-theme="dark"] #blot-field { opacity: 0.55; }

#bamboo {
  position: fixed;
  left: 0;
  bottom: 0;
  height: 100vh;
  width: auto;
  max-width: 88vw;
  z-index: 1;
  pointer-events: none;
  opacity: 0.74;
}
[data-theme="dark"] #bamboo { opacity: 0.5; }

/* ---------- Top controls ---------- */

.top {
  position: fixed;
  top: 1.1rem;
  left: 1.2rem;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.enso {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: transparent;
  border: 2.5px solid var(--ink-mid);
  cursor: pointer;
  position: relative;
  transition: transform 0.3s var(--ease-brush);
}
.enso::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--ink-mid);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.3s, transform 0.3s var(--ease-brush);
}
[data-theme="dark"] .enso::after { opacity: 1; transform: scale(1); }
.enso:hover { transform: rotate(-12deg) scale(1.06); }
.enso:focus-visible { outline: 2px solid var(--shu); outline-offset: 3px; }

.lang-toggle {
  background: transparent;
  color: var(--ink-mid);
  border: none;
  border-bottom: 1px solid transparent;
  padding: 0.2rem 0.1rem;
  font-family: inherit;
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.lang-toggle:hover, .lang-toggle:focus-visible { color: var(--ink); border-bottom-color: var(--ink-faint); }
.lang-toggle:focus-visible { outline: 2px solid var(--shu); outline-offset: 3px; }

/* ---------- The scroll (vertical title) ---------- */

.scroll {
  position: fixed;
  top: clamp(2.5rem, 8vh, 5rem);
  right: clamp(0.9rem, 4vw, 3rem);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}

.scroll-title {
  font-family: "Yuji Syuku", "Shippori Mincho", serif;
  font-weight: 400;
  font-size: clamp(28px, 4vw, 40px);
  writing-mode: vertical-rl;
  letter-spacing: 0.35em;
  color: var(--ink);
  line-height: 1;
}

.scroll-title span {
  display: inline-block;
  color: var(--ink);
  opacity: 1;
  filter: blur(0);
  transition:
    opacity 0.6s var(--ease-brush),
    filter 0.6s var(--ease-brush),
    transform 0.6s var(--ease-brush),
    color 1.4s ease-out;
}

body.boot .scroll-title span {
  opacity: 0;
  filter: blur(6px);
  transform: scale(1.04);
  color: var(--shu);
  transition: none;
}

.seal {
  display: block;
  width: 40px;
  height: 40px;
}

.seal-brand {
  transform: rotate(-2deg);
  transition: transform 0.18s var(--ease-brush), opacity 0.18s;
}
body.boot .seal-brand { opacity: 0; transform: rotate(-4deg) scale(1.6); transition: none; }

.scroll-caption {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.2em;
  color: var(--ink-mid);
  writing-mode: vertical-rl;
  transition: opacity 0.5s;
}
body.boot .scroll-caption { opacity: 0; transition: none; }

/* ---------- Intro ---------- */

main { position: relative; z-index: 2; }

.intro {
  padding: clamp(7rem, 18vh, 12rem) clamp(1.4rem, 8vw, 7rem) 3rem;
  max-width: 620px;
  transition: opacity 0.5s, transform 0.5s var(--ease-brush);
}
body.boot .intro { opacity: 0; transform: translateY(10px); transition: none; }

.intro-date {
  font-family: "Yuji Syuku", serif;
  font-size: 0.9rem;
  letter-spacing: 0.45em;
  color: var(--ink-mid);
  margin-bottom: 1.6rem;
}

.intro-lede {
  font-size: clamp(0.92rem, 1.5vw, 1.02rem);
  font-weight: 300;
  line-height: 2.2;
  color: var(--ink);
  max-width: 30em;
}

.intro-dedication {
  margin-top: 1.4rem;
  font-size: 0.8rem;
  letter-spacing: 0.24em;
  color: var(--ink-mid);
}

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

.seal-btn {
  margin-top: 2.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: "Zen Kaku Gothic New", sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.22em;
  color: var(--ink);
  padding: 0.4rem 0.2rem;
  transition: transform 0.15s var(--ease-brush);
}
.seal-btn .seal-small { width: 40px; height: 40px; transition: transform 0.15s var(--ease-brush); }
.seal-btn:hover .seal-small, .seal-btn:focus-visible .seal-small { transform: rotate(-3deg) scale(1.07); }
.seal-btn:active .seal-small { transform: scale(0.94); }
.seal-btn:focus-visible { outline: 2px solid var(--shu); outline-offset: 3px; }
.seal-btn span { border-bottom: 1px solid transparent; transition: border-color 0.2s; }
.seal-btn:hover span { border-bottom-color: var(--ink-faint); }
.seal-btn:disabled { opacity: 0.55; cursor: wait; }

/* ---------- Grove ---------- */

.grove {
  position: relative;
  max-width: 1240px;
  margin: 0 auto;
  padding: 2rem 1rem 7rem;
  min-height: 420px;
}

.wish-area {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 2.6rem 1.7rem;
  padding: 1.5rem clamp(1rem, 7vw, 5rem);
}

.grove-note {
  width: 100%;
  text-align: center;
  color: var(--ink-mid);
  font-weight: 300;
  font-size: 0.92rem;
  letter-spacing: 0.14em;
  padding: 3rem 0;
}

/* ---------- Year navigation ---------- */

.year-nav {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.4rem 1.6rem;
  padding: 0.5rem 1.5rem 0;
}

.year-nav button {
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: "Yuji Syuku", serif;
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  color: var(--ink-mid);
  padding: 0.3rem 0.15rem;
  position: relative;
  transition: color 0.25s;
}
.year-nav button:hover { color: var(--ink); }
.year-nav button:focus-visible { outline: 2px solid var(--shu); outline-offset: 3px; }
.year-nav button[aria-current="true"] {
  color: var(--ink);
}
.year-nav button[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50% 46% 52% 48%;
  background: var(--shu);
}

.year-note {
  position: relative;
  z-index: 2;
  text-align: center;
  font-family: "Yuji Syuku", serif;
  font-size: 0.92rem;
  letter-spacing: 0.24em;
  color: var(--ink-mid);
  padding: 0.6rem 1rem 0;
}

/* ---------- Tanzaku ---------- */

.tz-wrap {
  --tilt: 0deg;
  --amp: 2.2deg;
  --dur: 6s;
  --delay: 0s;
  position: relative;
  transform-origin: 50% 0;
  transform: rotate(var(--tilt));
  animation: sway var(--dur) ease-in-out var(--delay) infinite;
  display: flex;
  flex-direction: column;
  align-items: center;
  filter: drop-shadow(0 5px 9px rgba(20, 17, 14, 0.22));
  transition: opacity 0.5s, transform 0.5s var(--ease-brush);
}
body.boot .tz-wrap { opacity: 0; transform: translateY(-9px) rotate(var(--tilt)); transition: none; animation: none; }

.tz-wrap:hover, .tz-wrap:focus-within {
  animation-play-state: paused;
}

.tz-wrap.gust { --amp: 5deg; }

@keyframes sway {
  0%, 100% { transform: rotate(var(--tilt)); }
  50% { transform: rotate(calc(var(--tilt) + var(--amp))); }
}

.tz-wrap.new {
  animation: settle 1.1s var(--ease-brush) both, sway var(--dur) ease-in-out 1.1s infinite;
}

@keyframes settle {
  0% { opacity: 0; transform: translateY(-44px) rotate(6deg); }
  45% { opacity: 1; transform: translateY(0) rotate(-3deg); }
  75% { transform: rotate(1.2deg); }
  100% { transform: rotate(var(--tilt)); }
}

.tz-wrap.leaving {
  animation: chiru 0.9s ease-in both;
}

@keyframes chiru {
  0% { opacity: 1; transform: rotate(var(--tilt)); }
  30% { transform: translate(6px, 8px) rotate(8deg); }
  100% { opacity: 0; transform: translate(26px, 64px) rotate(14deg); filter: blur(3px); }
}

.tz-wrap .string {
  width: 1.5px;
  height: 30px;
  background: var(--ink-faint);
  position: relative;
}
.tz-wrap .string::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.tanzaku {
  width: auto;
  min-width: 76px;
  min-height: 216px;
  background-color: var(--t);
  background-image: radial-gradient(130% 95% at 32% 22%, transparent 55%, color-mix(in oklab, var(--t) 86%, var(--ink) 14%) 100%);
  box-shadow:
    inset 0 0 0 1.5px color-mix(in srgb, var(--t-deep) 45%, transparent),
    inset 0 0 14px -6px var(--t-deep);
  padding: 24px 10px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.tanzaku::before {
  content: "";
  position: absolute;
  top: 12%;
  left: 8%;
  right: 8%;
  height: 1px;
  background: color-mix(in srgb, var(--t-deep) 35%, transparent);
}

.tanzaku::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  mix-blend-mode: var(--pigment-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.35 0 0 0 0 0.32 0 0 0 0 0.28 0 0 0 0.6 0'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wish-text {
  font-family: "Klee One", cursive;
  font-weight: 400;
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--t-ink);
  writing-mode: vertical-rl;
  text-orientation: upright;
  height: 150px;
  width: max-content;
  max-width: 190px;
  overflow-wrap: anywhere;
  line-break: anywhere;
  margin-top: 6px;
}

.tz-wrap.long .wish-text, .tanzaku.preview.long .wish-text {
  font-size: 0.84rem;
  line-height: 1.62;
}

.wish-name {
  font-family: "Klee One", cursive;
  font-weight: 600;
  font-size: 0.74rem;
  color: var(--t-ink);
  opacity: 0.92;
  writing-mode: vertical-rl;
  align-self: flex-start;
  margin-top: auto;
}

/* ---------- Delete (hazusu) ---------- */

.tz-delete {
  margin-top: 0.55rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.15rem;
}
.tz-delete .seal { width: 13px; height: 13px; opacity: 0.85; filter: grayscale(0.15); }
.tz-delete .tz-delete-label {
  font-family: "Yuji Syuku", serif;
  font-size: 11px;
  color: var(--ink-mid);
  writing-mode: vertical-rl;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.25s, transform 0.25s var(--ease-brush);
}
.tz-wrap:hover .tz-delete-label,
.tz-delete:focus-visible .tz-delete-label { opacity: 1; transform: translateY(0); }
.tz-delete:focus-visible { outline: 2px solid var(--shu); outline-offset: 2px; }

.confirm-chip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: var(--paper-hi);
  box-shadow: 0 4px 18px rgba(20, 17, 14, 0.18), inset 0 0 0 1px var(--paper-shade);
  padding: 0.7rem 0.9rem;
  width: max-content;
  max-width: 220px;
  text-align: center;
}
.confirm-chip p {
  font-size: 0.78rem;
  color: var(--ink);
  margin-bottom: 0.55rem;
  letter-spacing: 0.04em;
}
.confirm-chip .chip-actions { display: flex; justify-content: center; gap: 1rem; }
.confirm-chip button {
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: "Zen Kaku Gothic New", sans-serif;
  font-size: 0.8rem;
  padding: 0.15rem 0.1rem;
  color: var(--ink-mid);
  border-bottom: 1px solid transparent;
}
.confirm-chip button:hover, .confirm-chip button:focus-visible { color: var(--ink); border-bottom-color: var(--ink-faint); }
.confirm-chip button:focus-visible { outline: 2px solid var(--shu); outline-offset: 2px; }
.confirm-chip .chip-remove { font-weight: 500; color: var(--ink); }

/* ---------- Footer ---------- */

.footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 3rem 1.5rem 4.5rem;
  max-width: 880px;
  margin: 0 auto;
}
.footer::before {
  content: "";
  display: block;
  width: 120px;
  height: 1px;
  margin: 0 auto 3rem;
  background: var(--ink-faint);
  opacity: 0.55;
}

.footer-heading {
  font-family: "Yuji Syuku", serif;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--ink-mid);
  font-size: 0.9rem;
  margin-bottom: 1.4rem;
}

.footer-members {
  color: var(--ink-mid);
  font-weight: 300;
  font-size: 0.86rem;
  line-height: 2.3;
  letter-spacing: 0.06em;
  max-width: 44em;
  margin: 0 auto;
}
.footer-members .member { white-space: nowrap; }

.footer-note {
  margin-top: 2.2rem;
  font-family: "Yuji Syuku", serif;
  color: var(--ink-mid);
  font-size: 0.84rem;
  letter-spacing: 0.22em;
}

/* ---------- FAB ---------- */

.fab {
  position: fixed;
  bottom: 1.4rem;
  right: 1.4rem;
  z-index: 35;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.3rem;
  transition: transform 0.2s var(--ease-brush);
}
.fab .seal-small { width: 46px; height: 46px; filter: drop-shadow(0 3px 10px rgba(20, 17, 14, 0.28)); }
.fab:hover { transform: rotate(-3deg) scale(1.08); }
.fab:active { transform: scale(0.94); }
.fab:focus-visible { outline: 2px solid var(--shu); outline-offset: 3px; }
.fab[hidden] { display: none; }

/* ---------- Dialog ---------- */

.wish-dialog {
  border: none;
  background: var(--paper-hi);
  color: var(--ink);
  padding: 2.1rem 1.9rem 1.8rem;
  width: min(94vw, 560px);
  margin: auto;
  box-shadow: 0 24px 90px rgba(15, 13, 10, 0.35), inset 0 0 0 1px var(--paper-shade);
}
.wish-dialog::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: calc(var(--grain-opacity) * 0.5);
  mix-blend-mode: var(--pigment-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.35 0 0 0 0 0.32 0 0 0 0 0.28 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wish-dialog::backdrop {
  background: rgba(24, 21, 18, 0.45);
  backdrop-filter: blur(2px);
}
[data-theme="dark"] .wish-dialog::backdrop { background: rgba(5, 6, 8, 0.6); }

.dialog-title {
  font-family: "Yuji Syuku", serif;
  font-weight: 400;
  font-size: 1.25rem;
  letter-spacing: 0.24em;
  color: var(--ink);
  text-align: center;
  margin-bottom: 1.6rem;
}

.dialog-grid {
  display: flex;
  gap: 1.6rem;
  align-items: flex-start;
}
.dialog-fields { flex: 1; min-width: 0; }

.dialog-preview {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0.4rem;
}
.dialog-preview .string {
  width: 1.5px;
  height: 22px;
  background: var(--ink-faint);
  display: block;
}
.tanzaku.preview {
  min-width: 64px;
  min-height: 178px;
  padding: 18px 8px 12px;
  transform: rotate(1.6deg);
}
.tanzaku.preview .wish-text { height: 118px; font-size: 0.86rem; }
.tanzaku.preview.long .wish-text { font-size: 0.74rem; }
.tanzaku.preview .wish-name { font-size: 0.62rem; }

.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--ink-mid);
  margin: 1.15rem 0 0.35rem;
}
.dialog-fields .field-label:first-child { margin-top: 0; }

#wish-name, #wish-text {
  width: 100%;
  font-family: "Zen Kaku Gothic New", sans-serif;
  font-size: 0.95rem;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--ink-faint);
  padding: 0.5rem 0.1rem;
  transition: border-color 0.3s;
}
[data-theme="dark"] #wish-name, [data-theme="dark"] #wish-text { border-bottom-color: var(--ink-mid); }
#wish-name option { background: var(--paper-hi); color: var(--ink); }

#wish-text {
  resize: vertical;
  font-family: "Klee One", cursive;
  line-height: 1.9;
  min-height: 4.2em;
}

#wish-name:focus-visible, #wish-text:focus-visible {
  outline: none;
  border-bottom-color: var(--ink);
}

.ink-meter {
  height: 2px;
  background: var(--paper-shade);
  margin-top: 2px;
  overflow: hidden;
}
.ink-meter span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ink-mid);
  transition: width 0.25s var(--ease-brush), background-color 0.3s;
}
.ink-meter span.brimming { background: var(--shu); }

.char-count {
  text-align: right;
  font-size: 0.7rem;
  color: var(--ink-mid);
  margin-top: 0.35rem;
}

.color-picker {
  display: flex;
  gap: 0.85rem;
  margin-top: 0.4rem;
}

.color-swatch {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50% 46% 52% 48%;
  cursor: pointer;
  display: block;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--sw-deep) 45%, transparent), inset 0 0 8px -3px var(--sw-deep);
  transition: transform 0.2s var(--ease-brush);
}
.color-swatch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch:has(input:checked) {
  transform: scale(1.14);
  box-shadow:
    inset 0 0 0 1.5px color-mix(in srgb, var(--sw-deep) 60%, transparent),
    inset 0 0 8px -3px var(--sw-deep),
    0 0 0 2px var(--paper-hi),
    0 0 0 3.5px var(--ink-mid);
}
.color-swatch:has(input:focus-visible) {
  outline: 2px solid var(--shu);
  outline-offset: 3px;
}

.form-error {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--shu);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1.4rem;
  margin-top: 1.6rem;
}
.dialog-actions .seal-btn { margin-top: 0; }

.btn-ghost {
  background: transparent;
  color: var(--ink-mid);
  border: none;
  border-bottom: 1px solid transparent;
  font-family: "Zen Kaku Gothic New", sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  padding: 0.25rem 0.1rem;
  cursor: pointer;
}
.btn-ghost:hover, .btn-ghost:focus-visible { color: var(--ink); border-bottom-color: var(--ink-faint); }
.btn-ghost:focus-visible { outline: 2px solid var(--shu); outline-offset: 2px; }

/* ---------- Ambient: motes (light) and falling leaf ---------- */

.mote {
  position: fixed;
  bottom: -8px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ink-mid);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
  animation: rise var(--mote-dur, 90s) linear var(--mote-delay, 0s) infinite;
}
[data-theme="dark"] .mote { display: none; }

@keyframes rise {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  8% { opacity: 0.22; }
  50% { transform: translateY(-55vh) translateX(24px); opacity: 0.16; }
  100% { transform: translateY(-105vh) translateX(-10px); opacity: 0; }
}

.leaf {
  position: fixed;
  top: -30px;
  z-index: 3;
  pointer-events: none;
  width: 26px;
  height: 9px;
  background: var(--ink);
  opacity: 0.4;
  border-radius: 100% 4% 100% 4%;
  animation: leaf-fall 9s ease-in forwards;
}
.leaf::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  animation: leaf-spin 2.6s ease-in-out infinite;
}

@keyframes leaf-fall {
  0% { transform: translate(0, 0) rotate(10deg); opacity: 0; }
  6% { opacity: 0.42; }
  30% { transform: translate(-6vw, 26vh) rotate(150deg); }
  55% { transform: translate(3vw, 52vh) rotate(230deg); }
  80% { transform: translate(-4vw, 76vh) rotate(340deg); opacity: 0.32; }
  100% { transform: translate(1vw, 92vh) rotate(410deg); opacity: 0; }
}

@keyframes leaf-spin {
  0%, 100% { transform: rotateX(0deg); }
  50% { transform: rotateX(50deg); }
}

/* ---------- Theme wash (View Transitions) ---------- */

::view-transition-old(root) { animation: none; }
::view-transition-new(root) {
  animation: vt-wash 0.6s ease-out;
}
@keyframes vt-wash {
  from { clip-path: circle(0 at var(--vt-x, 40px) var(--vt-y, 40px)); }
  to { clip-path: circle(150vmax at var(--vt-x, 40px) var(--vt-y, 40px)); }
}

/* ---------- Boot choreography delays ---------- */

body.loaded #bamboo { clip-path: inset(0); }
body.boot #bamboo { clip-path: inset(0 100% 0 0); }
#bamboo { transition: clip-path 1s var(--ease-brush) 0.1s; }

body.loaded .scroll-title span { transition-delay: calc(0.5s + var(--i, 0) * 0.12s); }
body.loaded .scroll-title span:nth-child(1) { --i: 0; }
body.loaded .scroll-title span:nth-child(2) { --i: 1; }
body.loaded .scroll-title span:nth-child(3) { --i: 2; }
body.loaded .scroll-title span:nth-child(4) { --i: 3; }
body.loaded .scroll-title span:nth-child(5) { --i: 4; }

body.loaded .seal-brand { transition: transform 0.3s var(--ease-brush) 1.3s, opacity 0.22s ease-out 1.3s; }
body.loaded .scroll-caption { transition-delay: 1.7s; }
body.loaded .intro { transition-delay: 2s; }
body.loaded .tz-wrap { transition-delay: calc(1.4s + var(--stagger, 0s)); }

body.seen #bamboo,
body.seen .scroll-title span,
body.seen .seal-brand,
body.seen .scroll-caption,
body.seen .intro,
body.seen .tz-wrap { transition-delay: 0s !important; transition-duration: 0.4s !important; }

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .scroll {
    position: static;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
    padding: 4.4rem 1rem 0;
    min-width: 0;
  }
  .scroll-title { writing-mode: horizontal-tb; font-size: 28px; letter-spacing: 0.26em; text-indent: 0.26em; text-align: center; }
  .scroll-caption { writing-mode: horizontal-tb; text-align: center; }
  .seal-brand { width: 28px; height: 28px; }
  .intro { padding-top: 2.2rem; text-align: center; margin: 0 auto; }
  .intro-lede { margin: 0 auto; }
  #bamboo { max-width: 88vw; opacity: 0.34; }
  [data-theme="dark"] #bamboo { opacity: 0.3; }
  .wish-area { gap: 2rem 1.1rem; padding: 1rem 0.4rem; }
  .tanzaku { min-width: 66px; min-height: 186px; padding: 20px 8px 12px; }
  .wish-text { height: 126px; font-size: 0.9rem; }
  .dialog-grid { flex-direction: column; }
  .dialog-preview { display: none; }
  .leaf { display: none; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tz-wrap, .tz-wrap.new { animation: none; }
  .tz-wrap.leaving { animation: none; opacity: 0; transition: opacity 0.2s; }
  .wash-band { animation: none; }
  .mote, .leaf { display: none; }
  #bamboo { transition: none; clip-path: inset(0) !important; }
  body.boot .scroll-title span, body.boot .seal-brand, body.boot .scroll-caption,
  body.boot .intro, body.boot .tz-wrap { opacity: 1; transform: none; filter: none; color: var(--ink); }
  ::view-transition-new(root) { animation: none; }
}
