/* ============================================================
   Christmas in Pink — a particle ritual
   ============================================================ */

:root {
  --bg: #05030a;
  --ink: #f9eef7;
  --muted: rgba(249, 238, 247, 0.5);
  --faint: rgba(249, 238, 247, 0.28);
  --line: rgba(255, 255, 255, 0.14);
  --accent: #ff7ad9;
  --accent-soft: #ffc4ea;
  --accent-rgb: 255, 122, 217;
  --serif: "Didot", "Bodoni 72", "Playfair Display", "Times New Roman", "Songti SC", serif;
  --sans: "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Segoe UI", system-ui, sans-serif;
  /* Pixel UI face: DotGothic16 ships CJK glyphs; fallbacks stay pixel-friendly. */
  --pixel-font: "DotGothic16", "Zpix", "Press Start 2P", "Silkscreen", "PingFang SC", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { position: fixed; inset: 0; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled { cursor: wait; opacity: 0.6; }

#stage {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
  background:
    radial-gradient(ellipse 80% 62% at 50% 36%, rgba(32, 12, 42, 0.85) 0%, rgba(9, 5, 14, 0.96) 52%, #030108 100%);
}

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.grain {
  position: absolute;
  inset: -40%;
  pointer-events: none;
  opacity: 0.15;
  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='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  animation: grain-shift 0.9s steps(3) infinite;
  z-index: 2;
}

@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-1.5%, 1%); }
  66% { transform: translate(1%, -1.5%); }
  100% { transform: translate(0, 0); }
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 72% 60% at 50% 44%, transparent 42%, rgba(2, 1, 6, 0.58) 100%),
    linear-gradient(to bottom, rgba(3, 1, 8, 0.5) 0%, transparent 16%, transparent 84%, rgba(3, 1, 8, 0.5) 100%);
  z-index: 3;
}

/* ---------- top bar ---------- */

.hud-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 30px;
  pointer-events: none;
}

.mark {
  color: var(--accent);
  font-size: 15px;
  line-height: 1;
  text-shadow: 0 0 16px rgba(var(--accent-rgb), 0.9);
  animation: mark-twinkle 4.5s ease-in-out infinite;
  pointer-events: none;
  user-select: none;
}

@keyframes mark-twinkle {
  0%, 100% { opacity: 0.7; transform: scale(0.94) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.08) rotate(45deg); }
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.ghost-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: rgba(255, 255, 255, 0.72);
  display: grid;
  place-items: center;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.help-glyph {
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  transform: translateY(-1px);
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  background: rgba(var(--accent-rgb), 0.07);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: rgba(255, 253, 255, 0.92);
  font-size: 11px;
  letter-spacing: 0.12em;
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s, transform 0.2s;
}

.pill-btn:hover {
  background: rgba(var(--accent-rgb), 0.15);
  border-color: rgba(var(--accent-rgb), 0.5);
  box-shadow: 0 0 28px rgba(var(--accent-rgb), 0.14);
}

.pill-btn:active { transform: scale(0.98); }

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: live-pulse 2.4s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 0.5; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

.pill-btn.is-live {
  border-color: rgba(126, 255, 200, 0.38);
  background: rgba(126, 255, 200, 0.07);
}

.pill-btn.is-live .live-dot {
  background: #79ffc9;
  box-shadow: 0 0 10px #79ffc9;
  animation-duration: 1.6s;
}

.photo-btn { border-color: rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.045); }
.photo-btn:hover { border-color: rgba(255, 255, 255, 0.32); background: rgba(255, 255, 255, 0.09); }
.photo-btn.is-attention { animation: photo-attention 2.6s ease-in-out infinite; }

@keyframes photo-attention {
  0%, 100% { box-shadow: 0 0 0 rgba(var(--accent-rgb), 0); }
  50% { box-shadow: 0 0 26px rgba(var(--accent-rgb), 0.3); }
}

.photo-count {
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  display: inline-grid;
  place-items: center;
  background: rgba(var(--accent-rgb), 0.22);
  color: var(--accent-soft);
  font-size: 8.5px;
  letter-spacing: 0;
}

/* ---------- ritual tracker ---------- */

.ritual {
  position: fixed;
  top: 82px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 16;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  user-select: none;
  width: max-content;
  max-width: 92vw;
}

.ritual-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ritual-steps li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 76px;
  color: var(--faint);
  transition: color 0.4s ease;
}

.ritual-steps li + li::before {
  content: "";
  position: absolute;
  top: 13px;
  right: calc(50% + 16px);
  width: calc(100% - 32px);
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.14));
  transform: translateX(-100%);
  transform-origin: right center;
}

.ritual-steps li:first-child::before { display: none; }

.ritual-steps i {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  font-style: normal;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  transition: all 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ritual-steps span {
  font-size: 8px;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  transition: color 0.4s ease;
}

.ritual-steps li.is-done { color: rgba(255, 238, 249, 0.55); }
.ritual-steps li.is-done i { border-color: rgba(var(--accent-rgb), 0.35); color: var(--accent-soft); }

.ritual-steps li.is-active { color: var(--accent-soft); }
.ritual-steps li.is-active i {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.2);
  color: #fff;
  box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.45), inset 0 0 12px rgba(var(--accent-rgb), 0.25);
  transform: scale(1.08);
}

.ritual-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px 5px 15px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(12, 6, 18, 0.38);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: auto;
}

#ritual-hint {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: rgba(255, 241, 251, 0.72);
  white-space: nowrap;
  min-width: 60px;
  text-align: center;
}

.mini-btn,
.mini-icon {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.55);
  height: 22px;
  border-radius: 999px;
  font-size: 8.5px;
  letter-spacing: 0.1em;
  padding: 0 9px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.mini-icon { width: 22px; padding: 0; font-size: 12px; line-height: 1; }

.mini-btn:hover,
.mini-icon:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.09); }

#skip-btn {
  color: var(--accent-soft);
  border-color: rgba(var(--accent-rgb), 0.38);
  background: rgba(var(--accent-rgb), 0.11);
}
#skip-btn:hover {
  color: #fff;
  border-color: rgba(var(--accent-rgb), 0.72);
  background: rgba(var(--accent-rgb), 0.2);
}

/* ---------- cursor & magic ---------- */

.hand-cursor {
  position: fixed;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 15;
  opacity: 0;
  transform: scale(0.2);
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.95) 0%, rgba(var(--accent-rgb), 0.25) 45%, transparent 70%);
  box-shadow: 0 0 26px rgba(var(--accent-rgb), 0.8), inset 0 0 12px rgba(255, 255, 255, 0.7);
  transition: opacity 0.2s, transform 0.2s;
  mix-blend-mode: screen;
}

.hand-cursor.is-visible { opacity: 0.85; transform: scale(1); }

.magic-ring {
  position: fixed;
  left: 0;
  top: 0;
  width: 108px;
  height: 108px;
  margin: -54px 0 0 -54px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 14;
  opacity: 0;
  transform: scale(0.8) rotate(0deg);
  transition: opacity 0.3s ease, transform 0.3s ease;
  background: conic-gradient(from 0deg, transparent 0deg 40deg, rgba(var(--accent-rgb), 0.9) 70deg, transparent 110deg 190deg, rgba(255, 255, 255, 0.7) 230deg, transparent 270deg 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  filter: drop-shadow(0 0 8px rgba(var(--accent-rgb), 0.55));
}

.magic-ring.is-active { opacity: 0.9; transform: scale(1); animation: magic-rotate 2.4s linear infinite; }
.magic-ring::after {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  border: 1px dashed rgba(var(--accent-rgb), 0.35);
}

@keyframes magic-rotate { to { transform: scale(1) rotate(360deg); } }

.flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  opacity: 0;
  background: radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 0.9) 0%, rgba(var(--accent-rgb), 0.45) 22%, transparent 62%);
}

.flash.is-active { animation: flash-out 0.8s ease-out; }

@keyframes flash-out {
  0% { opacity: 0; }
  12% { opacity: 0.85; }
  100% { opacity: 0; }
}

