/* ============================================================
   Happy birthday · a little universe
   ------------------------------------------------------------
   01 tokens / fonts
   02 base / utilities
   03 sky + canvas + grain
   04 topbar / progress / nav
   05 hero
   06 universe
   07 gallery
   08 wishes
   09 finale
   10 dialogs / editor / toast
   11 responsive
   12 reduced motion
   ============================================================ */

/* ---------- 01 tokens / fonts ---------- */
@font-face {
  font-family: "Permanent Marker";
  src: url("../assets/fonts/PermanentMarker-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../assets/fonts/Fraunces-400.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../assets/fonts/Fraunces-600.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans Batak";
  src: url("../assets/fonts/NotoSansBatak-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+1BC0-1BFF, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Noto Sans Gurmukhi";
  src: url("../assets/fonts/NotoSansGurmukhi-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0A01-0A76, U+200C-200D, U+25CC, U+0964-0965, U+0951-0952,
    U+20B9, U+262C, U+A830-A839;
}

:root {
  --cream: #f7efe3;
  --cream-2: #fbf6ec;
  --paper: #fffaf1;
  --ink: #17130f;
  --ink-soft: #4a4038;
  --pink: #f6cdd5;
  --pink-deep: #ee9fb5;
  --butter: #f6e3a8;
  --mint: #cfe7d6;
  --mint-deep: #8ed0b4;
  --sky: #c9e2ef;
  --sky-deep: #8fc6df;
  --lilac: #d9cdf0;
  --coral: #f5b19c;
  --gold: #f2c14e;
  --night: #141118;
  --night-2: #1c1822;
  --font-marker: "Permanent Marker", "Comic Sans MS", cursive;
  --font-serif: "Fraunces", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --font-sans: "Nunito Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --max: 1240px;
}

/* ---------- 02 base / utilities ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--cream);
  scrollbar-color: rgba(23, 19, 15, 0.28) transparent;
  scrollbar-width: thin;
}

body {
  margin: 0;
  min-width: 280px;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-locked {
  overflow: hidden;
}

::selection {
  background: var(--pink-deep);
  color: var(--ink);
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

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

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-size: 12px;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease-out);
}
.skip-link:focus {
  transform: none;
}

.section-label {
  margin: 0 0 18px;
  font-family: var(--font-serif);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(23, 19, 15, 0.52);
}
.section-label.light {
  color: rgba(255, 253, 248, 0.56);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), background 0.25s,
    box-shadow 0.25s, color 0.25s, border-color 0.25s;
}
.btn:hover {
  transform: translateY(-2px);
}
.btn:active {
  transform: translateY(0);
}
.btn-ink {
  background: var(--ink);
  color: var(--cream);
  box-shadow: 0 12px 28px rgba(23, 19, 15, 0.18);
}
.btn-ink:hover {
  background: #2a231d;
  box-shadow: 0 18px 36px rgba(23, 19, 15, 0.24);
}
.btn-ghost {
  background: rgba(255, 253, 248, 0.55);
  border-color: rgba(23, 19, 15, 0.22);
  color: var(--ink);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover {
  background: rgba(255, 253, 248, 0.9);
}
.btn-cream {
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.26);
}
.btn-cream:hover {
  background: #fffdf6;
}

.btn-text {
  padding: 6px 2px;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: none;
  color: inherit;
  font-size: 12px;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: border-color 0.2s, opacity 0.2s;
}
.btn-text:hover {
  border-bottom-color: currentColor;
}
.btn-text.danger {
  color: #ad4a39;
}

/* ---------- 03 sky + canvas + grain ---------- */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--cream);
  pointer-events: none;
}

.sky-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.65s linear;
  will-change: opacity;
}
.sky-layer.is-on {
  opacity: 1;
}
.sky-hero {
  background:
    radial-gradient(60% 55% at 50% 42%, #fffaf0 0%, rgba(255, 250, 240, 0) 72%),
    linear-gradient(155deg, #f9eddf 0%, #f7e6d2 52%, #f2dcd1 100%);
}
.sky-universe {
  background:
    radial-gradient(46% 50% at 18% 28%, rgba(255, 250, 240, 0.9), transparent 70%),
    radial-gradient(50% 46% at 86% 68%, rgba(201, 226, 239, 0.75), transparent 72%),
    linear-gradient(112deg, #f9e2d8 0%, #f6cdda 30%, #f7e7b7 58%, #d3e8d8 80%, #c9e2ef 100%);
}
.sky-dawn {
  background:
    radial-gradient(42% 52% at 24% 38%, rgba(255, 250, 238, 0.9), transparent 72%),
    linear-gradient(126deg, #fbe6d5 0%, #f7cdd2 42%, #f7e3ae 74%, #f4d7c4 100%);
}
.sky-tide {
  background:
    radial-gradient(48% 50% at 76% 32%, rgba(255, 250, 235, 0.85), transparent 72%),
    linear-gradient(116deg, #f6e8c4 0%, #d7ecd9 38%, #b9e0cf 63%, #c9e2ef 100%);
}
.sky-orbit {
  background:
    radial-gradient(48% 48% at 30% 62%, rgba(255, 244, 218, 0.86), transparent 72%),
    linear-gradient(128deg, #ded2f2 0%, #f2cfdc 38%, #f6e3ae 68%, #cfe1ee 100%);
}
.sky-wishes {
  background:
    radial-gradient(52% 58% at 50% 42%, rgba(255, 250, 240, 0.86), transparent 76%),
    linear-gradient(148deg, #efe4f6 0%, #f8dfe4 42%, #f7ecc9 72%, #dcece0 100%);
}
.sky-finale {
  background:
    radial-gradient(52% 48% at 78% 38%, rgba(242, 193, 78, 0.16), transparent 70%),
    radial-gradient(42% 44% at 18% 74%, rgba(217, 205, 240, 0.16), transparent 72%),
    linear-gradient(160deg, #191520 0%, #121016 58%, #171320 100%);
}

.webgl {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.9s var(--ease-out);
}
.webgl.is-on {
  opacity: 1;
}
.webgl.is-dim {
  opacity: 0.16;
}

.css-stars {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s var(--ease-out);
}
.css-stars.is-on {
  opacity: 1;
}
.css-star {
  position: absolute;
  width: var(--s, 10px);
  height: var(--s, 10px);
  color: var(--c, #f2c14e);
  opacity: 0.7;
  animation: twinkle var(--t, 5s) ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
.css-star svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 61;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: multiply;
}

/* ---------- 04 topbar / progress / nav ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px clamp(18px, 4vw, 56px);
  color: var(--ink);
  pointer-events: none;
  transition: color 0.55s var(--ease-out);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  pointer-events: auto;
  transform: rotate(-3deg);
  transform-origin: left center;
}
.brand-word {
  font-family: var(--font-marker);
  font-size: clamp(22px, 2.1vw, 31px);
  line-height: 1;
  letter-spacing: 0.01em;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.32);
}
.brand-spark {
  display: inline-block;
  color: var(--pink-deep);
  font-size: 13px;
  animation: slowSpin 16s linear infinite;
}
.brand:hover .brand-word {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-serif);
  font-size: 10px;
  letter-spacing: 0.24em;
  opacity: 0.7;
}
.topbar-line {
  width: 46px;
  height: 1px;
  background: currentColor;
  opacity: 0.5;
}
.topbar-stamp {
  display: grid;
  justify-items: end;
  gap: 5px;
  min-width: max-content;
  line-height: 1;
}
.topbar-glyph {
  display: block;
  font-family: "Noto Sans Batak", "Noto Sans Gurmukhi", "Segoe UI Symbol",
    "Nirmala UI", var(--font-serif);
  font-size: 13px;
  line-height: 1;
  letter-spacing: 0;
  white-space: pre;
  font-kerning: none;
  font-variant-ligatures: none;
  font-synthesis: none;
  unicode-bidi: isolate;
  text-rendering: geometricPrecision;
  opacity: 0.92;
}
.topbar-date {
  font-family: var(--font-serif);
  font-size: 9.5px;
  line-height: 1;
  letter-spacing: 0.22em;
  font-variant-numeric: tabular-nums;
  opacity: 0.86;
}

body.on-dark .topbar {
  color: var(--cream);
}
body.on-dark .brand-spark {
  color: var(--gold);
}

/* ---------- music toggle ---------- */
.topbar-right {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.5vw, 20px);
  pointer-events: none;
}
.music-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 13px 0 5px;
  border: 1px solid rgba(23, 19, 15, 0.16);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.42);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.3s var(--ease-out), border-color 0.3s var(--ease-out),
    transform 0.3s var(--ease-out), color 0.55s var(--ease-out);
}
.music-toggle:hover {
  background: rgba(255, 253, 248, 0.72);
  transform: translateY(-1px);
}
.music-toggle:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}
.music-disc {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--cream);
  background:
    radial-gradient(circle at 50% 50%, rgba(247, 239, 227, 0.92) 0 2.5px, transparent 3px),
    radial-gradient(circle at 34% 28%, #443b35 0 6%, #1c1815 55%, #0f0d0b 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.music-disc svg {
  width: 17px;
  height: 17px;
}
.music-label {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  font-family: var(--font-serif);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: max-width 0.35s var(--ease-out), opacity 0.25s var(--ease-out);
}
.music-toggle:hover .music-label,
.music-toggle:focus-visible .music-label,
.music-toggle.is-playing .music-label {
  max-width: 132px;
  opacity: 1;
}
.music-toggle.is-playing .music-disc {
  animation: musicSpin 5.5s linear infinite;
}
.music-toggle.is-buffering .music-disc {
  opacity: 0.62;
}
body.on-dark .music-toggle {
  color: var(--cream);
  border-color: rgba(255, 253, 248, 0.26);
  background: rgba(255, 253, 248, 0.1);
}
body.on-dark .music-toggle:hover {
  background: rgba(255, 253, 248, 0.2);
}
body.on-dark .music-disc {
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 50%, rgba(20, 17, 24, 0.9) 0 2.5px, transparent 3px),
    radial-gradient(circle at 34% 28%, #fbf3e5 0 6%, #e9dcc9 55%, #cdbda6 100%);
}
@keyframes musicSpin {
  to {
    transform: rotate(360deg);
  }
}

.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 55;
  height: 2px;
  background: rgba(23, 19, 15, 0.06);
  pointer-events: none;
}
.progress span {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--pink-deep), var(--gold), var(--mint-deep));
}

.chapter-nav {
  position: fixed;
  right: clamp(10px, 2.2vw, 32px);
  top: 50%;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 15px;
  transform: translateY(-50%);
  color: var(--ink);
  transition: color 0.55s var(--ease-out);
}
.chapter-nav button {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.25s;
}
.chapter-nav button span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 1px rgba(255, 253, 248, 0.3);
  transition: transform 0.25s, box-shadow 0.25s;
}
.chapter-nav button em {
  font-family: var(--font-serif);
  font-size: 9px;
  font-style: normal;
  letter-spacing: 0.18em;
  opacity: 0;
  transform: translateX(5px);
  transition: opacity 0.25s, transform 0.25s;
}
.chapter-nav button:hover,
.chapter-nav button.is-active {
  opacity: 1;
}
.chapter-nav button:hover em,
.chapter-nav button.is-active em {
  opacity: 0.85;
  transform: none;
}
.chapter-nav button.is-active span {
  transform: scale(1.35);
  box-shadow: 0 0 0 4px rgba(23, 19, 15, 0.1);
}
body.on-dark .chapter-nav {
  color: var(--cream);
}
body.on-dark .chapter-nav button.is-active span {
  box-shadow: 0 0 0 4px rgba(255, 253, 248, 0.14);
}

/* ---------- 05 hero ---------- */
.hero-track {
  position: relative;
  z-index: 2;
  height: 190vh;
}

.hero {
  --p: 0;
  --hero-fade: 1;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: transparent;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(60% 55% at 50% 44%, #fffbf2 0%, rgba(255, 251, 242, 0) 72%),
    linear-gradient(158deg, #f9ecdc 0%, #f7e4cf 54%, #f3dcd1 100%);
}
.bloom {
  position: absolute;
  border-radius: 50%;
  filter: blur(46px);
  opacity: 0.62;
  mix-blend-mode: multiply;
}
.bloom-a {
  width: 52vw;
  height: 52vw;
  left: -8vw;
  top: 6vh;
  background: radial-gradient(circle, #f7c6d5 0%, rgba(247, 198, 213, 0) 68%);
}
.bloom-b {
  width: 48vw;
  height: 48vw;
  right: -6vw;
  top: 2vh;
  background: radial-gradient(circle, #f5e0a3 0%, rgba(245, 224, 163, 0) 68%);
}
.bloom-c {
  width: 54vw;
  height: 42vw;
  left: 24vw;
  bottom: -12vh;
  background: radial-gradient(circle, #cfe7d6 0%, rgba(207, 231, 214, 0) 70%);
}

.hero-deco {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.deco-star {
  position: absolute;
  width: var(--s, 60px);
  height: var(--s, 60px);
  color: var(--c, var(--coral));
  transform: translate(-50%, -50%) rotate(var(--r, 0deg));
  filter: drop-shadow(0 8px 14px rgba(90, 55, 45, 0.18));
  animation: floatDeco var(--t, 7s) ease-in-out infinite;
  animation-delay: var(--d, 0s);
  opacity: var(--o, 1);
}
.deco-star svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.deco-star .star-fill {
  fill: currentColor;
}
.deco-star .star-shine {
  fill: #fff;
  opacity: 0.28;
}

/* the glass brick wall */
.wall {
  --cols: 12;
  --rows: 7;
  position: absolute;
  inset: -4%;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  gap: 0;
  transform: scale(1.02);
  backdrop-filter: blur(2.5px) saturate(1.08);
  -webkit-backdrop-filter: blur(2.5px) saturate(1.08);
  transition: filter 0.4s;
}

.brick {
  position: relative;
  perspective: 760px;
  opacity: calc(1 - var(--p) * 0.92);
  transform: translate3d(
      calc(var(--p) * var(--bx, 0px)),
      calc(var(--p) * var(--by, 0px)),
      0
    )
    rotate(calc(var(--p) * var(--br, 0deg)));
  will-change: transform, opacity;
}
.brick-inner {
  position: absolute;
  inset: 2px;
  transform-style: preserve-3d;
  transition: transform 0.68s var(--ease-out);
  will-change: transform;
}
.brick:hover .brick-inner,
.brick.is-flipped .brick-inner {
  transform: rotateY(180deg);
}
.brick-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 1px rgba(92, 70, 60, 0.07),
    inset 0 10px 18px rgba(255, 255, 255, 0.34),
    inset 0 -8px 14px rgba(120, 95, 82, 0.05);
}
.brick-front {
  background:
    linear-gradient(142deg, rgba(255, 255, 255, 0.58) 0%, rgba(255, 255, 255, 0.16) 46%, rgba(242, 230, 216, 0.2) 100%);
  filter: blur(0.2px);
}
.brick-front::after {
  content: "";
  position: absolute;
  inset: 2px;
  background: linear-gradient(
    118deg,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0) 34%,
    rgba(255, 255, 255, 0) 68%,
    rgba(255, 255, 255, 0.24) 100%
  );
}
.brick-back {
  transform: rotateY(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.62), transparent 46%),
    linear-gradient(145deg, var(--c1, #f6cdd5), var(--c2, #f6e3a8));
}
.brick-star {
  color: rgba(255, 255, 255, 0.88);
  font-size: var(--bs, 16px);
  line-height: 1;
  text-shadow: 0 2px 5px rgba(90, 55, 45, 0.2);
  transform: rotate(var(--sr, 0deg));
}

.hero-copy {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 12vh 5vw 10vh;
  text-align: center;
  pointer-events: none;
  opacity: var(--hero-fade);
}
.hero-kicker {
  margin: 0 0 2.4vh;
  font-family: var(--font-serif);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.34em;
  color: rgba(23, 19, 15, 0.58);
  text-transform: uppercase;
}
.hero-title {
  margin: 0;
  font-family: var(--font-marker);
  font-size: clamp(70px, 14.2vw, 214px);
  font-weight: 400;
  line-height: 0.82;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-shadow:
    0 2px 0 rgba(255, 255, 255, 0.36),
    0 18px 36px rgba(92, 54, 40, 0.14);
}
.hero-line {
  display: block;
  white-space: nowrap;
}
.hero-line .char {
  display: inline-block;
  transform-origin: 50% 82%;
  will-change: transform;
}
.hero-note {
  margin: 2.6vh 0 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(12px, 1.05vw, 15px);
  letter-spacing: 0.13em;
  color: rgba(23, 19, 15, 0.68);
}
.hero-note span {
  display: inline-block;
  margin-left: 0.4em;
  color: var(--gold);
  font-style: normal;
  animation: slowSpin 10s linear infinite;
}

.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 4.6vh;
  padding: 12px 22px;
  border: 1px solid rgba(23, 19, 15, 0.3);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.52);
  color: var(--ink);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.24em;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  transition: background 0.3s, transform 0.3s var(--ease-out), border-color 0.3s;
}
.scroll-cue:hover {
  background: rgba(255, 253, 248, 0.92);
  border-color: rgba(23, 19, 15, 0.55);
  transform: translateY(-2px);
}
.scroll-cue-arrow {
  font-size: 13px;
  animation: cueBounce 2.4s ease-in-out infinite;
}

.hero-hint {
  position: absolute;
  left: 50%;
  bottom: 24px;
  z-index: 5;
  margin: 0;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: rgba(23, 19, 15, 0.44);
  white-space: nowrap;
  pointer-events: none;
}

/* ---------- 06 universe ---------- */
.universe-track {
  position: relative;
  z-index: 2;
  height: 140vh;
}
.universe {
  position: sticky;
  top: 0;
  display: grid;
  place-items: center;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}
.universe-inner {
  position: relative;
  width: min(var(--max), 88vw);
  padding: 10vh 0 8vh;
  opacity: var(--u-in, 0);
  transform: translateY(var(--u-y, 44px));
  will-change: opacity, transform;
}
.universe-inner::before {
  content: "";
  position: absolute;
  inset: -18% -8%;
  z-index: -1;
  background: radial-gradient(
    ellipse at 38% 52%,
    rgba(255, 252, 244, 0.72) 0%,
    rgba(255, 252, 244, 0) 68%
  );
  filter: blur(8px);
}
.display {
  margin: 0 0 3.4vh;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(64px, 9.6vw, 148px);
  line-height: 0.92;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.universe .display {
  white-space: nowrap;
}
.lede {
  max-width: 730px;
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(17px, 1.5vw, 21px);
  font-weight: 400;
  line-height: 1.95;
  color: rgba(23, 19, 15, 0.76);
  text-wrap: pretty;
}
.lede-poem {
  line-height: 2.05;
}
.scroll-hint {
  margin: 6vh 0 0;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(23, 19, 15, 0.48);
}
.scroll-hint span {
  display: inline-block;
  margin-right: 8px;
  animation: cueBounce 2.6s ease-in-out infinite;
}

/* ---------- 07 gallery ---------- */
.gallery-track {
  position: relative;
  z-index: 2;
  height: 330vh;
}
.gallery-stage {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}
.gallery-head {
  position: absolute;
  top: 8.5vh;
  left: 6vw;
  right: 6vw;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.gallery-head .section-label {
  margin: 0;
}
.gallery-count {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: rgba(23, 19, 15, 0.58);
  font-variant-numeric: tabular-nums;
}
.chapters {
  position: relative;
  width: min(1180px, 88vw);
  height: 72vh;
}
.chapter {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5%;
  opacity: 0;
  transition: opacity 0.55s var(--ease-out);
  will-change: transform, opacity;
}
.chapter-copy {
  position: relative;
  z-index: 2;
  width: 48%;
}
.chapter-no {
  margin: 0 0 2.2vh;
  font-family: var(--font-serif);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: rgba(23, 19, 15, 0.55);
}
.chapter-no span {
  margin: 0 0.5em;
  color: var(--gold);
}
.chapter-copy h2 {
  margin: 0 0 3vh;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(42px, 5.2vw, 82px);
  line-height: 1.06;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.chapter-body {
  max-width: 420px;
  margin: 0;
  font-size: clamp(13px, 1.02vw, 15px);
  line-height: 2;
  color: rgba(23, 19, 15, 0.7);
  text-wrap: pretty;
}
.chapter-body p {
  margin: 0;
}
.chapter-body p + p {
  margin-top: 1em;
}
.chapter-body.is-close p {
  font-family: var(--font-serif);
  font-size: clamp(17px, 1.5vw, 22px);
  line-height: 1.8;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.chapter-body.is-close p::before {
  content: "✦";
  margin-right: 0.55em;
  color: var(--gold);
  font-size: 0.8em;
}
.chapter-tag {
  margin: 5vh 0 0;
  font-family: var(--font-serif);
  font-size: 9px;
  letter-spacing: 0.3em;
  color: rgba(23, 19, 15, 0.42);
}
.poster {
  position: relative;
  flex: 0 0 auto;
  width: min(calc(min(48vh, 460px) * var(--poster-ar, 0.8)), 47%);
  aspect-ratio: var(--poster-ar, 4 / 5);
  height: auto;
  margin: 0;
  will-change: transform;
}
.poster-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 5px;
  background: #fff;
  box-shadow:
    0 42px 80px rgba(92, 54, 40, 0.2),
    0 10px 24px rgba(92, 54, 40, 0.12),
    0 0 0 1px rgba(255, 255, 255, 0.5);
  transform: rotate(calc(var(--tilt, 0) * 1deg));
  transition: transform 0.6s var(--ease-out);
}
.poster:hover .poster-frame {
  transform: rotate(calc(var(--tilt, 0) * 1deg)) scale(1.025);
}
.poster-frame:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}
.poster-slides {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.65s var(--ease-out);
  will-change: transform;
}
.poster-slide,
.poster-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}
.poster-slide {
  flex: 0 0 100%;
}
.poster-ui {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.poster-nav {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(23, 19, 15, 0.12);
  border-radius: 50%;
  background: rgba(255, 251, 242, 0.78);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-50%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.25s, background 0.25s, transform 0.25s var(--ease-out);
}
.poster-nav:hover {
  background: rgba(255, 251, 242, 0.96);
}
.poster-nav:focus-visible {
  opacity: 1;
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.poster-prev {
  left: 12px;
}
.poster-next {
  right: 12px;
}
.poster-dots {
  position: absolute;
  left: 50%;
  bottom: 8px;
  display: flex;
  gap: 2px;
  transform: translateX(-50%);
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.25s;
}
.poster-dot {
  position: relative;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}
.poster-dot::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: rgba(23, 19, 15, 0.24);
  transition: background 0.25s, transform 0.25s;
}
.poster-dot[aria-current="true"]::before {
  background: var(--ink);
  transform: scale(1.3);
}
.poster:hover .poster-nav,
.poster:focus-within .poster-nav,
.poster:hover .poster-dots,
.poster:focus-within .poster-dots {
  opacity: 1;
}
.poster:hover .poster-prev,
.poster:focus-within .poster-prev {
  transform: translateY(-50%) translateX(2px);
}
.poster:hover .poster-next,
.poster:focus-within .poster-next {
  transform: translateY(-50%) translateX(-2px);
}
.poster.is-single .poster-ui {
  display: none;
}
@media (hover: none) {
  .poster-nav,
  .poster-dots {
    opacity: 0.95;
  }
}
.poster figcaption {
  position: absolute;
  top: 50%;
  left: 100%;
  margin-left: 20px;
  font-family: var(--font-serif);
  font-size: 9px;
  letter-spacing: 0.26em;
  color: rgba(23, 19, 15, 0.55);
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: translateY(-50%);
}
.gallery-hint {
  position: absolute;
  bottom: 5.5vh;
  left: 50%;
  margin: 0;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(23, 19, 15, 0.4);
  white-space: nowrap;
}

/* ---------- 08 wishes ---------- */
.wishes {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 11vh 5vw 7vh;
}
.wishes-inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: min(1200px, 100%);
  min-height: 78vh;
}
.wishes-head {
  max-width: 820px;
  margin: 0 auto;
  text-align: center;
}
.wishes-head h2 {
  margin: 0 0 16px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(34px, 4.4vw, 62px);
  line-height: 1.14;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}
.wishes-sub {
  margin: 0 auto;
  max-width: 560px;
  font-size: clamp(12px, 1.02vw, 14px);
  line-height: 1.9;
  color: rgba(23, 19, 15, 0.66);
}

.constellation {
  position: relative;
  align-self: center;
  width: 100%;
  max-width: 1080px;
  height: 47vh;
  min-height: 330px;
  margin: 1.5vh 0;
}
.constellation-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.constellation-lines polyline {
  fill: none;
  stroke: rgba(23, 19, 15, 0.26);
  stroke-width: 1;
  stroke-dasharray: 2 5;
  vector-effect: non-scaling-stroke;
}
.constellation-lines circle {
  fill: rgba(255, 253, 248, 0.7);
}

.wish-stars {
  position: absolute;
  inset: 0;
}
.wish-star {
  --size: 64px;
  --r: 0deg;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: min(var(--size), 11vw);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--c, var(--pink-deep));
  cursor: pointer;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 12px 16px rgba(92, 54, 40, 0.16));
  animation: wishFloat var(--t, 7s) ease-in-out infinite;
  animation-delay: var(--d, 0s);
  transition: filter 0.35s, opacity 0.35s;
  will-change: transform;
}
.wish-star svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  transition: transform 0.35s var(--ease-out);
}
.wish-star .star-fill {
  fill: currentColor;
  stroke: transparent;
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}
.wish-star .star-shine {
  fill: #fff;
  opacity: 0.35;
}
.wish-star:hover svg,
.wish-star:focus-visible svg {
  transform: scale(1.16) rotate(6deg);
}
.wish-star:hover,
.wish-star:focus-visible {
  filter: drop-shadow(0 0 20px color-mix(in srgb, currentColor 62%, transparent))
    drop-shadow(0 14px 18px rgba(92, 54, 40, 0.2));
}
.wish-star.is-empty {
  opacity: 0.94;
  filter: drop-shadow(0 10px 15px rgba(92, 54, 40, 0.13));
}
.wish-star.is-empty .star-fill {
  fill: color-mix(in srgb, currentColor 88%, #fff7ea);
  stroke: rgba(23, 19, 15, 0.44);
  stroke-width: 1.6;
}
.wish-star.is-empty .star-shine {
  opacity: 0.16;
}
.wish-star .wish-plus {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 400;
  color: rgba(23, 19, 15, 0.72);
  text-shadow: 0 0 10px rgba(255, 253, 248, 0.95);
  pointer-events: none;
}
.wish-star.is-lit .wish-plus {
  display: none;
}
.wish-star.is-lit svg {
  animation: starGlow 4.6s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
.wish-star::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  z-index: 3;
  padding: 5px 9px;
  border-radius: 4px;
  background: rgba(23, 19, 15, 0.88);
  color: var(--cream);
  font-family: var(--font-sans);
  font-size: 9px;
  letter-spacing: 0.08em;
  line-height: 1.4;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity 0.22s, transform 0.22s;
  pointer-events: none;
}
.wish-star:hover::after,
.wish-star:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.wish-star.is-bonus {
  left: 50%;
  top: 50%;
  width: min(112px, 17vw);
  color: var(--gold);
  opacity: 0;
  visibility: hidden;
  z-index: 4;
  filter: drop-shadow(0 0 26px rgba(242, 193, 78, 0.55));
}
.wish-star.is-bonus.is-visible {
  visibility: visible;
  animation: bonusIn 1.1s var(--ease-out) forwards,
    wishFloat 7s ease-in-out 1.1s infinite;
}
.wish-star.is-bonus.is-empty {
  opacity: 0.7;
}
.wish-star.is-bonus::before {
  content: "";
  position: absolute;
  inset: -34%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 193, 78, 0.38), transparent 66%);
  filter: blur(8px);
}

.wishes-foot {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding-top: 1vh;
}
.wishes-count {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: rgba(23, 19, 15, 0.62);
}
.wishes-count strong {
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
}
.wishes-tip {
  position: absolute;
  right: 0;
  bottom: 4px;
  margin: 0;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: rgba(23, 19, 15, 0.38);
}

/* ---------- 09 finale ---------- */
.finale {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  min-height: 100svh;
  padding: 11vh 6vw 0;
  overflow: hidden;
  background:
    radial-gradient(46% 44% at 82% 34%, rgba(242, 193, 78, 0.12), transparent 70%),
    radial-gradient(40% 46% at 14% 78%, rgba(217, 205, 240, 0.12), transparent 72%),
    linear-gradient(158deg, #1a1620 0%, #121016 56%, #171320 100%);
  color: var(--cream);
}
.finale::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: radial-gradient(
    rgba(255, 253, 248, 0.5) 0.6px,
    transparent 0.7px
  );
  background-size: 26px 26px;
  opacity: 0.18;
  pointer-events: none;
}
.finale-stars {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.finale-stars i {
  position: absolute;
  width: var(--s, 4px);
  height: var(--s, 4px);
  border-radius: 50%;
  background: var(--c, #fff);
  opacity: var(--o, 0.5);
  animation: twinkle var(--t, 5s) ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
.finale-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 5vw;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding-bottom: 5vh;
}
.finale-copy {
  max-width: 600px;
}
.finale-copy h2 {
  margin: 0 0 20px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(34px, 4.2vw, 56px);
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: #f8f0e4;
}
.finale-sub {
  margin: 0;
  font-size: 13px;
  line-height: 1.9;
  color: rgba(255, 253, 248, 0.58);
}
#open-jar {
  margin-top: 4.4vh;
}
.finale-reveal {
  margin: 4.2vh 0 0;
  font-family: var(--font-serif);
  font-size: clamp(20px, 2.1vw, 27px);
  line-height: 1.7;
  color: var(--gold);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1s var(--ease-out) 0.45s, transform 1s var(--ease-out) 0.45s;
}
.finale-reveal span {
  display: inline-block;
  margin-top: 0.35em;
  font-family: var(--font-marker);
  font-size: 0.82em;
  color: var(--cream);
  letter-spacing: 0.02em;
}
.finale.is-open .finale-reveal {
  opacity: 1;
  transform: none;
}

.jar-stage {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  width: min(33vw, 430px);
}
.jar-glow {
  position: absolute;
  top: 6%;
  width: 120%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 193, 78, 0.24), transparent 62%);
  filter: blur(24px);
}
.jar {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 34px 60px rgba(0, 0, 0, 0.42));
  transform-origin: 50% 92%;
}
.jar-caption {
  margin: 8px 0 0;
  font-family: var(--font-serif);
  font-size: 9px;
  letter-spacing: 0.28em;
  color: rgba(255, 253, 248, 0.4);
}
.finale.is-shaking .jar {
  animation: jarShake 0.58s ease-in-out 2;
}
.finale.is-open .jar-lid {
  animation: lidPop 1.1s var(--ease-out) forwards;
}
.finale.is-open .jar {
  animation: jarBreathe 5s ease-in-out 1.1s infinite;
}

.footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px 0 28px;
  border-top: 1px solid rgba(255, 253, 248, 0.12);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: rgba(255, 253, 248, 0.42);
}
.footer p {
  margin: 0;
}
.footer-made span {
  color: var(--pink-deep);
}
.footer-brand {
  font-family: var(--font-marker);
  font-size: 18px;
  letter-spacing: 0.02em;
  color: var(--cream);
}
.footer-top {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}
.footer-top:hover {
  color: var(--cream);
  border-bottom-color: currentColor;
}

/* ---------- 10 dialogs / editor / toast ---------- */
dialog {
  position: fixed;
  inset: 0;
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}
dialog::backdrop {
  background: rgba(18, 15, 22, 0.52);
  backdrop-filter: blur(10px) saturate(0.9);
  -webkit-backdrop-filter: blur(10px) saturate(0.9);
}
dialog[open] {
  animation: dialogIn 0.38s var(--ease-out) both;
}

.dialog-x {
  position: absolute;
  top: 12px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(23, 19, 15, 0.55);
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.dialog-x:hover {
  background: rgba(23, 19, 15, 0.07);
  color: var(--ink);
}

.wish-dialog {
  position: relative;
  width: min(524px, 92vw);
  padding: 48px 44px 28px;
  overflow: hidden;
  border-radius: 18px;
  background:
    radial-gradient(80% 60% at 20% 0%, #fffdf7 0%, rgba(255, 253, 247, 0) 70%),
    linear-gradient(158deg, #fffaf1 0%, #f7e9dd 100%);
  box-shadow:
    0 44px 100px rgba(18, 15, 22, 0.34),
    0 0 0 1px rgba(255, 255, 255, 0.6) inset;
}
.wish-dialog::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--pink-deep), var(--gold), var(--mint-deep));
}
.wish-dialog-no {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: rgba(23, 19, 15, 0.48);
}
.wish-dialog-title {
  margin: 0 0 20px;
  font-family: var(--font-serif);
  font-size: clamp(28px, 3.3vw, 36px);
  font-weight: 600;
  line-height: 1.2;
}
.wish-dialog-body {
  min-height: 3.4em;
  margin: 0 0 18px;
  font-family: var(--font-serif);
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.95;
  color: rgba(23, 19, 15, 0.84);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.wish-dialog-from {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: rgba(23, 19, 15, 0.48);
}
.wish-dialog.is-empty .wish-dialog-from {
  visibility: hidden;
}
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid rgba(23, 19, 15, 0.1);
}

