@font-face {
  font-family: 'GreatVibes';
  src: url('vendor/fonts/GreatVibes-Regular.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant';
  src: url('vendor/fonts/cormorant.woff2') format('woff2');
  font-weight: 500 600;
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant';
  src: url('vendor/fonts/cormorant-italic.woff2') format('woff2');
  font-style: italic;
  font-weight: 500;
  font-display: swap;
}

:root {
  --bg: #030510;
  --fg: #f4f6ff;
  --fg-soft: rgba(235, 241, 255, 0.76);
  --fg-muted: rgba(215, 226, 252, 0.48);
  --surface: rgba(9, 14, 30, 0.62);
  --surface-strong: rgba(10, 15, 32, 0.82);
  --border: rgba(255, 255, 255, 0.12);
  --border-hi: rgba(255, 255, 255, 0.24);
  --gold: #f0cc92;
  --accent: #8ec5ff;
  --accent-soft: rgba(142, 197, 255, 0.16);
  --accent-border: rgba(166, 214, 255, 0.42);
  --glow: rgba(142, 197, 255, 0.62);
  --btn-grad: linear-gradient(135deg, #62a5ff 0%, #9fd4ff 100%);
  --btn-text: #061124;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-pill: 999px;
  --blur: blur(20px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: 'Cormorant', "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  --font-script: 'GreatVibes', 'Snell Roundhand', 'Brush Script MT', cursive;
  --font-mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#scene:active { cursor: grabbing; }
#scene.over-frame { cursor: pointer; }

.hidden { display: none !important; }

/* ---------- Base buttons ---------- */
button {
  font: inherit;
  color: var(--fg);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), opacity 0.25s var(--ease);
}
button:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: var(--border-hi);
}
button:active { transform: scale(0.96); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 3D Starlight Entry Cover ---------- */
.star-cover {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  transition: opacity 0.74s cubic-bezier(0.32, 0, 0.26, 1);
}
.star-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 54%, rgba(16, 36, 62, 0.56), transparent 58%),
    radial-gradient(ellipse at 82% 58%, rgba(40, 22, 62, 0.44), transparent 52%),
    radial-gradient(ellipse at 54% 34%, #10162b 0%, #070b18 50%, #03050c 100%);
  transition: opacity 0.96s ease-in-out;
}
.star-cover[data-departing="true"]::before { opacity: 0; }
.star-cover[data-scene-visible="true"] { opacity: 0; pointer-events: none; }
.star-cover canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.star-cover-brand {
  position: absolute;
  left: max(24px, env(safe-area-inset-left));
  top: max(22px, env(safe-area-inset-top));
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: rgba(240, 206, 152, 0.88);
  font-size: 10.5px;
  letter-spacing: 0.24em;
  pointer-events: none;
  transition: opacity 0.28s ease-out;
}
.star-cover-brand svg { width: 15px; height: 15px; }

.star-cover-dedication {
  position: absolute;
  left: 50%;
  top: 56%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  transition: opacity 0.28s ease-out, transform 0.35s var(--ease);
}
.cover-rule {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 190px;
}
.cover-rule span {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240, 204, 146, 0.62), transparent);
}
.cover-rule i {
  font-style: normal;
  font-size: 8px;
  color: #f4d49c;
  text-shadow: 0 0 12px rgba(244, 212, 156, 0.7);
}
.cover-for {
  font-family: var(--font-serif);
  font-size: clamp(19px, 2.3vw, 28px);
  font-weight: 500;
  letter-spacing: 0.14em;
  white-space: nowrap;
  color: #fff4dd;
  text-shadow: 0 0 24px rgba(240, 198, 128, 0.45);
}

.star-cover-enter {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: none;
  color: rgba(235, 212, 174, 0.82);
  touch-action: manipulation;
}
.star-cover-enter:hover { background: none; border: 0; }
.star-cover-enter:active { transform: none; }
.star-cover-enter span {
  position: absolute;
  left: 50%;
  top: 72%;
  transform: translateX(-50%);
  padding: 10px 24px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(240, 204, 146, 0.28);
  background: rgba(12, 18, 36, 0.44);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  white-space: nowrap;
  font-size: 13.5px;
  letter-spacing: 0.2em;
  text-shadow: 0 0 14px rgba(210, 155, 86, 0.45);
  transition: color 0.25s, border-color 0.25s, background 0.25s, opacity 0.25s;
}
.star-cover-enter:hover span {
  color: #fff6e2;
  border-color: rgba(246, 216, 162, 0.62);
  background: rgba(24, 34, 62, 0.6);
}
.star-cover[data-leaving="true"] .star-cover-enter span,
.star-cover[data-leaving="true"] .star-cover-brand,
.star-cover[data-leaving="true"] .star-cover-dedication {
  opacity: 0;
}

