/* =========================================================
   WZW'S TREE 鈥?a very special Christmas toy
   ========================================================= */

:root {
  --ink: #0a1f18;
  --ink-soft: rgba(10, 31, 24, 0.62);
  --pine: #0e3126;
  --pine-2: #174838;
  --pine-3: #1e5b48;
  --cream: #f3ead6;
  --cream-2: #fbf4e3;
  --cream-3: #fff9ed;
  --paper: #f6edd9;
  --gold: #e9bd6f;
  --gold-soft: #f4d99f;
  --gold-deep: #b98235;
  --berry: #c94742;
  --berry-deep: #94232f;
  --ice: #cfe6df;
  --shadow-soft: 0 18px 50px rgba(0, 0, 0, 0.28);
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  --sans: "Avenir Next", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --shelf-h: 232px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  margin: 0;
  background: #06130e;
}

body {
  overflow: hidden;
  color: var(--cream);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button {
  border: 0;
  margin: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

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

.noscript {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 30px;
  background: var(--pine);
  color: var(--cream);
  font-size: 15px;
  line-height: 1.8;
  text-align: center;
}

[hidden] {
  display: none !important;
}

.page {
  width: 100%;
  height: 100vh;
  height: 100svh;
  min-height: 320px;
  display: flex;
  justify-content: center;
  background:
    radial-gradient(70% 60% at 15% 8%, rgba(55, 107, 83, 0.25), transparent 70%),
    radial-gradient(80% 70% at 90% 90%, rgba(148, 90, 38, 0.12), transparent 70%),
    #06130e;
}

.app {
  position: relative;
  width: 100%;
  max-width: 1440px;
  height: 100vh;
  height: 100svh;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  background: var(--pine);
}

/* =========================================================
   Stage & atmosphere
   ========================================================= */

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #0b241b;
  isolation: isolate;
}

.stage-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(85% 58% at 50% 9%, #2f6a55 0%, #1d5140 28%, #123a2d 54%, #0b241b 78%, #071710 100%);
}

.stage-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.16;
  mix-blend-mode: soft-light;
  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='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

.stage-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(2, 10, 7, 0.45) 0%, transparent 18%, transparent 68%, rgba(2, 10, 7, 0.62) 100%),
    radial-gradient(120% 100% at 50% 50%, transparent 55%, rgba(2, 9, 6, 0.5) 100%);
}

.aurora {
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  filter: blur(54px);
  opacity: 0.3;
  mix-blend-mode: screen;
  pointer-events: none;
}

.aurora-one {
  width: 60%;
  height: 34%;
  top: -10%;
  left: -16%;
  background: radial-gradient(ellipse, rgba(92, 220, 175, 0.65), transparent 70%);
  animation: auroraDrift 20s ease-in-out infinite alternate;
}

.aurora-two {
  width: 50%;
  height: 28%;
  top: 5%;
  right: -12%;
  background: radial-gradient(ellipse, rgba(241, 191, 105, 0.5), transparent 68%);
  animation: auroraDrift 26s 2s ease-in-out infinite alternate-reverse;
}

.moon {
  position: absolute;
  z-index: 0;
  top: 9%;
  right: 7%;
  width: clamp(72px, 10vw, 126px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, #fffdf1 0%, #f8efd0 40%, #e7d2a0 72%, #c4a66c 100%);
  box-shadow:
    0 0 50px rgba(245, 222, 166, 0.28),
    0 0 110px rgba(245, 222, 166, 0.12);
  opacity: 0.94;
}

.moon::before {
  content: "";
  position: absolute;
  inset: 15% 18% 22% 20%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 30%, rgba(168, 139, 91, 0.15) 0 6%, transparent 7%),
    radial-gradient(circle at 68% 62%, rgba(168, 139, 91, 0.13) 0 8%, transparent 9%),
    radial-gradient(circle at 48% 78%, rgba(168, 139, 91, 0.1) 0 5%, transparent 6%);
}

.starfield {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.8;
  background-image:
    radial-gradient(1px 1px at 12% 28%, rgba(255, 247, 219, 0.9), transparent 100%),
    radial-gradient(1.4px 1.4px at 23% 16%, rgba(255, 247, 219, 0.65), transparent 100%),
    radial-gradient(1px 1px at 38% 34%, rgba(255, 247, 219, 0.7), transparent 100%),
    radial-gradient(1.3px 1.3px at 62% 18%, rgba(255, 247, 219, 0.8), transparent 100%),
    radial-gradient(1px 1px at 74% 28%, rgba(255, 247, 219, 0.6), transparent 100%),
    radial-gradient(1.2px 1.2px at 87% 13%, rgba(255, 247, 219, 0.72), transparent 100%),
    radial-gradient(1px 1px at 91% 44%, rgba(255, 247, 219, 0.45), transparent 100%),
    radial-gradient(1px 1px at 48% 11%, rgba(255, 247, 219, 0.55), transparent 100%),
    radial-gradient(1px 1px at 67% 47%, rgba(255, 247, 219, 0.36), transparent 100%),
    radial-gradient(1px 1px at 8% 47%, rgba(255, 247, 219, 0.38), transparent 100%);
  animation: starFieldTwinkle 7s ease-in-out infinite alternate;
}

.light-string {
  position: absolute;
  z-index: 1;
  top: 8px;
  left: -2%;
  width: 104%;
  height: clamp(110px, 22vh, 170px);
  opacity: 0.9;
  filter: drop-shadow(0 0 6px rgba(255, 219, 154, 0.3));
  pointer-events: none;
}

