:root {
  --cream: #fdf8ee;
  --cream-soft: #f6eedf;
  --lavender: #d9cbe8;
  --lavender-deep: #b89fd4;
  --lavender-tint: #f3edf9;
  --peach: #f7c7b4;
  --peach-deep: #e28d76;
  --ink: #5a4236;
  --ink-soft: #82675a;
  --gold: #f0b752;
  --font-book: "Hiragino Maru Gothic ProN", "Yuanti SC", "STYuanti-SC-Regular", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #dfd3ea;
  font-family: var(--font-book);
  color: var(--ink);
}

.hidden {
  display: none !important;
}

#viewport {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #e8ddf2 0%, #d4c4e3 100%);
}

#stage {
  position: relative;
  width: 1920px;
  height: 1080px;
  flex-shrink: 0;
  overflow: hidden;
  transform-origin: center center;
  box-shadow: 0 24px 60px rgba(90, 66, 54, 0.22);
}

#stage.dragging-active,
#stage.dragging-active * {
  cursor: none !important;
}

#desk-bg {
  position: absolute;
  inset: 0;
  width: 1920px;
  height: 1080px;
  object-fit: cover;
  pointer-events: none;
}

#night-sky-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 1920px;
  height: 260px;
  pointer-events: none;
  z-index: 4;
}

/* ===== 1 秒开场错峰入场仪式 ===== */
@keyframes introRoomIn {
  0%   { opacity: 0; transform: translateY(28px) scale(0.965); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes introBlueprintIn {
  0%   { opacity: 0; transform: translateY(26px) rotate(-5.2deg) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) rotate(-3.2deg) scale(1); }
}

@keyframes introBoardIn {
  0%   { opacity: 0; transform: translateY(26px) rotate(4.8deg) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) rotate(2.6deg) scale(1); }
}

@keyframes introOomiIn {
  0%   { opacity: 0; transform: translateY(22px) scale(0.88); }
  70%  { opacity: 1; transform: translateY(-4px) scale(1.03); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== 顶部绘本 HUD ===== */
#top-hud {
  position: absolute;
  top: 22px;
  left: 34px;
  right: 34px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 40;
  pointer-events: none;
}

.hud-left,
.hud-center,
.hud-right {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.cream-pill,
.cream-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--cream);
  border: 2.5px solid var(--ink);
  color: var(--ink);
  font-family: var(--font-book);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 0 rgba(90, 66, 54, 0.16);
  text-decoration: none;
}

.cream-btn {
  cursor: pointer;
  transition: transform 0.14s ease, background-color 0.14s ease, box-shadow 0.14s ease;
}

.cream-btn:hover {
  transform: translateY(-2px);
  background: #fffdf7;
  box-shadow: 0 6px 0 rgba(90, 66, 54, 0.18);
}

.cream-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 0 rgba(90, 66, 54, 0.16);
}

.cream-btn.accent-lavender {
  background: var(--lavender-tint);
  border-color: var(--ink);
}

.cream-btn.accent-lavender.active-mode {
  background: var(--lavender);
}

.cream-btn.accent-peach {
  background: #fde4d8;
}

.cream-btn.icon-btn {
  padding-left: 12px;
}

.cream-btn.icon-btn img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.pill-divider {
  width: 2px;
  height: 18px;
  border-radius: 2px;
  background: var(--lavender-deep);
}

.zone-badge {
  color: var(--ink-soft);
  font-size: 15px;
}

.zone-dots {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.z-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e7dcf2;
  border: 2px solid var(--ink);
  transition: transform 0.25s ease, background-color 0.25s ease;
}

.z-dot.active {
  background: var(--gold);
  transform: scale(1.18);
}

.z-dot.done {
  background: var(--peach);
}

.remain-text {
  font-size: 15px;
  color: var(--ink);
}

/* ===== 中央立体书屋画布 ===== */
#room-viewport {
  position: absolute;
  left: 444px;
  top: 190px;
  width: 1000px;
  height: 920px;
  z-index: 15;
  overflow: visible;
  touch-action: none;
  opacity: 0;
}

#stage.intro-ready #room-viewport {
  animation: introRoomIn 0.72s cubic-bezier(0.22, 1.15, 0.36, 1) 0s both;
}