/* ---------- Unified top utility bar ---------- */
#topBar {
  position: fixed;
  right: 20px;
  top: calc(16px + env(safe-area-inset-top));
  z-index: 35;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
body.clean #topBar { display: none; }

.icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-soft);
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: transparent;
  color: #fff;
}
.icon-btn.on {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}
.icon-btn svg { width: 16px; height: 16px; display: block; }

#musicBtn .eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 13px;
}
#musicBtn .eq i {
  display: block;
  width: 2.5px;
  border-radius: 2px;
  background: var(--accent);
  animation: eqBar 1.05s ease-in-out infinite;
}
#musicBtn .eq i:nth-child(1) { height: 6px; animation-delay: 0s; }
#musicBtn .eq i:nth-child(2) { height: 12px; animation-delay: 0.22s; }
#musicBtn .eq i:nth-child(3) { height: 8px; animation-delay: 0.44s; }
#musicBtn .muted-ic { display: none; }
#musicBtn.off .eq { display: none; }
#musicBtn.off .muted-ic { display: block; opacity: 0.7; }
@keyframes eqBar {
  0%, 100% { transform: scaleY(0.42); }
  50% { transform: scaleY(1); }
}

.bar-sep {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.14);
  margin: 0 2px;
}

#langSw {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
#langSw button {
  height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
}
#langSw button:hover { color: var(--fg); background: rgba(255, 255, 255, 0.06); }
#langSw button.on {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* ---------- Left subtle live code HUD ---------- */
#code {
  position: fixed;
  left: 22px;
  top: 76px;
  bottom: 102px;
  width: min(275px, 20vw);
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(7, 11, 26, 0.34), rgba(7, 11, 26, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 10px 14px 12px;
  opacity: 0.70;
  transition: opacity 0.75s var(--ease), transform 0.6s var(--ease);
}
#code.settled { opacity: 0.32; }
body.photo-focus #code { opacity: 0 !important; }

.code-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.code-head .dots { display: inline-flex; gap: 5px; }
.code-head .dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.22); }
.code-title { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.4px; color: rgba(210, 224, 255, 0.45); }

#code pre {
  margin: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  font: 10px/1.6 var(--font-mono);
  color: rgba(206, 220, 252, 0.68);
  white-space: pre-wrap;
}
#code code {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  will-change: transform;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 94%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 94%, transparent);
}
#code .cl { white-space: pre; overflow: hidden; text-overflow: clip; min-height: 1.6em; }
#code .c { color: rgba(145, 162, 198, 0.56); }
#code .k { color: rgba(196, 158, 255, 0.82); }
#code .s { color: rgba(255, 212, 150, 0.80); }
#code .f { color: rgba(138, 188, 255, 0.85); }

/* ---------- Right editorial greeting, dedicated names, blessing & countdown ---------- */
#greet {
  position: fixed;
  right: clamp(22px, 3.2vw, 48px);
  top: 50%;
  transform: translateY(-51%);
  width: min(352px, 27.5vw);
  z-index: 3;
  pointer-events: none;
  text-align: center;
  transition: opacity 0.55s var(--ease), top 0.6s var(--ease), transform 0.6s var(--ease);
}
body.cam-open #greet { top: 27%; transform: translateY(-42%); }
body.photo-focus #greet,
body.album-open #greet { opacity: 0; pointer-events: none; }

.greet-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.merry {
  font-family: var(--font-script);
  font-size: clamp(34px, 3.4vw, 56px);
  line-height: 1.15;
  white-space: nowrap;
  color: #fffef8;
  text-shadow: 0 0 20px var(--glow), 0 0 46px var(--glow);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1.2s var(--ease), transform 1.2s var(--ease);
}
.greet-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(200px, 74%);
  margin: 8px auto 10px;
  opacity: 0;
  transform: scaleX(0.6);
  transition: opacity 1.0s 0.2s var(--ease), transform 1.0s 0.2s var(--ease);
}
.greet-rule span {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-border), transparent);
}
.greet-rule i {
  font-style: normal;
  font-size: 8px;
  color: var(--accent);
  text-shadow: 0 0 10px var(--glow);
}