.arch {
  position: absolute;
  z-index: 0;
  left: 50%;
  bottom: 2%;
  width: min(86vw, 640px);
  aspect-ratio: 1;
  transform: translateX(-50%);
  border-radius: 50%;
  border: 1px solid rgba(239, 203, 138, 0.14);
  pointer-events: none;
}

.arch-inner {
  width: min(73vw, 548px);
  border-color: rgba(239, 203, 138, 0.08);
  border-style: dashed;
}

.pines {
  position: absolute;
  z-index: 1;
  bottom: -28px;
  width: clamp(150px, 21vw, 250px);
  height: auto;
  opacity: 0.62;
  filter: blur(0.3px);
  pointer-events: none;
}

.pines-left {
  left: -42px;
  transform: rotate(2deg);
}

.pines-right {
  right: -36px;
  transform: rotate(-3deg) scale(0.9);
  opacity: 0.48;
}

.snowdrift {
  position: absolute;
  z-index: 2;
  left: -15%;
  width: 130%;
  bottom: -88px;
  height: 170px;
  border-radius: 50% 50% 0 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(222, 237, 225, 0.28), rgba(222, 237, 225, 0.02) 68%);
  filter: blur(12px);
  pointer-events: none;
}

.drift-front {
  bottom: -108px;
  height: 190px;
  background: radial-gradient(ellipse at 50% 0%, rgba(239, 246, 235, 0.2), transparent 70%);
  filter: blur(22px);
}