.editor-dialog {
  width: min(1080px, 94vw);
  max-height: 92vh;
  max-height: 92svh;
  overflow: hidden;
  border-radius: 20px;
  background:
    radial-gradient(70% 50% at 14% 0%, #fffdf8 0%, rgba(255, 253, 248, 0) 68%),
    linear-gradient(158deg, #fffaf2 0%, #f4e7d8 100%);
  box-shadow:
    0 50px 120px rgba(18, 15, 22, 0.36),
    0 0 0 1px rgba(255, 255, 255, 0.55) inset;
}
.editor-shell {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  max-height: 92svh;
  padding: 32px 36px 22px;
}
.editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 0 0 16px;
  border-bottom: 1px solid rgba(23, 19, 15, 0.1);
}
.editor-head .section-label {
  margin-bottom: 6px;
}
.editor-head h2 {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: clamp(28px, 3.2vw, 38px);
  font-weight: 600;
  line-height: 1.1;
}
.editor-head p:last-child {
  max-width: 620px;
  margin: 0;
  font-size: 11px;
  line-height: 1.8;
  color: rgba(23, 19, 15, 0.58);
}
.editor-list {
  display: grid;
  flex: 1;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  padding: 14px 4px 6px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(23, 19, 15, 0.22) transparent;
}
.editor-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(23, 19, 15, 0.09);
  border-radius: 11px;
  background: rgba(255, 253, 248, 0.5);
  transition: border-color 0.2s, background 0.2s;
}
.editor-row:focus-within {
  border-color: rgba(23, 19, 15, 0.28);
  background: rgba(255, 255, 255, 0.84);
}
.editor-row.is-bonus {
  grid-column: 1 / -1;
  border-style: dashed;
  border-color: rgba(242, 193, 78, 0.5);
  background: rgba(255, 250, 235, 0.72);
}
.editor-star {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin-top: 12px;
  color: var(--c);
  filter: drop-shadow(0 2px 3px rgba(92, 54, 40, 0.16));
}
.editor-star .star-fill {
  fill: currentColor;
}
.editor-field {
  flex: 1;
  min-width: 0;
}
.editor-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: rgba(23, 19, 15, 0.5);
}
.editor-label b {
  font-weight: 600;
  color: rgba(23, 19, 15, 0.7);
}
.editor-field textarea {
  display: block;
  width: 100%;
  min-height: 56px;
  max-height: 132px;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--ink);
  resize: vertical;
}
.editor-field textarea::placeholder {
  color: rgba(23, 19, 15, 0.34);
  font-style: italic;
}
.editor-count {
  margin-top: 1px;
  font-size: 8px;
  letter-spacing: 0.08em;
  text-align: right;
  color: rgba(23, 19, 15, 0.34);
}
.editor-status {
  min-height: 15px;
  margin: 4px 0 0;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: rgba(23, 19, 15, 0.5);
}
.editor-status.is-ok {
  color: #5d7a4a;
}
.editor-note {
  margin: 2px 0 10px;
  font-size: 9px;
  line-height: 1.7;
  color: rgba(23, 19, 15, 0.4);
}
.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(23, 19, 15, 0.1);
}
.editor-actions-left,
.editor-actions-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
.file-label {
  position: relative;
  cursor: pointer;
}
.file-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  z-index: 120;
  max-width: 90vw;
  padding: 11px 18px;
  border-radius: 999px;
  background: rgba(23, 19, 15, 0.93);
  color: var(--cream);
  font-size: 11px;
  letter-spacing: 0.04em;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity 0.32s, transform 0.32s var(--ease-out);
  pointer-events: none;
}
.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.confetti {
  position: fixed;
  inset: 0;
  z-index: 90;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.confetti.is-on {
  opacity: 1;
}

/* ---------- keyframes ---------- */
@keyframes slowSpin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes floatDeco {
  0%,
  100% {
    transform: translate(-50%, -50%) rotate(var(--r, 0deg)) translateY(0);
  }
  50% {
    transform: translate(-50%, -50%) rotate(calc(var(--r, 0deg) + 4deg)) translateY(-12px);
  }
}
@keyframes cueBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(5px);
  }
}
@keyframes wishFloat {
  0%,
  100% {
    transform: translate(-50%, -50%) translateY(0) rotate(var(--r, 0deg));
  }
  50% {
    transform: translate(-50%, -50%) translateY(-9px) rotate(calc(var(--r, 0deg) + 3deg));
  }
}
@keyframes starGlow {
  0%,
  100% {
    filter: drop-shadow(0 0 6px color-mix(in srgb, currentColor 30%, transparent));
  }
  50% {
    filter: drop-shadow(0 0 18px color-mix(in srgb, currentColor 62%, transparent));
  }
}
@keyframes bonusIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4) rotate(-30deg);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0);
  }
}
@keyframes twinkle {
  0%,
  100% {
    opacity: var(--o, 0.65);
    transform: scale(1);
  }
  50% {
    opacity: 0.18;
    transform: scale(0.82);
  }
}
@keyframes jarShake {
  0%,
  100% {
    transform: rotate(0) translateY(0);
  }
  20% {
    transform: rotate(-3deg) translateY(-4px);
  }
  40% {
    transform: rotate(3deg) translateY(2px);
  }
  60% {
    transform: rotate(-2deg) translateY(-2px);
  }
  80% {
    transform: rotate(1.5deg) translateY(0);
  }
}
@keyframes lidPop {
  0% {
    transform: translate(0, 0) rotate(0);
    opacity: 1;
  }
  35% {
    transform: translate(6px, -34px) rotate(-6deg);
    opacity: 1;
  }
  100% {
    transform: translate(46px, -120px) rotate(-28deg);
    opacity: 0;
  }
}
@keyframes jarBreathe {
  0%,
  100% {
    transform: translateY(0) rotate(0);
  }
  50% {
    transform: translateY(-5px) rotate(0.6deg);
  }
}
@keyframes dialogIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- 11 responsive ---------- */
@media (max-width: 1100px) {
  .chapters {
    width: 90vw;
  }
  .poster {
    width: min(calc(min(48vh, 460px) * var(--poster-ar, 0.8)), 50%);
  }
  .chapter-copy h2 {
    font-size: clamp(38px, 5vw, 66px);
  }
}