#room-world {
  position: absolute;
  left: 500px;
  top: 500px;
  width: 1000px;
  height: 1000px;
  margin-left: -500px;
  margin-top: -500px;
  transform-origin: center center;
  transform: translate(0px, 0px) scale(0.90);
}

#book-room-empty {
  position: absolute;
  left: 20px;
  top: 175px;
  width: 960px;
  height: 650px;
  pointer-events: none;
}

#placed-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
}

.placed-sticker {
  position: absolute;
  transform-origin: center center;
  pointer-events: none;
  transition: filter 0.16s ease;
}

.placed-sticker.interactive-easter,
.placed-sticker.diy-selectable {
  pointer-events: auto;
  cursor: pointer;
}

.placed-sticker img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.placed-sticker.just-snapped {
  animation: stickerSnapPop 0.34s cubic-bezier(0.22, 1.32, 0.36, 1) forwards;
}

@keyframes stickerSnapPop {
  0%   { transform: translate(-50%, -50%) rotate(var(--r, 0deg)) scale(calc(var(--s, 1) * 1.10)) scaleX(var(--fx, 1)); }
  60%  { transform: translate(-50%, -50%) rotate(var(--r, 0deg)) scale(calc(var(--s, 1) * 0.96)) scaleX(var(--fx, 1)); }
  100% { transform: translate(-50%, -50%) rotate(var(--r, 0deg)) scale(var(--s, 1)) scaleX(var(--fx, 1)); }
}

.snap-diecut-dissolve {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: diecutDissolve 0.28s ease-out 0.08s forwards;
}

@keyframes diecutDissolve {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

.paper-ripple {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  border: 3px solid rgba(255, 249, 234, 0.92);
  background: radial-gradient(circle, rgba(255, 246, 214, 0.28) 0%, rgba(255, 246, 214, 0) 70%);
  box-shadow: 0 0 14px rgba(255, 232, 174, 0.45);
  animation: paperRipple 0.34s ease-out forwards;
}

@keyframes paperRipple {
  0%   { width: 34px; height: 34px; opacity: 0.95; }
  100% { width: 148px; height: 148px; opacity: 0; }
}

.placed-sticker.diy-selected {
  filter: drop-shadow(0 6px 14px rgba(138, 100, 184, 0.32));
}

/* 自由模式手绘四角取景锚框 */
.diy-selection-box {
  position: absolute;
  pointer-events: none;
  z-index: 46;
  transform: translate(-50%, -50%) rotate(var(--sel-r, 0deg));
  border-radius: 12px;
  border: 1.5px solid rgba(176, 146, 214, 0.55);
  box-shadow: 0 0 18px rgba(184, 159, 212, 0.38);
}

.sel-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--ink);
  border-style: solid;
  border-width: 0;
}

.sel-corner.tl {
  left: -5px;
  top: -5px;
  border-top-width: 3.5px;
  border-left-width: 3.5px;
  border-top-left-radius: 6px;
}

.sel-corner.tr {
  right: -5px;
  top: -5px;
  border-top-width: 3.5px;
  border-right-width: 3.5px;
  border-top-right-radius: 6px;
}

.sel-corner.bl {
  left: -5px;
  bottom: -5px;
  border-bottom-width: 3.5px;
  border-left-width: 3.5px;
  border-bottom-left-radius: 6px;
}

.sel-corner.br {
  right: -5px;
  bottom: -5px;
  border-bottom-width: 3.5px;
  border-right-width: 3.5px;
  border-bottom-right-radius: 6px;
}

.diy-lock-badge {
  position: absolute;
  top: -26px;
  right: -4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--cream);
  border: 2px solid var(--ink);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(90, 66, 54, 0.16);
}

/* 拼完活起来微动效 & 点击彩蛋动效 */
.placed-sticker.alive-pet-breathe img {
  animation: petBreathe 3.2s ease-in-out infinite;
  transform-origin: center bottom;
}

.placed-sticker.alive-ivy-sway img {
  animation: ivySway 4.2s ease-in-out infinite;
  transform-origin: 50% 15%;
}

.placed-sticker.alive-pet-peek img {
  animation: petPeek 3.8s ease-in-out infinite;
  transform-origin: center bottom;
}

.placed-sticker.alive-pet-nap img {
  animation: petNap 3.6s ease-in-out infinite;
  transform-origin: center bottom;
}

.placed-sticker.pet-chirping img {
  animation: petChirpBounce 0.48s cubic-bezier(0.22, 1.4, 0.36, 1) !important;
}

