/* ============================================================================
   TREE ME — "Gallery plinth"
   ----------------------------------------------------------------------------
   The 3D tree is the exhibit; chrome is a quiet museum label.
   · one accent (holiday vermilion), ink on pine / ink on gallery paper
   · type floor 13px, labels 500, no tracked capitals
   · one radius scale 8 / 12 / 20
   · hover lifts 2px, press steps down, only transform/opacity animate
   · touch targets 44px, no tap highlight, safe areas honoured
   ========================================================================== */

/* ---------------------------------------------------------------- tokens */
:root {
  --pine-900: #06110d;
  --pine-800: #0a1a14;
  --pine-700: #0f241c;
  --pine-600: #153026;

  --ink: #f4f1e8;
  --ink-2: rgba(244, 241, 232, 0.74);
  --ink-3: rgba(244, 241, 232, 0.58);
  --line: rgba(244, 241, 232, 0.13);
  --line-soft: rgba(244, 241, 232, 0.07);
  --wash: rgba(244, 241, 232, 0.06);

  --paper: #f6f4ee;
  --paper-2: #efede5;
  --paper-ink: #17201a;
  --paper-ink-2: rgba(23, 32, 26, 0.64);
  --paper-ink-3: rgba(23, 32, 26, 0.56);
  --paper-line: rgba(23, 32, 26, 0.14);
  --paper-line-soft: rgba(23, 32, 26, 0.08);

  --accent: #e2422f;
  --accent-press: #c8341f;
  --accent-soft: rgba(226, 66, 47, 0.14);

  /* one radius scale */
  --r-xs: 8px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 12px;
  --r-xl: 20px;

  --ease-out: cubic-bezier(0.22, 0.9, 0.28, 1);
  --ease-spring: cubic-bezier(0.34, 1.32, 0.64, 1);
  --ease-press: cubic-bezier(0.3, 0, 0.2, 1);

  --m-in: 150ms;
  --m-out: 120ms;
  --m-press: 90ms;
  --m-panel: 200ms;
  --m-close: 120ms;
  --m-slide: 240ms;

  --dock-h: 150px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;

  color-scheme: dark;
}

/* ---------------------------------------------------------------- reset */
*,
*::before,
*::after { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--pine-900);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

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

button:disabled { cursor: default; }

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

[hidden] { display: none !important; }

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

::selection { background: var(--accent); color: #fff; }

/* ---------------------------------------------------------------- shell */
.page {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

.app {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--pine-900);
  isolation: isolate;
}

/* ---------------------------------------------------------------- backdrop */
.stage-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-aurora,
.stars,
.moon,
.room-bokeh,
.paper-grid,
.floor-glow,
.stage-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.bg-aurora {
  background:
    radial-gradient(58% 46% at 30% 18%, rgba(72, 138, 112, 0.42), transparent 70%),
    radial-gradient(50% 44% at 76% 8%, rgba(60, 104, 140, 0.34), transparent 72%),
    linear-gradient(180deg, #0b2a3d 0%, #0a1e2b 46%, #06121a 100%);
}

.stars {
  opacity: 0.9;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 18%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1.2px 1.2px at 28% 9%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1.6px 1.6px at 46% 22%, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(1.1px 1.1px at 62% 12%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 78% 26%, rgba(255, 255, 255, 0.8), transparent);
}

.moon {
  inset: auto 12% auto auto;
  top: 8%;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #f6e6b8, #d8b878 62%, #a98a4e 100%);
  box-shadow: 0 0 60px 18px rgba(240, 214, 150, 0.16);
  opacity: 0.9;
}

.room-bokeh { display: none; }

.paper-grid {
  display: none;
  background-image:
    linear-gradient(var(--paper-line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--paper-line-soft) 1px, transparent 1px);
  background-size: 44px 44px;
}

.floor-glow {
  inset: auto 0 -18% 0;
  top: auto;
  height: 52%;
  background: radial-gradient(60% 100% at 50% 100%, rgba(120, 180, 150, 0.12), transparent 72%);
}

.stage-grain {
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

/* vignette so the tree sits "in" the scene */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(78% 62% at 50% 42%, transparent 46%, rgba(3, 9, 7, 0.36) 100%),
    linear-gradient(180deg, rgba(3, 9, 7, 0.28) 0%, transparent 22%);
}

.snow-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* photo backgrounds (built-in + user upload) */
.stage.has-photo-bg .stage-bg {
  background-image: var(--stage-photo);
  background-size: cover;
  background-position: center 44%;
  background-repeat: no-repeat;
  background-color: var(--pine-900);
}
.stage.has-photo-bg .stage-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(62% 58% at 50% 44%, rgba(0, 0, 0, 0.04), rgba(3, 9, 7, 0.42) 78%),
    linear-gradient(180deg, rgba(3, 9, 7, 0.42), rgba(3, 9, 7, 0.08) 32%, rgba(3, 9, 7, 0.55));
}
.stage.has-photo-bg .bg-aurora,
.stage.has-photo-bg .stars,
.stage.has-photo-bg .moon,
.stage.has-photo-bg .room-bokeh,
.stage.has-photo-bg .paper-grid { opacity: 0; }

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: relative;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--r-md);
  color: var(--ink);
  text-align: left;
  transition: background var(--m-in) var(--ease-out);
}
@media (hover: hover) {
  .brand:hover { background: var(--wash); }
}
.brand:active { transform: scale(0.98); }

.brand-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  flex: 0 0 auto;
}
.brand-mark svg { width: 15px; height: 15px; }

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

