﻿/* ============================================================
 * 张芷歆 13 岁生日 · 五层蛋糕城堡
 * 一屏三栏：左侧送礼 / 中间蛋糕城堡 / 右侧歌声墙
 * ============================================================ */

:root {
  --ink: #100c22;
  --ink-2: #1b1440;
  --pink: #ff5c92;
  --pink-soft: #ff9dbb;
  --cyan: #35e0f2;
  --gold: #ffd166;
  --violet: #8b5cf6;
  --lime: #8ac926;
  --text: #f4f1ff;
  --text-dim: #b5abd6;
  --glass: rgba(255, 255, 255, .07);
  --glass-2: rgba(255, 255, 255, .13);
  --line: rgba(255, 255, 255, .14);
  --radius: 16px;
  --radius-lg: 22px;
  --radius-full: 999px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .35);
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--ink);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
[hidden] { display: none !important; }

/* ---------------- 背景 ----------------
 * 4 张照片做成四角拍立得卡片，同屏展示、各自轻晃；
 * 玻璃侧栏是半透明的，照片从后面透出来，很有层次 */
.bg-photos {
  position: fixed; inset: 0; z-index: -3;
  overflow: hidden;
  background: var(--ink);
}
.bg-photos img {
  position: absolute;
  width: 30vmin; height: 23vmin;
  object-fit: cover;
  border: 5px solid rgba(255, 246, 250, .92);
  border-bottom-width: 20px;           /* 拍立得白框 */
  border-radius: 6px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, .55);
  filter: brightness(.88) saturate(1.05);
  opacity: .68;
}
.bg-photos img:nth-child(1) { left: 1.5vmin;  top: 15vh;  animation: drift1 15s ease-in-out infinite alternate; }
.bg-photos img:nth-child(2) { left: 9vmin;    bottom: 7vh; animation: drift2 18s ease-in-out infinite alternate; }
.bg-photos img:nth-child(3) { right: 1.5vmin; top: 15vh;  animation: drift3 16s ease-in-out infinite alternate; }
.bg-photos img:nth-child(4) { right: 9vmin;   bottom: 7vh; animation: drift4 14s ease-in-out infinite alternate; }
@keyframes drift1 { from { transform: rotate(-9deg) translateY(0);  } to { transform: rotate(-6deg)  translateY(-10px); } }
@keyframes drift2 { from { transform: rotate(7deg)  translateY(0);  } to { transform: rotate(10deg)  translateY(-12px); } }
@keyframes drift3 { from { transform: rotate(8deg)  translateY(0);  } to { transform: rotate(5deg)   translateY(-10px); } }
@keyframes drift4 { from { transform: rotate(-7deg) translateY(0);  } to { transform: rotate(-10deg) translateY(-12px); } }

.bg-layer {
  position: fixed; inset: 0; z-index: -2;
  /* 氛围光斑 + 轻压暗，保证前景文字可读，但不遮住照片 */
  background:
    radial-gradient(900px 600px at 12% 8%, rgba(139, 92, 246, .28), transparent 60%),
    radial-gradient(800px 600px at 88% 20%, rgba(255, 92, 146, .24), transparent 62%),
    radial-gradient(900px 700px at 50% 100%, rgba(53, 224, 242, .16), transparent 65%),
    linear-gradient(180deg, rgba(16,12,34,.30) 0%, rgba(27,20,64,.22) 45%, rgba(16,12,34,.30) 100%);
}