.name-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 1.1s 0.35s var(--ease), transform 1.1s 0.35s var(--ease);
}
.to-primary {
  font-family: var(--font-serif);
  font-size: clamp(23px, 2.2vw, 31px);
  font-weight: 600;
  letter-spacing: 0.14em;
  color: #fff7e6;
  text-shadow: 0 0 18px var(--glow);
}
.to-secondary {
  font-family: 'Cormorant', Georgia, serif;
  font-style: italic;
  font-size: clamp(14px, 1.25vw, 17px);
  letter-spacing: 0.18em;
  color: var(--accent);
  opacity: 0.9;
}

#greet.show .merry,
#greet.show .greet-rule,
#greet.show .name-stack {
  opacity: 1;
  transform: none;
}

#letterWrap {
  width: 100%;
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(10, 15, 32, 0.48), rgba(8, 12, 26, 0.28));
  border: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1.0s var(--ease), transform 1.0s var(--ease);
}
#letterWrap.show { opacity: 1; transform: none; }

#letter {
  font-family: var(--font-serif);
  font-size: clamp(14px, 1.12vw, 16.5px);
  line-height: 1.92;
  color: rgba(248, 250, 255, 0.94);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.45);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-align: center;
}

/* ---------- Minimalist Christmas Countdown ---------- */
.countdown {
  margin-top: 14px;
  padding: 8px 14px 9px;
  border-radius: 14px;
  background: linear-gradient(155deg, rgba(14, 22, 44, 0.56), rgba(8, 12, 26, 0.40));
  border: 1px solid rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.30);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.9s 0.2s var(--ease), transform 0.9s 0.2s var(--ease);
}
.countdown.show { opacity: 1; transform: none; }
.cd-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--fg-soft);
}
.cd-label em { font-style: normal; }
.cd-label span { width: 14px; height: 1px; background: var(--accent-border); }
.cd-grid {
  display: flex;
  align-items: center;
  margin-top: 5px;
}
.cd-unit {
  width: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.cd-unit + .cd-unit { border-left: 1px solid rgba(255, 255, 255, 0.11); }
.cd-unit strong {
  font-family: 'Cormorant', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  color: #ffe8bc;
  font-variant-numeric: lining-nums tabular-nums;
}
.cd-unit span { font-size: 9px; color: var(--fg-muted); letter-spacing: 0.06em; }

/* ---------- Focused 3D Photo HUD ---------- */
#photoHud {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(82px + env(safe-area-inset-bottom));
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-strong);
  border: 1px solid rgba(240, 204, 146, 0.36);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.56), 0 0 28px -10px rgba(240, 204, 146, 0.42);
  animation: dockIn 0.38s var(--ease);
}
#photoHud button {
  height: 32px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: #fff2d8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
}
#photoHud button:hover {
  background: rgba(240, 204, 146, 0.18);
  border-color: rgba(240, 204, 146, 0.42);
}
#photoHud button svg { width: 15px; height: 15px; }
#photoHud .hud-close { padding: 0 12px; font-size: 12.5px; }
.photo-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 6px;
  white-space: nowrap;
}
#photoCaption { font-family: var(--font-serif); font-size: 14.5px; color: #fff6e4; letter-spacing: 0.06em; }
#photoIndex { font-size: 11px; color: var(--gold); font-variant-numeric: tabular-nums; }
.hud-sep { width: 1px; height: 16px; background: rgba(255, 255, 255, 0.14); }

/* ---------- Right Slide-Over Starlight Memories Album Drawer ---------- */
.album-drawer {
  position: fixed;
  right: 18px;
  top: calc(68px + env(safe-area-inset-top));
  bottom: calc(86px + env(safe-area-inset-bottom));
  width: min(370px, calc(100vw - 36px));
  z-index: 15;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  background: linear-gradient(170deg, rgba(13, 20, 42, 0.84), rgba(7, 11, 24, 0.90));
  border: 1px solid rgba(240, 204, 146, 0.26);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 240, 208, 0.14);
  overflow: hidden;
  animation: drawerIn 0.42s var(--ease);
}
@keyframes drawerIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: none; }
}
.album-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}
.album-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
  color: #fff3db;
  letter-spacing: 0.06em;
}
.album-head p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--fg-muted);
}
.album-grid {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 204, 146, 0.28) transparent;
}
.album-tile {
  position: relative;
  padding: 5px;
  border-radius: 12px;
  background: linear-gradient(155deg, rgba(240, 204, 146, 0.22), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(240, 204, 146, 0.25);
  overflow: hidden;
  aspect-ratio: 4 / 5;
  display: flex;
  flex-direction: column;
}
.album-tile:hover {
  border-color: rgba(248, 220, 168, 0.72);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}
.album-tile.active {
  border-color: #ffe2a8;
  box-shadow: 0 0 0 2px rgba(255, 224, 158, 0.35), 0 10px 26px rgba(0, 0, 0, 0.5);
}
.album-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  border-radius: 8px;
  display: block;
}
.album-tile span {
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 9px;
  padding: 4px 8px;
  border-radius: 7px;
  background: rgba(6, 10, 22, 0.72);
  backdrop-filter: blur(8px);
  font-size: 11px;
  color: #fff4df;
  text-align: center;
  letter-spacing: 0.04em;
}