/* ---------- camera panel ---------- */

.camera-panel {
  position: fixed;
  left: 28px;
  bottom: 28px;
  z-index: 18;
  width: 236px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(16, 9, 22, 0.55);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: panel-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.cam-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: #07040c;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

#cam {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  filter: saturate(0.85) contrast(1.05) brightness(0.92);
}

#skeleton {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.cam-badge {
  position: absolute;
  left: 8px;
  bottom: 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 7px;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.55);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.cam-badge i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #79ffc9;
  box-shadow: 0 0 6px #79ffc9;
}

.cam-readout {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 5px 3px;
}

.cam-caption {
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--faint);
}

.cam-readout strong {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--accent-soft);
  text-shadow: 0 0 16px rgba(var(--accent-rgb), 0.5);
}

.cam-close {
  margin-left: auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  transition: color 0.2s, border-color 0.2s;
}

.cam-close:hover { color: #fff; border-color: rgba(255, 255, 255, 0.35); }

/* ---------- dock ---------- */

.dock {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 18;
}

.dock-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(16, 9, 22, 0.42);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.35);
}

.themes {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
}

.theme-dot {
  position: relative;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  opacity: 0.5;
  transition: opacity 0.3s, transform 0.3s, box-shadow 0.3s;
}

.theme-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid transparent;
  transition: border-color 0.3s;
}

.theme-dot:hover { opacity: 0.85; transform: scale(1.08); }

.theme-dot.is-active {
  opacity: 1;
  transform: scale(1.05);
  box-shadow: 0 0 16px currentColor, 0 0 4px currentColor;
}

.theme-dot.is-active::after { border-color: rgba(255, 255, 255, 0.45); }

/* ---------- toast / loader / modal ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 46px;
  z-index: 40;
  transform: translate(-50%, 14px);
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(16, 9, 22, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: rgba(255, 249, 253, 0.88);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
  max-width: 86vw;
  text-align: center;
}

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

.loader {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(4, 2, 9, 0.62);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.loader[hidden] { display: none; }

.loader-inner { text-align: center; }

.loader-ring {
  position: relative;
  width: 54px;
  height: 54px;
  margin: 0 auto 24px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.loader-ring::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid transparent;
  border-top-color: var(--accent);
  border-right-color: rgba(var(--accent-rgb), 0.4);
  animation: spin 1.1s linear infinite;
}

.loader-ring span {
  position: absolute;
  inset: 50%;
  width: 6px;
  height: 6px;
  margin: -3px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px 4px rgba(var(--accent-rgb), 0.55);
}

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

.loader-title {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.24em;
  color: rgba(255, 248, 253, 0.9);
}

.loader-sub {
  margin: 10px 0 0;
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: var(--faint);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 2, 8, 0.66);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: fade-in 0.35s ease;
}

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

.modal-card {
  position: relative;
  width: min(660px, 100%);
  max-height: 88vh;
  overflow: auto;
  padding: 40px 42px 28px;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(var(--accent-rgb), 0.14), transparent 55%),
    linear-gradient(160deg, rgba(31, 17, 38, 0.96), rgba(9, 5, 15, 0.98));
  box-shadow: 0 50px 140px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: modal-in 0.45s cubic-bezier(0.2, 0.9, 0.2, 1);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(22px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
  display: grid;
  place-items: center;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.modal-close:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

.modal-kicker {
  margin: 0 0 12px;
  font-size: 8.5px;
  letter-spacing: 0.42em;
  color: var(--accent);
}

.modal-card h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: 0.04em;
  color: #fff2fa;
}

.modal-intro {
  margin: 16px 0 24px;
  max-width: 50ch;
  font-size: 11.5px;
  line-height: 1.9;
  letter-spacing: 0.04em;
  color: rgba(255, 240, 250, 0.52);
}

.story-list {
  list-style: none;
  margin: 0;
  padding: 22px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  display: grid;
  gap: 17px;
}

.story-list li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
}

.story-index {
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--accent);
  padding-top: 1px;
}

.story-list strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: rgba(255, 249, 253, 0.9);
}

.story-list p {
  margin: 5px 0 0;
  font-size: 10.5px;
  line-height: 1.7;
  color: rgba(255, 238, 249, 0.44);
}

.modal-foot {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-foot p {
  margin: 5px 0;
  font-size: 9px;
  line-height: 1.7;
  letter-spacing: 0.08em;
  color: rgba(255, 238, 249, 0.32);
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
  z-index: 100;
}

/* ---------- focused photo ---------- */

.focus-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(to bottom, rgba(3, 1, 8, 0.5) 0%, transparent 22%, transparent 76%, rgba(3, 1, 8, 0.68) 100%),
    radial-gradient(ellipse 72% 65% at 50% 50%, transparent 45%, rgba(3, 1, 8, 0.4) 100%);
  transition: opacity 0.55s ease;
}

.focus-scrim.is-shown { opacity: 1; }

.photo-tools {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  z-index: 24;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(12, 6, 18, 0.62);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: tools-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.photo-tools[hidden] { display: none; }

.photo-tools::after {
  content: "握拳 / 双掌张开 · 回到星云";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 7px);
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 6, 16, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: rgba(255, 244, 252, 0.55);
  pointer-events: none;
}