@media (max-width: 820px) {
  .topbar {
    padding: 18px 18px;
  }
  .topbar-meta {
    font-size: 9px;
    letter-spacing: 0.18em;
  }
  .topbar-right {
    gap: 8px;
  }
  .music-toggle {
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
  }
  .music-disc {
    width: 27px;
    height: 27px;
  }
  .music-label {
    display: none;
  }
  .topbar-stamp {
    gap: 4px;
  }
  .topbar-glyph {
    font-size: 11px;
  }
  .topbar-date {
    font-size: 8.5px;
    letter-spacing: 0.16em;
  }
  .topbar-line {
    width: 22px;
  }
  .chapter-nav {
    right: 7px;
    gap: 12px;
  }
  .chapter-nav button em {
    display: none;
  }
  .chapter-nav button span {
    width: 6px;
    height: 6px;
  }
  .hero {
    background: var(--cream);
  }
  .hero-title {
    font-size: clamp(58px, 17vw, 128px);
    line-height: 0.86;
  }
  .hero-copy {
    padding: 13vh 4vw 9vh;
  }
  .hero-kicker {
    font-size: 8px;
    letter-spacing: 0.26em;
  }
  .hero-hint {
    display: none;
  }
  .scroll-cue {
    padding: 10px 16px;
    font-size: 8px;
    letter-spacing: 0.18em;
  }
  .display {
    font-size: clamp(52px, 14vw, 96px);
  }
  .universe-inner {
    width: 88vw;
  }
  .lede {
    font-size: 16px;
    line-height: 1.95;
  }
  .br-desktop {
    display: none;
  }
  .gallery-head {
    top: 7vh;
    left: 7vw;
    right: 7vw;
  }
  .chapters {
    width: 86vw;
    height: 82vh;
  }
  .chapter {
    flex-direction: column;
    justify-content: center;
    gap: 2.2vh;
    padding-top: 2vh;
  }
  .chapter-copy {
    width: 100%;
  }
  .chapter-no {
    margin-bottom: 1.2vh;
  }
  .chapter-copy h2 {
    margin-bottom: 1.6vh;
    font-size: clamp(32px, 8.4vw, 48px);
  }
  .chapter-body {
    max-width: none;
    font-size: 12.5px;
    line-height: 1.85;
  }
  .chapter-tag {
    display: none;
  }
  .poster {
    width: min(100%, calc(min(38vh, 330px) * var(--poster-ar, 0.8)));
    align-self: center;
  }
  .poster figcaption {
    display: none;
  }
  .gallery-hint {
    bottom: 4vh;
  }
  .wishes {
    padding: 9vh 4vw 6vh;
  }
  .wishes-inner {
    min-height: 84vh;
  }
  .wishes-head h2 {
    font-size: clamp(30px, 8.4vw, 44px);
  }
  .wishes-sub {
    font-size: 11.5px;
    max-width: 340px;
  }
  .constellation {
    height: 48vh;
    min-height: 340px;
    margin: 0;
  }
  .wish-star {
    width: min(var(--size), 12vw);
  }
  .wish-star::after {
    display: none;
  }
  .wish-star.is-bonus {
    width: min(88px, 19vw);
  }
  .wishes-foot {
    gap: 14px;
    padding-bottom: 10px;
  }
  .wishes-tip {
    position: static;
    flex-basis: 100%;
    text-align: center;
  }
  .finale {
    padding: 9vh 7vw 0;
  }
  .finale-inner {
    flex-direction: column;
    justify-content: center;
    gap: 4vh;
    text-align: center;
  }
  .finale-copy {
    max-width: 560px;
  }
  .finale-copy h2 {
    font-size: clamp(30px, 7.6vw, 44px);
  }
  .jar-stage {
    width: min(52vw, 260px);
  }
  .jar-caption {
    display: none;
  }
  #open-jar {
    margin-top: 3vh;
  }
  .footer {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 18px;
    padding: 18px 0 22px;
    text-align: center;
  }
  .footer-made {
    flex-basis: 100%;
  }
  .editor-dialog {
    width: 94vw;
    max-height: 92svh;
  }
  .editor-shell {
    padding: 22px 18px 16px;
  }
  .editor-head {
    padding-right: 26px;
  }
  .editor-head h2 {
    font-size: 26px;
  }
  .editor-head p:last-child {
    font-size: 10px;
  }
  .editor-list {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .editor-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .editor-actions-left {
    justify-content: space-between;
    gap: 8px;
  }
  .editor-actions-right {
    justify-content: flex-end;
  }
  .editor-actions .btn {
    padding: 11px 18px;
  }
  .wish-dialog {
    padding: 40px 24px 24px;
  }
  .wish-dialog-title {
    font-size: 26px;
  }
  .wish-dialog-body {
    font-size: 17px;
  }
  .wish-dialog .dialog-actions {
    margin-top: 22px;
  }
  .wall {
    --cols: 8;
    --rows: 12;
  }
}