.brand-name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }

.brand-name {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40vw;
}

.brand-edit {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex: 0 0 auto;
}

/* primary action + segmented icon control */
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.face-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 44px;
  padding: 0 18px 0 14px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(226, 66, 47, 0.26);
  transition: background var(--m-in) var(--ease-out), transform var(--m-press) var(--ease-press);
}
@media (hover: hover) {
  .face-cta:hover { background: #ea5340; }
}
.face-cta:active { background: var(--accent-press); transform: scale(0.97); }
.face-cta-ic { width: 17px; height: 17px; flex: 0 0 auto; }

.action-group {
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-md);
  background: rgba(6, 18, 13, 0.62);
  border: 1px solid var(--line);
  overflow: hidden;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--ink-2);
  transition: background var(--m-in) var(--ease-out), color var(--m-in) var(--ease-out),
    transform var(--m-press) var(--ease-press);
}
.icon-btn + .icon-btn { border-left: 1px solid var(--line-soft); }
.icon-btn svg { width: 19px; height: 19px; }
@media (hover: hover) {
  .icon-btn:hover { background: var(--wash); color: var(--ink); }
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn .icon-off { display: none; }
.icon-btn[aria-pressed="false"] .icon-on { display: none; }
.icon-btn[aria-pressed="false"] .icon-off { display: block; }

/* ---------------------------------------------------------------- 3D stage */
.tree-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  z-index: 2;
}

.main-tree3d {
  position: relative;
  width: 100%;
  height: 100%;
}

#mainTree3d {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#mainTree3d:active { cursor: grabbing; }

.main-tree-loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  text-align: center;
  color: var(--ink-2);
  background: radial-gradient(60% 50% at 50% 46%, rgba(6, 18, 13, 0.55), rgba(6, 18, 13, 0.9));
  transition: opacity var(--m-slide) var(--ease-out);
}
.main-tree-loader b { font-size: 14px; font-weight: 600; color: var(--ink); }
.main-tree-loader small { font-size: 12.5px; color: var(--ink-3); }
.main-tree-loader.is-hidden { opacity: 0; pointer-events: none; }

.tree3d-spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.main-tree-hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 4;
  max-width: 88vw;
  padding: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-3);
  text-align: center;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.65);
  pointer-events: none;
  transition: opacity var(--m-panel) var(--ease-out);
}
.main-tree-hint.is-faded { opacity: 0; }

/* ---------------------------------------------------------------- dock */
.dock {
  position: relative;
  z-index: 10;
  flex: 0 0 auto;
  background: rgba(8, 22, 16, 0.96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -1px 0 rgba(244, 241, 232, 0.04), 0 -18px 40px rgba(0, 0, 0, 0.28);
  padding: 12px 0 calc(10px + env(safe-area-inset-bottom));
  animation: dock-in var(--m-slide) var(--ease-spring) both;
}
@keyframes dock-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.dock-inner {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 12px;
}

.dock-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
}

.dock-tabs { display: flex; align-items: center; gap: 2px; }

.dock-tab {
  position: relative;
  height: 40px;
  padding: 0 11px;
  border-radius: var(--r-xs);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-3);
  transition: color var(--m-in) var(--ease-out), background var(--m-in) var(--ease-out);
}
@media (hover: hover) {
  .dock-tab:hover { color: var(--ink-2); background: var(--wash); }
}
.dock-tab.is-active { color: var(--ink); font-weight: 600; }
.dock-tab.is-active::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform-origin: 50% 50%;
  animation: tab-underline 220ms var(--ease-spring) both;
}
@keyframes tab-underline {
  from { transform: scaleX(0.2); opacity: 0; }
  to { transform: scaleX(1); opacity: 1; }
}

.dock-tools { display: flex; align-items: center; gap: 6px; }