@keyframes tools-in {
  from { opacity: 0; transform: translate(-50%, 10px) scale(0.97); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

#photo-index {
  min-width: 44px;
  text-align: center;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(255, 243, 251, 0.72);
}

.tool-round {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.75);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.tool-round:hover { background: rgba(var(--accent-rgb), 0.18); border-color: rgba(var(--accent-rgb), 0.5); color: #fff; }

.tool-close {
  height: 27px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 248, 253, 0.66);
  font-size: 9px;
  letter-spacing: 0.1em;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.tool-close:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.3); color: #fff; }

body.is-focusing .ritual {
  opacity: 0;
  transform: translate(-50%, -8px);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

body.is-focusing .dock { opacity: 0.4; transition: opacity 0.4s ease; }
/* Keep the hand preview visible while a photo is enlarged. */
.ritual { transition: opacity 0.4s ease, transform 0.4s ease; }

/* ---------- empty album callout ---------- */

.photo-callout {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  z-index: 19;
  width: min(360px, calc(100vw - 40px));
  transform: translateX(-50%);
  padding: 22px 24px 20px;
  border-radius: 20px;
  border: 1px solid rgba(var(--accent-rgb), 0.24);
  background:
    radial-gradient(110% 90% at 50% 0%, rgba(var(--accent-rgb), 0.13), transparent 60%),
    rgba(13, 7, 18, 0.76);
  backdrop-filter: blur(22px) saturate(130%);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-align: center;
  animation: callout-in 0.55s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.photo-callout[hidden] { display: none; }
.photo-callout:not([hidden]) ~ .toast { bottom: 346px; }

@keyframes callout-in {
  from { opacity: 0; transform: translate(-50%, 16px) scale(0.97); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.callout-kicker {
  margin: 0 0 9px;
  font-size: 7.5px;
  letter-spacing: 0.3em;
  color: var(--accent);
}

.photo-callout h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 23px;
  letter-spacing: 0.04em;
  color: #fff2fa;
}

.callout-copy {
  margin: 9px auto 14px;
  max-width: 30ch;
  font-size: 10.5px;
  line-height: 1.8;
  letter-spacing: 0.03em;
  color: rgba(255, 238, 249, 0.48);
}

.callout-btn {
  height: 32px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.42);
  background: rgba(var(--accent-rgb), 0.16);
  color: #fff6fc;
  font-size: 10px;
  letter-spacing: 0.12em;
  box-shadow: 0 0 24px rgba(var(--accent-rgb), 0.16);
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s, transform 0.2s;
}

.callout-btn:hover {
  background: rgba(var(--accent-rgb), 0.26);
  border-color: rgba(var(--accent-rgb), 0.7);
  box-shadow: 0 0 34px rgba(var(--accent-rgb), 0.28);
}

.callout-btn:active { transform: scale(0.98); }

.callout-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.callout-secondary {
  height: 32px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 244, 252, 0.72);
  font-size: 9px;
  letter-spacing: 0.08em;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.callout-secondary:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.1);
}

.callout-actions .callout-btn,
.callout-actions .callout-secondary { margin-top: 0; }

.callout-note {
  display: block;
  margin-top: 10px;
  font-size: 8px;
  letter-spacing: 0.08em;
  color: rgba(255, 238, 249, 0.27);
}

/* ---------- drag and drop ---------- */

.drop-veil {
  position: fixed;
  inset: 14px;
  z-index: 55;
  display: grid;
  place-items: center;
  border-radius: 24px;
  border: 1px dashed rgba(var(--accent-rgb), 0.55);
  background: rgba(6, 2, 10, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s;
}

.drop-veil.is-shown { opacity: 1; visibility: visible; }
.drop-veil div { text-align: center; color: rgba(255, 244, 252, 0.78); }
.drop-veil span {
  display: block;
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 300;
  color: var(--accent);
  text-shadow: 0 0 30px rgba(var(--accent-rgb), 0.6);
}
.drop-veil p { margin: 8px 0 0; font-size: 11px; letter-spacing: 0.12em; }

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  .hud-top { padding: 16px 16px; }
  .mark { font-size: 13px; }
  .top-actions { gap: 7px; }
  .ghost-btn { width: 34px; height: 34px; }
  .pill-btn { height: 34px; padding: 0 12px; font-size: 9.5px; letter-spacing: 0.06em; }
  .photo-label { display: none; }
  .photo-btn { padding: 0 10px; }
  .photo-count { min-width: 15px; height: 15px; }

  .ritual { top: 64px; gap: 8px; }
  .ritual-steps li { width: 46px; }
  .ritual-steps li span { display: none; }
  .ritual-steps li i { width: 24px; height: 24px; font-size: 9.5px; }
  .ritual-steps li + li::before { top: 11px; right: calc(50% + 14px); width: calc(100% - 28px); }
  .ritual-hint { padding: 4px 5px 4px 12px; gap: 7px; }
  #ritual-hint { font-size: 9px; letter-spacing: 0.08em; min-width: 44px; }

  .camera-panel {
    left: 12px;
    top: 74px;
    bottom: auto;
    transform: none;
    width: 136px;
    padding: 5px;
    border-radius: 14px;
  }
  body.has-photo-prompt .camera-panel {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  body.is-focusing .camera-panel {
    left: 12px;
    top: 74px;
    transform: none;
    bottom: auto;
    width: 108px;
    padding: 4px;
    border-radius: 12px;
    opacity: 1;
    pointer-events: auto;
  }
  body.is-focusing .cam-frame { border-radius: 9px; }
  body.is-focusing .cam-readout { padding: 5px 2px 1px; gap: 4px; }
  body.is-focusing .cam-readout strong { font-size: 8.5px; }
  body.is-focusing .cam-close { width: 15px; height: 15px; }
  .cam-readout { padding: 7px 3px 2px; gap: 6px; }
  .cam-caption { display: none; }
  .cam-readout strong { font-size: 10px; }
  .cam-close { width: 18px; height: 18px; }

  .dock { right: 50%; transform: translateX(50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
  .dock-row { padding: 5px; }
  .themes { gap: 7px; padding: 0 6px; }
  .theme-dot { width: 15px; height: 15px; }

  .toast { bottom: 132px; font-size: 10.5px; padding: 9px 16px; white-space: normal; }

  .modal-card { padding: 30px 22px 22px; border-radius: 20px; }
  .modal-intro { font-size: 11px; }
  .story-list { gap: 14px; }
  .modal-foot { display: none; }

  .magic-ring { width: 88px; height: 88px; margin: -44px 0 0 -44px; }

  .photo-callout {
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    padding: 14px 16px 13px;
    border-radius: 16px;
    width: calc(100vw - 32px);
  }
  .photo-callout h3 { font-size: 18px; }
  .callout-kicker,
  .callout-copy,
  .callout-note { display: none; }
  .callout-btn { height: 30px; padding: 0 16px; }
  .callout-secondary { height: 30px; padding: 0 13px; font-size: 8.5px; }
  .callout-actions { gap: 6px; margin-top: 10px; }
  .photo-callout:not([hidden]) ~ .toast { bottom: 194px; }
  .photo-tools {
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    gap: 7px;
    padding: 6px 7px 6px 9px;
  }
  #photo-index { min-width: 38px; font-size: 10px; }
  .tool-round { width: 26px; height: 26px; }
  .tool-close { height: 26px; padding: 0 10px; font-size: 8.5px; }
  .photo-tools::after { font-size: 7px; padding: 3px 8px; letter-spacing: 0.04em; }
  .drop-veil { inset: 8px; }
}

@media (max-height: 640px) {
  .ritual { top: 56px; }
  .ritual-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .grain, .mark, .live-dot, .magic-ring.is-active { animation: none; }
}

/* ---------- camera expand + photo booth ---------- */

.cam-expand {
  margin-left: auto;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent-soft);
  font-size: 8px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.cam-expand:hover {
  color: #fff;
  border-color: rgba(var(--accent-rgb), 0.5);
  background: rgba(var(--accent-rgb), 0.14);
}

.cam-readout .cam-close { margin-left: 0; }

body.is-booth .hud-top,
body.is-booth .ritual,
body.is-booth .camera-panel,
body.is-booth .photo-tools,
body.is-booth .photo-callout,
body.is-booth .dock,
body.is-booth .hand-cursor,
body.is-booth .magic-ring {
  opacity: 0;
  pointer-events: none;
}

.booth {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--sans);
  animation: booth-in 0.35s ease-out;
}

.booth[hidden] { display: none; }

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

.booth-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(2, 1, 6, 0.55) 0%, rgba(2, 1, 6, 0.08) 36%, rgba(2, 1, 6, 0.2) 68%, rgba(2, 1, 6, 0.78) 100%),
    radial-gradient(ellipse 76% 68% at 50% 48%, transparent 36%, rgba(2, 1, 6, 0.36) 100%);
  pointer-events: auto;
}

.booth-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: max(18px, env(safe-area-inset-top, 0px)) 22px max(12px, env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}

.booth-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: auto;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.7);
}

.booth-kicker {
  margin: 0 0 5px;
  color: var(--accent-soft);
  font-size: 8px;
  letter-spacing: 0.24em;
  font-weight: 500;
}

.booth-head h2,
.booth-result-inner h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(23px, 3vw, 30px);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.booth-sub {
  margin: 6px 0 0;
  color: rgba(255, 244, 252, 0.5);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.booth-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(12, 6, 18, 0.5);
  color: rgba(255, 244, 252, 0.75);
  font-size: 13px;
  display: grid;
  place-items: center;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.booth-close:hover { color: #fff; border-color: rgba(255, 255, 255, 0.4); }

.booth-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  pointer-events: none;
}

.booth-card {
  position: absolute;
  left: 50%;
  top: 57%;
  width: min(430px, 42vw);
  padding: 11px 11px 38px;
  transform: translate(-50%, -50%) rotate(-1.5deg);
  border-radius: 7px;
  background: #fff8e9;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(96, 67, 36, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.7);
  pointer-events: auto;
}

.booth-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 2px;
  background: #0a0710;
  cursor: crosshair;
}

#booth-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  filter: saturate(0.9) contrast(1.03) brightness(1.04);
}

.booth-filter {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 58% at 50% 34%, rgba(255, 239, 221, 0.28), transparent 66%),
    linear-gradient(135deg, rgba(255, 153, 205, 0.12), transparent 42%, rgba(120, 255, 206, 0.08));
  mix-blend-mode: screen;
}

.booth-emojis {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}

.emoji-sticker {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  font-size: clamp(28px, 4.6vw, 42px);
  line-height: 1;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
}

.emoji-sticker:active { cursor: grabbing; transform: translate(-50%, -50%) scale(1.08); }

