:root {
  color-scheme: dark;
  --bg-ink: #02030b;
  --ink: #f8f1e3;
  --ink-soft: rgba(246, 235, 216, 0.7);
  --ink-mute: rgba(220, 230, 245, 0.44);
  --line: rgba(240, 220, 170, 0.15);
  --music-gold: #f3d7a6;
  --accent: #ffd36e;
  --accent-2: #7ef4ff;
  --accent-glow: rgba(255, 211, 110, 0.24);
  --dot-1: #ffd36e;
  --dot-2: #7ef4ff;
  --dot-3: #ff9ad8;
  --sans: "Avenir Next", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Songti SC", "STSong", "Noto Serif CJK SC", serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
}

html { background: var(--bg-ink); }

body {
  overflow: hidden;
  background:
    radial-gradient(ellipse 95% 84% at 50% 54%, #06112a 0%, #040816 55%, #02030b 100%);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button { font: inherit; }

.stage {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 420px;
  overflow: hidden;
  isolation: isolate;
}

#tree-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  outline: none;
  opacity: 0;
  animation: canvas-reveal 2.8s cubic-bezier(0.18, 0.76, 0.28, 1) 0.05s forwards;
  -webkit-tap-highlight-color: transparent;
}

#tree-canvas.is-dragging { cursor: grabbing; }
#tree-canvas:focus-visible { outline: 1px solid rgba(255, 211, 110, 0.35); outline-offset: -5px; }

.ambient-vignette,
.ambient-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ambient-vignette {
  z-index: 2;
  background:
    radial-gradient(ellipse 82% 76% at 50% 47%, transparent 42%, rgba(1, 6, 16, 0.12) 69%, rgba(1, 4, 11, 0.66) 100%),
    linear-gradient(180deg, rgba(1, 5, 13, 0.28) 0%, transparent 18%, transparent 74%, rgba(1, 4, 11, 0.4) 100%);
}

.ambient-grain {
  z-index: 3;
  opacity: 0.05;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

.masthead {
  position: absolute;
  z-index: 5;
  top: clamp(24px, 5.2vh, 58px);
  left: clamp(22px, 4.5vw, 68px);
  pointer-events: none;
  animation: rise-in 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.28s both;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 15px;
  color: var(--ink-mute);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.36em;
  line-height: 1;
  text-transform: uppercase;
}

.eyebrow-rule {
  width: 29px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent));
  opacity: 0.72;
}

.masthead h1 {
  margin: 0;
  color: #fff4dc;
  font-family: var(--serif);
  font-size: clamp(30px, 4.1vw, 58px);
  font-weight: 400;
  letter-spacing: 0.145em;
  line-height: 1.08;
  text-shadow: 0 0 24px rgba(255, 211, 110, 0.12), 0 0 64px rgba(126, 244, 255, 0.06);
}

.title-star {
  position: relative;
  top: -0.34em;
  display: inline-block;
  margin-left: 0.32em;
  color: var(--accent);
  font-family: var(--serif);
  font-size: 0.28em;
  font-weight: 400;
  letter-spacing: 0;
  opacity: 0.84;
  text-shadow: 0 0 16px var(--accent-glow);
  animation: tiny-star 7.5s ease-in-out infinite;
}

.subtitle {
  margin: 12px 0 0;
  color: rgba(234, 226, 210, 0.52);
  font-family: var(--serif);
  font-size: clamp(10px, 0.88vw, 12px);
  letter-spacing: 0.22em;
  line-height: 1.8;
  white-space: nowrap;
}

.intro-skip {
  display: inline-block;
  margin-top: 12px;
  padding: 5px 11px;
  border: 1px solid rgba(246, 218, 168, 0.16);
  border-radius: 999px;
  background: rgba(12, 8, 16, 0.16);
  color: rgba(234, 226, 210, 0.56);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.2em;
  line-height: 1.2;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0.72;
  transition: color 0.25s ease, opacity 0.25s ease;
}

.intro-skip:hover,
.intro-skip:focus-visible {
  color: var(--accent);
  opacity: 1;
}

.intro-skip[hidden] {
  display: none;
}

.palette-readout {
  position: absolute;
  z-index: 5;
  top: clamp(27px, 5.4vh, 60px);
  right: clamp(22px, 4.5vw, 68px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 11px;
  pointer-events: none;
  animation: rise-in 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.46s both;
}

.palette-kicker {
  color: rgba(234, 226, 210, 0.5);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.32em;
  line-height: 1;
}

.palette-line {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(246, 238, 222, 0.76);
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.16em;
  line-height: 1;
}

#palette-name { transition: color 0.6s ease; }

.palette-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.palette-dots i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  box-shadow: 0 0 9px currentColor;
  transition: background-color 0.7s ease, box-shadow 0.7s ease;
}

.palette-dots i:nth-child(1) { background: var(--dot-1); color: var(--dot-1); }
.palette-dots i:nth-child(2) { background: var(--dot-2); color: var(--dot-2); opacity: 0.82; }
.palette-dots i:nth-child(3) { background: var(--dot-3); color: var(--dot-3); opacity: 0.68; }


/* Background music toggle · warm gold on black glass */
.sound-toggle {
  position: absolute;
  z-index: 7;
  top: calc(clamp(27px, 5.4vh, 60px) + 48px);
  right: clamp(22px, 4.5vw, 68px);
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(246, 218, 168, 0.28);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 241, 216, 0.13), rgba(7, 4, 14, 0.74) 70%);
  color: var(--music-gold);
  box-shadow:
    0 14px 34px rgba(2, 0, 8, 0.34),
    0 0 26px rgba(241, 196, 125, 0.07),
    inset 0 1px 0 rgba(255, 248, 232, 0.08);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    color 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease,
    transform 0.2s ease;
  animation: fade-in 1.5s ease 0.9s both;
}

.sound-toggle:hover {
  color: #fff0d0;
  border-color: rgba(255, 231, 187, 0.55);
  box-shadow:
    0 14px 34px rgba(2, 0, 8, 0.38),
    0 0 34px rgba(241, 196, 125, 0.16),
    inset 0 1px 0 rgba(255, 248, 232, 0.13);
}

.sound-toggle:active { transform: scale(0.95); }

.sound-toggle:focus-visible {
  outline: 1px solid rgba(255, 231, 187, 0.86);
  outline-offset: 3px;
}

.sound-toggle[data-state="playing"] {
  color: #ffe4b0;
  border-color: rgba(255, 224, 168, 0.54);
  box-shadow:
    0 14px 34px rgba(2, 0, 8, 0.38),
    0 0 34px rgba(241, 196, 125, 0.14),
    inset 0 1px 0 rgba(255, 248, 232, 0.12);
}

.sound-toggle[data-state="unavailable"] {
  opacity: 0.55;
  cursor: pointer;
}

.sound-toggle[data-state="unavailable"]:hover { opacity: 0.82; }