.gift-box {
  position: absolute;
  z-index: 2;
  bottom: 8px;
  width: clamp(42px, 5.4vw, 64px);
  height: clamp(36px, 4.6vw, 54px);
  border-radius: 3px;
  background: linear-gradient(140deg, #d95851, #9f2331);
  box-shadow: 0 12px 18px rgba(0, 0, 0, 0.28);
  opacity: 0.9;
}

.gift-left {
  left: 6%;
  transform: rotate(-4deg);
}

.gift-right {
  right: 7%;
  height: clamp(30px, 4vw, 46px);
  width: clamp(48px, 6vw, 70px);
  background: linear-gradient(145deg, #eee1c6, #c9b48d);
  transform: rotate(3deg);
}

.gift-ribbon-v,
.gift-ribbon-h {
  position: absolute;
  background: var(--gold);
  opacity: 0.88;
}

.gift-ribbon-v {
  top: 0;
  bottom: 0;
  left: 43%;
  width: 14%;
}

.gift-ribbon-h {
  left: 0;
  right: 0;
  top: 41%;
  height: 15%;
}

.gift-bow {
  position: absolute;
  top: -10px;
  left: 50%;
  width: 24px;
  height: 14px;
  transform: translateX(-50%);
  border-radius: 50% 50% 40% 40%;
  border: 4px solid var(--gold);
  opacity: 0.9;
}

.rubber-stamp {
  position: absolute;
  z-index: 2;
  left: 16px;
  top: 44%;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 1.5px solid rgba(217, 105, 92, 0.7);
  color: rgba(234, 144, 128, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transform: rotate(-12deg);
  font-size: 6.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-align: center;
  opacity: 0.7;
  pointer-events: none;
}

.rubber-stamp::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 0.8px dashed currentColor;
  opacity: 0.7;
}

.rubber-stamp b {
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

.rubber-stamp small {
  font-size: 5.5px;
  letter-spacing: 0.2em;
  opacity: 0.75;
}

.no-mark {
  position: absolute;
  z-index: 2;
  right: 15px;
  bottom: 25%;
  writing-mode: vertical-rl;
  color: rgba(243, 234, 214, 0.32);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.3em;
  pointer-events: none;
}

.snowfall {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.stage-note,
.stage-sideword {
  display: none;
}

@media (min-width: 1200px) {
  .stage-note {
    position: absolute;
    z-index: 8;
    left: max(38px, 4.6vw);
    top: 22%;
    display: block;
    width: 248px;
    color: var(--cream);
    pointer-events: none;
  }

  .stage-note-kicker {
    display: block;
    color: rgba(241, 201, 124, 0.66);
    font-size: 7px;
    font-weight: 700;
    letter-spacing: 0.17em;
  }

  .stage-note h2 {
    margin: 11px 0 12px;
    color: var(--cream-3);
    font-family: var(--serif);
    font-size: 38px;
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.12;
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.2);
  }

  .stage-note h2 em {
    color: var(--gold-soft);
    font-weight: 500;
  }

  .stage-note p {
    margin: 0;
    color: rgba(243, 234, 214, 0.56);
    font-size: 11px;
    line-height: 1.8;
  }

  .stage-note-rule {
    display: block;
    width: 44px;
    height: 1px;
    margin: 17px 0 10px;
    background: rgba(233, 189, 111, 0.5);
  }

  .stage-note-small {
    display: block;
    color: rgba(243, 234, 214, 0.38);
    font-size: 9.5px;
    letter-spacing: 0.12em;
  }

  .stage-sideword {
    position: absolute;
    z-index: 8;
    right: 22px;
    top: 30%;
    display: block;
    writing-mode: vertical-rl;
    color: rgba(243, 234, 214, 0.22);
    font-size: 7px;
    font-weight: 600;
    letter-spacing: 0.32em;
    pointer-events: none;
  }

  .rubber-stamp,
  .no-mark {
    display: none;
  }
}

/* =========================================================
   Top bar
   ========================================================= */

.topbar {
  position: absolute;
  z-index: 30;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 15px 0;
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
}

.brand-mark {
  width: 27px;
  flex: 0 0 27px;
  filter: drop-shadow(0 0 10px rgba(240, 202, 128, 0.28));
}

.brand-mark svg {
  width: 100%;
  height: auto;
  display: block;
}

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

.brand-kicker {
  color: rgba(243, 234, 214, 0.55);
  font-size: 6.5px;
  font-weight: 700;
  letter-spacing: 0.21em;
  line-height: 1;
}

.brand-name {
  color: var(--cream-3);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.055em;
  line-height: 1;
  white-space: nowrap;
}

.brand-apos {
  color: var(--gold);
  font-size: 0.8em;
}

.top-actions {
  display: flex;
  gap: 7px;
  pointer-events: auto;
}

.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: rgba(247, 239, 219, 0.86);
  background: rgba(6, 23, 17, 0.32);
  border: 1px solid rgba(243, 234, 214, 0.17);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  transition: background 0.2s, transform 0.2s, border-color 0.2s;
}

.icon-btn:hover {
  background: rgba(24, 61, 47, 0.7);
  border-color: rgba(243, 234, 214, 0.3);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.icon-btn .icon-off {
  display: none;
}

.icon-btn.is-muted .icon-on {
  display: none;
}

.icon-btn.is-muted .icon-off {
  display: block;
}

/* =========================================================
   The tree
   ========================================================= */

.tree-scene {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-top: 52px;
  pointer-events: none;
}

.tree-figure {
  position: relative;
  height: min(calc(100% - 34px), calc(100vw / 0.7523), 770px);
  aspect-ratio: 1497 / 1990;
  transform-origin: 50% 100%;
  pointer-events: auto;
  filter: drop-shadow(0 25px 28px rgba(0, 0, 0, 0.3));
  animation: figureRise 1s cubic-bezier(0.19, 1, 0.22, 1) both;
}

.figure-aura {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 14%;
  width: 92%;
  height: 82%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(240, 202, 128, 0.18), rgba(167, 225, 197, 0.06) 45%, transparent 70%);
  filter: blur(26px);
  animation: auraBreathe 6s ease-in-out infinite alternate;
  pointer-events: none;
}

.figure-image-wrap {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.figure-image-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.star-topper {
  position: absolute;
  z-index: 6;
  top: calc(-1 * clamp(24px, 7.3vw, 48px));
  left: 50%;
  width: clamp(42px, 12.4vw, 76px);
  transform: translateX(-50%) scale(0.2) rotate(-16deg);
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 14px rgba(248, 210, 128, 0.5));
}

.star-topper svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.tree-figure.has-star .star-topper {
  animation: starArrive 0.9s cubic-bezier(0.18, 1.3, 0.4, 1) both, starBreath 4.5s 0.9s ease-in-out infinite;
}

.ornament-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: visible;
  pointer-events: none;
}

.figure-plaque {
  position: absolute;
  z-index: 4;
  left: 7%;
  bottom: 9%;
  padding: 4px 7px 3px;
  border-radius: 2px;
  background: rgba(246, 237, 217, 0.9);
  color: var(--ink);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
  transform: rotate(-4deg);
  font-size: 5.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-align: center;
  pointer-events: none;
  opacity: 0.82;
}

.figure-plaque b {
  display: block;
  font-size: 6px;
  letter-spacing: 0.08em;
  color: rgba(10, 31, 24, 0.5);
}

/* Hanging ornaments */

.ornament {
  position: absolute;
  width: var(--orn-size, clamp(48px, 13.5vw, 66px));
  pointer-events: auto;
  aspect-ratio: 100 / 120;
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(var(--scale, 1));
  z-index: var(--z, 5);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: left, top, transform;
  filter: drop-shadow(0 5px 4px rgba(0, 0, 0, 0.3));
  transition: filter 0.2s;
  animation: ornamentAppear 0.35s ease both;
}

.ornament-inner {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform-origin: 50% 10%;
}

.ornament svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.ornament:hover {
  filter: drop-shadow(0 9px 10px rgba(0, 0, 0, 0.38)) brightness(1.06);
}

.ornament:active {
  cursor: grabbing;
}

.ornament.is-dragging {
  z-index: 40 !important;
  filter: drop-shadow(0 16px 14px rgba(0, 0, 0, 0.4)) brightness(1.1);
  transition: none;
}

.ornament.is-dragging .ornament-inner {
  transform: scale(1.12) rotate(4deg);
}

.ornament.is-dropping .ornament-inner {
  animation: ornamentDrop 0.7s cubic-bezier(0.18, 1.15, 0.3, 1) both;
}

.ornament.is-poked .ornament-inner {
  animation: ornamentWiggle 0.55s ease both;
}

.ornament.is-fresh {
  animation: ornamentAppear 0.4s ease both, freshGlow 1.4s 0.1s ease-out both;
}

/* =========================================================
   Scene footer
   ========================================================= */

.scene-bar {
  position: absolute;
  z-index: 22;
  left: 0;
  right: 0;
  bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px;
  pointer-events: none;
}

.scene-bar > * {
  pointer-events: auto;
}

.hint-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 62%;
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(5, 20, 14, 0.46);
  border: 1px solid rgba(243, 234, 214, 0.13);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: rgba(246, 237, 217, 0.78);
  font-size: 10.5px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s;
}

.hint-spark {
  color: var(--gold);
  font-size: 11px;
  flex: 0 0 auto;
  animation: sparkle 2.8s ease-in-out infinite;
}

.scene-tools {
  display: flex;
  gap: 5px;
  flex: 0 0 auto;
}