.booth-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  color: #96744e;
  text-align: center;
  font-family: "Snell Roundhand", "Edwardian Script ITC", "Segoe Script", "Brush Script MT", cursive;
  font-size: 23px;
  font-style: italic;
  letter-spacing: 0.01em;
}

.booth-tip {
  position: absolute;
  left: 50%;
  bottom: 2px;
  margin: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  color: rgba(255, 244, 252, 0.48);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.8);
}

.booth-controls {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  width: 100%;
  padding-bottom: 4px;
  pointer-events: auto;
}

.emoji-tray {
  display: flex;
  align-items: center;
  gap: 5px;
  width: min(560px, 92vw);
  margin: 0 auto 10px;
  padding: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  background: rgba(10, 6, 16, 0.52);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.emoji-tray::-webkit-scrollbar { display: none; }

.emoji-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid transparent;
  display: grid;
  place-items: center;
  font-size: 21px;
  line-height: 1;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.emoji-btn:hover,
.emoji-btn:active {
  transform: translateY(-2px) scale(1.06);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
}

.booth-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(420px, 94vw);
  margin: 0 auto;
}

.booth-face-tools {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  justify-self: end;
  width: 68px;
}

.booth-clear {
  justify-self: start;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 6, 16, 0.45);
  color: rgba(255, 244, 252, 0.58);
  font-size: 9px;
  letter-spacing: 0.08em;
  backdrop-filter: blur(12px);
}

.booth-clear:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); }

.booth-spacer { width: 54px; }

.booth-shutter {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 2px solid rgba(255, 250, 246, 0.92);
  background: rgba(8, 5, 12, 0.35);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.12), 0 10px 30px rgba(0, 0, 0, 0.38);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.booth-shutter span {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-soft);
  box-shadow: 0 0 26px rgba(var(--accent-rgb), 0.55), inset 0 1px 6px rgba(255, 255, 255, 0.7);
}

.booth-shutter:hover { transform: scale(1.04); box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.15), 0 12px 34px rgba(0, 0, 0, 0.42); }
.booth-shutter:active { transform: scale(0.94); }

.booth-flash {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  background: #fff;
}

.booth-flash.is-active { animation: booth-flash 0.5s ease-out; }

@keyframes booth-flash {
  0% { opacity: 0; }
  14% { opacity: 0.86; }
  100% { opacity: 0; }
}

.booth-result {
  position: fixed;
  inset: 0;
  z-index: 8;
  overflow-y: auto;
  padding: max(20px, env(safe-area-inset-top, 0px)) 16px max(20px, env(safe-area-inset-bottom, 0px));
  background: rgba(4, 2, 9, 0.94);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}

.booth-result[hidden] { display: none; }

.booth-result-inner {
  width: min(480px, 100%);
  margin: 0 auto;
  text-align: center;
  animation: result-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

.booth-result-inner h2 { margin-bottom: 16px; }

#booth-photo {
  display: block;
  max-width: 100%;
  max-height: 60vh;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.booth-save-note {
  margin: 10px 0 14px;
  color: rgba(255, 244, 252, 0.42);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.booth-result-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.booth-primary,
.booth-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 17px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.booth-primary {
  color: #07140d;
  border-color: var(--accent-soft);
  background: var(--accent-soft);
  box-shadow: 0 8px 26px rgba(var(--accent-rgb), 0.25);
}

.booth-primary:hover { background: #fff; border-color: #fff; }

.booth-secondary {
  color: rgba(255, 244, 252, 0.72);
  background: rgba(255, 255, 255, 0.05);
}

.booth-secondary:hover { color: #fff; border-color: rgba(255, 255, 255, 0.32); background: rgba(255, 255, 255, 0.1); }

.booth-done {
  margin-top: 14px;
  color: rgba(255, 244, 252, 0.48);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.booth-done:hover { color: #fff; }

@media (max-width: 760px) {
  .cam-expand { height: 18px; padding: 0 6px; font-size: 7.5px; }
  body.is-focusing .cam-expand { height: 15px; padding: 0 5px; font-size: 7px; }
  body.is-focusing .cam-readout .cam-close { margin-left: 0; }

  .booth-shell {
    padding: max(13px, env(safe-area-inset-top, 0px)) 12px max(9px, env(safe-area-inset-bottom, 0px));
  }

  .booth-head h2 { font-size: 22px; }
  .booth-sub { margin-top: 4px; font-size: 9px; }
  .booth-close { width: 30px; height: 30px; font-size: 12px; }

  .booth-stage { margin-top: 2px; }

  .booth-card {
    top: 59%;
    width: min(84vw, 330px);
    padding: 8px 8px 30px;
    border-radius: 6px;
    transform: translate(-50%, -50%) rotate(-1deg);
  }

  .booth-caption { font-size: 18px; bottom: 6px; }
  .booth-tip { bottom: -2px; font-size: 8px; letter-spacing: 0.02em; }

  .emoji-tray { width: calc(100vw - 24px); margin-bottom: 8px; padding: 5px; gap: 3px; }
  .emoji-btn { width: 33px; height: 33px; font-size: 19px; }
  .booth-actions { width: min(330px, 88vw); gap: 8px; }
  .booth-clear { height: 25px; padding: 0 10px; font-size: 8px; }
  .booth-spacer { width: 42px; }
  .booth-shutter { width: 58px; height: 58px; }
  .booth-shutter span { width: 46px; height: 46px; }
  .booth-close { backdrop-filter: blur(14px); }

  .booth-result-inner { width: min(100%, 390px); }
  .booth-result-inner h2 { font-size: 24px; margin-bottom: 12px; }
  #booth-photo { max-height: 54vh; }
  .booth-save-note { margin: 8px 0 12px; }
  .booth-primary, .booth-secondary { height: 34px; padding: 0 14px; font-size: 9px; }
}

/* emoji size + countdown additions */

.emoji-sticker {
  display: inline-block;
  flex: 0 0 auto;
}

.emoji-sticker.is-selected::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px dashed rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.16);
  pointer-events: none;
}

.emoji-size-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: min(340px, 86vw);
  margin: 0 auto 8px;
  color: rgba(255, 244, 252, 0.55);
  font-size: 8.5px;
  letter-spacing: 0.05em;
}

.emoji-size-caption { flex: 0 0 auto; }

.emoji-size-btn {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 244, 252, 0.8);
  font-size: 13px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.emoji-size-btn:hover { color: #fff; border-color: rgba(255, 255, 255, 0.38); background: rgba(255, 255, 255, 0.12); }

.emoji-size {
  width: 104px;
  height: 16px;
  flex: 0 1 104px;
  accent-color: var(--accent-soft);
  cursor: pointer;
}

.emoji-size-value {
  flex: 0 0 27px;
  min-width: 27px;
  color: var(--accent-soft);
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.booth-countdown {
  position: fixed;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: clamp(90px, 17vh, 170px);
  pointer-events: none;
  background: radial-gradient(ellipse 42% 40% at 50% 26%, rgba(2, 1, 6, 0.5), transparent 70%);
}

.booth-countdown[hidden] { display: none; }

.booth-countdown-number {
  color: #fff8e9;
  font-family: var(--serif);
  font-size: clamp(76px, 14vw, 132px);
  font-weight: 300;
  line-height: 0.9;
  text-shadow:
    0 0 26px rgba(var(--accent-rgb), 0.65),
    0 0 72px rgba(var(--accent-rgb), 0.3),
    0 8px 30px rgba(0, 0, 0, 0.6);
  transform-origin: 50% 60%;
}

.booth-countdown-number.is-pop {
  animation: countdown-pop 0.55s cubic-bezier(0.2, 0.9, 0.2, 1);
}

@keyframes countdown-pop {
  0% { opacity: 0.1; transform: scale(1.55); }
  45% { opacity: 1; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1); }
}

.booth-countdown-label {
  margin: 13px 0 0;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 6, 16, 0.48);
  color: rgba(255, 244, 252, 0.68);
  font-size: 9px;
  letter-spacing: 0.1em;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.booth-shutter.is-counting {
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 5px rgba(var(--accent-rgb), 0.12), 0 0 32px rgba(var(--accent-rgb), 0.35);
}

.booth-shutter.is-counting span {
  animation: shutter-pulse 1s ease-in-out infinite;
}

@keyframes shutter-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.86); }
}

@media (max-width: 760px) {
  .emoji-size-row { width: min(310px, 88vw); gap: 5px; margin-bottom: 6px; font-size: 8px; }
  .emoji-size { width: 88px; flex-basis: 88px; }
  .emoji-size-btn { width: 20px; height: 20px; font-size: 12px; }
  .emoji-size-value { flex-basis: 25px; min-width: 25px; }
  .booth-countdown { padding-top: 15vh; }
  .booth-countdown-label { font-size: 8px; margin-top: 9px; }
}

/* ---------- glass ornament booth ---------- */

.booth-ornament {
  position: absolute;
  left: 50%;
  top: 57%;
  width: min(78vw, 360px);
  transform: translate(-50%, -50%) rotate(-1.4deg);
  pointer-events: auto;
  filter: drop-shadow(0 30px 44px rgba(0, 0, 0, 0.42));
}

.ornament-cord {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 8px);
  width: 2px;
  height: clamp(48px, 10vh, 108px);
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(to top, rgba(255, 224, 145, 0.92), rgba(255, 224, 145, 0.08));
  box-shadow: 0 0 12px rgba(255, 211, 126, 0.35);
}