.sound-face {
  display: grid;
  place-items: center;
  width: 18px;
  height: 16px;
}

.sound-glyph {
  grid-area: 1 / 1;
  display: none;
  width: 17px;
  height: 17px;
  overflow: visible;
}

.sound-toggle .sound-play { display: block; }

.sound-play path {
  fill: currentColor;
  stroke: none;
}

.sound-muted path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-muted path:first-child {
  fill: currentColor;
  fill-opacity: 0.92;
  stroke: none;
}

.sound-muted .sound-slash { opacity: 0.92; }

.sound-toggle[data-state="muted"] .sound-play,
.sound-toggle[data-state="unavailable"] .sound-play,
.sound-toggle[data-state="playing"] .sound-play { display: none; }

.sound-toggle[data-state="muted"] .sound-muted,
.sound-toggle[data-state="unavailable"] .sound-muted { display: block; }

.sound-bars {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 2.5px;
  height: 15px;
}

.sound-bars i {
  display: block;
  width: 2px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 7px rgba(255, 220, 160, 0.35);
  transform-origin: center;
  animation: sound-bar 1.1s ease-in-out infinite;
}

.sound-bars i:nth-child(1) { height: 6px; }
.sound-bars i:nth-child(2) { height: 13px; animation-delay: 0.18s; }
.sound-bars i:nth-child(3) { height: 9px; animation-delay: 0.36s; }

.sound-toggle[data-state="playing"] .sound-bars { display: flex; }

@keyframes sound-bar {
  0%, 100% { transform: scaleY(0.55); opacity: 0.72; }
  50% { transform: scaleY(1); opacity: 1; }
}

@media (max-width: 700px) {
  .sound-toggle {
    top: max(46px, calc(env(safe-area-inset-top) + 34px));
    right: 21px;
    width: 40px;
    height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sound-toggle { animation: none; }
  .sound-bars i {
    animation: none;
    transform: none;
    opacity: 1;
  }
}

.control-dock {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: max(34px, calc(env(safe-area-inset-bottom) + 22px));
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background:
    linear-gradient(145deg, rgba(51, 30, 69, 0.54), rgba(12, 6, 21, 0.69));
  box-shadow:
    0 18px 48px rgba(2, 0, 8, 0.42),
    0 0 34px rgba(137, 90, 188, 0.06),
    inset 0 1px 0 rgba(255, 242, 216, 0.07);
  -webkit-backdrop-filter: blur(18px) saturate(1.22);
  backdrop-filter: blur(18px) saturate(1.22);
  animation: dock-in 1.2s cubic-bezier(0.2, 0.7, 0.2, 1) 0.7s both;
}

.control {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 43px;
  padding: 0 15px;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 450;
  letter-spacing: 0.12em;
  line-height: 1;
  white-space: nowrap;
  transition: color 0.35s ease, background-color 0.35s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.control:hover {
  color: #fff2ff;
  background: rgba(255, 232, 194, 0.06);
}

.control:active { transform: scale(0.96); }

.control:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: -2px;
  color: #fff4ff;
}

.control-icon {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: var(--accent);
  transition: color 0.6s ease;
}

.control-icon svg {
  display: block;
  width: 16px;
  height: 16px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.control-icon .icon-play { display: none; }
.control-icon .icon-play path { fill: currentColor; stroke: none; }

body.is-paused .control-icon .icon-pause { display: none; }
body.is-paused .control-icon .icon-play { display: block; }
body.is-paused #pause-button { color: var(--accent); }
body.is-paused #pause-button:hover { background: rgba(255, 232, 194, 0.06); }
body.is-paused .title-star { animation-play-state: paused; }

.swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.swatch i {
  position: absolute;
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
  transition: background-color 0.6s ease, color 0.6s ease;
}

.swatch i:nth-child(1) { left: 0; top: 4px; background: var(--dot-1); color: var(--dot-1); }
.swatch i:nth-child(2) { left: 5px; top: 0; background: var(--dot-2); color: var(--dot-2); }
.swatch i:nth-child(3) { left: 9px; top: 7px; background: var(--dot-3); color: var(--dot-3); }

.dock-rule {
  display: block;
  width: 1px;
  height: 15px;
  margin: 0 2px;
  background: linear-gradient(180deg, transparent, rgba(255, 232, 196, 0.12), transparent);
}

.interaction-hint {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: max(13px, calc(env(safe-area-inset-bottom) + 4px));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  transform: translateX(-50%);
  color: rgba(232, 226, 212, 0.44);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.18em;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  animation: fade-in 1.8s ease 1.15s both;
}

.interaction-hint i {
  display: block;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.65;
}

.canvas-fallback {
  position: absolute;
  z-index: 8;
  top: 50%;
  left: 50%;
  width: min(82vw, 440px);
  margin: 0;
  transform: translate(-50%, -50%);
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.08em;
  line-height: 1.9;
  text-align: center;
}

.canvas-fallback[hidden] { display: none; }

body.no-canvas #tree-canvas { display: none; }

@keyframes canvas-reveal {
  from { opacity: 0; transform: scale(1.018); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes dock-in {
  from { opacity: 0; transform: translate(-50%, 13px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes tiny-star {
  0%, 100% { opacity: 0.64; transform: scale(0.92) rotate(0deg); }
  50% { opacity: 0.94; transform: scale(1.08) rotate(8deg); }
}

@media (max-width: 700px) {
  .masthead {
    top: max(22px, calc(env(safe-area-inset-top) + 12px));
    left: 21px;
  }

  .eyebrow { gap: 9px; margin-bottom: 11px; font-size: 8px; letter-spacing: 0.28em; }
  .eyebrow-rule { width: 21px; }
  .masthead h1 { font-size: clamp(25px, 7.2vw, 36px); letter-spacing: 0.12em; }
  .subtitle { margin-top: 9px; font-size: 9.5px; letter-spacing: 0.15em; }

  .palette-readout {
    top: max(26px, calc(env(safe-area-inset-top) + 16px));
    right: 21px;
    gap: 0;
  }

  .palette-kicker { display: none; }
  .palette-line { gap: 8px; font-size: 11px; letter-spacing: 0.12em; }
  .palette-dots { gap: 4px; }

  .control-dock {
    bottom: max(41px, calc(env(safe-area-inset-bottom) + 30px));
    padding: 5px;
  }

  .control { height: 40px; padding: 0 11px; gap: 6px; font-size: 10.5px; letter-spacing: 0.08em; }
  .control-icon, .control-icon svg { width: 15px; height: 15px; }
  .swatch { width: 15px; height: 15px; }
  .swatch i { width: 6.5px; height: 6.5px; }
  .dock-rule { margin: 0; }

  .interaction-hint {
    bottom: max(17px, calc(env(safe-area-inset-bottom) + 7px));
    gap: 8px;
    font-size: 8px;
    letter-spacing: 0.13em;
  }
}

@media (max-width: 380px) {
  .subtitle { display: none; }
  .control { padding: 0 9px; gap: 5px; font-size: 10px; }
  .interaction-hint { gap: 6px; letter-spacing: 0.08em; }
}

@media (max-height: 570px) {
  .masthead { top: 19px; }
  .masthead .subtitle { display: none; }
  .palette-readout { top: 21px; }
  .control-dock { bottom: 30px; }
  .interaction-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #tree-canvas, .masthead, .palette-readout, .control-dock, .interaction-hint {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
  }
  .title-star { animation: none; }
}


/* =========================================================
   WISH BLOCK · editable bottom greeting
   ========================================================= */
:root {
  --script: "Kaiti SC", "STKaiti", "KaiTi", "Iowan Old Style", "Palatino Linotype", "Songti SC", serif;
  --dock-bottom: 144px;
}

.stage { min-height: 0; }

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

.palette-wash {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(ellipse 66% 58% at 50% 48%, var(--accent), transparent 72%);
  mix-blend-mode: screen;
}

body.is-color-shifting .palette-wash {
  animation: palette-wash 1.15s cubic-bezier(0.2, 0.6, 0.2, 1);
}

@keyframes palette-wash {
  0% { opacity: 0; }
  18% { opacity: 0.05; }
  100% { opacity: 0; }
}

.palette-auto {
  display: inline-flex;
  align-items: center;
  height: 13px;
  padding: 0 5px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 99px;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 6px;
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1;
  opacity: 0.9;
}
.palette-auto[hidden] { display: none; }

.control-dock {
  z-index: 7;
  bottom: max(var(--dock-bottom), calc(env(safe-area-inset-bottom) + 126px));
}

.control-atelier {
  color: rgba(248, 240, 224, 0.8);
}

.control-atelier .control-icon {
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.wish-block {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px));
  width: min(780px, calc(100vw - 52px));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  pointer-events: none;
  isolation: isolate;
  animation: fade-in 1.8s ease 1.1s both;
}

.wish-block::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -12px -24px -8px;
  border-radius: 20px;
  pointer-events: none;
  background:
    radial-gradient(ellipse 68% 118% at 50% 58%, rgba(2, 5, 16, 0.82) 0%, rgba(8, 6, 24, 0.5) 56%, rgba(2, 4, 14, 0) 100%),
    linear-gradient(180deg, rgba(4, 5, 18, 0) 0%, rgba(5, 4, 18, 0.28) 34%, rgba(8, 4, 22, 0.4) 100%);
}

.wish-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: min(360px, 78%);
  margin-bottom: 7px;
  color: rgba(234, 226, 210, 0.5);
}

.wish-rule {
  display: block;
  flex: 1 1 auto;
  width: 30px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 226, 170, 0.36));
}

.wish-rule:last-child {
  background: linear-gradient(90deg, rgba(255, 226, 170, 0.36), transparent);
}

.wish-kicker {
  flex: 0 0 auto;
  font-size: 7.5px;
  font-weight: 500;
  letter-spacing: 0.24em;
  line-height: 1;
  white-space: nowrap;
}

.wish-main {
  max-width: 100%;
  margin: 0;
  padding: 2px 12px;
  border: 0;
  border-radius: 8px;
  color: #fff8ec;
  font-family: var(--script);
  font-size: clamp(20px, 2.25vw, 31px);
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.32;
  text-shadow: 0 0 18px rgba(255, 216, 140, 0.18);
  text-wrap: balance;
  max-height: calc(2.64em + 6px);
  overflow: hidden;
  pointer-events: auto;
  cursor: text;
  outline: none;
  transition: background-color 0.25s ease, box-shadow 0.25s ease, color 0.4s ease;
  -webkit-tap-highlight-color: transparent;
}

.wish-sub {
  max-width: 100%;
  margin: 4px 0 7px;
  padding: 2px 10px;
  border-radius: 6px;
  color: rgba(255, 243, 224, 0.66);
  font-family: var(--serif);
  font-size: clamp(8.5px, 0.82vw, 10.5px);
  font-style: italic;
  letter-spacing: 0.19em;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: auto;
  cursor: text;
  outline: none;
  transition: color 0.25s ease, background-color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.wish-main:hover,
.wish-sub:hover {
  background: rgba(255, 232, 194, 0.035);
}

.wish-main:focus,
.wish-sub:focus {
  background: rgba(255, 244, 226, 0.07);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 38%, transparent);
  color: #fff8ff;
}

.wish-main:empty::before,
.wish-sub:empty::before {
  content: attr(data-placeholder);
  color: rgba(255, 241, 220, 0.4);
  pointer-events: none;
}

.wish-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 25px;
  pointer-events: auto;
}