.placed-sticker.easter-press img {
  animation: easterPress 0.26s cubic-bezier(0.22, 1.35, 0.36, 1) !important;
}

.placed-sticker.plant-rustle img {
  animation: plantRustle 0.56s ease-in-out !important;
  transform-origin: 50% 82%;
}

@keyframes petBreathe {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.03, 0.97); }
}

@keyframes ivySway {
  0%, 100% { transform: rotate(-1.6deg); }
  50% { transform: rotate(2.1deg); }
}

@keyframes petPeek {
  0%, 100% { transform: rotate(0deg) translateY(0px); }
  40% { transform: rotate(3.0deg) translateY(-3px); }
  75% { transform: rotate(-1.8deg) translateY(0px); }
}

@keyframes petNap {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.045, 0.955); }
}

@keyframes petChirpBounce {
  0%   { transform: translateY(0) scale(1, 1); }
  35%  { transform: translateY(-16px) scale(0.94, 1.09); }
  70%  { transform: translateY(2px) scale(1.06, 0.94); }
  100% { transform: translateY(0) scale(1, 1); }
}

@keyframes easterPress {
  0%   { transform: scale(1, 1); }
  40%  { transform: scale(1.07, 0.92); }
  100% { transform: scale(1, 1); }
}

@keyframes plantRustle {
  0%   { transform: rotate(0deg); }
  25%  { transform: rotate(-4.5deg) scale(1.03, 0.98); }
  55%  { transform: rotate(4deg) scale(0.99, 1.02); }
  80%  { transform: rotate(-2deg); }
  100% { transform: rotate(0deg); }
}

/* 灯光、阳光、浮尘、热气与梦境泡泡 */
#fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 48;
}

.fx-sunbeam {
  position: absolute;
  left: 340px;
  top: 230px;
  width: 520px;
  height: 460px;
  opacity: 0;
  background: linear-gradient(128deg, rgba(255, 232, 168, 0.42) 0%, rgba(255, 224, 150, 0.14) 55%, rgba(255, 224, 150, 0) 100%);
  clip-path: polygon(34% 0%, 100% 18%, 74% 100%, 0% 72%);
  transition: opacity 0.8s ease;
}

.fx-sunbeam.on {
  animation: sunPulse 5.4s ease-in-out infinite;
}

@keyframes sunPulse {
  0%, 100% { opacity: 0.42; }
  50% { opacity: 0.72; }
}

.sun-dust-canvas {
  position: absolute;
  left: 340px;
  top: 230px;
  width: 520px;
  height: 460px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s ease;
}

.sun-dust-canvas.on {
  opacity: 1;
}

/* 复古台灯双层暖金径向光晕（精准对准灯罩发光口 774, 514） */
.fx-lamp-glow {
  position: absolute;
  left: 774px;
  top: 514px;
  width: 260px;
  height: 260px;
  margin-left: -130px;
  margin-top: -130px;
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(circle, rgba(255, 212, 114, 0.56) 0%, rgba(255, 192, 86, 0.24) 46%, rgba(255, 192, 86, 0) 76%);
  transition: opacity 0.45s ease;
}

.fx-lamp-glow::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 112px;
  height: 112px;
  margin-left: -56px;
  margin-top: -56px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 240, 178, 0.78) 0%, rgba(255, 214, 112, 0.32) 52%, rgba(255, 214, 112, 0) 80%);
}

.fx-lamp-glow.on {
  animation: lampGlow 3.6s ease-in-out infinite;
}