.ornament-cord::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -7px;
  width: 8px;
  height: 16px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 224, 145, 0.85);
  border-radius: 50%;
}

.ornament-cap {
  position: absolute;
  left: 50%;
  top: -17px;
  z-index: 7;
  width: 58px;
  height: 31px;
  transform: translateX(-50%);
  border-radius: 8px 8px 4px 4px;
  border: 1px solid rgba(255, 244, 200, 0.65);
  background: linear-gradient(180deg, #fff2bd 0%, #d6a74d 48%, #99702f 100%);
  box-shadow:
    0 3px 0 rgba(82, 52, 19, 0.45),
    0 0 16px rgba(255, 208, 111, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.ornament-cap span {
  position: absolute;
  left: 50%;
  top: -12px;
  width: 22px;
  height: 16px;
  transform: translateX(-50%);
  border: 1.5px solid #e8c36f;
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 0 10px rgba(255, 215, 125, 0.28);
}

.ornament-glass {
  position: relative;
  width: 100%;
  aspect-ratio: 0.87;
  border-radius: 50%;
  padding: 8px;
  background:
    radial-gradient(ellipse at 30% 15%, rgba(219, 255, 232, 0.16), transparent 42%),
    linear-gradient(145deg, rgba(255, 220, 142, 0.5), rgba(94, 199, 146, 0.2) 52%, rgba(255, 195, 110, 0.42));
  box-shadow:
    0 0 0 1px rgba(255, 245, 204, 0.55),
    0 0 30px rgba(255, 206, 107, 0.18),
    0 14px 40px rgba(0, 0, 0, 0.38),
    inset 0 0 0 2px rgba(15, 50, 33, 0.4);
}

.ornament-glass .booth-media {
  position: absolute;
  inset: 8px;
  aspect-ratio: auto;
  border-radius: 50%;
  overflow: hidden;
  background: #07110c;
}

#booth-video {
  filter: saturate(0.86) contrast(1.04) brightness(1.03) sepia(0.06) hue-rotate(-4deg);
}

.ornament-sheen {
  position: absolute;
  inset: 8px;
  z-index: 5;
  border-radius: 50%;
  pointer-events: none;
  background:
    linear-gradient(132deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.04) 22%, transparent 43%, transparent 72%, rgba(124, 255, 188, 0.08) 100%),
    radial-gradient(ellipse at 32% 18%, rgba(255, 255, 255, 0.22), transparent 30%),
    radial-gradient(ellipse at 75% 82%, rgba(255, 199, 113, 0.11), transparent 38%);
  mix-blend-mode: screen;
}

.ornament-edge {
  position: absolute;
  inset: 5px;
  z-index: 6;
  border-radius: 50%;
  pointer-events: none;
  border: 1px solid rgba(255, 244, 197, 0.42);
  box-shadow:
    inset 0 0 22px rgba(255, 218, 137, 0.18),
    inset 0 -24px 30px rgba(7, 66, 43, 0.28);
}

.ornament-tag {
  position: absolute;
  left: 50%;
  bottom: -17px;
  z-index: 6;
  transform: translateX(-50%) rotate(1deg);
  padding: 5px 18px 6px;
  border-radius: 4px;
  background: #fff8e9;
  color: #96744e;
  font-family: "Snell Roundhand", "Edwardian Script ITC", "Segoe Script", "Brush Script MT", cursive;
  font-size: 18px;
  font-style: italic;
  white-space: nowrap;
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.3);
}

.emoji-sticker img {
  display: block;
  width: 1em;
  height: 1em;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.emoji-btn img {
  display: block;
  width: 25px;
  height: 25px;
  pointer-events: none;
}

@media (max-width: 760px) {
  .booth-ornament {
    top: 57%;
    width: min(76vw, 310px);
  }

  .ornament-cord { height: clamp(36px, 8vh, 62px); }
  .ornament-tag { bottom: -13px; padding: 4px 13px 5px; font-size: 15px; }
  .emoji-btn img { width: 22px; height: 22px; }
}

/* ---------- polaroid, film filters and christmas effects ---------- */

.booth-card {
  border-radius: 5px;
  background: #fff8e9;
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(98, 67, 33, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.booth-string {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 3px);
  width: 2px;
  height: clamp(48px, 10vh, 110px);
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(to top, rgba(255, 225, 154, 0.84), rgba(255, 225, 154, 0.08));
  box-shadow: 0 0 10px rgba(255, 213, 128, 0.28);
  pointer-events: none;
}

.booth-clip {
  position: absolute;
  left: 50%;
  top: -21px;
  z-index: 7;
  width: 42px;
  height: 35px;
  transform: translateX(-50%) rotate(-2.5deg);
  border-radius: 5px 5px 3px 3px;
  border: 1px solid rgba(255, 243, 193, 0.72);
  background: linear-gradient(180deg, #fff0b6 0%, #d7a746 55%, #8d652d 100%);
  box-shadow:
    0 4px 0 rgba(74, 44, 15, 0.35),
    0 0 12px rgba(255, 210, 120, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  pointer-events: none;
}

.booth-clip::before,
.booth-clip::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 11px;
  height: 25px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 246, 210, 0.62);
  border-radius: 5px;
  background: linear-gradient(90deg, rgba(255, 236, 171, 0.7), rgba(159, 108, 38, 0.8));
}

.booth-clip::before { top: 4px; left: calc(50% - 7px); transform: translateX(-50%) rotate(-8deg); }
.booth-clip::after { top: 4px; left: calc(50% + 7px); transform: translateX(-50%) rotate(8deg); }

.booth-card .booth-media {
  border-radius: 2px;
  background: #070a08;
}

.booth-fx {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

.booth-fx i {
  position: absolute;
  display: block;
  pointer-events: none;
}

.fx-snow {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 9px rgba(224, 248, 255, 0.85);
  animation: fx-snow-fall linear infinite;
  filter: blur(0.2px);
}

@keyframes fx-snow-fall {
  from { transform: translate3d(0, -14px, 0); opacity: 0; }
  12% { opacity: 0.8; }
  to { transform: translate3d(18px, 360px, 0); opacity: 0; }
}

.fx-gold {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 230, 151, 0.9), rgba(255, 183, 84, 0.05) 70%);
  animation: fx-gold-float ease-in-out infinite alternate;
}

@keyframes fx-gold-float {
  from { transform: translate3d(-5px, 8px, 0) scale(0.7); opacity: 0.25; }
  to { transform: translate3d(8px, -10px, 0) scale(1.2); opacity: 0.75; }
}

.booth-card .booth-emojis { z-index: 4; }

.booth-filters {
  display: flex;
  gap: 5px;
  width: min(540px, 92vw);
  margin: 0 auto 8px;
  padding: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.booth-filters::-webkit-scrollbar { display: none; }

.filter-chip {
  flex: 0 0 auto;
  height: 25px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(10, 6, 16, 0.42);
  color: rgba(255, 244, 252, 0.55);
  font-size: 8.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.filter-chip:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); }

.filter-chip.is-active {
  color: #08140e;
  border-color: var(--accent-soft);
  background: var(--accent-soft);
  box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.2);
}