.wish-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(234, 226, 210, 0.35);
  font-size: 8px;
  letter-spacing: 0.12em;
  line-height: 1;
  white-space: nowrap;
}

.wish-hint i {
  display: block;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.65;
}

.wish-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 25px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 27%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  color: var(--accent);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.wish-button:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: #fff4ff;
}

.wish-button:active { transform: scale(0.96); }
.wish-button:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.wish-button:disabled { cursor: default; opacity: 0.72; }

.wish-button-star {
  display: inline-block;
  font-size: 10px;
  line-height: 1;
  text-shadow: 0 0 10px var(--accent-glow);
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.wish-button.is-wishing .wish-button-star {
  transform: rotate(180deg) scale(1.24);
}

.wish-button.is-wishing {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: #fff6ff;
}

/* =========================================================
   ATELIER · light customiser dialog
   ========================================================= */
.atelier {
  position: fixed;
  inset: 0;
  z-index: 60;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: hidden;
}

.atelier:not([open]) { display: none; }

.atelier::backdrop {
  background: rgba(1, 5, 13, 0.58);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  animation: atelier-backdrop 0.4s ease both;
}

.atelier-panel {
  position: absolute;
  top: max(18px, calc(env(safe-area-inset-top) + 12px));
  right: max(18px, calc(env(safe-area-inset-right) + 12px));
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 12px));
  width: min(390px, calc(100vw - 36px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 232, 196, 0.15);
  border-radius: 25px;
  background:
    linear-gradient(158deg, rgba(9, 23, 40, 0.95), rgba(2, 7, 16, 0.97));
  box-shadow:
    0 32px 100px rgba(0, 0, 0, 0.54),
    0 0 80px rgba(255, 196, 120, 0.06),
    inset 0 1px 0 rgba(255, 242, 216, 0.08);
  -webkit-backdrop-filter: blur(24px) saturate(1.08);
  backdrop-filter: blur(24px) saturate(1.08);
  animation: atelier-in 0.48s cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

@keyframes atelier-in {
  from { opacity: 0; transform: translateX(24px) scale(0.985); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes atelier-backdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

.atelier-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid rgba(255, 232, 196, 0.08);
}

.atelier-kicker {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.32em;
  line-height: 1;
  opacity: 0.8;
}

.atelier-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 400;
  letter-spacing: 0.09em;
  line-height: 1.2;
}

.atelier-sub {
  margin: 8px 0 0;
  color: rgba(232, 228, 216, 0.5);
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.09em;
  line-height: 1.5;
}

.atelier-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  padding: 0;
  border: 1px solid rgba(255, 232, 196, 0.14);
  border-radius: 50%;
  background: rgba(255, 232, 194, 0.04);
  color: rgba(238, 228, 210, 0.7);
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease;
}