/* ---------------- 家庭口令门 ---------------- */
.gate {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background:
    radial-gradient(900px 600px at 20% 10%, rgba(139, 92, 246, .45), transparent 60%),
    radial-gradient(800px 600px at 85% 85%, rgba(255, 92, 146, .40), transparent 62%),
    linear-gradient(160deg, #171233 0%, #241a4d 55%, #171233 100%);
  transition: opacity .45s ease;
}
.gate.gone { opacity: 0; pointer-events: none; }
.gate-card {
  width: min(360px, 100%);
  text-align: center;
  padding: 30px 26px 24px;
  border-radius: 22px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .16);
  backdrop-filter: blur(12px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
  animation: gatePop .5s ease;
}
@keyframes gatePop {
  from { transform: translateY(14px) scale(.97); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.gate-emoji { font-size: 46px; line-height: 1; }
.gate-card h2 {
  margin: 12px 0 6px; font-size: 20px; letter-spacing: 2px;
  background: linear-gradient(100deg, var(--pink-soft), var(--cyan), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.gate-hint { margin: 0 0 16px; font-size: 13px; color: var(--text-dim); line-height: 1.7; }
.gate-hint small { opacity: .75; font-size: 11px; }
.gate input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  font-size: 16px;
  letter-spacing: 3px;
  text-align: center;
  outline: none;
  margin-bottom: 12px;
}
.gate input:focus { border-color: rgba(255, 157, 187, .6); }
.gate-btn {
  width: 100%;
  padding: 11px 0;
  border: 0; border-radius: 12px;
  font-size: 15px; font-weight: 800; letter-spacing: 2px; color: #fff;
  background: linear-gradient(120deg, var(--pink), var(--violet));
  transition: transform .15s ease, filter .2s ease;
}
.gate-btn:hover { filter: brightness(1.12); }
.gate-btn:active { transform: scale(.97); }
.gate-msg { margin: 10px 0 0; font-size: 12px; color: var(--pink-soft); min-height: 18px; }

/* ---------------- 顶部弹幕 ---------------- */
.danmaku {
  position: fixed; top: 0; left: 0; right: 0;
  height: 88px; z-index: 70;
  overflow: hidden; pointer-events: none;
}
.dm {
  position: absolute; left: 100%;
  padding: 5px 16px;
  border-radius: var(--radius-full);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  animation: dmFly linear forwards;
}
@keyframes dmFly {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-100vw - 100%)); }
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 52px; z-index: 60;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  background: linear-gradient(180deg, rgba(16, 12, 34, .96), rgba(16, 12, 34, .6));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.tb-title { font-size: 15px; font-weight: 800; letter-spacing: 1px; }
.tb-right { display: flex; align-items: center; gap: 8px; }
.tb-who, .tb-qr, .tb-reset {
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--glass);
  color: var(--text);
  padding: 4px 12px; font-size: 12px;
  max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tb-who.set { border-color: rgba(138, 201, 38, .6); color: #d9f7a8; }
.tb-qr { border-color: rgba(53, 224, 242, .5); color: #bff3fb; }
.tb-reset { border-color: rgba(255, 92, 146, .55); color: #ffd3e2; }
.tb-progress {
  font-size: 12px; color: var(--gold);
  padding: 4px 12px; border-radius: var(--radius-full);
  background: rgba(255, 209, 102, .12);
  border: 1px solid rgba(255, 209, 102, .35);
}

/* ---------------- 一屏三栏 ---------------- */
.screen {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr) 288px;
  gap: 18px;
  height: 100vh; height: 100dvh;
  padding: 66px 18px 14px;
  max-width: 1440px;
  margin: 0 auto;
}
.side {
  display: flex; flex-direction: column; gap: 12px;
  overflow-y: auto; padding-bottom: 10px;
  scrollbar-width: thin;
}
.side-title {
  margin: 0; font-size: 15px; font-weight: 800; color: var(--pink-soft);
  letter-spacing: 1px;
}

.act {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 13px 14px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--text);
  transition: transform .15s ease, background .2s ease, border-color .2s ease;
}
.act:hover { background: var(--glass-2); border-color: rgba(255, 255, 255, .3); transform: translateY(-2px); }
.act:active { transform: scale(.98); }
.act i { font-style: normal; font-size: 28px; flex: none; }
.act span { flex: 1; min-width: 0; }
.act b { display: block; font-size: 15px; }
.act em { display: block; font-style: normal; font-size: 12px; color: var(--text-dim); }
.act u {
  flex: none; text-decoration: none;
  min-width: 26px; text-align: center;
  font-size: 12px; font-weight: 700; color: #1a1030;
  background: var(--gold); border-radius: var(--radius-full);
  padding: 2px 7px;
}

.panel {
  padding: 12px 14px 14px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  border: 1px solid var(--line);
}
.panel h3 { margin: 0 0 10px; font-size: 13px; color: var(--text-dim); font-weight: 700; }
.empty { margin: 4px 0; font-size: 12px; color: var(--text-dim); opacity: .8; }

.song-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; margin-bottom: 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  font-size: 13px;
}
.song-row .play {
  flex: none; width: 30px; height: 30px;
  border-radius: 50%; border: 0;
  background: linear-gradient(120deg, var(--pink), var(--violet));
  color: #fff; font-size: 12px;
}
.song-row .meta { flex: 1; min-width: 0; }
.song-row .meta b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-row .meta em { font-style: normal; font-size: 11px; color: var(--text-dim); }
.song-row.playing { border-color: var(--pink); }

/* ---------------- 中间：城堡 ---------------- */
.castle-wrap {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 0; min-width: 0;
  text-align: center;
}
.castle-head { flex: none; }
.ch-date {
  margin: 0; font-size: 12px; letter-spacing: 2px; color: var(--gold);
}
.ch-name {
  margin: 2px 0 4px;
  font-size: clamp(30px, 4.6vw, 52px);
  font-weight: 900; letter-spacing: 6px; line-height: 1.15;
  background: linear-gradient(100deg, var(--pink-soft), var(--cyan), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 22px rgba(255, 92, 146, .35));
}
.ch-tip { margin: 0; font-size: 13px; color: var(--text-dim); }
#castle { flex: 1; min-height: 0; width: 100%; display: flex; justify-content: center; margin-top: 6px; }
#castle svg { width: 100%; height: 100%; }
#castle .cake-img { filter: drop-shadow(0 18px 28px rgba(0, 0, 0, .5)); }
.castle-foot { flex: none; margin: 4px 0 0; font-size: 12px; color: var(--text-dim); }
.castle-foot a { color: var(--pink-soft); margin-left: 10px; text-decoration: none; opacity: .75; }
.castle-foot #starBtn { color: var(--gold); opacity: .95; font-weight: 700; }

/* SVG 城堡状态 */
.tier-g { cursor: pointer; }
.tier-g.locked { opacity: .5; filter: saturate(.35); }
.tier-g.locked .lock { display: block; }
.tier-g .lock { display: none; }
.tier-g.open .glow-ring { animation: doorGlow 1.6s ease-in-out infinite; }
.tier-g.done .star { display: block; }
.tier-g .star { display: none; }
.tier-g.shake { animation: tierShake .4s ease; }
@keyframes doorGlow {
  0%, 100% { opacity: .25; }
  50%      { opacity: .85; }
}
@keyframes tierShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.candle-f { opacity: 0; transition: opacity .5s ease, transform .5s ease; }

/* 13 支生日蜡烛：平时整排收起，进入点蜡烛环节才出现 */
#castle .candle-g { opacity: 0; transition: opacity .45s ease; }
#castle.candles-visible .candle-g { opacity: 1; }
/* 点亮后蜡烛周围的光晕：跟着点亮状态一起显隐 */
#castle .candle-halo { opacity: 0; transition: opacity .5s ease; }
#castle .candle-g.on .candle-halo { opacity: 1; }

/* ---------------- Dock（移动端） ---------------- */
.dock {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 80;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(16, 12, 34, .4), rgba(16, 12, 34, .96));
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.dock button {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--glass);
  color: var(--text);
  padding: 7px 2px 6px;
  font-size: 11px;
}
.dock button i { font-style: normal; display: block; font-size: 20px; }
.dock button span { display: block; margin-top: 1px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 24px;
  border: 0; border-radius: var(--radius-full);
  font-size: 14px; font-weight: 700; color: #fff;
  transition: transform .15s ease, box-shadow .2s ease, opacity .2s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(120deg, var(--pink), var(--violet));
  box-shadow: 0 10px 26px rgba(255, 92, 146, .35);
}
.btn-ghost { background: var(--glass); border: 1px solid var(--line); color: var(--text); }
.btn-gold { background: linear-gradient(120deg, #ffd166, #ffb347); color: #1a1030; box-shadow: 0 10px 26px rgba(255, 209, 102, .35); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ---------------- 舞台（闯关弹框） ---------------- */
.stage {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 6, 24, .8);
  backdrop-filter: blur(8px);
  padding: 18px;
}
.stage-inner {
  width: min(680px, 100%);
  max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px);
  display: flex; flex-direction: column;
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, #241a4e, #1b1440);
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: var(--shadow);
  animation: popIn .3s ease;
}
.stage-head {
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.stage-head h3 { margin: 0; font-size: 17px; }
.stage-close {
  border: 1px solid var(--line); border-radius: var(--radius-full);
  background: var(--glass); color: var(--text);
  padding: 6px 16px; font-size: 13px;
}
.stage-body { flex: 1; overflow-y: auto; padding: 18px; }

/* ---------------- 通用弹框 ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 95;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 6, 24, .8);
  backdrop-filter: blur(8px);
  padding: 18px;
}
.modal-card {
  width: min(460px, 100%);
  max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px);
  overflow-y: auto;
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, #241a4e, #1b1440);
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: var(--shadow);
  padding: 20px;
  animation: popIn .3s ease;
}
.lightbox-card {
  max-width: min(560px, 92vw);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #1b1440;
  border: 1px solid rgba(255, 255, 255, .2);
  box-shadow: var(--shadow);
}
.lightbox-card img { width: 100%; }
.lightbox-card p { margin: 0; padding: 10px 14px; font-size: 13px; color: var(--text-dim); }

@keyframes popIn {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 表单 */
.form { display: flex; flex-direction: column; gap: 10px; }
.form h3 { margin: 0 0 4px; font-size: 17px; }
.form input, .form select, .form textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .3);
  color: var(--text); font-size: 14px; outline: none;
}
.form input:focus, .form textarea:focus { border-color: var(--pink); }
.form textarea { resize: vertical; }
.form-row { display: flex; gap: 10px; }
.form-msg { margin: 0; font-size: 12px; color: var(--text-dim); min-height: 18px; }
.form-msg.err { color: #ff8ba7; }
.form-tip { margin: 0; font-size: 12px; color: var(--text-dim); }
.preview-box img { width: 100%; max-height: 200px; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); }
.who-row { display: flex; align-items: center; gap: 8px; }
.who-row b { color: var(--gold); font-size: 13px; }
.linkish {
  border: 0; background: none; padding: 0;
  color: var(--cyan); font-size: 12px; text-decoration: underline;
}