/* Live camera grades. */
.booth-media[data-filter="none"] #booth-video { filter: none; }
.booth-media[data-filter="film"] #booth-video { filter: sepia(0.16) saturate(0.92) contrast(1.06) brightness(1.04); }
.booth-media[data-filter="snow"] #booth-video { filter: saturate(0.84) contrast(1.04) brightness(1.02) hue-rotate(-7deg); }
.booth-media[data-filter="gold"] #booth-video { filter: sepia(0.2) saturate(1.08) contrast(1.03) brightness(1.06); }

.booth-media[data-filter="none"] .booth-filter { background: radial-gradient(ellipse at 50% 32%, rgba(255, 245, 226, 0.06), transparent 65%); }
.booth-media[data-filter="film"] .booth-filter {
  background:
    linear-gradient(130deg, rgba(255, 197, 117, 0.18), transparent 43%, rgba(55, 41, 21, 0.1)),
    radial-gradient(ellipse at 50% 30%, rgba(255, 238, 210, 0.13), transparent 70%);
}
.booth-media[data-filter="snow"] .booth-filter {
  background:
    linear-gradient(150deg, rgba(147, 213, 255, 0.13), transparent 48%, rgba(21, 45, 72, 0.15)),
    radial-gradient(ellipse at 50% 32%, rgba(233, 250, 255, 0.1), transparent 70%);
}
.booth-media[data-filter="gold"] .booth-filter {
  background:
    radial-gradient(ellipse at 72% 20%, rgba(255, 214, 132, 0.26), transparent 36%),
    linear-gradient(135deg, rgba(255, 197, 98, 0.14), transparent 52%, rgba(93, 59, 20, 0.08));
}

.booth-media[data-filter="film"] .booth-fx::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.27;
  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='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  pointer-events: none;
}

.booth-media[data-filter="film"] .booth-fx::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 24%, rgba(255, 206, 132, 0.18) 42%, transparent 58%);
  mix-blend-mode: screen;
  pointer-events: none;
}

.booth-media[data-filter="gold"] .booth-fx::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 70% 24%, rgba(255, 224, 155, 0.22), transparent 18%),
    radial-gradient(circle at 32% 78%, rgba(255, 197, 103, 0.1), transparent 28%);
  mix-blend-mode: screen;
  pointer-events: none;
}

@media (max-width: 760px) {
  .booth-card { top: 59%; }
  .booth-string { height: clamp(36px, 8vh, 64px); }
  .booth-clip { width: 36px; height: 30px; top: -18px; }
  .booth-filters { width: calc(100vw - 24px); margin-bottom: 6px; }
  .filter-chip { height: 23px; padding: 0 8px; font-size: 8px; }
}