.atelier-close:hover {
  color: #fff6e8;
  background: rgba(255, 232, 194, 0.09);
}

.atelier-close svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.atelier-close:focus-visible,
.text-button:focus-visible,
.primary-button:focus-visible,
.theme-card:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

.atelier-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 24px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 220, 160, 0.2) transparent;
}

.atelier-body::-webkit-scrollbar { width: 4px; }
.atelier-body::-webkit-scrollbar-thumb { background: rgba(255, 220, 160, 0.18); border-radius: 999px; }

.atelier-section { padding: 0 0 22px; }
.atelier-section + .atelier-section { border-top: 1px solid rgba(255, 232, 196, 0.08); padding-top: 19px; }

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h3 {
  margin: 0;
  color: rgba(250, 241, 224, 0.9);
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.13em;
}

.section-heading span {
  color: rgba(236, 226, 208, 0.3);
  font-size: 7px;
  letter-spacing: 0.24em;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.theme-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 49px;
  padding: 8px 9px;
  border: 1px solid rgba(255, 232, 196, 0.08);
  border-radius: 12px;
  background: rgba(255, 232, 194, 0.025);
  color: rgba(236, 228, 214, 0.64);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.3s ease, background 0.3s ease, color 0.3s ease;
}

.theme-card:hover {
  border-color: rgba(255, 232, 196, 0.2);
  background: rgba(255, 232, 194, 0.05);
  color: #fff7ea;
}

.theme-card[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 58%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: #fff9ff;
}

.theme-orb {
  position: relative;
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--orb);
  box-shadow: 0 0 16px color-mix(in srgb, var(--orb-accent) 38%, transparent);
}

.theme-orb::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: var(--orb-center);
  filter: blur(0.4px);
}

.theme-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.theme-copy b {
  overflow: hidden;
  font-family: var(--serif);
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: 0.07em;
  line-height: 1.15;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.theme-copy small {
  overflow: hidden;
  color: rgba(236, 226, 210, 0.3);
  font-size: 6px;
  font-weight: 500;
  letter-spacing: 0.16em;
  line-height: 1;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.theme-check {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.theme-card[aria-pressed="true"] .theme-check {
  opacity: 1;
  transform: scale(1);
}

.range-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 35px;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  cursor: pointer;
}

.range-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}

.range-copy b {
  color: rgba(242, 234, 220, 0.8);
  font-size: 10.5px;
  font-weight: 450;
  letter-spacing: 0.06em;
  line-height: 1;
}

.range-copy small {
  color: rgba(236, 226, 210, 0.3);
  font-size: 6px;
  letter-spacing: 0.18em;
  line-height: 1;
}

.range-row output {
  color: rgba(236, 228, 210, 0.52);
  font-family: var(--sans);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  text-align: right;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    var(--accent) var(--fill, 50%),
    rgba(255, 232, 194, 0.16) var(--fill, 50%),
    rgba(255, 232, 194, 0.16) 100%
  );
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  margin-top: -4.5px;
  border: 0;
  border-radius: 50%;
  background: #fff6e6;
  box-shadow: 0 0 10px var(--accent-glow);
}

input[type="range"]::-moz-range-track {
  height: 2px;
  border-radius: 99px;
  background: rgba(255, 232, 194, 0.16);
}

input[type="range"]::-moz-range-progress {
  height: 2px;
  border-radius: 99px;
  background: var(--accent);
}

input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 0;
  border-radius: 50%;
  background: #fff6e6;
  box-shadow: 0 0 10px var(--accent-glow);
}

input[type="range"]:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 5px;
  border-radius: 99px;
}

.switch-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 8px;
  padding: 12px 0 3px;
  border-top: 1px solid rgba(255, 232, 196, 0.06);
  cursor: pointer;
}

.switch-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.switch-copy b {
  color: rgba(242, 234, 220, 0.8);
  font-size: 10.5px;
  font-weight: 450;
  letter-spacing: 0.06em;
}

.switch-copy small {
  color: rgba(236, 226, 210, 0.3);
  font-family: var(--serif);
  font-size: 8.5px;
  letter-spacing: 0.04em;
}

.switch-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 19px;
  border: 1px solid rgba(255, 232, 196, 0.15);
  border-radius: 999px;
  background: rgba(255, 232, 194, 0.06);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.switch-track span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(255, 242, 220, 0.72);
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1), background-color 0.3s ease;
}

.switch-row input:checked + .switch-track {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  background: color-mix(in srgb, var(--accent) 26%, transparent);
}

.switch-row input:checked + .switch-track span {
  transform: translateX(15px);
  background: #fff7ea;
  box-shadow: 0 0 10px var(--accent-glow);
}

.switch-row input:focus-visible + .switch-track {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

.text-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.text-field > span {
  color: rgba(236, 226, 210, 0.5);
  font-size: 8.5px;
  letter-spacing: 0.1em;
}

.text-field textarea,
.text-field input {
  width: 100%;
  border: 1px solid rgba(255, 232, 196, 0.1);
  border-radius: 9px;
  background: rgba(255, 232, 194, 0.035);
  color: rgba(252, 244, 228, 0.9);
  font-family: var(--sans);
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}

.text-field textarea {
  min-height: 56px;
  resize: vertical;
  max-height: 120px;
}

.text-field textarea:focus,
.text-field input:focus {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: rgba(255, 232, 194, 0.055);
}

.text-field textarea::placeholder,
.text-field input::placeholder {
  color: rgba(238, 228, 210, 0.25);
}

.atelier-tip {
  margin: 9px 0 0;
  color: rgba(236, 226, 210, 0.28);
  font-family: var(--serif);
  font-size: 9px;
  letter-spacing: 0.04em;
  line-height: 1.6;
}

.atelier-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px max(18px, calc(env(safe-area-inset-bottom) + 14px));
  border-top: 1px solid rgba(255, 232, 196, 0.08);
  background: rgba(8, 4, 14, 0.2);
}

.text-button,
.primary-button {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 9px;
  letter-spacing: 0.08em;
  transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
}

.text-button {
  border: 1px solid transparent;
  background: transparent;
  color: rgba(234, 226, 210, 0.42);
}

.text-button:hover {
  color: rgba(252, 244, 228, 0.84);
  background: rgba(255, 232, 194, 0.045);
}