.dock-mini {
  position: relative;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  background: transparent;
  transition: background var(--m-in) var(--ease-out), color var(--m-in) var(--ease-out),
    border-color var(--m-in) var(--ease-out), transform var(--m-press) var(--ease-press);
}
.dock-mini::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: var(--r-xs);
}
@media (hover: hover) {
  .dock-mini:hover { background: var(--wash); color: var(--ink); }
}
.dock-mini:active { transform: scale(0.96); }
.dock-mini-danger:hover { color: #ffb3a6; border-color: rgba(226, 66, 47, 0.45); background: var(--accent-soft); }

.ornament-count {
  min-width: 44px;
  padding-left: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.ornament-count.is-full { color: var(--accent); }

/* panel track */
.dock-panels-wrap { position: relative; margin-top: 8px; }
.dock-panels { overflow: hidden; }

.dock-panel { display: none; }
.dock-panel.is-active { display: block; }

/* cards stagger in */
.dock-panel.is-active .ornament-card,
.dock-panel.is-active .action-card,
.dock-panel.is-active .theme-card {
  animation: card-in 260ms var(--ease-spring) both;
}
.dock-panel.is-active :is(.ornament-card, .action-card, .theme-card):nth-child(1) { animation-delay: 0ms; }
.dock-panel.is-active :is(.ornament-card, .action-card, .theme-card):nth-child(2) { animation-delay: 18ms; }
.dock-panel.is-active :is(.ornament-card, .action-card, .theme-card):nth-child(3) { animation-delay: 36ms; }
.dock-panel.is-active :is(.ornament-card, .action-card, .theme-card):nth-child(4) { animation-delay: 54ms; }
.dock-panel.is-active :is(.ornament-card, .action-card, .theme-card):nth-child(5) { animation-delay: 72ms; }
.dock-panel.is-active :is(.ornament-card, .action-card, .theme-card):nth-child(6) { animation-delay: 90ms; }
.dock-panel.is-active :is(.ornament-card, .action-card, .theme-card):nth-child(n + 7) { animation-delay: 100ms; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(7px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.ornament-track,
.action-track,
.theme-track {
  display: flex;
  align-items: stretch;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 6px 2px 4px;
  touch-action: pan-x;
  mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
}
.ornament-track::-webkit-scrollbar,
.action-track::-webkit-scrollbar,
.theme-track::-webkit-scrollbar { display: none; }

/* cards: open display, no boxes */
.ornament-card,
.action-card,
.theme-card {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  width: 76px;
  min-height: 84px;
  padding: 6px 4px 7px;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink-2);
  transition: background var(--m-in) var(--ease-out), color var(--m-in) var(--ease-out),
    transform var(--m-in) var(--ease-out), box-shadow var(--m-in) var(--ease-out);
}
@media (hover: hover) {
  .ornament-card:hover,
  .action-card:hover,
  .theme-card:hover {
    background: var(--wash);
    color: var(--ink);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
  }
}
.ornament-card:active,
.action-card:active,
.theme-card:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: none;
}

.ornament-card img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}

.ornament-name,
.action-card > span:last-child,
.theme-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.ornament-card.is-active,
.action-card.is-active {
  color: var(--ink);
  background: var(--wash);
}
.ornament-card.is-active { box-shadow: inset 0 0 0 1px var(--accent); }

/* action card */
.action-card { width: 74px; }
.action-glyph {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid var(--line);
  font-size: 20px;
  line-height: 1;
  color: var(--ink);
  background: rgba(244, 241, 232, 0.04);
  transition: background var(--m-in) var(--ease-out), border-color var(--m-in) var(--ease-out);
}
.action-card.is-active .action-glyph {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

/* theme cards */
.theme-card {
  width: 96px;
  min-height: 84px;
  align-items: stretch;
  gap: 5px;
  padding: 6px 6px 7px;
}
.theme-preview {
  height: 50px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background-color: var(--pine-700);
  background-image: var(--card-bg, none);
  background-size: cover;
  background-position: center;
}
.theme-card[data-theme-card="paper"] .theme-preview {
  background-image: linear-gradient(180deg, #faf8f2 0%, #e7e3d8 100%);
}
.theme-card.is-active .theme-preview { box-shadow: 0 0 0 2px var(--accent); }
.theme-name { font-size: 13px; font-weight: 600; color: var(--ink); text-align: left; padding: 0 2px; }
.theme-upload { align-items: center; justify-content: center; border: 1px dashed var(--line); }
@media (hover: hover) {
  .theme-upload:hover { border-color: var(--ink-3); }
}
.theme-upload-plus { font-size: 18px; line-height: 1; color: var(--ink-2); }
.theme-actions { padding: 6px 2px 2px; }

.mini-btn {
  height: 40px;
  padding: 0 14px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12.5px;
  transition: background var(--m-in) var(--ease-out), color var(--m-in) var(--ease-out);
}
.mini-btn:hover { background: var(--wash); color: var(--ink); }
.mini-btn:active { transform: scale(0.97); }

/* arrows: pointer devices only */
.dock-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(9, 24, 18, 0.92);
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1;
  transition: background var(--m-in) var(--ease-out), color var(--m-in) var(--ease-out),
    transform var(--m-press) var(--ease-press);
}
.dock-arrow:hover { background: var(--pine-600); color: var(--ink); }
.dock-arrow:active { transform: translateY(-50%) scale(0.94); }
.dock-arrow-prev { left: -6px; }
.dock-arrow-next { right: -6px; }

@media (hover: none), (pointer: coarse) {
  .dock-arrow { display: none !important; }
}

/* ---------------------------------------------------------------- drag ghost */
.drag-ghost {
  position: fixed;
  z-index: 120;
  left: 0;
  top: 0;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: none;
  border: 0;
  box-shadow: none;
  transform: translate(-50%, -50%) scale(1);
  transition: transform var(--m-in) var(--ease-out);
}
.drag-ghost.is-over-tree { transform: translate(-50%, -50%) scale(1.08); }
.drag-ghost img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.45));
}
.drag-ghost-label { display: none; }

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed;
  left: 50%;
  top: calc(66px + env(safe-area-inset-top));
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(86vw, 380px);
  padding: 9px 14px;
  border-radius: var(--r-md);
  background: rgba(10, 26, 19, 0.96);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
  opacity: 0;
  transform: translate(-50%, -8px) scale(0.97);
  pointer-events: none;
  transition: opacity var(--m-panel) var(--ease-out), transform 240ms var(--ease-spring);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast #toastIcon { color: var(--accent); font-size: 12px; }

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