.mini-btn {
  height: 32px;
  padding: 0 9px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: rgba(246, 237, 217, 0.72);
  background: rgba(5, 20, 14, 0.42);
  border: 1px solid rgba(243, 234, 214, 0.12);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-size: 10.5px;
  transition: background 0.2s, opacity 0.2s, transform 0.2s;
}

.mini-btn svg {
  width: 13px;
  height: 13px;
}

.mini-btn:hover {
  background: rgba(26, 67, 51, 0.75);
}

.mini-btn:active {
  transform: scale(0.94);
}

.mini-btn[disabled] {
  opacity: 0.35;
  pointer-events: none;
}

/* =========================================================
   Ornament box (shelf)
   ========================================================= */

.shelf {
  position: relative;
  z-index: 35;
  flex: 0 0 auto;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(108, 75, 30, 0.038) 0.8px, transparent 0.9px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 42%);
  background-size: 5px 5px, 100% 100%;
  border-radius: 27px 27px 0 0;
  box-shadow:
    0 -20px 55px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
  padding-bottom: env(safe-area-inset-bottom);
  transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

.shelf::before {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(185, 130, 53, 0.45), transparent);
}

.shelf-grip {
  width: 38px;
  height: 3px;
  margin: 7px auto 0;
  border-radius: 99px;
  background: rgba(10, 31, 24, 0.14);
}

.shelf-inner {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 4px 0 8px;
}

.shelf-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 0 17px;
}

.shelf-title {
  min-width: 0;
}

.shelf-eyebrow {
  display: block;
  color: rgba(10, 31, 24, 0.42);
  font-size: 7.2px;
  font-weight: 700;
  letter-spacing: 0.22em;
  line-height: 1.1;
}

.shelf-title h2 {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 1px 0 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.015em;
  line-height: 1.15;
}

.shelf-count {
  color: rgba(10, 31, 24, 0.46);
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.unlock-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(14, 49, 38, 0.055);
  border: 1px solid rgba(14, 49, 38, 0.07);
  color: rgba(10, 31, 24, 0.6);
  font-size: 9.5px;
  font-weight: 500;
  white-space: nowrap;
}

.unlock-pill b {
  color: var(--berry);
  font-size: 10.5px;
}

.unlock-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold-deep);
  box-shadow: 0 0 0 2px rgba(185, 130, 53, 0.12);
}

.shelf-track {
  display: flex;
  gap: 8px;
  align-items: stretch;
  padding: 8px 17px 7px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.shelf-track::-webkit-scrollbar {
  display: none;
}

.shelf-track::after {
  content: "";
  flex: 0 0 3px;
}

.ornament-card {
  position: relative;
  flex: 0 0 75px;
  width: 75px;
  height: 102px;
  padding: 5px 3px 5px;
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  scroll-snap-align: start;
  color: var(--ink);
  background: rgba(255, 251, 241, 0.88);
  border: 1px solid rgba(103, 74, 34, 0.09);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.92) inset,
    0 3px 8px rgba(75, 48, 18, 0.055);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s;
  overflow: hidden;
}

.ornament-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 8px 14px rgba(75, 48, 18, 0.11);
}

.ornament-card:active {
  transform: translateY(-1px) scale(0.97);
}

.ornament-card:focus-visible {
  outline-color: var(--pine);
}

.ornament-card.is-special {
  background:
    radial-gradient(circle at 50% 26%, rgba(247, 216, 152, 0.38), transparent 65%),
    rgba(255, 250, 237, 0.94);
  border-color: rgba(185, 130, 53, 0.23);
}

.ornament-card.is-locked {
  background: rgba(235, 224, 202, 0.78);
  border-color: rgba(103, 74, 34, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.ornament-card.is-locked .card-art {
  filter: grayscale(1) brightness(0.72) opacity(0.35);
}

.ornament-card.is-locked:hover {
  transform: translateY(-2px);
}

.ornament-card.is-placed .card-plus {
  background: var(--gold-deep);
}

.card-art {
  width: 50px;
  height: 61px;
  margin-top: 1px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  transition: filter 0.2s;
}

.card-art svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.card-name {
  display: block;
  width: 100%;
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.015em;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-en {
  display: block;
  width: 100%;
  margin-top: 1px;
  color: rgba(10, 31, 24, 0.37);
  font-size: 6px;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-plus {
  position: absolute;
  z-index: 3;
  top: 5px;
  right: 5px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--pine);
  color: var(--cream-3);
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
  opacity: 0.85;
}

.ornament-card.is-locked .card-plus,
.ornament-card.is-placed .card-plus {
  display: none;
}

.card-lock {
  position: absolute;
  z-index: 3;
  top: 16px;
  left: 50%;
  width: 24px;
  height: 24px;
  transform: translateX(-50%);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(14, 49, 38, 0.82);
  color: var(--cream);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.16);
}

.card-lock svg {
  width: 11px;
  height: 11px;
  display: block;
}

.card-progress {
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 5px;
  height: 2px;
  border-radius: 99px;
  background: rgba(10, 31, 24, 0.09);
  overflow: hidden;
}

.card-progress i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--gold-deep);
  transition: width 0.5s ease;
}

.ornament-card.is-locked .card-en {
  color: rgba(149, 57, 53, 0.62);
  padding: 0 2px;
}

.ornament-card.is-new {
  animation: cardUnlock 0.8s cubic-bezier(0.18, 1.2, 0.3, 1) both;
}

.card-check {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold-deep);
  color: var(--cream-3);
  font-size: 9.5px;
  font-weight: 700;
}

.shelf-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1px 17px 2px;
}