.booth-doodles {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.booth-doodle {
  position: absolute;
  display: block;
  height: auto;
  pointer-events: none;
  opacity: 0.92;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
}

.tray-divider {
  flex: 0 0 auto;
  padding: 0 3px 0 5px;
  color: rgba(255, 244, 252, 0.3);
  font-size: 7px;
  letter-spacing: 0.08em;
  writing-mode: vertical-rl;
  line-height: 1;
}

.booth-media[data-filter="film"] .booth-fx::after {
  opacity: 0.34;
}

.photo-tools { gap: 6px; }
.tool-danger { color: rgba(255, 160, 170, 0.82); border-color: rgba(255, 120, 132, 0.22); }
.tool-danger:hover { color: #fff; border-color: rgba(255, 120, 132, 0.55); background: rgba(255, 90, 106, 0.16); }
.tool-clear { font-size: 8px; padding: 0 8px; }

.booth-limit-note {
  margin: 8px 0 2px;
  color: #ffc7ca;
  font-size: 10px;
  letter-spacing: 0.03em;
}

.booth-limit-note[hidden] { display: none; }

.booth-manage {
  margin: 4px 0 6px;
  height: 30px;
  font-size: 9px;
}

.booth-manage[hidden] { display: none; }

.booth-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.booth-hat-btn {
  height: 27px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 225, 154, 0.28);
  background: rgba(10, 6, 16, 0.48);
  color: #ffe5ad;
  font-size: 8.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.booth-hat-btn:hover { color: #fff; border-color: rgba(255, 225, 154, 0.55); background: rgba(255, 218, 130, 0.13); }
.booth-hat-btn:disabled { opacity: 0.6; }

.booth-hat-btn.is-active {
  color: #201005;
  background: #ffe2a4;
  border-color: #ffe9b8;
  box-shadow: 0 0 18px rgba(255, 214, 120, 0.28);
}

.booth-hat-btn.is-active::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 4px;
  border-radius: 50%;
  background: #2a7b4f;
  vertical-align: middle;
  animation: hat-live 1.4s ease-in-out infinite;
}

@keyframes hat-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.face-tracking-pending .booth-media::after {
  content: "正在建立人脸跟随…";
  position: absolute;
  left: 50%;
  bottom: 10px;
  z-index: 6;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(6, 10, 8, 0.6);
  color: rgba(255, 244, 252, 0.78);
  font-size: 8px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
}

@media (max-width: 760px) {
  .booth-hat-btn { height: 25px; padding: 0 6px; font-size: 7.5px; }
  .booth-head h2 { font-size: 20px; }
  .booth-actions { width: min(360px, 96vw); gap: 6px; }
  .booth-face-tools { width: 62px; gap: 4px; }
}

body.is-booth .toast {
  z-index: 80;
  bottom: calc(172px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 760px) {
  body.is-booth .toast { bottom: calc(174px + env(safe-area-inset-bottom, 0px)); max-width: calc(100vw - 32px); }
}

/* ---------- extra Christmas effects ---------- */

.fx-star {
  display: block;
  position: absolute;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  pointer-events: none;
  animation: fx-star-twinkle ease-in-out infinite alternate;
}

@keyframes fx-star-twinkle {
  from { opacity: 0.18; transform: scale(0.55) rotate(-12deg); }
  to { opacity: 0.95; transform: scale(1.15) rotate(10deg); }
}

.fx-confetti {
  width: 5px;
  height: 9px;
  border-radius: 2px;
  pointer-events: none;
  animation: fx-confetti-fall linear infinite;
}

@keyframes fx-confetti-fall {
  from { transform: translate3d(0, -24px, 0) rotate(0deg); opacity: 0; }
  10% { opacity: 0.9; }
  60% { transform: translate3d(-10px, 190px, 0) rotate(220deg); }
  to { transform: translate3d(14px, 390px, 0) rotate(460deg); opacity: 0.1; }
}

.booth-media[data-filter="snow"] .booth-filter {
  background:
    linear-gradient(160deg, rgba(139, 205, 255, 0.2), transparent 42%, rgba(16, 46, 74, 0.22)),
    radial-gradient(ellipse 70% 40% at 50% 12%, rgba(208, 238, 255, 0.28), transparent 68%),
    linear-gradient(to top, rgba(206, 236, 255, 0.12), transparent 34%);
}

.fx-star {
  width: 10px;
  height: 10px;
  background: radial-gradient(circle, #fffdf2 0%, #ffe6b0 38%, rgba(255, 214, 140, 0) 72%);
}

/* softer Ricoh-like grade */
.booth-media[data-filter="film"] #booth-video { filter: saturate(0.82) contrast(0.96) brightness(1.05) sepia(0.08); }
.booth-media[data-filter="snow"] #booth-video { filter: saturate(0.76) contrast(0.97) brightness(1.04) hue-rotate(-4deg); }
.booth-media[data-filter="gold"] #booth-video { filter: saturate(0.92) contrast(0.97) brightness(1.06) sepia(0.1); }

.booth-media[data-filter="film"] .booth-filter {
  background:
    linear-gradient(140deg, rgba(255, 208, 150, 0.12), transparent 44%, rgba(40, 62, 50, 0.1)),
    radial-gradient(ellipse at 50% 30%, rgba(255, 244, 224, 0.16), transparent 72%),
    linear-gradient(to top, rgba(38, 66, 52, 0.12), transparent 40%);
}
.booth-media[data-filter="snow"] .booth-filter {
  background:
    linear-gradient(150deg, rgba(150, 205, 235, 0.12), transparent 46%, rgba(24, 48, 60, 0.14)),
    radial-gradient(ellipse 70% 40% at 50% 12%, rgba(226, 242, 250, 0.2), transparent 68%);
}
.booth-media[data-filter="gold"] .booth-filter {
  background:
    radial-gradient(ellipse at 72% 20%, rgba(255, 214, 132, 0.16), transparent 36%),
    linear-gradient(135deg, rgba(255, 205, 120, 0.1), transparent 52%, rgba(93, 59, 20, 0.06));
}
.booth-media[data-filter="film"] .booth-fx::after { opacity: 0.22; }

/* make the countdown readable on the sky */
.booth-countdown {
  justify-content: center;
  padding-top: 0;
}

.booth-countdown-number {
  font-size: clamp(120px, 20vw, 210px);
  color: #fff6e0;
  text-shadow:
    0 0 18px rgba(var(--accent-rgb), 0.85),
    0 0 60px rgba(var(--accent-rgb), 0.45),
    0 10px 40px rgba(0, 0, 0, 0.75);
  animation: countdown-pop 0.5s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.booth-countdown-label {
  margin-top: 18px;
  padding: 6px 14px;
  color: rgba(255, 248, 236, 0.86);
  background: rgba(8, 12, 10, 0.62);
}

@media (max-width: 760px) {
  .booth-countdown-number { font-size: clamp(96px, 26vw, 150px); }
  .booth-countdown-label { margin-top: 12px; }
}

.booth-gesture {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 6;
  margin: 0;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(4, 10, 7, 0.55);
  color: #c6ffe0;
  font-size: 8.5px;
  letter-spacing: 0.05em;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
}

@media (max-width: 760px) {
  .booth-gesture { font-size: 8px; padding: 3px 7px; right: 6px; top: 6px; }
}

/* booth card: landscape / portrait framing */
.booth-media[data-ratio="portrait"] { aspect-ratio: 3 / 4; }

.booth-card:has(.booth-media[data-ratio="portrait"]) {
  width: min(330px, 31vw);
  top: 55%;
}

/* the card fill must follow the chosen print size */
.booth-card .booth-media { aspect-ratio: var(--booth-ar, 4 / 3); }
.booth-media[data-ratio="portrait"] { --booth-ar: 3 / 4; }
.booth-media[data-ratio="landscape"] { --booth-ar: 4 / 3; }

.filter-sep {
  flex: 0 0 auto;
  width: 1px;
  height: 15px;
  margin: 0 2px;
  align-self: center;
  background: rgba(255, 255, 255, 0.16);
}

.filter-chip[data-ratio] {
  border-color: rgba(var(--accent-rgb), 0.24);
}

@media (max-width: 760px) {
  .booth-card:has(.booth-media[data-ratio="portrait"]) {
    width: min(62vw, 240px);
    top: 55%;
  }
  .filter-sep { height: 13px; }
}

@media (max-height: 700px) {
  .booth-card:has(.booth-media[data-ratio="portrait"]) { width: min(58vw, 220px); }
}

/* portrait print sits higher so the tree shows above it */
.booth-card:has(.booth-media[data-ratio="portrait"]) { top: 50%; }
@media (max-width: 760px) {
  .booth-card:has(.booth-media[data-ratio="portrait"]) { top: 52%; }
}

/* 梦幻朦胧 / 暖调午后 filter looks */
.booth-media[data-filter="dream"] #booth-video {
  filter: blur(1.1px) saturate(0.9) contrast(0.94) brightness(1.09) sepia(0.05);
}
.booth-media[data-filter="warm"] #booth-video {
  filter: saturate(1.12) contrast(0.97) brightness(1.06) sepia(0.18);
}

.booth-media[data-filter="dream"] .booth-filter {
  background:
    radial-gradient(ellipse 80% 60% at 22% 16%, rgba(255, 214, 240, 0.34), transparent 62%),
    radial-gradient(ellipse 70% 55% at 82% 78%, rgba(198, 222, 255, 0.3), transparent 66%),
    radial-gradient(ellipse at 50% 50%, rgba(238, 228, 255, 0.24), transparent 78%),
    linear-gradient(155deg, rgba(255, 226, 244, 0.16), rgba(210, 200, 255, 0.12));
  mix-blend-mode: screen;
}

.booth-media[data-filter="warm"] .booth-filter {
  background:
    radial-gradient(ellipse 60% 50% at 26% 18%, rgba(255, 214, 150, 0.4), transparent 64%),
    linear-gradient(140deg, rgba(255, 190, 120, 0.22), transparent 48%, rgba(96, 52, 18, 0.16)),
    linear-gradient(to top, rgba(88, 44, 14, 0.2), transparent 46%);
}

.booth-media[data-filter="dream"] .booth-fx::after,
.booth-media[data-filter="warm"] .booth-fx::after { opacity: 0.34; }

.booth-filters .filter-chip[data-filter="dream"],
.booth-filters .filter-chip[data-filter="warm"] { white-space: nowrap; }

/* pixel-art stickers */
.pixel-sprite,
img.pixel-sprite {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.emoji-sticker.is-pixel img { filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35)); }

.emoji-tray .emoji-btn img { image-rendering: pixelated; }

.booth-doodle.pixel-sprite {
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.32));
}

.booth-countdown-number.is-pixel { display: flex; align-items: center; justify-content: center; }

.booth-countdown-number .pixel-digit {
  width: clamp(120px, 20vw, 210px);
  height: auto;
  image-rendering: pixelated;
  filter:
    drop-shadow(0 0 18px rgba(var(--accent-rgb), 0.9))
    drop-shadow(0 0 44px rgba(var(--accent-rgb), 0.5))
    drop-shadow(0 10px 22px rgba(0, 0, 0, 0.6));
}

@media (max-width: 760px) {
  .booth-countdown-number .pixel-digit { width: clamp(96px, 26vw, 150px); }
}

/* pixel typography -------------------------------------------------- */
@font-face {
  font-family: "DotGothic16";
  src: url("../fonts/dotgothic16-subset.woff2") format("woff2");
  font-display: swap;
  font-weight: 400;
}

body.pixel-ui,
body.pixel-ui button,
body.pixel-ui input,
body.pixel-ui select,
body.pixel-ui textarea,
body.pixel-ui .ritual-steps span,
body.pixel-ui .filter-chip,
body.pixel-ui .emoji-size-row,
body.pixel-ui .booth-gesture,
body.pixel-ui .booth-countdown-label,
body.pixel-ui .toast,
body.pixel-ui .camera-status,
body.pixel-ui .photo-tools,
body.pixel-ui .booth-result-note {
  font-family: var(--pixel-font);
  letter-spacing: 0.02em;
}

body.pixel-ui .ritual-steps span,
body.pixel-ui .booth-hint,
body.pixel-ui .booth-title-sub { font-size: 0.92em; }

/* Keep the Polaroid handwriting and the big display titles as they were. */
body.pixel-ui .booth-caption,
body.pixel-ui .booth-title,
body.pixel-ui .hero-title,
body.pixel-ui .result-title { font-family: var(--serif); }

body.pixel-ui .filter-chip,
body.pixel-ui .booth-secondary,
body.pixel-ui .callout-button { border-radius: 3px; }

/* pixel UI legibility: small hint text was too thin */
body.pixel-ui .booth-hint,
body.pixel-ui .ritual-hint,
body.pixel-ui .booth-tip,
body.pixel-ui .booth-note,
body.pixel-ui .camera-status,
body.pixel-ui .photo-limit-note {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 248, 240, 0.82);
  letter-spacing: 0.03em;
}