@keyframes lampGlow {
  0%, 100% { opacity: 0.78; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* 咖啡杯口热气（精准贴合 z1_mug 杯口 622, 484） */
.fx-mug-steam {
  position: absolute;
  left: 600px;
  top: 430px;
  width: 44px;
  height: 54px;
  opacity: 0;
  transition: opacity 0.55s ease, transform 0.35s ease;
}

.fx-mug-steam.on {
  opacity: 1;
}

.fx-mug-steam.burst {
  transform: scale(1.22) translateY(-4px);
}

.steam-wisp {
  position: absolute;
  bottom: 0;
  width: 12px;
  height: 24px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 251, 244, 0.84);
  border-color: transparent rgba(255, 250, 240, 0.86) transparent transparent;
  animation: steamRise 2.7s ease-in-out infinite;
}

.steam-wisp.w1 { left: 6px; animation-delay: 0s; }
.steam-wisp.w2 { left: 16px; animation-delay: 0.9s; }
.steam-wisp.w3 { left: 26px; animation-delay: 1.7s; }

@keyframes steamRise {
  0% { transform: translateY(3px) scale(0.78) rotate(8deg); opacity: 0; }
  35% { opacity: 0.88; }
  100% { transform: translateY(-30px) scale(1.22) rotate(-10deg); opacity: 0; }
}

/* 和纸落地灯双层暖金光晕 */
.fx-floor-lamp-glow {
  position: absolute;
  left: 178px;
  top: 514px;
  width: 272px;
  height: 272px;
  margin-left: -136px;
  margin-top: -136px;
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(circle, rgba(255, 198, 108, 0.58) 0%, rgba(249, 174, 88, 0.24) 48%, rgba(249, 174, 88, 0) 76%);
  transition: opacity 0.45s ease;
}

.fx-floor-lamp-glow::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 118px;
  height: 118px;
  margin-left: -59px;
  margin-top: -59px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 236, 174, 0.72) 0%, rgba(255, 206, 118, 0.28) 54%, rgba(255, 206, 118, 0) 82%);
}

.fx-floor-lamp-glow.on {
  animation: lampGlow 4s ease-in-out infinite;
}

.fx-nap-zzz {
  position: absolute;
  left: 396px;
  top: 646px;
  width: 60px;
  height: 60px;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.fx-nap-zzz.on {
  opacity: 1;
}

.fx-nap-zzz .zzz {
  position: absolute;
  font-family: var(--font-book);
  font-weight: 800;
  color: #8c6ea8;
  text-shadow: 0 2px 0 #fffdf9;
  animation: zzzFloat 3s ease-in-out infinite;
}

.fx-nap-zzz .z1 { left: 8px; bottom: 4px; font-size: 16px; }
.fx-nap-zzz .z2 { left: 26px; bottom: 14px; font-size: 22px; animation-delay: 1.2s; }

@keyframes zzzFloat {
  0%   { transform: translate(0, 4px) scale(0.75); opacity: 0; }
  35%  { opacity: 0.95; }
  100% { transform: translate(12px, -28px) scale(1.1); opacity: 0; }
}

/* 真实贴纸原形幻影预览 */
.snap-preview {
  position: absolute;
  transform: translate(-50%, -50%) scale(var(--ps, 1));
  pointer-events: none;
  z-index: 49;
}

.snap-preview img {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.44;
  filter:
    drop-shadow(0 0 14px rgba(244, 188, 78, 0.92))
    drop-shadow(0 0 4px rgba(255, 250, 232, 0.96));
  animation: ghostBreathe 1.4s ease-in-out infinite;
}

@keyframes ghostBreathe {
  0%, 100% { opacity: 0.38; transform: scale(0.99); }
  50% { opacity: 0.56; transform: scale(1.02); }
}

/* 提示圈（小提示按钮专用） */
.hint-ring {
  position: absolute;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 49;
  border: 4px dashed #ebb043;
  background: radial-gradient(circle, rgba(255, 224, 130, 0.42) 0%, rgba(255, 224, 130, 0) 72%);
  animation: hintPulse 1.1s ease-in-out infinite;
}

@keyframes hintPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(0.92); opacity: 0.72; }
  50% { transform: translate(-50%, -50%) scale(1.14); opacity: 1; }
}

/* 粒子层与手绘彩蛋粒子 */
#particle-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 60;
}

.spark-dot {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: sparkBurst 0.65s cubic-bezier(0.16, 0.88, 0.3, 1) forwards;
}

@keyframes sparkBurst {
  0%   { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.15); opacity: 0; }
}

.fx-float-icon {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: floatIconRise 0.95s cubic-bezier(0.22, 0.88, 0.36, 1) forwards;
}

@keyframes floatIconRise {
  0%   { transform: translate(-50%, -50%) scale(0.45) rotate(-8deg); opacity: 0; }
  22%  { opacity: 1; transform: translate(calc(-50% + var(--fx-x, 0px) * 0.25), -68%) scale(1.08) rotate(4deg); }
  100% { transform: translate(calc(-50% + var(--fx-x, 0px)), calc(-50% - var(--fx-y, 58px))) scale(0.9) rotate(var(--fx-rot, 10deg)); opacity: 0; }
}