/* ---------------------------------------------------------------- modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(3, 9, 7, 0.74);
  animation: fade-in var(--m-panel) var(--ease-out);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  position: relative;
  width: min(92vw, 430px);
  max-height: min(90dvh, 780px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px;
  border-radius: var(--r-xl);
  background: var(--paper);
  color: var(--paper-ink);
  border: 1px solid var(--paper-line);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.5);
  animation: sheet-in 280ms var(--ease-spring);
}
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.modal-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--paper-ink-2);
  font-size: 19px;
  line-height: 1;
  transition: background var(--m-in) var(--ease-out), color var(--m-in) var(--ease-out);
}
.modal-x:hover { background: var(--paper-line-soft); color: var(--paper-ink); }
.modal-x:active { transform: scale(0.94); }

.modal-card h2 {
  margin: 0 0 6px;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--paper-ink);
  padding-right: 28px;
}

.modal-copy {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--paper-ink-2);
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.primary-btn,
.ghost-btn,
.modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 16px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 600;
  transition: background var(--m-in) var(--ease-out), color var(--m-in) var(--ease-out),
    border-color var(--m-in) var(--ease-out), transform var(--m-press) var(--ease-press);
}

.primary-btn,
.modal-btn.primary {
  background: var(--accent);
  color: #fff;
}
.primary-btn:hover,
.modal-btn.primary:hover { background: #ea5340; }
.primary-btn:active,
.modal-btn.primary:active { background: var(--accent-press); transform: scale(0.98); }
.primary-btn:disabled {
  background: var(--paper-line);
  color: var(--paper-ink-3);
  opacity: 1;
}
.primary-btn[disabled] { pointer-events: none; }

.ghost-btn,
.modal-btn {
  background: transparent;
  color: var(--paper-ink);
  border: 1px solid var(--paper-line);
}
.ghost-btn:hover,
.modal-btn:hover { background: var(--paper-line-soft); }
.ghost-btn:active,
.modal-btn:active { transform: scale(0.98); }

.full-btn { width: 100%; margin-top: 16px; }
.modal-actions .primary-btn,
.modal-actions .ghost-btn { flex: 1; }

/* form bits */
.field-label {
  display: block;
  margin: 4px 0 6px;
  font-size: 12.5px;
  color: var(--paper-ink-3);
}

.text-input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--paper-line);
  background: #fff;
  color: var(--paper-ink);
  font: inherit;
  font-size: 16px;
  transition: border-color var(--m-in) var(--ease-out), box-shadow var(--m-in) var(--ease-out);
}
.text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.fine-print {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--paper-ink-3);
}

/* sliders */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: var(--paper-line);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
  transition: transform var(--m-press) var(--ease-out);
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }

/* checkbox rows */
.fx-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--paper-ink);
  white-space: nowrap;
}
.fx-toggle input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--paper-line);
  background: #fff;
  display: grid;
  place-items: center;
  transition: background var(--m-in) var(--ease-out), border-color var(--m-in) var(--ease-out);
}
.fx-toggle input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.fx-toggle input[type="checkbox"]:checked::after {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

/* face modal */
.face-card { width: min(92vw, 420px); }

.crop-box {
  position: relative;
  width: 100%;
  max-width: 236px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--paper-2);
  border: 1px solid var(--paper-line);
  touch-action: none;
  cursor: grab;
}
.crop-box:active { cursor: grabbing; }
.crop-box canvas { width: 100%; height: 100%; object-fit: cover; }
.crop-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 999px rgba(23, 32, 26, 0.28);
  clip-path: circle(34% at 50% 50%);
  border-radius: 50%;
}
.crop-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.82);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.zoom-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--paper-ink-2);
}
.zoom-row span { flex: 0 0 auto; min-width: 28px; }

.face-fx {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--paper-line-soft);
}
.face-fx-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.face-fx-head span { font-size: 13.5px; font-weight: 600; color: var(--paper-ink); }
.face-fx-head small { font-size: 12px; color: var(--paper-ink-3); }

.fx-preview {
  position: relative;
  width: 76px;
  height: 76px;
  margin: 0 auto 10px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--paper-line);
  background: var(--paper-2);
}
.fx-preview canvas { width: 100%; height: 100%; }
.fx-preview span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 3px;
  text-align: center;
  font-size: 11.5px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.fx-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

/* postcard modal */
.card-modal { width: min(92vw, 520px); }
.card-preview {
  max-height: min(46dvh, 420px);
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--paper-line);
  background: var(--paper-2);
}

.text-link {
  display: block;
  width: 100%;
  margin: 10px 0 0;
  padding: 8px 0;
  color: var(--paper-ink-2);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--paper-line);
  text-underline-offset: 3px;
  transition: color var(--m-in) var(--ease-out), text-decoration-color var(--m-in) var(--ease-out);
}
.text-link:hover { color: var(--paper-ink); text-decoration-color: var(--accent); }
.text-link:active { transform: translateY(1px); }

/* intro card */
.intro-card { width: min(92vw, 452px); }

.intro-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  margin-bottom: 9px;
  border-radius: var(--r-xs);
  background: var(--accent-soft);
  color: var(--accent-press);
  font-size: 12px;
  font-weight: 650;
}

.intro-card h2 { margin-bottom: 6px; }

.intro-steps {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
}

.intro-steps li {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 0;
  border-top: 1px solid var(--paper-line-soft);
  animation: step-in 300ms var(--ease-spring) both;
}
.intro-steps li:first-child { border-top: 0; padding-top: 6px; }
.intro-steps li:nth-child(1) { animation-delay: 40ms; }
.intro-steps li:nth-child(2) { animation-delay: 100ms; }
.intro-steps li:nth-child(3) { animation-delay: 160ms; }

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

.intro-ic {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent-press);
}
.intro-ic svg { width: 21px; height: 21px; }

.intro-steps b {
  display: block;
  margin-bottom: 2px;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--paper-ink);
}
.intro-steps p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--paper-ink-2);
}

.intro-foot {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--paper-line-soft);
  font-size: 12.5px;
  color: var(--paper-ink-3);
}

.intro-card .modal-actions { margin-top: 14px; }
.intro-card .primary-btn { width: 100%; }