/* ---------- Bottom hint + floating glass dock ---------- */
#hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(74px + env(safe-area-inset-bottom));
  z-index: 3;
  text-align: center;
  padding: 0 16px;
  font-size: 12px;
  letter-spacing: 0.3px;
  color: rgba(230, 238, 255, 0.56);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.65);
  pointer-events: none;
  transition: opacity 0.6s var(--ease);
}
body.photo-focus #hint { opacity: 0 !important; }

#bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 9;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  max-width: calc(100vw - 24px);
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  animation: dockIn 0.65s var(--ease);
}
@keyframes dockIn {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

#bar button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-soft);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
#bar button .ic { display: inline-flex; align-items: center; justify-content: center; }
#bar button .ic svg { width: 15px; height: 15px; display: block; }
#bar button:hover { background: rgba(255, 255, 255, 0.10); color: #fff; }
#bar button.on {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: #fff;
  box-shadow: 0 0 18px -6px var(--glow);
}
#bar button.on .ic { color: var(--accent); }

/* ---------- Hand gesture reticle cursor ---------- */
.hand-cursor {
  display: none;
  position: fixed;
  z-index: 18;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 2px solid #ffe09e;
  box-shadow: 0 0 14px rgba(255, 224, 158, 0.7);
  pointer-events: none;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.hand-cursor[data-pinch="true"] {
  border-color: #ff8ba7;
  box-shadow: 0 0 18px rgba(255, 139, 167, 0.85);
  transform: scale(0.82);
}

/* ---------- Sleek frosted-glass champagne camera gesture HUD ---------- */
#cam {
  position: fixed;
  right: 22px;
  bottom: calc(90px + env(safe-area-inset-bottom));
  width: 268px;
  z-index: 11;
  padding: 10px;
  border-radius: 18px;
  background: linear-gradient(165deg, rgba(15, 22, 44, 0.82), rgba(8, 12, 26, 0.88));
  border: 1px solid rgba(255, 224, 158, 0.34);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.56), 0 0 32px -12px rgba(255, 212, 128, 0.35), inset 0 1px 0 rgba(255, 240, 200, 0.20);
}
.cam-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; padding: 0 2px; }
.cam-live { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 500; color: #ffe8b8; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #6ee7b7; box-shadow: 0 0 8px #6ee7b7; animation: pulseDot 1.8s ease-in-out infinite; }
@keyframes pulseDot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.82); } }
#camClose {
  width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.72);
  display: inline-flex; align-items: center; justify-content: center;
}
#camClose:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
#camClose svg { width: 13px; height: 13px; }
#cam .cam-view { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid rgba(255, 232, 180, 0.24); background: #040712; aspect-ratio: 4 / 3; }
#cam video, #cam canvas { display: block; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
#cam canvas { position: absolute; inset: 0; }
#cam .cam-view::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 58%, rgba(4, 7, 18, 0.50) 100%); }
#cam .corner { position: absolute; width: 12px; height: 12px; z-index: 2; pointer-events: none; border-color: rgba(255, 232, 178, 0.75); border-style: solid; border-width: 0; }
#cam .corner.tl { left: 7px; top: 7px; border-top-width: 1.5px; border-left-width: 1.5px; border-top-left-radius: 3px; }
#cam .corner.tr { right: 7px; top: 7px; border-top-width: 1.5px; border-right-width: 1.5px; border-top-right-radius: 3px; }
#cam .corner.bl { left: 7px; bottom: 7px; border-bottom-width: 1.5px; border-left-width: 1.5px; border-bottom-left-radius: 3px; }
#cam .corner.br { right: 7px; bottom: 7px; border-bottom-width: 1.5px; border-right-width: 1.5px; border-bottom-right-radius: 3px; }
#camLabel {
  margin-top: 8px; padding: 5px 10px; border-radius: 10px; font-size: 11.5px; line-height: 1.45;
  text-align: center; color: #fff2d4; background: rgba(255, 224, 158, 0.10); border: 1px solid rgba(255, 224, 158, 0.22);
}