.aroma-puff {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 250, 240, 0.9) 0%, rgba(255, 232, 198, 0.25) 65%, rgba(255, 232, 198, 0) 100%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: aromaRise 1.05s ease-out forwards;
}

@keyframes aromaRise {
  0%   { transform: translate(-50%, -50%) scale(0.5); opacity: 0.9; }
  100% { transform: translate(calc(-50% + var(--ax, 0px)), calc(-50% - var(--ay, 56px))) scale(1.5); opacity: 0; }
}

/* ===== 桌面小团子 Oomi（已校准至左下方干净桌垫留白） ===== */
.oomi-mascot {
  position: absolute;
  left: 374px;
  top: 822px;
  width: 138px;
  height: 144px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 25;
  opacity: 0;
}

#stage.intro-ready .oomi-mascot {
  animation:
    introOomiIn 0.62s cubic-bezier(0.22, 1.25, 0.36, 1) 0.28s both,
    oomiIdle 3.4s ease-in-out 0.95s infinite;
}

.oomi-mascot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(90, 66, 54, 0.22));
}

.oomi-mascot.happy-hop {
  animation: oomiHop 0.55s cubic-bezier(0.22, 1.4, 0.36, 1) !important;
}

@keyframes oomiIdle {
  0%, 100% { transform: translateY(0px) scale(1, 1); }
  50% { transform: translateY(-4px) scale(1.02, 0.98); }
}

@keyframes oomiHop {
  0%   { transform: translateY(0) scale(1, 1); }
  40%  { transform: translateY(-22px) scale(0.94, 1.08); }
  75%  { transform: translateY(2px) scale(1.06, 0.94); }
  100% { transform: translateY(0) scale(1, 1); }
}

/* ===== 左侧图纸堆 ===== */
.blueprint-panel {
  position: absolute;
  left: 56px;
  top: 230px;
  width: 406px;
  height: 576px;
  transform: rotate(-3.2deg);
  z-index: 22;
  opacity: 0;
}

#stage.intro-ready .blueprint-panel {
  animation: introBlueprintIn 0.65s cubic-bezier(0.22, 1.15, 0.36, 1) 0.12s both;
}

.blueprint-back {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  border: 2.5px solid var(--ink);
  background: #f2eaf8;
}

.blueprint-back.sheet-2 {
  transform: translate(-10px, 8px) rotate(-2deg);
  background: #eae0f4;
}

.blueprint-back.sheet-1 {
  transform: translate(-5px, 4px) rotate(-1deg);
  background: #f6f0fb;
}