/* ---------------- 扫码 / 昵称入口 ---------------- */
.qr-entry { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.qr-entry h3 { margin: 0; font-size: 17px; }
.qr-box {
  align-self: center;
  width: min(230px, 70vw);
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .35);
}
.qr-box svg { display: block; width: 100%; height: auto; }
.qr-url {
  margin: 0; font-size: 11px; color: var(--text-dim);
  text-align: center; word-break: break-all;
}
.qr-copy { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.qr-copy .btn { padding: 8px 16px; font-size: 13px; }
.qr-entry .btn[data-close] { align-self: center; padding: 8px 20px; font-size: 13px; }

/* ---------------- 第 1 层 · 盲盒 ---------------- */
.bb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.bb-card { position: relative; height: 190px; perspective: 700px; border: 0; background: none; padding: 0; }
.bb-inner {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.34, 1.4, .64, 1);
}
.bb-card.open .bb-inner { transform: rotateY(180deg); }
.bb-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 12px;
  border: 1px solid var(--line);
}
.bb-front { background: linear-gradient(160deg, #3a2a6e, #2a1a4e); }
.bb-front .gift { font-size: 46px; animation: bbBob 2.2s ease-in-out infinite; }
.bb-front b { font-size: 13px; }
.bb-front small { font-size: 11px; color: var(--text-dim); }
@keyframes bbBob { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
.bb-back {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #fff2f7, #ffe0ec);
  color: #4a2a3e;
}
.bb-back img { width: 74px; height: 74px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, .18); }
.bb-back b { font-size: 13px; }
.bb-back p { margin: 0; font-size: 11px; line-height: 1.5; text-align: center; color: #8a5a6e; }

/* ---------------- 第 2 层 · 猜成语 ---------------- */
.idiom-box { text-align: center; }
.idiom-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.idiom-dots i {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-style: normal; font-size: 12px;
  background: var(--glass); border: 1px solid var(--line); color: var(--text-dim);
}
.idiom-dots i.ok { background: rgba(138, 201, 38, .3); border-color: var(--lime); color: #fff; }
.idiom-dots i.now { border-color: var(--gold); color: var(--gold); }
.idiom-emoji { font-size: 64px; line-height: 1.3; margin: 10px 0 4px; }
.idiom-q { font-size: 13px; color: var(--text-dim); margin: 0 0 14px; }
.idiom-row { display: flex; gap: 10px; justify-content: center; }
.idiom-row input {
  width: 220px; text-align: center;
  padding: 11px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: rgba(0, 0, 0, .3);
  color: var(--text); font-size: 16px; letter-spacing: 3px; outline: none;
}
.idiom-row input:focus { border-color: var(--gold); }
.idiom-msg { min-height: 22px; margin: 12px 0 0; font-size: 13px; color: var(--text-dim); }
.idiom-msg.ok { color: var(--lime); }
.idiom-msg.bad { color: #ff8ba7; }
.idiom-box.wrong .idiom-emoji { animation: tierShake .4s ease; }

/* ---------------- 第 3 层 · 拼图 ---------------- */
.pz-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pz-board {
  display: grid; grid-template-columns: repeat(4, 88px); grid-template-rows: repeat(4, 88px);
  gap: 5px; padding: 10px;
  border-radius: 16px;
  background: var(--glass); border: 1px solid var(--line);
}
.pz-cell { border-radius: 8px; overflow: hidden; padding: 0; border: 0; background: #241a4e; position: relative; }
.pz-cell canvas { display: block; width: 100%; height: 100%; }
.pz-cell.sel::after {
  content: ""; position: absolute; inset: 0;
  border: 3px solid var(--gold); border-radius: 8px;
  box-shadow: 0 0 14px rgba(255, 209, 102, .7);
}
.pz-cell.dragging { opacity: .55; }
.pz-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.pz-peek { position: fixed; inset: 0; z-index: 99; display: flex; align-items: center; justify-content: center; background: rgba(10, 6, 24, .85); }
.pz-peek img { width: min(480px, 86vw); border-radius: 18px; }
.pz-drag-ghost {
  position: fixed; z-index: 98; pointer-events: none;
  border-radius: 10px; overflow: hidden;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .5);
}

/* ---------------- 第 5 层 · 装饰蛋糕 ---------------- */
.decor-wrap { display: flex; gap: 16px; align-items: stretch; }
.decor-palette {
  flex: none; width: 118px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  align-content: start;
}
.dchip {
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--glass); color: var(--text);
  padding: 7px 2px 5px; font-size: 11px;
  touch-action: none; user-select: none;
  transition: transform .12s ease, border-color .12s ease;
}
.dchip:hover { border-color: var(--gold); }
.dchip i {
  font-style: normal;
  display: flex; align-items: center; justify-content: center;
  height: 26px; font-size: 22px;
}
.dchip i b { font-size: 21px; font-weight: 900; color: var(--pink-soft); letter-spacing: -1px; }
.dchip.candle { border-color: rgba(255, 209, 102, .55); }
.blow-tip b { color: #fff; font-size: 15px; }
.decor-stage { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.decor-mini {
  width: min(420px, 100%); height: auto;
  aspect-ratio: 380 / 580;
  border-radius: 16px;
  background: rgba(255, 255, 255, .05);
  border: 1px dashed rgba(255, 255, 255, .3);
  touch-action: none;
  cursor: grab;
}
.decor-mini:active { cursor: grabbing; }
.decor-status { font-size: 13px; color: var(--text-dim); }
.decor-status b { color: var(--gold); }
.decor-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.decor-tools { display: flex; gap: 10px; justify-content: center; }
/* 迷你蛋糕上已放置的装饰：可再点一下取消 */
.deco-item { cursor: pointer; }
.deco-item:hover { filter: brightness(1.2) drop-shadow(0 0 6px rgba(255, 209, 102, .75)); }
/* 迷你蛋糕上的蜡烛（含 13 数字蜡烛）：装饰上去就是亮着的，可以直接对着手机吹灭 */
.decor-mini .candle-f.on { opacity: 1; animation: flicker .28s ease-in-out infinite alternate; }

/* ---------------- 收尾庆祝 ---------------- */
.finale-chip {
  position: fixed; top: 96px; left: 50%; transform: translateX(-50%);
  z-index: 96;
  padding: 9px 20px; border-radius: var(--radius-full);
  font-size: 14px; font-weight: 800; color: #1a1030;
  background: linear-gradient(120deg, #ffd166, #ff9dbb);
  box-shadow: 0 12px 30px rgba(255, 209, 102, .45);
  cursor: pointer;
  animation: popIn .35s ease;
}

/* ---------------- FX 画布 ---------------- */
.fx { position: fixed; inset: 0; z-index: 85; pointer-events: none; }

/* ---------------- Toast ---------------- */
#gameToast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  z-index: 97;
  padding: 11px 20px; border-radius: var(--radius-full);
  font-size: 14px; font-weight: 700; color: #1a1030;
  background: linear-gradient(120deg, #ffd166, #ffb347);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  transition: opacity .25s ease, transform .25s ease;
}

/* ---------------- 录音 ---------------- */
.rec-row { display: flex; align-items: center; gap: 10px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff4d6d; animation: recBlink 1s ease-in-out infinite; }
@keyframes recBlink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.rec-time { font-size: 15px; font-weight: 800; color: var(--gold); min-width: 44px; }

/* ---------------- 第 4 层 · 生日歌 ---------------- */
.song-box { text-align: center; padding: 10px 0; }
.song-disc {
  width: 140px; height: 140px; margin: 6px auto 10px;
  border-radius: 50%;
  background: radial-gradient(circle, #2b2340 30%, #3d2a66 50%, #2b2340 70%);
  border: 3px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 50px;
  box-shadow: 0 8px 28px rgba(0,0,0,.4);
}
.song-disc.spin { animation: discSpin 4s linear infinite; }
@keyframes discSpin { to { transform: rotate(360deg); } }
.song-name { margin: 0; font-size: 16px; font-weight: 800; }
.song-name em { display: block; font-style: normal; font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.ch-lyric { min-height: 28px; font-size: 15px; color: var(--text-dim); margin: 12px 0 0; letter-spacing: 2px; }
.ch-lyric .on { color: var(--pink-soft); font-weight: 800; text-shadow: 0 0 12px rgba(255,92,146,.6); }

/* ---------------- 大蛋糕蜡烛：一支支手动点亮 / 吹灭 ---------------- */
#castle .candle-f {
  transition: opacity .6s ease, transform .5s ease;
  opacity: 0;
  transform-origin: 50% 100%;
}
#castle .candle-f.on { opacity: 1; animation: flicker .28s ease-in-out infinite alternate; }
#castle.picking svg { cursor: crosshair; }
@keyframes flicker {
  from { transform: scaleY(.85) rotate(-4deg); opacity: .9; }
  to   { transform: scaleY(1.1) rotate(4deg); opacity: 1; }
}

/* ---------------- 吹蜡烛浮条 ---------------- */
.blow-bar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 96;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, rgba(36,26,78,.96), rgba(27,20,64,.96));
  border: 1px solid rgba(255,209,102,.4);
  box-shadow: 0 12px 36px rgba(0,0,0,.5);
  backdrop-filter: blur(14px);
  animation: popIn .35s ease;
}
.blow-tip { font-size: 13px; color: var(--gold); font-weight: 700; }

/* ---------------- 画作名称 ---------------- */
.paint-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.paint-cell { position: relative; }
.paint-cell img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  border-radius: 10px; cursor: zoom-in;
  border: 1px solid var(--line);
}
.paint-title {
  position: absolute; left: 4px; right: 4px; bottom: 4px;
  padding: 3px 6px; border-radius: 6px;
  background: rgba(10, 6, 24, .72);
  color: var(--text); font-size: 10px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: center;
}

/* ---------------- 移动端 ---------------- */
@media (max-width: 1020px) {
  body { overflow: auto; }
  .screen {
    display: block;
    height: auto; min-height: 100dvh;
    padding: 60px 12px 96px;
  }
  .side { display: none; }
  .castle-wrap { min-height: calc(100dvh - 160px); }
  .dock { display: grid; }
  .topbar { padding: 0 12px; }
  .tb-title { font-size: 13px; }
  .tb-right { gap: 6px; }
  .tb-who, .tb-qr, .tb-reset { padding: 4px 9px; font-size: 11px; max-width: 96px; }
  .tb-progress { padding: 4px 9px; font-size: 11px; }
  .bg-photos img { width: 24vmin; height: 18vmin; border-width: 4px; border-bottom-width: 14px; opacity: .5; }
  .blow-bar { left: 10px; right: 10px; transform: none; bottom: 84px; flex-wrap: wrap; justify-content: center; gap: 8px; }
  .blow-tip { flex: 1 1 100%; text-align: center; }
  .stage { padding: 10px; }
  .stage-inner { max-height: calc(100dvh - 20px); }
  .stage-body { padding: 14px; }
  .decor-wrap { flex-direction: column; }
  .decor-palette { width: 100%; grid-template-columns: repeat(5, 1fr); }
  .pz-board { grid-template-columns: repeat(4, minmax(64px, 1fr)); grid-template-rows: repeat(4, minmax(64px, 1fr)); width: 100%; }
  .pz-board .pz-cell { width: 100%; height: auto; aspect-ratio: 1; }
}