.primary-button {
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: #fff5ff;
}

.primary-button:hover {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

/* =========================================================
   Responsive bottom stack
   ========================================================= */
@media (max-width: 700px) {
  :root { --dock-bottom: 150px; }

  .palette-auto {
    height: 12px;
    padding: 0 4px;
    font-size: 5.5px;
  }

  .control-dock {
    bottom: max(var(--dock-bottom), calc(env(safe-area-inset-bottom) + 136px));
  }

  .wish-block {
    width: calc(100vw - 36px);
    bottom: max(12px, calc(env(safe-area-inset-bottom) + 6px));
  }

  .wish-meta {
    width: min(292px, 82%);
    margin-bottom: 6px;
  }

  .wish-kicker { font-size: 6.5px; letter-spacing: 0.19em; }
  .wish-rule { width: 22px; }

  .wish-main {
    padding: 2px 4px;
    font-size: clamp(19px, 5.4vw, 23px);
    letter-spacing: 0.055em;
    line-height: 1.3;
  }

  .wish-sub {
    max-width: calc(100vw - 45px);
    margin: 3px 0 5px;
    font-size: 8px;
    letter-spacing: 0.12em;
  }

  .wish-footer {
    flex-wrap: wrap;
    gap: 7px 12px;
    min-height: 24px;
  }

  .wish-hint {
    gap: 5px;
    font-size: 7px;
    letter-spacing: 0.06em;
  }

  .wish-button {
    height: 23px;
    padding: 0 8px;
    gap: 4px;
    font-size: 7.5px;
  }

  .wish-button-star { font-size: 9px; }

  .atelier-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: min(88svh, 760px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 24px 24px 0 0;
    animation-name: atelier-in-mobile;
  }

  .atelier-head { padding: 20px 20px 15px; }
  .atelier-head h2 { font-size: 22px; }
  .atelier-kicker { margin-bottom: 7px; }
  .atelier-sub { font-size: 10px; }
  .atelier-body { padding: 17px 20px 10px; }
  .atelier-foot { padding: 12px 20px max(15px, calc(env(safe-area-inset-bottom) + 11px)); }
  .range-row { grid-template-columns: 80px minmax(0, 1fr) 32px; gap: 8px; }
  .theme-card { min-height: 47px; }
}

@keyframes atelier-in-mobile {
  from { opacity: 0; transform: translateY(32px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 380px) {
  .wish-hint span:nth-of-type(2),
  .wish-hint i:first-of-type,
  .wish-hint i:nth-of-type(2),
  .wish-hint span:nth-of-type(3) { display: none; }
  .wish-main { font-size: 18px; }
  .control { padding: 0 9px; gap: 5px; }
}

@media (max-height: 650px) and (min-width: 701px) {
  :root { --dock-bottom: 108px; }
  .wish-meta { display: none; }
  .wish-main { font-size: 20px; }
  .wish-sub { margin-bottom: 4px; }
  .wish-block { bottom: 10px; }
}

@media (max-height: 620px) {
  .wish-meta { display: none; }
  .wish-sub { display: none; }
  .wish-main { font-size: 18px; }
  .wish-hint span:nth-of-type(2),
  .wish-hint i:first-of-type,
  .wish-hint i:nth-of-type(2),
  .wish-hint span:nth-of-type(3) { display: none; }
  :root { --dock-bottom: 92px; }
  .control-dock { bottom: max(92px, calc(env(safe-area-inset-bottom) + 82px)); }
  .wish-block { bottom: max(9px, calc(env(safe-area-inset-bottom) + 5px)); }
  .wish-footer { min-height: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .wish-block { animation-duration: 0.01ms !important; animation-delay: 0ms !important; }
  .atelier-panel, .atelier::backdrop { animation-duration: 0.01ms !important; }
  body.is-color-shifting .palette-wash { animation: none; }
  .wish-button-star { transition: none; }
}



/* =========================================================
   Compact copy · wish action lives in the control rail
   ========================================================= */
.wish-edit-hint {
  display: inline-block;
  margin-left: 9px;
  color: rgba(234, 226, 210, 0.3);
  font-family: var(--sans);
  font-size: 7.5px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.1em;
  vertical-align: 0.04em;
}

.control-wish .control-icon {
  color: var(--accent-2);
}

.control-wish:disabled {
  cursor: default;
  opacity: 0.56;
}

.control-wish {
  position: relative;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.control-wish::after {
  content: "写下愿望";
  position: absolute;
  top: 50%;
  right: calc(100% + 12px);
  padding: 6px 9px;
  border: 1px solid rgba(255, 226, 176, 0.2);
  border-radius: 7px;
  background: rgba(6, 5, 19, 0.9);
  color: rgba(255, 240, 215, 0.72);
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.1em;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(5px, -50%);
  transition: opacity 180ms ease, transform 180ms ease;
}

.control-wish:hover::after,
.control-wish:focus-visible::after {
  opacity: 1;
  transform: translate(0, -50%);
}

.control-wish.is-wish-dragging::after,
.control-wish.is-wishing::after {
  opacity: 0;
  transform: translate(5px, -50%);
}

.control-wish.is-wish-dragging {
  cursor: grabbing;
}

.control-wish.is-wish-dragging .control-icon {
  filter: drop-shadow(0 0 12px var(--accent-glow));
  transform: translateY(-1px) scale(1.07);
}

body.is-wish-dragging {
  cursor: grabbing;
  -webkit-user-select: none;
  user-select: none;
}

body.is-wish-dragging canvas {
  cursor: grabbing;
}

.control-wish.is-wishing .control-icon {
  filter: drop-shadow(0 0 9px var(--accent-glow));
}

.control-wish.is-wishing .control-icon svg {
  animation: wish-star-turn 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes wish-star-turn {
  0% { transform: rotate(0deg) scale(1); }
  55% { transform: rotate(160deg) scale(1.22); }
  100% { transform: rotate(180deg) scale(1); }
}

.atelier::backdrop {
  background: rgba(3, 1, 8, 0.31);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.atelier-close,
.primary-button {
  appearance: none;
  -webkit-appearance: none;
}

.primary-button {
  background: rgba(255, 178, 216, 0.12);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

/* A vertical rail on roomy screens leaves the lower stage to the wish. */
@media (min-width: 900px) and (min-height: 560px) {
  .control-dock {
    left: auto;
    right: clamp(22px, 3.4vw, 50px);
    bottom: clamp(128px, 15.5vh, 186px);
    flex-direction: column;
    align-items: stretch;
    gap: 1px;
    padding: 6px;
    border-radius: 21px;
    animation-name: rail-in;
  }

  .control {
    width: 100%;
    height: 38px;
    justify-content: flex-start;
    padding: 0 11px;
    gap: 7px;
    font-size: 10.5px;
    letter-spacing: 0.1em;
  }

  .dock-rule {
    width: 22px;
    height: 1px;
    margin: 2px auto;
    background: linear-gradient(90deg, transparent, rgba(255, 232, 196, 0.13), transparent);
  }

  @keyframes rail-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

/* The copy is the only thing under the tree on a roomy screen. */
@media (max-width: 700px) {
  :root { --dock-bottom: 112px; }
  .control-dock {
    bottom: max(var(--dock-bottom), calc(env(safe-area-inset-bottom) + 100px));
  }
  .wish-meta { width: min(318px, 90%); }
  .wish-main { margin-bottom: 0; }
  .wish-sub { margin-bottom: 0; }
}

@media (max-width: 380px) {
  .control { padding: 0 8px; gap: 5px; font-size: 9.5px; }
  .control-label { letter-spacing: 0.04em; }
  .wish-kicker { font-size: 6px; letter-spacing: 0.15em; }
  .wish-edit-hint { margin-left: 6px; font-size: 7px; letter-spacing: 0.04em; }
}

@media (prefers-reduced-motion: reduce) {
  .control-wish.is-wishing .control-icon svg { animation: none; }
  .control-wish.is-wish-dragging .control-icon { transition: none; }
  .control-wish::after { transition: none; }
}



.wish-main {
  transition: background-color 0.25s ease, box-shadow 0.25s ease, color 0.4s ease, text-shadow 0.5s ease;
}

.wish-edit-hint {
  color: rgba(234, 226, 210, 0.42);
}

body.is-wishing .wish-main {
  color: #fff8ea;
  text-shadow:
    0 0 24px var(--accent-glow),
    0 0 58px color-mix(in srgb, var(--accent) 18%, transparent);
}

body.is-wishing .wish-sub {
  color: rgba(250, 241, 224, 0.72);
  transition: color 0.4s ease;
}

body.is-wishing .palette-wash {
  animation: none;
}

@keyframes wish-wash {
  0% { opacity: 0; }
  14% { opacity: 0.11; }
  45% { opacity: 0.045; }
  100% { opacity: 0; }
}



@media (prefers-reduced-motion: reduce) {
  .wish-main { transition: none; }
  body.is-wishing .palette-wash { animation: none; }
  body.is-wishing .wish-main { text-shadow: 0 0 28px var(--accent-glow); }
}

/* =========================================================
   Prismatic holiday typography
   Metallic gold / pink / cyan with layered coloured bloom
   ========================================================= */
:root {
  --metal-gold: #ffd36e;
  --metal-gold-light: #fff1cf;
  --metal-pink: #ff9ad8;
  --metal-cyan: #9ef3ff;
  --metal-violet: #c79cff;
  --title-metal: linear-gradient(104deg, #fff3d0 0%, #ffd36e 24%, #ffb9df 55%, #9ef3ff 82%, #ffe6b7 100%);
  --wish-metal: linear-gradient(100deg, #fff9ec 0%, #ffe8ba 34%, #ffd6e5 68%, #c9f5ff 100%);
  --wish-sub-metal: linear-gradient(92deg, #fff2cf 0%, #ffd9e6 60%, #c8f0ff 100%);
}

.masthead h1 {
  color: var(--metal-gold-light);
}

.masthead h1 .title-copy {
  display: inline-block;
  color: var(--metal-gold-light);
  text-shadow: none;
  filter:
    drop-shadow(0 0 2px rgba(255, 246, 220, 0.26))
    drop-shadow(0 0 14px rgba(255, 211, 110, 0.18));
}

.wish-main,
.wish-sub {
  color: var(--metal-gold-light);
  caret-color: #ffe7a8;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .masthead h1 .title-copy {
    background-image: var(--title-metal);
    background-size: 150% 100%;
    background-position: 32% 50%;
    background-repeat: no-repeat;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    -webkit-text-stroke: 0.24px rgba(255, 244, 218, 0.36);
  }

  .wish-main {
    background-image: var(--wish-metal);
    background-size: 160% 100%;
    background-position: 34% 50%;
    background-repeat: no-repeat;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    -webkit-text-stroke: 0.2px rgba(255, 246, 222, 0.36);
    text-shadow: none;
    filter:
      drop-shadow(0 0 2px rgba(255, 247, 228, 0.34))
      drop-shadow(0 0 12px rgba(255, 196, 120, 0.2))
      drop-shadow(0 0 22px rgba(255, 130, 200, 0.08));
  }

  .wish-sub {
    background-image: var(--wish-sub-metal);
    background-size: 150% 100%;
    background-position: 28% 50%;
    background-repeat: no-repeat;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    -webkit-text-stroke: 0.16px rgba(255, 246, 224, 0.32);
    text-shadow: none;
    filter:
      drop-shadow(0 0 6px rgba(255, 211, 150, 0.18))
      drop-shadow(0 0 14px rgba(150, 220, 255, 0.1));
  }

  .wish-main:hover,
  .wish-sub:hover {
    background-image: var(--wish-metal);
    background-color: rgba(255, 232, 194, 0.035);
  }

  .wish-sub:hover {
    background-image: var(--wish-sub-metal);
  }

  body.is-wishing .wish-main {
    background-image: var(--wish-metal);
    color: transparent;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    filter:
      brightness(1.08)
      drop-shadow(0 0 2px rgba(255, 255, 255, 0.36))
      drop-shadow(0 0 12px rgba(255, 180, 125, 0.28));
  }

  body.is-wishing .wish-sub {
    background-image: var(--wish-sub-metal);
    color: transparent;
    -webkit-text-fill-color: transparent;
    filter:
      brightness(1.06)
      drop-shadow(0 0 8px rgba(255, 205, 150, 0.22));
  }
}

.wish-main:hover,
.wish-sub:hover {
  box-shadow: 0 0 0 1px rgba(255, 224, 177, 0.1), 0 0 22px rgba(255, 131, 205, 0.08);
}

.wish-main:focus,
.wish-sub:focus {
  background-image: none;
  background-color: rgba(255, 244, 226, 0.08);
  color: #fff7e6;
  -webkit-text-fill-color: #fff7e6;
  -webkit-text-stroke-color: rgba(255, 223, 163, 0.9);
  text-shadow: 0 0 12px rgba(255, 211, 150, 0.24);
  filter: drop-shadow(0 0 8px rgba(255, 205, 150, 0.28));
  animation: none;
}

.wish-main:focus {
  caret-color: #ffe7a8;
}

.wish-sub:focus {
  caret-color: #ffabc9;
}

.wish-main:empty::before,
.wish-sub:empty::before {
  background-image: none;
  color: rgba(255, 241, 220, 0.44);
  -webkit-text-fill-color: rgba(255, 241, 220, 0.44);
  -webkit-text-stroke: 0;
  text-shadow: none;
  filter: none;
  animation: none;
}

.wish-main::selection,
.wish-sub::selection {
  background: rgba(255, 145, 211, 0.34);
  color: #fff8ee;
  -webkit-text-fill-color: #fff8ee;
}

@keyframes prism-sheen {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .masthead h1 .title-copy,
  .wish-main,
  .wish-sub {
    animation: none;
  }

  .wish-main,
  .wish-sub {
    transition: none;
  }
}

@media (max-width: 360px) {
  .wish-sub {
    width: calc(100vw - 10px);
    max-width: calc(100vw - 10px);
    font-size: 7.2px;
    letter-spacing: 0.08em;
  }
}

body .wish-main.is-editing,
body .wish-sub.is-editing {
  background-image: none;
  background-color: rgba(255, 244, 226, 0.08);
  color: #fff7e6;
  -webkit-text-fill-color: #fff7e6;
  -webkit-text-stroke-color: rgba(255, 223, 163, 0.9);
  text-shadow: 0 0 12px rgba(255, 211, 150, 0.24);
  filter: drop-shadow(0 0 8px rgba(255, 205, 150, 0.28));
  animation: none;
}

body .wish-main.is-editing {
  caret-color: #ffe7a8;
}

body .wish-sub.is-editing {
  caret-color: #ffabc9;
}


/* =========================================================
   Wish paper · write, fold, hang
   ========================================================= */
.wish-paper {
  position: fixed;
  inset: 0;
  z-index: 80;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  border: 0;
  background: transparent;
  color: #34212b;
  overflow: auto;
  overscroll-behavior: contain;
}

.wish-paper:not([open]) { display: none; }
.wish-paper[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.wish-paper::backdrop {
  background: rgba(4, 2, 10, 0.56);
  -webkit-backdrop-filter: blur(6px) saturate(0.92);
  backdrop-filter: blur(6px) saturate(0.92);
  animation: wish-paper-backdrop 0.36s ease both;
}

@keyframes wish-paper-backdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

.wish-paper-sheet {
  position: relative;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: clamp(28px, 4.8vw, 40px) clamp(22px, 4.8vw, 38px) 26px;
  border: 1px solid rgba(96, 65, 49, 0.2);
  border-radius: 3px 7px 4px 5px;
  background:
    linear-gradient(116deg, rgba(255, 255, 255, 0.5), transparent 30%, rgba(191, 161, 124, 0.08) 78%, transparent),
    repeating-linear-gradient(180deg, transparent 0 31px, rgba(107, 78, 60, 0.075) 31px 32px),
    #fbf5e8;
  color: #34212b;
  box-shadow:
    0 36px 90px rgba(0, 0, 0, 0.48),
    0 10px 25px rgba(0, 0, 0, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.55),
    inset 0 0 50px rgba(143, 104, 69, 0.045);
  transform-origin: 50% 56%;
  animation: wish-paper-in 0.44s cubic-bezier(0.2, 0.75, 0.2, 1) both;
  scrollbar-width: thin;
  scrollbar-color: rgba(110, 77, 58, 0.3) transparent;
}

.wish-paper-sheet::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(132deg, transparent 0 45%, rgba(255, 255, 255, 0.5) 45.5%, rgba(104, 72, 52, 0.13) 46%, transparent 46.8%),
    linear-gradient(48deg, transparent 0 54%, rgba(255, 255, 255, 0.4) 54.5%, rgba(104, 72, 52, 0.1) 55%, transparent 55.8%);
  transition: opacity 0.16s ease;
}

.wish-paper-sheet.is-folding {
  pointer-events: none;
  animation: wish-paper-fold 0.62s cubic-bezier(0.5, 0.02, 0.72, 0.4) forwards;
}

.wish-paper-sheet.is-folding::before {
  opacity: 1;
  animation: wish-paper-crease 0.62s ease both;
}

@keyframes wish-paper-in {
  from { opacity: 0; transform: translateY(12px) scale(0.965) rotate(-0.8deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

@keyframes wish-paper-fold {
  0% { opacity: 1; transform: translate(0, 0) scale(1) rotate(0); }
  34% { opacity: 1; transform: translate(calc(var(--fold-x, 0px) * 0.14), calc(var(--fold-y, 0px) * 0.14)) scale(0.9) rotate(-1.5deg); }
  100% { opacity: 0; transform: translate(var(--fold-x, 0px), var(--fold-y, 0px)) scale(0.045) rotate(12deg); filter: blur(1px); }
}

@keyframes wish-paper-crease {
  0% { opacity: 0; transform: scaleY(0.2); }
  34% { opacity: 0.8; transform: scaleY(1); }
  100% { opacity: 0.25; transform: scaleY(1); }
}

.wish-paper-tape {
  position: absolute;
  top: -11px;
  left: 50%;
  width: 92px;
  height: 24px;
  transform: translateX(-50%) rotate(-1.2deg);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.18), transparent 16% 84%, rgba(255, 255, 255, 0.14)),
    rgba(225, 197, 141, 0.58);
  box-shadow: 0 1px 4px rgba(78, 49, 33, 0.15);
  opacity: 0.7;
  pointer-events: none;
}

.wish-paper-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 23px;
}

.wish-paper-kicker {
  margin: 0 0 9px;
  color: #a25562;
  font-family: var(--sans);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.3em;
  line-height: 1;
  opacity: 0.86;
}

.wish-paper-head h2 {
  margin: 0;
  color: #38212c;
  font-family: var(--serif);
  font-size: clamp(25px, 4.2vw, 31px);
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.22;
}

.wish-paper-desc {
  margin: 9px 0 0;
  color: rgba(52, 33, 43, 0.62);
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.055em;
  line-height: 1.6;
}

.wish-paper-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(72, 45, 52, 0.18);
  border-radius: 50%;
  background: rgba(101, 64, 45, 0.04);
  color: rgba(58, 35, 44, 0.65);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.wish-paper-close:hover {
  color: #3a2130;
  background: rgba(101, 64, 45, 0.09);
}

.wish-paper-close:active { transform: scale(0.94); }

.wish-paper-close svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.wish-paper-label {
  display: block;
  margin: 0 0 5px;
  color: rgba(52, 33, 43, 0.56);
  font-family: var(--sans);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.wish-paper-field {
  position: relative;
  border-bottom: 1px solid rgba(83, 52, 43, 0.2);
}

.wish-paper-field textarea {
  display: block;
  width: 100%;
  min-height: 160px;
  max-height: 34vh;
  padding: 2px 2px 9px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background:
    repeating-linear-gradient(180deg, transparent 0 31px, rgba(102, 73, 59, 0.13) 31px 32px);
  color: #35212c;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  line-height: 32px;
  letter-spacing: 0.035em;
  resize: vertical;
  caret-color: #9c4c60;
  scrollbar-width: thin;
  scrollbar-color: rgba(110, 77, 58, 0.28) transparent;
}

.wish-paper-field textarea::placeholder {
  color: rgba(62, 40, 48, 0.46);
  font-weight: 400;
}

.wish-paper-field:focus-within {
  border-radius: 2px;
  box-shadow:
    inset 2px 0 0 rgba(162, 85, 98, 0.58),
    inset 0 -1px 0 rgba(83, 52, 43, 0.28);
}

.wish-paper-field textarea:focus-visible {
  outline: none;
}

.wish-paper-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 4px 10px;
  min-height: 29px;
  padding-top: 8px;
}

.wish-paper-error {
  flex: 1 1 100%;
  min-height: 0;
  color: #a23e48;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.03em;
  line-height: 1.5;
}

.wish-paper-error:empty { display: none; }

.wish-paper-hint {
  flex: 1 1 auto;
  color: rgba(52, 33, 43, 0.43);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.015em;
  line-height: 1.5;
}

.wish-paper-count {
  margin-left: auto;
  color: rgba(52, 33, 43, 0.47);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.1em;
  line-height: 1.5;
  white-space: nowrap;
}

.wish-paper-public {
  margin: 11px 0 0;
  padding: 7px 10px;
  border-left: 2px solid rgba(162, 85, 98, 0.42);
  background: rgba(162, 85, 98, 0.055);
  color: rgba(79, 48, 57, 0.64);
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.04em;
  line-height: 1.65;
}

.wish-paper-public[hidden] { display: none; }

.wish-paper-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.wish-paper-cancel,
.wish-paper-done {
  min-height: 42px;
  padding: 0 20px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.13em;
  cursor: pointer;
  transition: background 0.22s ease, color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

.wish-paper-cancel {
  border: 1px solid rgba(67, 42, 49, 0.2);
  background: transparent;
  color: rgba(52, 33, 43, 0.62);
}

.wish-paper-cancel:hover {
  background: rgba(91, 57, 48, 0.06);
  color: #3c2330;
}

.wish-paper-done {
  border: 1px solid #35202c;
  background: #35202c;
  color: #fff6e8;
  box-shadow: 0 5px 15px rgba(57, 28, 39, 0.25);
}

.wish-paper-done:hover {
  background: #4b2b3c;
  box-shadow: 0 7px 20px rgba(57, 28, 39, 0.3);
}

.wish-paper-done:active,
.wish-paper-cancel:active { transform: translateY(1px); }

.wish-paper-remove {
  margin-right: auto;
  padding: 7px 0;
  border: 0;
  background: transparent;
  color: rgba(139, 67, 76, 0.66);
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.4;
  cursor: pointer;
  transition: color 0.2s ease;
}

.wish-paper-remove:hover,
.wish-paper-remove.is-confirming {
  color: #a23e48;
}

.wish-paper-remove[hidden] { display: none; }

.wish-paper-remove:focus-visible {
  outline: 2px solid #a25562;
  outline-offset: 3px;
}

.wish-paper-cancel:focus-visible,
.wish-paper-done:focus-visible,
.wish-paper-close:focus-visible {
  outline: 2px solid #a25562;
  outline-offset: 3px;
}

.wish-paper-read-note {
  min-height: 170px;
  margin: 0;
  padding: 8px 2px 18px;
  color: #35212c;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.9;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  background:
    repeating-linear-gradient(180deg, transparent 0 37px, rgba(102, 73, 59, 0.13) 37px 38px);
}

.wish-paper-read-meta {
  margin: 23px 0 0;
  color: rgba(52, 33, 43, 0.47);
  font-family: var(--sans);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1.5;
}

.wish-paper-read .wish-paper-actions {
  justify-content: space-between;
  border-top: 1px solid rgba(86, 54, 44, 0.14);
  padding-top: 17px;
}

@media (max-width: 640px) {
  .wish-paper {
    align-items: flex-start;
    padding-top: max(16px, calc(env(safe-area-inset-top) + 10px));
    padding-bottom: max(16px, calc(env(safe-area-inset-bottom) + 10px));
  }

  .wish-paper-sheet {
    width: min(100%, 440px);
    max-height: calc(100vh - 30px);
    max-height: calc(100dvh - 30px);
    padding: 27px 20px 20px;
  }

  .wish-paper-head { gap: 12px; margin-bottom: 18px; }
  .wish-paper-desc { font-size: 10px; }
  .wish-paper-field textarea { min-height: 150px; font-size: 16px; line-height: 30px; background-size: 100% 30px; }
  .wish-paper-read-note { min-height: 140px; font-size: 18px; }
  .wish-paper-actions { margin-top: 15px; }
  .wish-paper-cancel, .wish-paper-done { min-height: 44px; padding: 0 18px; }
}

.wish-mode {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: calc(100% + 7px);
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: min(94vw, 460px);
  padding: 5px 11px;
  border: 1px solid rgba(255, 226, 176, 0.18);
  border-radius: 999px;
  background: rgba(5, 5, 18, 0.78);
  color: rgba(238, 229, 212, 0.72);
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.09em;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 4px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease;
}

.wish-mode[data-mode="probing"],
.wish-mode[data-mode="shared"],
.wish-mode[data-mode="full"],
.wish-mode[data-mode="local"],
.wish-mode[data-mode="offline"] {
  opacity: 1;
  transform: translate(-50%, 0);
}

.wish-mode-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.wish-mode[data-mode="probing"] { color: rgba(255, 225, 166, 0.72); }
.wish-mode[data-mode="shared"] { color: rgba(210, 250, 235, 0.88); }
.wish-mode[data-mode="full"] { color: rgba(255, 221, 162, 0.92); }
.wish-mode[data-mode="local"] { color: rgba(226, 232, 245, 0.62); }
.wish-mode[data-mode="offline"] { color: rgba(255, 184, 170, 0.82); }

.control-wish.is-wish-ready .control-icon {
  color: #ffe1a3;
  filter: drop-shadow(0 0 9px rgba(255, 201, 111, 0.58));
}

.control-wish.is-wish-ready .control-icon svg {
  animation: wish-ready-bob 2.2s ease-in-out infinite;
}

.control-wish.is-wish-ready::after {
  display: none;
  content: "拖到树上";
}

@keyframes wish-ready-bob {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-2px) rotate(7deg); }
}

body.is-wish-paper-open { overflow: hidden; }

canvas.is-wish-hover { cursor: pointer; }

@media (max-width: 899px), (max-height: 559px) {
  .control-wish::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .wish-paper-sheet,
  .wish-paper::backdrop {
    animation-duration: 0.01ms !important;
  }

  .wish-paper-sheet.is-folding {
    animation: none !important;
    opacity: 0;
  }

  .wish-paper-sheet.is-folding::before {
    animation: none !important;
    opacity: 0;
  }

  .control-wish.is-wish-ready .control-icon svg { animation: none; }
  .wish-paper-cancel,
  .wish-paper-done,
  .wish-paper-close { transition: none; }
}