.blueprint-top {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  border: 2.5px solid var(--ink);
  background-color: #fbf7fe;
  background-image:
    linear-gradient(to right, rgba(184, 159, 212, 0.16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(184, 159, 212, 0.16) 1px, transparent 1px);
  background-size: 24px 24px;
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 26px rgba(90, 66, 54, 0.18);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.blueprint-top.turning {
  animation: pageTurnEffect 0.45s ease;
}

@keyframes pageTurnEffect {
  0%   { transform: rotateY(0deg) scale(1); opacity: 1; }
  45%  { transform: rotateY(-18deg) translateX(-16px) scale(0.97); opacity: 0.45; }
  100% { transform: rotateY(0deg) scale(1); opacity: 1; }
}

/* 历史图纸书签小耳签 */
.bp-tabs {
  position: absolute;
  top: -28px;
  right: 18px;
  display: flex;
  gap: 6px;
  z-index: 2;
}

.bp-tab {
  width: 32px;
  height: 28px;
  border-radius: 10px 10px 0 0;
  border: 2.2px solid var(--ink);
  border-bottom: none;
  background: #ece3f6;
  color: var(--ink);
  font-family: var(--font-book);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.14s ease, background-color 0.14s ease;
}

.bp-tab:hover:not(:disabled) {
  transform: translateY(-2px);
  background: #fff9ee;
}

.bp-tab.active {
  background: var(--cream);
  height: 31px;
  margin-top: -3px;
}

.bp-tab.done:not(.active) {
  background: #fde4d8;
}

.bp-tab.locked {
  background: #e6deed;
  color: #a696b3;
  border-color: #9e8cb2;
  cursor: not-allowed;
}

.bp-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.bp-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bp-zone-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.15;
}

.bp-zone-sub {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
}

.bp-measure {
  font-size: 12px;
  font-weight: 700;
  color: var(--lavender-deep);
  padding-top: 4px;
}

.bp-image-wrap {
  flex: 1;
  width: 100%;
  border-radius: 10px;
  border: 2px solid #d2c1e6;
  background: #fdfaff;
  padding: 6px;
  cursor: zoom-in;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.bp-image-wrap:hover {
  transform: scale(1.015);
  box-shadow: 0 4px 12px rgba(90, 66, 54, 0.12);
}

.bp-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.bp-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hint-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: #fff6dc;
  color: var(--ink);
  font-family: var(--font-book);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(90, 66, 54, 0.16);
  transition: transform 0.14s ease;
}

.hint-btn:hover {
  transform: translateY(-2px);
}

.hint-btn img {
  width: 24px;
  height: 28px;
  object-fit: contain;
}

.bp-tip {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

.zone-stamp {
  position: absolute;
  right: 26px;
  bottom: 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 12px;
  border-radius: 16px;
  background: rgba(253, 240, 234, 0.94);
  border: 3px solid #d97a67;
  transform: rotate(-10deg);
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(217, 122, 103, 0.25);
  animation: stampSlam 0.36s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}

.zone-stamp img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.zone-stamp span {
  font-size: 14px;
  font-weight: 800;
  color: #c9624f;
}

@keyframes stampSlam {
  0%   { transform: rotate(-20deg) scale(1.9); opacity: 0; }
  65%  { transform: rotate(-9deg) scale(0.92); opacity: 1; }
  100% { transform: rotate(-10deg) scale(1); opacity: 1; }
}

/* ===== 右侧微倾奶油格子贴纸板 ===== */
.sticker-board {
  position: absolute;
  left: 1408px;
  top: 156px;
  width: 470px;
  height: 822px;
  border-radius: 18px;
  border: 2.5px solid var(--ink);
  background-color: #fcf7ee;
  background-image:
    linear-gradient(45deg, #f3ebdf 25%, transparent 25%),
    linear-gradient(-45deg, #f3ebdf 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f3ebdf 75%),
    linear-gradient(-45deg, transparent 75%, #f3ebdf 75%);
  background-size: 48px 48px;
  background-position: 0 0, 0 24px, 24px -24px, -24px 0;
  transform: rotate(2.6deg);
  box-shadow: 0 14px 32px rgba(90, 66, 54, 0.22);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 22;
  opacity: 0;
}

#stage.intro-ready .sticker-board {
  animation: introBoardIn 0.68s cubic-bezier(0.22, 1.15, 0.36, 1) 0.2s both;
}

.board-header-strip {
  height: 58px;
  background: linear-gradient(180deg, #cbb5e4 0%, #bea5dc 100%);
  border-bottom: 2.5px solid var(--ink);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.barcode-bars {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  opacity: 0.62;
}

.barcode-bars span {
  display: block;
  height: 100%;
  background: var(--ink);
  border-radius: 1px;
}

.barcode-bars span:nth-child(odd) { width: 3px; }
.barcode-bars span:nth-child(even) { width: 5px; }
.barcode-bars span:nth-child(3n) { width: 2px; }

.board-code {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: 0.06em;
}

.sticker-grid {
  flex: 1;
  padding: 16px 18px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 10px 14px;
  align-items: center;
  justify-items: center;
}

.sticker-slot {
  position: relative;
  width: 196px;
  height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sticker-slot img {
  position: absolute;
  max-width: 178px;
  max-height: 118px;
  object-fit: contain;
  pointer-events: none;
}

.sticker-slot .slot-outline {
  opacity: 0.95;
  transform: rotate(var(--slot-tilt, 0deg));
}

.sticker-slot .slot-diecut {
  pointer-events: auto;
  cursor: grab;
  transform: rotate(var(--slot-tilt, 0deg));
  transition: transform 0.18s cubic-bezier(0.22, 1.3, 0.36, 1), filter 0.18s ease, opacity 0.14s ease;
}

.sticker-slot:not(.peeled):hover .slot-diecut {
  transform: rotate(0deg) translateY(-5px) scale(1.08);
  filter: drop-shadow(0 10px 14px rgba(90, 66, 54, 0.26));
}

/* 精致奶油暖棕圆角悬停小名签 */
.slot-label {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 6px);
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--cream);
  border: 1.8px solid var(--ink);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(90, 66, 54, 0.18);
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.sticker-slot:not(.peeled):hover .slot-label {
  opacity: 1;
  transform: translate(-50%, 0px);
}

.sticker-slot.hint-flash .slot-diecut,
.sticker-slot.prereq-flash .slot-diecut {
  animation: slotHintBounce 0.72s ease-in-out infinite;
}

@keyframes slotHintBounce {
  0%, 100% {
    transform: rotate(var(--slot-tilt, 0deg)) scale(1);
    filter: drop-shadow(0 0 8px rgba(240, 183, 82, 0.75));
  }
  50% {
    transform: rotate(0deg) scale(1.1);
    filter: drop-shadow(0 0 20px rgba(240, 183, 82, 0.98));
  }
}

.sticker-slot.peeled .slot-diecut {
  opacity: 0;
  pointer-events: none;
}

/* ===== 自由创作模式：左侧抽屉、右侧图层面板、底部手绘图标工具条 ===== */
.diy-drawer {
  position: absolute;
  left: 28px;
  top: 94px;
  width: 440px;
  height: 696px;
  border-radius: 20px;
  border: 2.5px solid var(--ink);
  background: rgba(253, 248, 238, 0.96);
  box-shadow: 0 14px 34px rgba(90, 66, 54, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 32;
}

.diy-drawer-head {
  padding: 14px 16px;
  background: #e9ddf4;
  border-bottom: 2.5px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.diy-head-title {
  font-size: 20px;
  font-weight: 800;
}

.diy-head-actions {
  display: flex;
  gap: 6px;
}

.mini-pill-btn {
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-book);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.mini-pill-btn:hover:not(:disabled) {
  background: #ffffff;
}

.mini-pill-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.diy-drawer-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.diy-categories {
  width: 116px;
  background: #f3eaf9;
  border-right: 2px solid #d5c4e6;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cat-tab {
  width: 100%;
  padding: 10px 10px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-book);
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.cat-tab:hover {
  background: rgba(253, 248, 238, 0.6);
}

.cat-tab.active {
  background: var(--cream);
  border-color: var(--ink);
  box-shadow: 0 3px 0 rgba(90, 66, 54, 0.14);
}

.diy-sticker-list {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  align-content: start;
}

.diy-item-card {
  height: 106px;
  border-radius: 14px;
  border: 2px solid #dfd1ec;
  background: #fffdf8;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.diy-item-card:hover {
  transform: translateY(-2px);
  border-color: var(--ink);
}

.diy-item-card img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* 右侧可折叠「图层」耳签与小面板 */
.diy-layers-drawer {
  position: absolute;
  right: 28px;
  top: 104px;
  z-index: 34;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.diy-layers-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 2.5px solid var(--ink);
  background: var(--lavender-tint);
  color: var(--ink);
  font-family: var(--font-book);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(90, 66, 54, 0.16);
  transition: transform 0.14s ease, background-color 0.14s ease;
}

.diy-layers-toggle:hover {
  transform: translateY(-2px);
  background: #efe5fa;
}

.diy-layers-toggle.open {
  background: var(--lavender);
}

.diy-layers-panel {
  width: 276px;
  max-height: 580px;
  border-radius: 18px;
  border: 2.5px solid var(--ink);
  background: rgba(253, 248, 238, 0.96);
  box-shadow: 0 14px 32px rgba(90, 66, 54, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.diy-layers-head {
  padding: 12px 14px;
  background: #e9ddf4;
  border-bottom: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.diy-layers-title {
  font-size: 16px;
  font-weight: 800;
}

.diy-layers-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

.diy-layers-list {
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 520px;
}

.layer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: #fffdf8;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-book);
  color: var(--ink);
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.layer-row:hover {
  background: #f5effb;
  border-color: #d0bce6;
}

.layer-row.selected {
  background: #efe5fa;
  border-color: var(--ink);
}

.layer-thumb {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.layer-name {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-z {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
}

/* 底部手绘线性图标悬浮工具条 */
.diy-toolbar {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  height: 56px;
  padding: 0 14px;
  border-radius: 999px;
  border: 2.5px solid var(--ink);
  background: var(--cream);
  box-shadow: 0 8px 22px rgba(90, 66, 54, 0.22);
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 42;
}

.tb-btn {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  border: 2px solid transparent;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}

.tb-btn:hover {
  transform: translateY(-2px);
  background: var(--lavender-tint);
  border-color: #c8b4dc;
}

.tb-btn.active {
  background: var(--lavender);
  border-color: var(--ink);
}

.tb-btn.danger:hover {
  background: #fce0d8;
  border-color: #d97a67;
}

.tb-btn.danger:hover svg {
  stroke: #a6412f;
}

.tb-btn::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--cream);
  border: 1.8px solid var(--ink);
  color: var(--ink);
  font-family: var(--font-book);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(90, 66, 54, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.tb-btn:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tb-sep {
  width: 2px;
  height: 22px;
  background: #dfd1ec;
  margin: 0 3px;
}

/* ===== 画布底部温柔绘本胶囊提示 ===== */
.story-toast {
  position: absolute;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  border: 2.5px solid var(--ink);
  background: #fff9ee;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(90, 66, 54, 0.2);
  z-index: 75;
  pointer-events: none;
  animation: toastPopIn 0.28s cubic-bezier(0.22, 1.3, 0.36, 1) forwards;
}

@keyframes toastPopIn {
  0%   { opacity: 0; transform: translateX(-50%) translateY(12px) scale(0.94); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* ===== 拖拽幽灵与小镊子 ===== */
.drag-layer {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 80;
}

#drag-sticker-img {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%) scale(1.06) rotate(0deg);
  filter: drop-shadow(0 16px 22px rgba(90, 66, 54, 0.28));
  pointer-events: none;
  will-change: transform;
}

#drag-sticker-img.peel-lift {
  animation: peelLiftPop 0.22s cubic-bezier(0.22, 1.32, 0.36, 1);
}

@keyframes peelLiftPop {
  0%   { filter: drop-shadow(0 4px 6px rgba(90, 66, 54, 0.16)); }
  100% { filter: drop-shadow(0 16px 22px rgba(90, 66, 54, 0.28)); }
}

#tweezers-cursor {
  position: absolute;
  width: 66px;
  height: auto;
  transform-origin: 12% 88%;
  transform: translate(-10%, -88%) rotate(-6deg);
  filter: drop-shadow(0 4px 6px rgba(90, 66, 54, 0.25));
  pointer-events: none;
}

.drag-returning {
  transition: left 0.24s cubic-bezier(0.22, 1, 0.36, 1), top 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease;
}

/* ===== 彩纸花瓣层 ===== */
.confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 70;
  overflow: hidden;
}

.confetti-petal {
  position: absolute;
  top: -20px;
  border-radius: 6px 12px;
  opacity: 0.9;
  animation: petalFall linear forwards;
}

@keyframes petalFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0.95; }
  100% { transform: translateY(1120px) rotate(420deg); opacity: 0; }
}

/* ===== 暖奶油弹窗（严禁黑底半透明遮罩） ===== */
.cream-modal {
  position: absolute;
  inset: 0;
  background: rgba(248, 241, 230, 0.78);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 95;
}

.cream-card {
  border-radius: 24px;
  border: 3px solid var(--ink);
  background: var(--cream);
  padding: 24px 28px;
  box-shadow: 0 18px 42px rgba(90, 66, 54, 0.24);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 22px;
  font-weight: 800;
}

.bp-zoom-card img {
  width: 620px;
  height: 620px;
  border-radius: 14px;
  border: 2px solid #d4c3e6;
  object-fit: contain;
  display: block;
}

.clear-card {
  width: 580px;
  text-align: center;
  padding: 32px 36px;
}

.clear-mascot {
  width: 148px;
  height: 148px;
  object-fit: contain;
  margin-bottom: 8px;
}

.clear-heading {
  margin: 4px 0 8px;
  font-size: 28px;
  font-weight: 800;
}

.clear-sub {
  margin: 0 0 24px;
  font-size: 16px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.restart-card {
  width: 460px;
  text-align: center;
  padding: 30px 32px;
}

.restart-heading {
  margin: 0 0 10px;
  font-size: 23px;
  font-weight: 800;
}

.restart-sub {
  margin: 0 0 24px;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.clear-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.postcard-card {
  width: 880px;
}

.postcard-card img {
  width: 100%;
  border-radius: 16px;
  border: 2.5px solid var(--ink);
  display: block;
}

.postcard-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}