.shelf-tip {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: rgba(10, 31, 24, 0.48);
  font-size: 9.5px;
  line-height: 1.35;
}

.primary-btn {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 0 0 auto;
  background: var(--pine);
  color: var(--cream-3);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow:
    0 5px 12px rgba(10, 31, 24, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: background 0.2s, transform 0.18s, box-shadow 0.2s;
}

.primary-btn:hover {
  background: var(--pine-2);
  box-shadow:
    0 8px 18px rgba(10, 31, 24, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.primary-btn:active {
  transform: scale(0.965);
}

.primary-btn svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.primary-btn.danger-btn {
  background: var(--berry-deep);
}

.ghost-btn {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--pine);
  border: 1px solid rgba(14, 49, 38, 0.2);
  background: rgba(255, 255, 255, 0.25);
  font-size: 11.5px;
  font-weight: 600;
  transition: background 0.2s, transform 0.18s;
}

.ghost-btn:hover {
  background: rgba(14, 49, 38, 0.06);
}

.ghost-btn:active {
  transform: scale(0.97);
}

.text-btn {
  color: rgba(10, 31, 24, 0.58);
  font-size: 10.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 6px 2px;
}

.text-btn:hover {
  color: var(--pine);
}

.text-btn.danger {
  color: rgba(148, 35, 47, 0.7);
}

/* =========================================================
   Toasts & sparks
   ========================================================= */

.toast {
  position: fixed;
  z-index: 75;
  left: 50%;
  bottom: calc(var(--shelf-h) + 52px);
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: min(88vw, 360px);
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(251, 244, 227, 0.97);
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  font-size: 10.5px;
  line-height: 1.35;
  opacity: 0;
  transform: translate(-50%, 12px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.18, 1.2, 0.3, 1);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.toast-icon {
  color: var(--gold-deep);
  font-size: 13px;
  flex: 0 0 auto;
}

.spark-layer {
  position: fixed;
  inset: 0;
  z-index: 72;
  overflow: hidden;
  pointer-events: none;
}

.spark {
  position: absolute;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  color: var(--gold-soft);
  font-size: 10.5px;
  line-height: 1;
  animation: sparkFly 1s cubic-bezier(0.16, 0.8, 0.3, 1) forwards;
}

.spark::before {
  content: "✦";
}

/* =========================================================
   Welcome
   ========================================================= */

.welcome {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.welcome.is-leaving {
  pointer-events: none;
}

.welcome.is-leaving .welcome-card {
  animation: welcomeDown 0.55s cubic-bezier(0.7, 0, 0.8, 0.4) both;
}

.welcome.is-leaving .welcome-scrim {
  animation: fadeOut 0.55s ease both;
}

.welcome-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(3, 14, 10, 0.02) 0%, rgba(3, 14, 10, 0.12) 32%, rgba(3, 14, 10, 0.72) 100%);
  -webkit-backdrop-filter: blur(0.6px);
  backdrop-filter: blur(0.6px);
  pointer-events: auto;
}

.welcome-card {
  position: relative;
  z-index: 2;
  width: min(100%, 520px);
  padding: 18px 21px calc(15px + env(safe-area-inset-bottom));
  border-radius: 27px 27px 0 0;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(rgba(108, 75, 30, 0.035) 0.8px, transparent 0.9px),
    linear-gradient(150deg, rgba(255, 255, 255, 0.4), transparent 50%);
  background-size: 5px 5px, 100% 100%;
  box-shadow: 0 -25px 70px rgba(0, 0, 0, 0.42);
  pointer-events: auto;
  animation: welcomeUp 0.8s cubic-bezier(0.19, 1, 0.22, 1) both;
}

.welcome-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: rgba(10, 31, 24, 0.45);
  font-size: 7.2px;
  font-weight: 700;
  letter-spacing: 0.19em;
}

.welcome-badge {
  padding: 2px 6px;
  border-radius: 99px;
  border: 1px solid rgba(185, 130, 53, 0.28);
  color: var(--gold-deep);
  letter-spacing: 0.12em;
}

.welcome-title {
  margin: 7px 0 6px;
  color: var(--pine);
  font-family: var(--serif);
  font-size: clamp(40px, 11.8vw, 64px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 0.79;
}

.welcome-title span {
  color: var(--gold-deep);
  font-size: 0.55em;
  vertical-align: 0.55em;
  margin-left: 0.03em;
}

.welcome-title em {
  color: var(--berry);
  font-style: italic;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.welcome-copy {
  margin: 10px 0 0;
  color: rgba(10, 31, 24, 0.66);
  font-size: 11.5px;
  line-height: 1.68;
  letter-spacing: 0.01em;
}

.welcome-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 12px 0 13px;
  padding: 9px 0;
  border-top: 1px dashed rgba(10, 31, 24, 0.13);
  border-bottom: 1px dashed rgba(10, 31, 24, 0.13);
}

.welcome-steps span {
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: rgba(10, 31, 24, 0.62);
  font-size: 9.5px;
  white-space: nowrap;
}

.welcome-steps b {
  color: var(--gold-deep);
  font-family: var(--serif);
  font-size: 9.5px;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.welcome-start {
  width: 100%;
  min-height: 47px;
  font-size: 13.5px;
  letter-spacing: 0.02em;
}

.welcome-start svg {
  width: 17px;
  height: 17px;
}

.welcome-fine {
  margin: 9px 0 0;
  color: rgba(10, 31, 24, 0.35);
  font-size: 6.4px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-align: center;
}

/* =========================================================
   Modals
   ========================================================= */

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(2, 10, 7, 0.68);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  animation: fadeIn 0.28s ease both;
}

.modal-card {
  position: relative;
  z-index: 2;
  width: min(100%, 400px);
  max-height: calc(100svh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 23px 21px 20px;
  border-radius: 25px;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(rgba(108, 75, 30, 0.035) 0.8px, transparent 0.9px),
    linear-gradient(160deg, rgba(255, 255, 255, 0.36), transparent 55%);
  background-size: 5px 5px, 100% 100%;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  animation: modalIn 0.4s cubic-bezier(0.19, 1, 0.22, 1) both;
  scrollbar-width: thin;
}

.modal-card::-webkit-scrollbar {
  width: 4px;
}

.modal-card::-webkit-scrollbar-thumb {
  background: rgba(10, 31, 24, 0.16);
  border-radius: 99px;
}

.modal-x {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: rgba(10, 31, 24, 0.55);
  background: rgba(10, 31, 24, 0.055);
  font-size: 19px;
  line-height: 1;
  transition: background 0.2s;
}

.modal-x:hover {
  background: rgba(10, 31, 24, 0.1);
}

.modal-eyebrow {
  display: block;
  color: var(--gold-deep);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.2em;
  line-height: 1.4;
}

.modal-card h2 {
  margin: 4px 0 12px;
  color: var(--pine);
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.13;
}

.modal-main {
  width: 100%;
  margin-top: 13px;
}

.how-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.how-list li {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(10, 31, 24, 0.12);
}

.how-list li:first-child {
  border-top: 1px dashed rgba(10, 31, 24, 0.12);
}

.how-list b {
  color: var(--berry);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.how-list span {
  color: rgba(10, 31, 24, 0.66);
  font-size: 11.5px;
  line-height: 1.6;
}

.secret-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0 0;
  padding: 12px 13px;
  border-radius: 15px;
  color: var(--cream);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(54, 107, 85, 0.7), transparent 60%),
    var(--pine);
}

.secret-star {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 17px;
  line-height: 1;
  animation: sparkle 3s ease-in-out infinite;
}

.secret-note p {
  margin: 0;
  color: rgba(243, 234, 214, 0.76);
  font-size: 11px;
  line-height: 1.6;
}

.secret-note b {
  color: var(--gold-soft);
  font-weight: 600;
}

.file-note {
  margin: 11px 0 0;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(148, 35, 47, 0.06);
  color: rgba(148, 35, 47, 0.72);
  font-size: 9.5px;
  line-height: 1.6;
}

.info-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.info-foot p {
  margin: 0;
  color: rgba(10, 31, 24, 0.38);
  font-size: 8.5px;
  line-height: 1.5;
}

.info-foot .text-btn {
  flex: 0 0 auto;
  font-size: 9.5px;
}

/* Unlock */

.unlock-card {
  text-align: center;
  overflow: hidden;
  padding-top: 24px;
}

.unlock-burst {
  position: absolute;
  z-index: 0;
  top: 52px;
  left: 50%;
  width: 250px;
  height: 250px;
  transform: translateX(-50%);
  opacity: 0.36;
  background: repeating-conic-gradient(from 0deg, rgba(233, 189, 111, 0.28) 0deg 1.2deg, transparent 1.2deg 12deg);
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 68%);
  mask-image: radial-gradient(circle, #000 0%, transparent 68%);
  animation: slowSpin 30s linear infinite;
  pointer-events: none;
}

.unlock-art {
  position: relative;
  z-index: 1;
  width: 138px;
  height: 166px;
  margin: 5px auto 0;
  filter: drop-shadow(0 14px 18px rgba(76, 45, 12, 0.26));
  animation: artPop 0.8s cubic-bezier(0.18, 1.25, 0.3, 1) both;
}

.unlock-art svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.unlock-meta {
  position: relative;
  z-index: 1;
}

.unlock-meta h2 {
  margin: 7px 0 0;
  font-size: 30px;
}

.unlock-meta span {
  display: block;
  margin-top: 3px;
  color: rgba(10, 31, 24, 0.38);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.unlock-note {
  position: relative;
  z-index: 1;
  max-width: 280px;
  margin: 11px auto 0;
  color: rgba(10, 31, 24, 0.58);
  font-size: 10.5px;
  line-height: 1.65;
}

.unlock-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 16px;
}

.unlock-actions .primary-btn,
.unlock-actions .ghost-btn {
  width: 100%;
}

.unlock-card .modal-eyebrow {
  position: relative;
  z-index: 1;
}

/* Card modal */

.card-modal-card {
  width: min(100%, 430px);
  padding: 20px 18px 17px;
}

.card-modal-card h2 {
  font-size: 23px;
  margin-bottom: 10px;
}

.card-preview-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 55svh;
  display: grid;
  place-items: center;
  border-radius: 14px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(52, 109, 86, 0.65), transparent 70%),
    #0a2219;
  border: 1px solid rgba(10, 31, 24, 0.1);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.2);
}