@media (max-width: 520px) {
  .brand-word {
    font-size: 22px;
  }
  .topbar-meta {
    gap: 8px;
    opacity: 0.64;
  }
  .topbar-line {
    width: 16px;
  }
  .topbar-glyph {
    font-size: 10.5px;
  }
  .topbar-date {
    font-size: 8.5px;
    letter-spacing: 0.14em;
  }
  .lede-poem {
    line-height: 1.9;
  }
  .hero-title {
    font-size: clamp(52px, 18.5vw, 92px);
  }
  .hero-note {
    font-size: 11px;
    letter-spacing: 0.08em;
  }
  .scroll-cue {
    margin-top: 3.2vh;
  }
  .chapter-copy h2 {
    font-size: clamp(30px, 8.8vw, 42px);
  }
  .poster {
    width: min(100%, calc(min(36vh, 300px) * var(--poster-ar, 0.8)));
  }
  .wishes-head h2 {
    font-size: clamp(28px, 8.6vw, 38px);
  }
  .constellation {
    height: 44vh;
    min-height: 300px;
  }
  .wish-star {
    width: min(var(--size), 13vw);
  }
  .wishes-foot .btn {
    padding: 11px 20px;
  }
  .finale-copy h2 {
    font-size: clamp(28px, 8.2vw, 38px);
  }
  .jar-stage {
    width: min(58vw, 220px);
  }
  .footer {
    font-size: 8px;
  }
  .footer-brand {
    font-size: 16px;
  }
  .editor-head p:last-child {
    display: none;
  }
}

@media (max-height: 640px) and (min-width: 821px) {
  .hero-title {
    font-size: clamp(58px, 11vw, 150px);
  }
  .hero-copy {
    padding-top: 9vh;
  }
  .scroll-cue {
    margin-top: 3vh;
  }
  .chapter-copy h2 {
    font-size: clamp(34px, 4.4vw, 60px);
  }
  .poster {
    height: min(52vh, 430px);
  }
  .constellation {
    height: 42vh;
    min-height: 280px;
  }
  .finale {
    padding-top: 8vh;
  }
}

/* ---------- 12 reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .hero-line .char {
    transform: none !important;
  }
  .wish-star {
    transform: translate(-50%, -50%) !important;
  }
}