/* info modal (legacy list) */
.info-card { width: min(92vw, 470px); }
.how-list {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.how-list li {
  position: relative;
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid var(--paper-line-soft);
  font-size: 13px;
  line-height: 1.55;
  color: var(--paper-ink-2);
}
.how-list li:first-child { border-top: 0; }
.how-list li::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-press);
  font-size: 11px;
  font-weight: 700;
}
.how-list li b { display: block; font-size: 13px; font-weight: 650; color: var(--paper-ink); }
.how-list li span { display: block; }

/* ---------------------------------------------------------------- paper theme */
.stage.theme-paper .bg-aurora {
  background:
    radial-gradient(70% 60% at 50% 8%, #ffffff, transparent 70%),
    linear-gradient(180deg, #f4f2ea 0%, #e9e6dc 100%);
}
.stage.theme-paper .stars,
.stage.theme-paper .moon { opacity: 0; }
.stage.theme-paper .paper-grid { display: block; }
.stage.theme-paper .floor-glow {
  background: radial-gradient(52% 80% at 50% 100%, rgba(23, 32, 26, 0.1), transparent 70%);
}
.stage.theme-paper .stage-grain { opacity: 0.035; }
.stage.theme-paper .stage::after {
  background:
    radial-gradient(80% 64% at 50% 42%, transparent 48%, rgba(27, 28, 25, 0.06) 100%),
    linear-gradient(180deg, rgba(27, 28, 25, 0.04) 0%, transparent 26%);
}
.stage.theme-paper .brand,
.stage.theme-paper .brand-name { color: var(--paper-ink); }
.stage.theme-paper .brand:hover { background: var(--paper-line-soft); }
.stage.theme-paper .brand-edit { color: var(--accent); }
.stage.theme-paper .action-group {
  background: rgba(255, 255, 255, 0.86);
  border-color: var(--paper-line);
}
.stage.theme-paper .icon-btn { color: var(--paper-ink-2); }
.stage.theme-paper .icon-btn + .icon-btn { border-left-color: var(--paper-line-soft); }
.stage.theme-paper .icon-btn:hover { background: var(--paper-line-soft); color: var(--paper-ink); }
.stage.theme-paper .main-tree-hint { color: var(--paper-ink-3); text-shadow: none; }
.stage.theme-paper .dock {
  background: var(--paper);
  border-top-color: var(--paper-line);
}
.stage.theme-paper .dock-tab { color: var(--paper-ink-3); }
.stage.theme-paper .dock-tab:hover { color: var(--paper-ink-2); background: var(--paper-line-soft); }
.stage.theme-paper .dock-tab.is-active { color: var(--paper-ink); }
.stage.theme-paper .dock-mini { color: var(--paper-ink-2); border-color: var(--paper-line); }
.stage.theme-paper .dock-mini:hover { background: var(--paper-line-soft); color: var(--paper-ink); }
.stage.theme-paper .ornament-count { color: var(--paper-ink-3); }
.stage.theme-paper .ornament-card,
.stage.theme-paper .action-card,
.stage.theme-paper .theme-card { color: var(--paper-ink-2); }
.stage.theme-paper .ornament-card:hover,
.stage.theme-paper .action-card:hover,
.stage.theme-paper .theme-card:hover { background: var(--paper-line-soft); color: var(--paper-ink); }
.stage.theme-paper .theme-name { color: var(--paper-ink); }
.stage.theme-paper .theme-preview { border-color: var(--paper-line); background-color: #fff; }
.stage.theme-paper .action-glyph {
  color: var(--paper-ink);
  border-color: var(--paper-line);
  background: #fff;
}
.stage.theme-paper .action-card.is-active .action-glyph { color: #fff; }
.stage.theme-paper .dock-arrow {
  background: #fff;
  color: var(--paper-ink-2);
  border-color: var(--paper-line);
}
.stage.theme-paper .theme-upload { border-color: var(--paper-line); }

/* warm room theme: keep the photo, tint the chrome warm */
.stage.theme-room .dock { background: rgba(20, 14, 10, 0.96); border-top-color: rgba(255, 214, 160, 0.14); }
.stage.theme-room .dock-tab.is-active::after { background: #f0a35c; }
.stage.theme-room .face-cta { background: #e2703a; box-shadow: 0 6px 18px rgba(226, 112, 58, 0.3); }

/* ---------------------------------------------------------------- misc */
.noscript-note {
  position: fixed;
  inset: auto 16px 16px 16px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: #2a1512;
  border: 1px solid rgba(255, 140, 120, 0.3);
  color: #ffd9d1;
  font-size: 13px;
  text-align: center;
}

.stage.theme-night { /* default scheme */ }
.is-off { opacity: 0.55; }
.is-muted { opacity: 0.5; }
.is-faded { opacity: 0.35; }
.is-hidden { display: none !important; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 720px) {
  :root { --dock-h: 168px; }
  .brand { min-height: 44px; }
  .brand-name { font-size: 15px; max-width: 32vw; }
  /* 视觉不放大，命中区撑到 44px */
  .face-cta { position: relative; height: 40px; padding: 0 14px 0 12px; font-size: 13px; }
  .face-cta::after { content: ""; position: absolute; inset: -2px; border-radius: var(--r-md); }
  .face-cta-ic { width: 16px; height: 16px; }
  .icon-btn { position: relative; width: 40px; height: 40px; }
  .icon-btn::after { content: ""; position: absolute; inset: -2px; }
  .icon-btn svg { width: 18px; height: 18px; }
  .dock { padding-top: 10px; }
  .dock-inner { padding: 0 10px; }
  .dock-tab { height: 36px; padding: 0 10px; font-size: 13.5px; }
  .dock-tab.is-active::after { left: 10px; right: 10px; }
  .dock-mini { height: 34px; padding: 0 10px; font-size: 12.5px; }
  .ornament-card { width: 72px; min-height: 82px; }
  .ornament-card img { width: 46px; height: 46px; }
  .ornament-name { font-size: 13px; }
  .action-card { width: 68px; }
  .action-glyph { width: 46px; height: 46px; font-size: 19px; }
  .theme-card { width: 90px; }
  .theme-preview { height: 46px; }
  .modal-card { padding: 18px; border-radius: var(--r-xl); }
  .modal-card h2 { font-size: 18px; }
  .toast { font-size: 12.5px; }
}

@media (max-width: 380px) {
  .brand-name { max-width: 30vw; }
  .dock-mini[data-orn="random"] { display: none; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .dock-bar { min-height: 30px; }
  .ornament-card, .action-card, .theme-card { min-height: 68px; }
  .ornament-card img { width: 38px; height: 38px; }
  .main-tree-hint { display: none; }
}

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .tree3d-spinner { animation: none; }
  .ornament-card:active,
  .action-card:active,
  .theme-card:active,
  .icon-btn:active,
  .dock-mini:active,
  .face-cta:active { transform: none; }
}


/* ============================================================================
   WARM WINTER SKIN  (v240)
   ----------------------------------------------------------------------------
   Everything below re-skins the same DOM: warm espresso ground, brass lines,
   a string of fairy lights above the tray, cream paper dialogs with serif
   titles, and warm glow on every interactive element.
   ========================================================================== */

:root {
  --pine-900: #150e0a;
  --pine-800: #1d1410;
  --pine-700: #271a14;
  --pine-600: #33231b;

  --ink: #f8efdf;
  --ink-2: rgba(248, 239, 223, 0.76);
  --ink-3: rgba(248, 239, 223, 0.56);
  --line: rgba(233, 192, 138, 0.22);
  --line-soft: rgba(233, 192, 138, 0.12);
  --wash: rgba(233, 192, 138, 0.1);

  --paper: #fbf3e3;
  --paper-2: #f2e6d1;
  --paper-ink: #2c1d13;
  --paper-ink-2: rgba(44, 29, 19, 0.7);
  --paper-ink-3: rgba(44, 29, 19, 0.52);
  --paper-line: rgba(150, 108, 58, 0.28);
  --paper-line-soft: rgba(150, 108, 58, 0.16);

  --brass: #e9c08a;
  --brass-deep: #b8843f;
  --ember: #ffb877;

  --accent: #d1482f;
  --accent-press: #b1361f;
  --accent-soft: rgba(209, 72, 47, 0.16);

  --serif: "Iowan Old Style", "Palatino Linotype", "Songti SC", Georgia, serif;
}

body { background: var(--pine-900); }

/* warm night sky instead of cold navy */
.bg-aurora {
  background:
    radial-gradient(56% 42% at 22% 12%, rgba(255, 168, 96, 0.22), transparent 68%),
    radial-gradient(60% 46% at 78% 6%, rgba(214, 108, 74, 0.24), transparent 70%),
    radial-gradient(70% 60% at 50% 100%, rgba(120, 66, 36, 0.28), transparent 72%),
    linear-gradient(180deg, #241318 0%, #2a1a16 34%, #1a1110 72%, #120c0b 100%);
}
.stars {
  opacity: 0.8;
  background-image:
    radial-gradient(1.6px 1.6px at 12% 18%, rgba(255, 226, 178, 0.95), transparent),
    radial-gradient(1.2px 1.2px at 28% 9%, rgba(255, 210, 150, 0.8), transparent),
    radial-gradient(1.8px 1.8px at 46% 22%, rgba(255, 232, 190, 0.9), transparent),
    radial-gradient(1.1px 1.1px at 62% 12%, rgba(255, 200, 140, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 78% 26%, rgba(255, 224, 170, 0.85), transparent),
    radial-gradient(1.2px 1.2px at 88% 8%, rgba(255, 214, 160, 0.7), transparent);
}
.moon {
  background: radial-gradient(circle at 34% 30%, #fff0cd, #f0c887 58%, #b9803f 100%);
  box-shadow: 0 0 70px 22px rgba(255, 196, 118, 0.22);
}
.floor-glow {
  background: radial-gradient(58% 100% at 50% 100%, rgba(255, 176, 104, 0.18), transparent 70%);
}
.stage::after {
  background:
    radial-gradient(78% 62% at 50% 42%, transparent 44%, rgba(18, 10, 8, 0.44) 100%),
    linear-gradient(180deg, rgba(18, 10, 8, 0.34) 0%, transparent 26%);
}
.stage-grain { opacity: 0.06; }

/* brand star gets a glow */
.brand-mark {
  background: radial-gradient(circle at 34% 30%, #f0603f, var(--accent) 62%, #9c2b18 100%);
  box-shadow: 0 0 0 1px rgba(255, 208, 150, 0.35), 0 4px 14px rgba(209, 72, 47, 0.4);
}
.brand-name { font-family: var(--serif); font-weight: 600; letter-spacing: 0; }

/* primary action: warm red with inner highlight */
.face-cta {
  background: linear-gradient(180deg, #e2573c 0%, #c8391f 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 224, 196, 0.35),
    inset 0 -1px 0 rgba(120, 30, 14, 0.4),
    0 8px 22px rgba(200, 57, 31, 0.34);
  color: #fff6ea;
}
@media (hover: hover) {
  .face-cta:hover { background: linear-gradient(180deg, #ec6549 0%, #d2432a 100%); }
}
.face-cta:active { background: linear-gradient(180deg, #b8361e 0%, #9c2b18 100%); }

/* segmented control: brass hairline on warm glass */
.action-group {
  background: linear-gradient(180deg, rgba(58, 38, 26, 0.78), rgba(30, 19, 14, 0.86));
  border: 1px solid rgba(233, 192, 138, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 224, 190, 0.1);
}
.icon-btn { color: var(--ink-2); }
.icon-btn + .icon-btn { border-left: 1px solid rgba(233, 192, 138, 0.16); }

/* ---------------------------------------------------------------- tray */
.dock {
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 176, 104, 0.1), transparent 60%),
    linear-gradient(180deg, #2b1c15 0%, #1c120e 62%, #150e0a 100%);
  border-top: 1px solid rgba(233, 192, 138, 0.34);
  border-radius: 18px 18px 0 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 226, 188, 0.16),
    0 -20px 48px rgba(10, 5, 3, 0.5),
    0 -26px 70px rgba(255, 150, 80, 0.12);
  padding-top: 16px;
}

/* string of fairy lights hanging above the tray */
.dock::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -9px;
  height: 14px;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 6px 4px, #fff0cc 0 1.5px, rgba(255, 196, 118, 0.6) 2px, transparent 3.4px),
    linear-gradient(rgba(233, 192, 138, 0.35), rgba(233, 192, 138, 0.35));
  background-size: 28px 14px, 100% 1px;
  background-position: 0 0, 0 3px;
  background-repeat: repeat-x, no-repeat;
  filter: drop-shadow(0 0 5px rgba(255, 186, 108, 0.65));
  opacity: 0.95;
}

/* brass hairline between the tab row and the tray */
.dock-panels-wrap::before {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: -4px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(233, 192, 138, 0.34) 12%, rgba(233, 192, 138, 0.34) 88%, transparent);
  pointer-events: none;
}

.dock-tab {
  color: var(--ink-3);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
}
.dock-tab.is-active { color: var(--ink); }
.dock-tab.is-active::after {
  background: linear-gradient(90deg, var(--brass-deep), var(--brass));
  box-shadow: 0 0 10px rgba(233, 192, 138, 0.5);
}

.dock-mini {
  border-color: rgba(233, 192, 138, 0.24);
  color: var(--ink-2);
  background: rgba(255, 224, 180, 0.04);
}
@media (hover: hover) {
  .dock-mini:hover {
    background: rgba(255, 214, 160, 0.1);
    border-color: rgba(233, 192, 138, 0.45);
    color: var(--ink);
  }
}
.ornament-count { color: var(--brass); opacity: 0.9; }

/* cards: warm glow on hover, brass ring when active */
.ornament-card,
.action-card,
.theme-card { color: var(--ink-2); }
@media (hover: hover) {
  .ornament-card:hover,
  .action-card:hover,
  .theme-card:hover {
    background: rgba(255, 214, 160, 0.09);
    box-shadow: 0 10px 24px rgba(8, 4, 2, 0.45), inset 0 0 0 1px rgba(233, 192, 138, 0.22);
    transform: translateY(-2px);
  }
}
.ornament-name,
.action-card > span:last-child,
.theme-name { font-size: 13px; color: var(--ink-2); }
.ornament-card.is-active { box-shadow: inset 0 0 0 1px var(--brass); }
.action-glyph {
  border-color: rgba(233, 192, 138, 0.28);
  background: radial-gradient(circle at 34% 28%, rgba(255, 224, 180, 0.14), rgba(60, 38, 26, 0.5));
  color: var(--ink);
}
.action-card.is-active .action-glyph {
  background: linear-gradient(180deg, #f0603f, #c8391f);
  border-color: rgba(255, 214, 160, 0.5);
  color: #fff6ea;
  box-shadow: 0 6px 16px rgba(200, 57, 31, 0.4);
}
.theme-preview { border-color: rgba(233, 192, 138, 0.28); }
.theme-card.is-active .theme-preview {
  box-shadow: 0 0 0 2px var(--brass), 0 0 12px rgba(233, 192, 138, 0.35);
}
.theme-upload { border-color: rgba(233, 192, 138, 0.3); }
.theme-upload-plus { color: var(--brass); }

/* ---------------------------------------------------------------- dialogs */
.modal-card {
  background:
    radial-gradient(120% 80% at 50% -10%, #fffaf0 0%, transparent 60%),
    var(--paper);
  border: 1px solid rgba(184, 132, 63, 0.32);
  box-shadow:
    0 30px 80px rgba(10, 5, 3, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
/* brass inner frame + corner sparkles */
.modal-card::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(184, 132, 63, 0.22);
  border-radius: calc(var(--r-xl) - 4px);
  pointer-events: none;
}
.modal-card h2 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0;
  font-size: 22px;
}
.modal-copy { color: var(--paper-ink-2); }

.primary-btn,
.modal-btn.primary {
  background: linear-gradient(180deg, #dd5a3c 0%, #c33a1f 100%);
  color: #fff6ea;
  box-shadow: inset 0 1px 0 rgba(255, 224, 196, 0.32), 0 8px 18px rgba(195, 58, 31, 0.28);
}
.primary-btn:disabled {
  background: rgba(44, 29, 19, 0.1);
  color: var(--paper-ink-3);
  box-shadow: none;
}
.ghost-btn,
.modal-btn {
  border-color: rgba(150, 108, 58, 0.4);
  color: var(--paper-ink);
  background: rgba(255, 255, 255, 0.5);
}

.intro-badge {
  background: rgba(184, 132, 63, 0.16);
  color: #8a5a22;
}
.intro-ic {
  background: radial-gradient(circle at 34% 28%, #fbe3bd, #e8c79a);
  color: #8a4a22;
  box-shadow: inset 0 0 0 1px rgba(184, 132, 63, 0.35);
}
.intro-steps b { font-family: var(--serif); font-size: 15px; }
.intro-steps p { color: var(--paper-ink-2); }
.intro-foot { color: var(--paper-ink-3); }

.crop-box { border-color: rgba(184, 132, 63, 0.35); background: #e8dcc4; }
.fx-preview { border-color: rgba(184, 132, 63, 0.35); background: #e8dcc4; }
.card-preview { border-color: rgba(184, 132, 63, 0.35); }

/* ---------------------------------------------------------------- toast */
.toast {
  background: linear-gradient(180deg, rgba(58, 38, 26, 0.97), rgba(32, 20, 14, 0.97));
  border: 1px solid rgba(233, 192, 138, 0.32);
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(8, 4, 2, 0.55), inset 0 1px 0 rgba(255, 224, 190, 0.14);
}
.toast #toastIcon { color: var(--brass); }

/* hint chip: warm, subtle */
.main-tree-hint {
  color: rgba(255, 236, 208, 0.62);
  text-shadow: 0 1px 8px rgba(10, 5, 3, 0.8);
}

/* ---------------------------------------------------------------- paper (画册) theme: warm cream */
.stage.theme-paper .bg-aurora {
  background:
    radial-gradient(70% 60% at 50% 8%, #fffdf7, transparent 68%),
    linear-gradient(180deg, #f8efdd 0%, #efe2ca 100%);
}
.stage.theme-paper .paper-grid {
  background-image:
    linear-gradient(rgba(150, 108, 58, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(150, 108, 58, 0.09) 1px, transparent 1px);
}
.stage.theme-paper .dock {
  background: linear-gradient(180deg, #f7ecd8 0%, #efe1c8 100%);
  border-top-color: rgba(184, 132, 63, 0.35);
}
.stage.theme-paper .dock-tab.is-active::after {
  background: linear-gradient(90deg, #b8843f, #d9a760);
}
.stage.theme-paper .brand-name,
.stage.theme-paper .theme-name { color: var(--paper-ink); }
.stage.theme-paper .main-tree-hint { color: rgba(44, 29, 19, 0.55); text-shadow: none; }

/* warm room theme */
.stage.theme-room .dock {
  background: linear-gradient(180deg, #33211a 0%, #1e130e 100%);
  border-top-color: rgba(255, 196, 128, 0.32);
}

@media (max-width: 720px) {
  .dock { border-radius: 16px 16px 0 0; padding-top: 14px; }
  .dock-tab { font-size: 14px; }
  .dock::before { background-size: 24px 14px, 100% 1px; }
}


/* ---- warm the photographic backdrops (they ship cold/blue) ------------------ */
.stage.has-photo-bg .stage-bg {
  filter: sepia(0.34) saturate(1.16) brightness(0.95) hue-rotate(-18deg) contrast(1.03);
}
.stage.has-photo-bg .stage-bg::after {
  background:
    radial-gradient(60% 40% at 50% 106%, rgba(255, 168, 86, 0.42), transparent 72%),
    radial-gradient(46% 34% at 14% 86%, rgba(255, 126, 56, 0.22), transparent 74%),
    radial-gradient(46% 34% at 86% 82%, rgba(255, 146, 70, 0.18), transparent 74%),
    linear-gradient(180deg, rgba(255, 178, 108, 0.2) 0%, rgba(96, 44, 20, 0.16) 34%, rgba(26, 11, 6, 0.46) 100%);
}

/* warm bokeh: a few out-of-focus lights near the bottom corners */
.stage.has-photo-bg .room-bokeh {
  display: block;
  opacity: 0.5;
  mix-blend-mode: screen;
}
.stage.has-photo-bg .room-bokeh span {
  background: radial-gradient(circle, rgba(255, 196, 120, 0.5), transparent 66%);
}

/* vignette follows the warm scheme */
.stage::after {
  background:
    radial-gradient(78% 62% at 50% 42%, transparent 44%, rgba(16, 8, 5, 0.44) 100%),
    linear-gradient(180deg, rgba(16, 8, 5, 0.32) 0%, transparent 26%);
}


/* ---- 窄屏顶栏：实测 360/390 会溢出（右缘 408 > 视口 390），收窄到 342/349 ---- */
@media (max-width: 430px) {
  .topbar { padding: calc(10px + env(safe-area-inset-top)) 8px 0; gap: 8px; }
  .brand { padding: 4px 4px 4px 2px; gap: 6px; }
  .brand-mark { width: 24px; height: 24px; }
  .brand-mark svg { width: 13px; height: 13px; }
  .brand-name { font-size: 17px; max-width: 22vw; }
  /* 「换脸」收成图标 FAB，文字在首访引导卡里已经讲过 */
  .face-cta { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .face-cta > span { display: none; }
  .face-cta::after { content: ""; position: absolute; inset: -2px; border-radius: var(--r-md); }
  .action-group .icon-btn { width: 38px; height: 40px; }
  .action-group .icon-btn::after { content: ""; position: absolute; inset: -2px; }
}