.card-preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.card-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  color: rgba(243, 234, 214, 0.55);
}

.card-loader span {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(243, 234, 214, 0.16);
  border-top-color: var(--gold);
  animation: spinOnly 0.9s linear infinite;
}

.card-loader p {
  margin: 0;
  font-size: 9.5px;
  letter-spacing: 0.08em;
}

.card-hint {
  margin: 8px 0 0;
  color: rgba(10, 31, 24, 0.42);
  font-size: 9.5px;
  text-align: center;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.card-actions .primary-btn,
.card-actions .ghost-btn {
  flex: 1 1 42%;
  min-height: 40px;
  font-size: 11px;
}

.card-actions .text-btn {
  flex: 1 0 100%;
  text-align: center;
}

/* Confirm */

.confirm-card {
  width: min(100%, 340px);
  text-align: center;
}

.confirm-card h2 {
  font-size: 23px;
}

.confirm-card p {
  margin: 0 auto;
  max-width: 260px;
  color: rgba(10, 31, 24, 0.58);
  font-size: 10.5px;
  line-height: 1.65;
}

.confirm-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.confirm-actions button {
  flex: 1;
}

/* =========================================================
   Motion
   ========================================================= */

@keyframes figureRise {
  from { opacity: 0; transform: translateY(40px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes welcomeUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes welcomeDown {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(100%); }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes starArrive {
  0% { opacity: 0; transform: translateX(-50%) scale(0.2) rotate(-18deg); }
  55% { opacity: 1; transform: translateX(-50%) scale(1.14) rotate(5deg); }
  100% { opacity: 1; transform: translateX(-50%) scale(1) rotate(0); }
}

@keyframes starBreath {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(248, 210, 128, 0.38)); transform: translateX(-50%) scale(1) rotate(0deg); }
  50% { filter: drop-shadow(0 0 24px rgba(248, 210, 128, 0.7)); transform: translateX(-50%) scale(1.035) rotate(1.2deg); }
}

@keyframes ornamentAppear {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ornamentDrop {
  0% { transform: translateY(-38px) scale(0.36) rotate(-18deg); opacity: 0; }
  55% { transform: translateY(5px) scale(1.1) rotate(4deg); opacity: 1; }
  78% { transform: translateY(-2px) scale(0.97) rotate(-1deg); }
  100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
}

@keyframes ornamentWiggle {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-7deg); }
  45% { transform: rotate(6deg); }
  70% { transform: rotate(-3deg); }
}

@keyframes freshGlow {
  0% { filter: drop-shadow(0 0 0 rgba(255, 226, 157, 0)); }
  35% { filter: drop-shadow(0 0 15px rgba(255, 226, 157, 0.8)); }
  100% { filter: drop-shadow(0 5px 4px rgba(0, 0, 0, 0.3)); }
}

@keyframes auraBreathe {
  from { opacity: 0.55; transform: translateX(-50%) scale(0.97); }
  to { opacity: 0.92; transform: translateX(-50%) scale(1.05); }
}

@keyframes auroraDrift {
  from { transform: translate3d(-2%, 0, 0) scale(1); }
  to { transform: translate3d(5%, 4%, 0) scale(1.12); }
}

@keyframes starFieldTwinkle {
  from { opacity: 0.55; }
  to { opacity: 0.95; }
}

@keyframes sparkle {
  0%, 100% { opacity: 0.45; transform: scale(0.9) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.08) rotate(12deg); }
}