/* ---------- Toast & music attribution ---------- */
#toast {
  position: fixed;
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
  z-index: 40;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: rgba(12, 18, 38, 0.88);
  border: 1px solid var(--accent-border);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  font-size: 13px;
  color: #fff;
  max-width: min(88vw, 460px);
  text-align: center;
  line-height: 1.5;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
}
#musicCredit {
  position: fixed;
  left: 18px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 2;
  font-size: 10.5px;
  color: rgba(215, 226, 252, 0.34);
  transition: color 0.25s;
}
#musicCredit:hover { color: rgba(235, 242, 255, 0.72); }
#musicCredit a { color: inherit; text-decoration: none; border-bottom: 1px dotted currentColor; }
body.clean #musicCredit,
body.clean #bar,
body.clean #hint { display: none !important; }
body.clean.nocam #cam { opacity: 0; pointer-events: none; }
body.clean, body.clean #scene { cursor: none; }

/* ---------- Responsive: tablet & mobile portrait ---------- */
@media (max-width: 900px), (orientation: portrait) {
  #topBar { right: 12px; top: calc(12px + env(safe-area-inset-top)); padding: 4px; }
  .star-cover-brand { left: 16px; top: calc(16px + env(safe-area-inset-top)); }
  .star-cover-dedication { top: 55%; }
  .star-cover-enter span { top: 71%; font-size: 12.5px; padding: 10px 20px; }

  #code {
    left: 12px;
    top: calc(12px + env(safe-area-inset-top));
    bottom: auto;
    height: 17vh;
    width: 52vw;
    padding: 7px 10px;
    border-radius: 12px;
  }
  #code pre { font-size: 8px; line-height: 1.5; }

  #greet {
    left: 16px;
    right: 16px;
    width: auto;
    top: auto;
    bottom: calc(96px + env(safe-area-inset-bottom));
    transform: none;
  }
  body.cam-open #greet { top: auto; bottom: calc(96px + env(safe-area-inset-bottom)); transform: none; }
  body.clean #greet { bottom: calc(32px + env(safe-area-inset-bottom)); }
  .merry { font-size: clamp(30px, 8.2vw, 50px); }
  .greet-rule { margin: 5px auto 6px; }
  .name-stack { flex-direction: row; align-items: baseline; gap: 10px; }
  .to-primary { font-size: clamp(19px, 5vw, 24px); }
  .to-secondary { font-size: clamp(13px, 3.4vw, 16px); }
  #letterWrap { margin-top: 10px; padding: 11px 14px; border-radius: 14px; }
  #letter { font-size: 13px; line-height: 1.72; max-height: 16vh; overflow: hidden; }
  .countdown { margin-top: 8px; padding: 6px 10px; }
  .cd-unit { width: 38px; }
  .cd-unit strong { font-size: 18px; }

  #photoHud {
    bottom: calc(84px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 20px);
    padding: 5px 6px;
    gap: 4px;
  }
  #photoCaption { font-size: 12.5px; }
  #photoHud .hud-close span { display: none; }

  .album-drawer {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: calc(82px + env(safe-area-inset-bottom));
    width: auto;
    max-height: 62vh;
    animation: sheetUp 0.42s var(--ease);
  }
  @keyframes sheetUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

  #bar {
    left: 10px;
    right: 10px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    transform: none;
    max-width: none;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 3px;
    padding: 5px;
    border-radius: 18px;
    animation: none;
  }
  #bar button {
    height: auto;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 8px 2px 7px;
    border-radius: 13px;
    font-size: 10.5px;
    line-height: 1.1;
  }
  #bar button .ic svg { width: 17px; height: 17px; }
  #hint { bottom: calc(74px + env(safe-area-inset-bottom)); font-size: 10.5px; }

  #cam {
    right: 12px;
    top: calc(58px + env(safe-area-inset-top));
    bottom: auto;
    width: 158px;
    padding: 7px;
    border-radius: 14px;
  }
  .cam-head { margin-bottom: 5px; }
  .cam-live { font-size: 10px; }
  #camLabel { font-size: 10px; padding: 4px 6px; margin-top: 6px; }
  #musicCredit { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot, #musicBtn .eq i { animation: none; }
}