body.pixel-ui .filter-chip { font-size: 12.5px; }
body.pixel-ui .emoji-size-row { font-size: 12.5px; }

/* countdown sits just above the shutter: never covers the photo card */
.booth-countdown {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 6px 16px 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  background: rgba(5, 9, 8, 0.75);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 70;
  pointer-events: none;
}

.booth-countdown[hidden] { display: none; }

.booth-countdown-number { position: relative; display: flex; align-items: center; }
.booth-countdown .pixel-digit { width: 48px !important; height: auto; }

.booth-countdown-label {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: 13px;
  white-space: nowrap;
  color: rgba(255, 250, 238, 0.94);
}

@media (max-width: 760px) {
  .booth-countdown { bottom: 78px; gap: 8px; padding: 5px 12px 5px 8px; }
  .booth-countdown .pixel-digit { width: 38px !important; }
  .booth-countdown-label { font-size: 12px; }
}

@media (max-height: 620px) {
  .booth-countdown { bottom: 64px; }
}

@media (max-width: 760px) {
  .booth-countdown {
    bottom: auto !important;
    top: 108px !important;
    left: 16px !important;
    transform: none !important;
  }
}

@media (min-width: 761px) {
  .booth-countdown {
    bottom: auto !important;
    top: 104px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
  }
}

/* first-tap confirmation pulse */
.magic-ring.is-tap {
  opacity: 1;
  transform: scale(0.62);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 24px rgba(var(--accent-rgb), 0.85);
  animation: tap-pulse 0.26s ease-out;
}

@keyframes tap-pulse {
  0% { transform: scale(0.95); opacity: 1; }
  100% { transform: scale(0.62); opacity: 0.85; }
}

/* camera preview sits top-left; keep it clear of the header controls */
.camera-panel {
  top: 86px;
  left: 20px;
  bottom: auto;
}

@media (max-width: 760px) {
  .camera-panel {
    top: 74px;
    left: 12px;
    bottom: auto;
    transform: none;
    width: 132px;
    padding: 5px;
    border-radius: 14px;
  }
}

/* keep the top-left preview compact enough to clear the ritual steps on phones */
@media (max-width: 760px) {
  .camera-panel {
    top: 62px !important;
    left: 10px !important;
    width: 104px !important;
    padding: 4px !important;
    border-radius: 12px !important;
  }
  .camera-panel .cam-frame { border-radius: 9px; }
  body.is-focusing .camera-panel { width: 88px !important; }
}

/* phones: the ritual steps turn into a compact right-side rail so the
   top-left camera preview never collides with them */
@media (max-width: 760px) {
  .ritual {
    top: 56px;
    left: auto;
    right: 8px;
    transform: none;
    align-items: flex-end;
    gap: 8px;
    width: auto;
    max-width: 52vw;
  }
  .ritual-steps {
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
  }
  .ritual-steps li {
    flex-direction: row-reverse;
    gap: 7px;
  }
  .ritual-steps li + li::before { display: none; }
  .ritual-steps li span { font-size: 10px; }
  .ritual-steps li i { width: 22px; height: 22px; font-size: 9px; }
  .ritual-hint {
    max-width: 52vw;
    padding: 4px 8px;
    gap: 5px;
  }
  #ritual-hint { font-size: 9.5px; }
  body.is-focusing .ritual { opacity: 0; transform: none; }
}


/* The result sheet is a full-screen layer; the booth's own close button and
   the "完成" link have to float above it or phones cannot dismiss the preview. */
#booth-close-top {
  position: fixed;
  top: max(14px, env(safe-area-inset-top, 0px));
  right: 14px;
  z-index: 90;
}

#booth-done {
  position: relative;
  z-index: 90;
}

/* The result sheet covers the booth header, so it carries its own close button. */
.booth-result-close {
  position: fixed;
  top: max(14px, env(safe-area-inset-top, 0px));
  right: 14px;
  z-index: 90;
  display: grid;
}

/* ---------- shutter-centric action row ---------------------------- */
/* Phone-camera layout: shutter on the centre line of the preview, with the
   secondary tools hugging it on either side (not pinned to the edges). */
.booth-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  margin: 0 auto;
  padding-bottom: 6px;
}

.booth-actions .booth-shutter {
  position: relative;
  z-index: 2;
  flex: none;
  order: 2;
}

.booth-actions .booth-clear {
  order: 1;
  position: static;
  transform: none;
  flex: none;
}

.booth-actions .booth-face-tools {
  order: 3;
  position: static;
  transform: none;
  width: auto;
  align-items: flex-start;
  flex: none;
}

@media (max-width: 760px) {
  .booth-actions { gap: 14px; }
}

/* the shutter switches to a full rainbow-style white ring like a phone camera */
body.is-booth .booth-shutter {
  border-color: rgba(255, 255, 255, 0.95);
}

/* landscape page: the action row sits right under the filters, close to the shutter */
.booth-controls { padding-bottom: 8px; }

/* header entry into the portrait recording page */
.rec-vertical-link {
  height: 38px;
  padding: 0 14px;
  text-decoration: none;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 253, 255, 0.86);
}

.rec-vertical-link span { letter-spacing: 0.1em; }

.rec-vertical-link:hover { border-color: rgba(var(--accent-rgb), 0.5); background: rgba(var(--accent-rgb), 0.12); }

@media (max-width: 760px) {
  .rec-vertical-link span { display: none; }
  .rec-vertical-link { padding: 0 10px; }
}

/* Tactile polish & live video sound control (emil-design-eng) */
:root {
  --ease-tactile: cubic-bezier(0.23, 1, 0.32, 1);
}

.pill-btn,
.ghost-btn,
.mini-btn,
.mini-icon,
.tool-round,
.tool-close,
.filter-chip,
.booth-primary,
.booth-secondary,
.booth-shutter,
.booth-hat-btn,
.booth-clear {
  transition: transform 160ms var(--ease-tactile), background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.pill-btn:active,
.ghost-btn:active,
.mini-btn:active,
.mini-icon:active,
.tool-round:active,
.tool-close:active,
.filter-chip:active,
.booth-primary:active,
.booth-secondary:active,
.booth-hat-btn:active,
.booth-clear:active {
  transform: scale(0.96);
}

.tool-sound {
  border-color: rgba(255, 224, 150, 0.36);
  background: rgba(255, 224, 150, 0.12);
  color: #ffe8b3;
}

.tool-sound.is-unmuted {
  border-color: rgba(var(--accent-rgb, 99, 245, 165), 0.72);
  background: rgba(var(--accent-rgb, 99, 245, 165), 0.22);
  color: #fff;
  box-shadow: 0 0 14px rgba(var(--accent-rgb, 99, 245, 165), 0.28);
}

/* Background music toggle button & animated equalizer bars */
.bgm-btn {
  gap: 7px;
}

.bgm-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  width: 12px;
}

.bgm-bars i {
  display: block;
  width: 2.5px;
  height: 4px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.55;
  transition: height 180ms var(--ease-tactile), opacity 180ms ease;
}

.bgm-btn.is-playing {
  border-color: rgba(var(--accent-rgb, 99, 245, 165), 0.55);
  background: rgba(var(--accent-rgb, 99, 245, 165), 0.14);
  color: #fff;
}

.bgm-btn.is-playing .bgm-bars i {
  opacity: 1;
  background: var(--accent, #63f5a5);
  animation: bgm-eq 0.9s ease-in-out infinite alternate;
}

.bgm-btn.is-playing .bgm-bars i:nth-child(1) {
  animation-delay: 0s;
}

.bgm-btn.is-playing .bgm-bars i:nth-child(2) {
  animation-delay: 0.25s;
}

.bgm-btn.is-playing .bgm-bars i:nth-child(3) {
  animation-delay: 0.45s;
}

@keyframes bgm-eq {
  0% { height: 3px; }
  100% { height: 12px; }
}