@keyframes sparkFly {
  0% { opacity: 0; transform: translate(0, 0) scale(0.4) rotate(0deg); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.15) rotate(var(--dr)); }
}

@keyframes artPop {
  0% { opacity: 0; transform: scale(0.55) rotate(-8deg); }
  60% { opacity: 1; transform: scale(1.08) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes slowSpin {
  from { transform: translateX(-50%) rotate(0deg); }
  to { transform: translateX(-50%) rotate(360deg); }
}

@keyframes spinOnly {
  to { transform: rotate(360deg); }
}

@keyframes cardUnlock {
  0% { transform: scale(0.6) rotate(-8deg); opacity: 0.4; }
  55% { transform: scale(1.08) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: -180% 0; }
  100% { background-position: 180% 0; }
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 370px) {
  .brand-name { font-size: 16px; }
  .brand-mark { width: 24px; flex-basis: 24px; }
  .topbar { padding-left: 12px; padding-right: 12px; }
  .icon-btn { width: 33px; height: 33px; }
  .ornament-card { flex-basis: 70px; width: 70px; height: 97px; }
  .card-art { width: 46px; height: 57px; }
  .shelf-title h2 { font-size: 18px; }
  .shelf-count { display: none; }
  .shelf-head, .shelf-track, .shelf-foot { padding-left: 13px; padding-right: 13px; }
  .unlock-pill { font-size: 9.5px; }
  .shelf-tip { font-size: 9.5px; }
  .primary-btn { padding: 0 13px; font-size: 11px; }
  .toast { font-size: 10.5px; }
}

@media (max-height: 720px) {
  .welcome-title { font-size: clamp(36px, 10.5vw, 52px); }
  .welcome-copy { font-size: 10.5px; margin-top: 8px; }
  .welcome-steps { margin: 9px 0 10px; padding: 7px 0; }
  .welcome-start { min-height: 44px; }
  .shelf-track { padding-top: 6px; padding-bottom: 5px; }
  .ornament-card { height: 96px; }
  .card-art { height: 56px; width: 46px; }
  .shelf-inner { padding-bottom: 6px; }
}

@media (max-height: 640px) {
  .rubber-stamp { display: none; }
  .welcome-fine { display: none; }
  .welcome-title { margin-top: 5px; }
  .shelf-grip { margin-top: 5px; }
  .shelf-head { margin-top: -1px; }
  .shelf-eyebrow { display: none; }
}

@media (min-width: 900px) {
  .scene-bar {
    left: 50%;
    right: auto;
    width: min(calc(100% - 40px), 780px);
    transform: translateX(-50%);
  }
}

@media (min-width: 720px) {
  .topbar { padding: calc(18px + env(safe-area-inset-top)) 26px 0; }
  .brand-mark { width: 32px; flex-basis: 32px; }
  .brand-kicker { font-size: 7.5px; }
  .brand-name { font-size: 23px; }
  .icon-btn { width: 40px; height: 40px; }
  .icon-btn svg { width: 19px; height: 19px; }
  .tree-figure { height: min(calc(100% - 42px), 770px); }
  .scene-bar { bottom: 14px; padding: 0 20px; }
  .hint-pill { font-size: 11px; padding: 9px 14px; }
  .mini-btn { height: 35px; font-size: 10.5px; }
  .shelf { border-radius: 30px 30px 0 0; }
  .shelf-inner { padding: 6px 0 10px; }
  .shelf-grip { margin-top: 9px; }
  .shelf-head, .shelf-track, .shelf-foot { padding-left: 24px; padding-right: 24px; }
  .shelf-title h2 { font-size: 23px; }
  .shelf-count { font-size: 9.5px; }
  .shelf-eyebrow { font-size: 7.5px; }
  .shelf-track { gap: 10px; padding-top: 10px; padding-bottom: 9px; }
  .ornament-card { flex-basis: 84px; width: 84px; height: 111px; border-radius: 17px; }
  .card-art { width: 56px; height: 68px; }
  .card-name { font-size: 11px; }
  .card-en { font-size: 6px; }
  .card-plus { width: 16px; height: 16px; top: 6px; right: 6px; }
  .shelf-foot { padding-top: 2px; }
  .shelf-tip { font-size: 10.5px; }
  .primary-btn { min-height: 44px; font-size: 12.5px; padding: 0 19px; }
  .welcome { align-items: center; }
  .welcome-scrim { background: rgba(3, 14, 10, 0.52); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
  .welcome-card {
    width: min(92vw, 440px);
    border-radius: 28px;
    padding: 24px 27px 21px;
    margin-bottom: 6vh;
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 35px 90px rgba(0, 0, 0, 0.45);
  }
  .welcome-title { font-size: 66px; margin-top: 10px; }
  .welcome-copy { font-size: 12.5px; }
  .welcome-steps { margin: 16px 0 17px; padding: 11px 0; }
  .welcome-steps span { font-size: 10.5px; }
  .welcome-start { min-height: 50px; font-size: 14px; }
  .welcome-fine { font-size: 7px; }
  .modal-card { padding: 26px 25px 22px; border-radius: 27px; }
  .modal-card h2 { font-size: 28px; }
  .unlock-art { width: 158px; height: 190px; }
  .unlock-meta h2 { font-size: 34px; }
  .card-modal-card { width: min(100%, 450px); }
  .card-preview-wrap { max-height: 55svh; }
}

@media (min-width: 1080px) {
  .stage-bg { background: radial-gradient(72% 62% at 50% 8%, #316e59 0%, #1c503f 30%, #0f3328 58%, #081b14 100%); }
  .arch { width: min(50vw, 670px); }
  .arch-inner { width: min(43vw, 573px); }
  .tree-figure { filter: drop-shadow(0 35px 38px rgba(0, 0, 0, 0.34)); }
  .shelf::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03), transparent 20%, transparent 80%, rgba(255, 255, 255, 0.03));
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .app {
    flex-direction: row;
    max-width: none;
  }
  .stage {
    flex: 1 1 auto;
    height: 100svh;
  }
  .shelf {
    flex: 0 0 315px;
    width: 315px;
    height: 100svh;
    border-radius: 24px 0 0 24px;
    display: flex;
    align-items: center;
    padding-bottom: 0;
    overflow-y: auto;
  }
  .shelf-inner {
    width: 100%;
    padding: 8px 0;
  }
  .shelf-grip {
    display: none;
  }
  .shelf-head,
  .shelf-track,
  .shelf-foot {
    padding-left: 15px;
    padding-right: 15px;
  }
  .shelf-track {
    flex-wrap: wrap;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: calc(100svh - 178px);
    gap: 7px;
    scroll-snap-type: none;
  }
  .ornament-card {
    flex-basis: 68px;
    width: 68px;
    height: 91px;
  }
  .card-art {
    width: 43px;
    height: 53px;
  }
  .card-name {
    font-size: 9.5px;
  }
  .card-en {
    display: none;
  }
  .shelf-tip {
    display: none;
  }
  .shelf-foot {
    justify-content: stretch;
  }
  .shelf-foot .primary-btn {
    flex: 1;
  }
  .tree-figure {
    height: min(calc(100% - 18px), 520px);
  }
  .tree-scene {
    padding-top: 30px;
  }
  .topbar {
    padding-top: 10px;
  }
  .scene-bar {
    bottom: 8px;
  }
  .toast {
    left: calc((100% - 315px) / 2);
    right: auto;
    bottom: 54px;
    transform: translate(-50%, 12px) scale(0.96);
  }
  .toast.show {
    transform: translate(-50%, 0) scale(1);
  }
  .welcome {
    align-items: center;
  }
  .welcome-card {
    width: min(86vw, 500px);
    max-height: calc(100svh - 20px);
    overflow-y: auto;
    border-radius: 26px;
    padding: 17px 22px;
    margin: 0;
  }
  .welcome-title {
    font-size: 47px;
    margin: 4px 0;
  }
  .welcome-copy {
    font-size: 10.5px;
    margin-top: 5px;
  }
  .welcome-steps {
    margin: 7px 0 8px;
    padding: 5px 0;
  }
  .welcome-start {
    min-height: 42px;
  }
  .welcome-fine {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
  .starfield,
  .aurora,
  .figure-aura,
  .hint-spark,
  .secret-star,
  .unlock-burst {
    animation: none !important;
  }
}

