@font-face {
  font-family: 'JimingHand';
  src: url('assets/fonts/handwriting.ttf') format('truetype');
  font-display: swap;
}

:root {
  --bg-deep: #150304;
  --bg-cinnabar: #4e0a08;
  --bg-crimson: #7c1411;
  --gold-bright: #fae1a5;
  --gold-mid: #dfaf52;
  --gold-dim: #9e6e24;
  --paper-cream: #f6ede0;
  --paper-warm: #ebd8bc;
  --ink-dark: #2c1410;
  --ink-muted: #694338;
  --font-serif: "Songti SC", "Noto Serif SC", "STSong", "SimSun", Georgia, serif;
  --font-hand: "JimingHand", "Songti SC", "STSong", serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #580f0c 0%, #2b0506 58%, #120203 100%);
  color: var(--gold-bright);
  font-family: var(--font-serif);
  -webkit-font-smoothing: antialiased;
}

/* 全屏 3D 画布与氛围暗角 */
#scene3d {
  position: fixed;
  inset: 0;
  z-index: 1;
  cursor: grab;
  touch-action: pan-y;
}
#scene3d:active {
  cursor: grabbing;
}
#scene3d canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.ambient-vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 45%, transparent 32%, rgba(16, 2, 3, 0.56) 100%),
    linear-gradient(to bottom, rgba(16, 2, 3, 0.58) 0%, transparent 18%, transparent 78%, rgba(16, 2, 3, 0.72) 100%);
}

.transition-flash {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 45%, rgba(255, 224, 146, 0.75), rgba(145, 24, 18, 0.25), transparent 72%);
  transition: opacity 0.55s ease;
}
.transition-flash.is-flashing {
  opacity: 1;
}

/* 透明底鎏金素材统一光晕 */
.art-gold-on-red {
  filter: drop-shadow(0 2px 10px rgba(246, 198, 92, 0.34));
  user-select: none;
}

.art-white-screen {
  filter: drop-shadow(0 0 18px rgba(248, 198, 92, 0.44));
  user-select: none;
}

/* 顶部状态栏 */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  background: linear-gradient(to bottom, rgba(22, 4, 5, 0.88), rgba(22, 4, 5, 0.35), transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--gold-bright);
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 8px var(--gold-mid);
}

.stage-nav {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
}
.stage-nav::-webkit-scrollbar {
  display: none;
}

.nav-pill {
  border: 1px solid rgba(235, 191, 102, 0.28);
  background: rgba(45, 7, 7, 0.55);
  color: rgba(250, 225, 165, 0.82);
  font-family: var(--font-serif);
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s ease;
}
.nav-pill:hover {
  border-color: rgba(250, 225, 165, 0.65);
  color: var(--gold-bright);
}
.nav-pill.is-active {
  background: linear-gradient(135deg, rgba(226, 173, 76, 0.32), rgba(140, 28, 22, 0.78));
  border-color: var(--gold-bright);
  color: #fff3d1;
  box-shadow: 0 0 14px rgba(242, 189, 86, 0.28);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(235, 191, 102, 0.34);
  background: rgba(40, 6, 7, 0.68);
  color: var(--gold-bright);
  font-size: 12px;
  font-family: var(--font-serif);
  cursor: pointer;
  transition: all 0.2s ease;
}
.icon-pill.is-on {
  background: rgba(223, 175, 82, 0.24);
  border-color: var(--gold-bright);
  box-shadow: 0 0 12px rgba(242, 189, 86, 0.25);
}

@media (max-width: 720px) {
  .brand {
    display: none;
  }
  .icon-pill .lbl {
    display: none;
  }
  .icon-pill {
    padding: 0 9px;
  }
}

/* 主舞台容器 */
.main-stage {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.stage-panel {
  position: absolute;
  inset: 0;
  padding: 58px 14px max(16px, env(safe-area-inset-bottom));
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s ease;
}
.stage-panel.is-active {
  display: flex;
  flex-direction: column;
  opacity: 1;
}

/* 通用金红按钮 */
.btn-primary-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid #ffe4a3;
  background: linear-gradient(135deg, #f3cf7a 0%, #d49638 55%, #b57322 100%);
  color: #2b0705;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(212, 150, 56, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.55);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.btn-primary-gold:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 26px rgba(244, 202, 114, 0.48);
}
.btn-primary-gold:active:not(:disabled) {
  transform: scale(0.97);
}
.btn-primary-gold:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-ghost-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid rgba(242, 203, 120, 0.45);
  background: rgba(54, 10, 9, 0.72);
  color: var(--gold-bright);
  font-family: var(--font-serif);
  font-size: 13px;
  letter-spacing: 0.06em;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}
.btn-ghost-gold:hover {
  border-color: var(--gold-bright);
  background: rgba(94, 18, 16, 0.85);
}
.btn-sm {
  padding: 7px 13px;
  font-size: 12px;
}

/* ========================================== */
/* 第一幕：轻触许愿（风铃）                      */
/* ========================================== */
#stage-bell.is-active {
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  background: radial-gradient(circle at 50% 44%, rgba(126, 20, 16, 0.38), rgba(22, 4, 5, 0.62) 72%);
}

.bell-hero {
  width: 100%;
  max-width: 480px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  pointer-events: auto;
}

.plaque-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.plaque-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.lotus-top-art {
  width: 168px;
  height: auto;
  opacity: 0.92;
}

.plaque-badge {
  display: inline-block;
  padding: 6px 22px;
  border: 1.5px solid rgba(242, 203, 120, 0.72);
  outline: 1px solid rgba(242, 203, 120, 0.28);
  outline-offset: 3px;
  background: rgba(38, 7, 7, 0.44);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: var(--gold-bright);
  font-size: 20px;
  letter-spacing: 0.28em;
  padding-left: calc(22px + 0.28em);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.36);
}

.bell-interactive {
  position: relative;
  width: 248px;
  height: 290px;
  margin: 4px 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

/* 呼应 PCB 铜线圈的同心方框 */
.pcb-coil-rings {
  position: absolute;
  inset: 14px;
  pointer-events: none;
}
.pcb-coil-rings span {
  position: absolute;
  border: 1px solid rgba(232, 178, 72, 0.22);
  border-radius: 10px;
  animation: coilPulse 4s ease-in-out infinite;
}
.pcb-coil-rings span:nth-child(1) { inset: 0; animation-delay: 0s; }
.pcb-coil-rings span:nth-child(2) { inset: 10px; animation-delay: 0.35s; }
.pcb-coil-rings span:nth-child(3) { inset: 20px; animation-delay: 0.7s; }
.pcb-coil-rings span:nth-child(4) { inset: 30px; animation-delay: 1.05s; }

@keyframes coilPulse {
  0%, 100% { border-color: rgba(232, 178, 72, 0.16); box-shadow: none; }
  50% { border-color: rgba(250, 222, 152, 0.45); box-shadow: 0 0 12px rgba(240, 185, 76, 0.14); }
}

.incense-art {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 68px;
  height: auto;
  opacity: 0.78;
  pointer-events: none;
  animation: incenseFloat 5s ease-in-out infinite;
}
@keyframes incenseFloat {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.72; }
  50% { transform: translateY(-7px) scale(1.03); opacity: 0.94; }
}

.bell-art {
  width: 175px;
  height: auto;
  transform-origin: 50% 4%;
  animation: bellSway 4.2s ease-in-out infinite;
  transition: transform 0.2s ease;
}
@keyframes bellSway {
  0%, 100% { transform: rotate(-2.8deg); }
  50% { transform: rotate(2.8deg); }
}

.bell-interactive.is-ringing .bell-art {
  animation: bellRingBurst 0.95s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes bellRingBurst {
  0% { transform: rotate(0deg) scale(1); }
  18% { transform: rotate(-13deg) scale(1.04); }
  38% { transform: rotate(11deg) scale(1.03); }
  58% { transform: rotate(-7deg) scale(1.01); }
  78% { transform: rotate(4deg); }
  100% { transform: rotate(0deg); }
}

.bell-ripples {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.bell-ripple-wave {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 228, 156, 0.85);
  transform: translate(-50%, -50%) scale(0.4);
  animation: rippleExpand 1.1s ease-out forwards;
}
@keyframes rippleExpand {
  to {
    transform: translate(-50%, -50%) scale(5.6);
    opacity: 0;
  }
}

.bell-title-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.tapwish-art {
  width: 196px;
  height: auto;
}
.tap-hint {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--gold-bright);
  letter-spacing: 0.14em;
}
.bell-subquote {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 16px;
  color: rgba(250, 225, 165, 0.78);
}

.returning-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
}

/* ========================================== */
/* 第二幕：和光同尘 · 3D 七层药师塔              */
/* ========================================== */
#stage-pagoda.is-active {
  overflow: hidden;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}

.pagoda-overlay {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.pagoda-top-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  pointer-events: auto;
}
.heguang-art {
  width: 142px;
  height: auto;
}

.tier-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(29, 5, 5, 0.72);
  border: 1px solid rgba(235, 191, 102, 0.28);
  backdrop-filter: blur(8px);
}

.tier-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(235, 191, 102, 0.35);
  background: rgba(54, 10, 9, 0.6);
  color: rgba(250, 225, 165, 0.55);
  font-size: 11px;
  font-family: var(--font-serif);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}
.tier-dot.is-lit {
  background: radial-gradient(circle, #fff0ba 0%, #e0a73c 70%, #b36f1c 100%);
  border-color: #fff2c6;
  color: #360705;
  font-weight: 700;
  box-shadow: 0 0 14px rgba(255, 208, 104, 0.75);
}
.tier-dot.is-viewing {
  transform: scale(1.16);
  outline: 2px solid rgba(255, 240, 185, 0.65);
  outline-offset: 2px;
}

.drag-tip {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: rgba(250, 225, 165, 0.66);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.pagoda-bottom-dock {
  width: 100%;
  max-width: 480px;
  pointer-events: auto;
}

.tier-card {
  padding: 16px 18px;
  border-radius: 16px;
  background: linear-gradient(155deg, rgba(66, 11, 10, 0.88), rgba(29, 5, 5, 0.92));
  border: 1px solid rgba(236, 193, 104, 0.45);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55), inset 0 0 24px rgba(232, 175, 72, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

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

.tier-badge {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 0.08em;
}
.tier-tag {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(242, 203, 120, 0.4);
  color: #f6dc9c;
  background: rgba(154, 42, 26, 0.35);
}

.tier-poem {
  margin: 0 0 6px;
  font-family: var(--font-hand);
  font-size: 18px;
  color: #ffe6a8;
}

.tier-msg {
  margin: 0 0 14px;
  font-size: 13.5px;
  line-height: 1.65;
  color: rgba(250, 234, 200, 0.9);
}

.tier-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.tier-actions .btn-primary-gold {
  flex: 1;
}

/* ========================================== */
/* 第三幕：愿笺其叁 & 愿有回响（3D 翻转双面笺）    */
/* ========================================== */
#stage-wishes.is-active {
  pointer-events: auto;
  background: radial-gradient(circle at 50% 25%, rgba(92, 14, 12, 0.45), rgba(20, 4, 5, 0.84) 75%);
}

.wishes-shell {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 8px 0 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  pointer-events: auto;
}

.wishes-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.wish3-art {
  width: 168px;
  height: auto;
}
.wishes-lead {
  margin: 0;
  font-size: 13.5px;
  color: rgba(250, 228, 178, 0.88);
  line-height: 1.5;
}
.wishes-counter {
  font-size: 12px;
  padding: 4px 14px;
  border-radius: 999px;
  border: 1px solid rgba(235, 191, 102, 0.35);
  background: rgba(45, 7, 7, 0.72);
  color: var(--gold-bright);
}

.slips-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 900px) {
  .slips-grid {
    grid-template-columns: 1fr;
    max-width: 460px;
    width: 100%;
    margin: 0 auto;
  }
}

.wish-flip-wrap {
  perspective: 1200px;
  min-height: 368px;
}

.wish-flip-inner {
  position: relative;
  width: 100%;
  min-height: 368px;
  transform-style: preserve-3d;
  transition: transform 0.78s cubic-bezier(0.22, 1, 0.36, 1);
}
.wish-flip-wrap.is-flipped .wish-flip-inner {
  transform: rotateY(180deg);
}

.wish-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 16px;
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.48);
}

/* 正面：洒金宣纸写愿面 */
.wish-face-front {
  background:
    radial-gradient(circle at 85% 15%, rgba(212, 150, 56, 0.14), transparent 45%),
    linear-gradient(160deg, #f8efe1 0%, #eedcc1 100%);
  border: 2px solid #cfa04c;
  outline: 1px solid rgba(154, 42, 26, 0.25);
  outline-offset: -6px;
  color: var(--ink-dark);
}

.slip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px dashed rgba(132, 34, 24, 0.28);
  padding-bottom: 8px;
}
.slip-title {
  font-size: 16px;
  font-weight: 700;
  color: #7c1411;
  letter-spacing: 0.06em;
}
.slip-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(124, 20, 17, 0.1);
  color: #7c1411;
}
.slip-prompt {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.slip-textarea {
  width: 100%;
  min-height: 98px;
  resize: none;
  border: 1px solid rgba(176, 124, 48, 0.45);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255, 252, 246, 0.8);
  color: #2c1410;
  font-family: var(--font-hand);
  font-size: 17px;
  line-height: 1.5;
  outline: none;
}
.slip-textarea:focus {
  border-color: #962219;
  box-shadow: 0 0 0 3px rgba(150, 34, 25, 0.12);
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-chip {
  border: 1px solid rgba(150, 34, 25, 0.3);
  background: rgba(255, 250, 240, 0.85);
  color: #7c1411;
  font-family: var(--font-serif);
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tag-chip:hover {
  background: #7c1411;
  color: #fae1a5;
}

.slip-front-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}
.seal-mini-preview {
  width: 34px;
  height: 34px;
  mix-blend-mode: multiply;
  opacity: 0.78;
}
.btn-stamp-wish {
  flex: 1;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid #f0c975;
  background: linear-gradient(135deg, #8b1713, #5a0a08);
  color: #fae1a5;
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.btn-stamp-wish:hover {
  transform: translateY(-1px);
}

/* 背面：朱砂描金「愿有回响」面 */
.wish-face-back {
  transform: rotateY(180deg);
  background:
    radial-gradient(circle at 20% 20%, rgba(242, 189, 86, 0.16), transparent 50%),
    linear-gradient(155deg, #6e100d 0%, #3a0707 62%, #240404 100%);
  border: 2px solid #e3b85b;
  outline: 1px solid rgba(250, 225, 165, 0.3);
  outline-offset: -7px;
  color: var(--gold-bright);
}

.echo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px dashed rgba(242, 203, 120, 0.35);
  padding-bottom: 8px;
}
.echo-kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(250, 225, 165, 0.76);
}
.echo-title {
  margin: 0;
  font-size: 17px;
  color: #ffe8ad;
  letter-spacing: 0.06em;
}
.echo-my-wish {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(20, 3, 4, 0.45);
  border: 1px solid rgba(235, 191, 102, 0.22);
  font-size: 12.5px;
  color: rgba(255, 240, 202, 0.85);
}
.echo-my-wish span {
  color: var(--gold-mid);
  margin-right: 4px;
}
.echo-content {
  margin: 0;
  font-size: 14px;
  line-height: 1.72;
  color: #fff2d4;
}
.echo-quote {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 16.5px;
  color: #f6cf78;
}

.echo-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.echo-seal-stamped {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  padding: 2px;
  background: rgba(246, 237, 224, 0.92);
  box-shadow: 0 0 12px rgba(242, 189, 86, 0.4);
  animation: stampPop 0.45s cubic-bezier(0.22, 1.4, 0.36, 1);
}
@keyframes stampPop {
  0% { transform: scale(2.1) rotate(-14deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.wishes-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

/* ========================================== */
/* 第四幕：心灯长明 · PCB 祈福纪念卡             */
/* ========================================== */
#stage-finale.is-active {
  pointer-events: none;
}

.finale-shell {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-bottom: 24px;
  pointer-events: none;
}

.finale-sky-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  pointer-events: auto;
}

.keepsake-card-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  pointer-events: auto;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.keepsake-card-wrap.is-hidden-for-sky {
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px);
}

.pcb-keepsake-card {
  position: relative;
  width: 100%;
  padding: 20px 18px 18px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 12%, rgba(164, 30, 22, 0.55), transparent 60%),
    linear-gradient(170deg, #6f0d0a 0%, #4d0807 62%, #2c0404 100%);
  border: 2px solid #d9a74c;
  outline: 1px solid rgba(250, 225, 165, 0.32);
  outline-offset: -8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), 0 0 36px rgba(235, 175, 68, 0.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.ks-top {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.ks-lotus-top {
  width: 138px;
  height: auto;
}
.ks-en {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--gold-bright);
  opacity: 0.9;
}
.ks-title-img {
  width: 174px;
  height: auto;
}
.ks-subtitle {
  font-size: 13px;
  letter-spacing: 0.28em;
  padding-left: 0.28em;
  color: rgba(250, 225, 165, 0.88);
}

/* 复刻 PCB 背面的留白框合照位 */
.ks-photo-window {
  width: 100%;
  background: #f7efe2;
  border-radius: 10px;
  padding: 8px 8px 10px;
  border: 1.5px solid #d9a74c;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.38);
  color: var(--ink-dark);
}
.ks-photo-inner {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10.5;
  overflow: hidden;
  border-radius: 6px;
  background: #230606;
}
.ks-photo-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ks-photo-swap {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(24, 5, 5, 0.78);
  border: 1px solid rgba(250, 225, 165, 0.6);
  color: var(--gold-bright);
  font-size: 11px;
  cursor: pointer;
}
.ks-photo-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 7px;
  text-align: center;
}
.ks-photo-meta span {
  font-family: var(--font-hand);
  font-size: 15.5px;
  color: #461c15;
}
.ks-photo-meta em {
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #8b5946;
}

.ks-geo-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 4px;
}
.ks-geo-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ks-loc {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--gold-bright);
}
.ks-coords {
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: rgba(250, 225, 165, 0.78);
}
.ks-code {
  font-family: var(--font-hand);
  font-size: 17px;
  color: #ffe39e;
  margin-top: 2px;
}
.ks-seal-box {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: rgba(246, 237, 224, 0.94);
  border: 1.5px solid #e0b458;
  padding: 4px;
  flex-shrink: 0;
}
.ks-seal-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.ks-wishes-summary {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.ks-wish-item {
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(24, 4, 4, 0.45);
  border: 1px solid rgba(235, 191, 102, 0.25);
  font-size: 12.5px;
  line-height: 1.5;
}
.ks-wish-item strong {
  color: #ffe39d;
}
.ks-wish-item .ks-echo-line {
  margin-top: 3px;
  color: rgba(246, 222, 174, 0.82);
  font-size: 12px;
}

.ks-signature {
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--gold-bright);
  padding-top: 4px;
}

.finale-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* ========================================== */
/* 彩蛋模式：赛博鸡鸣寺 · 每日吉签               */
/* ========================================== */
#stage-fortune.is-active {
  pointer-events: auto;
  background: radial-gradient(circle at 50% 42%, rgba(92, 14, 12, 0.5), rgba(18, 3, 4, 0.86) 76%);
}

.fortune-shell {
  width: 100%;
  max-width: 500px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  pointer-events: auto;
}
.fortune-kicker {
  font-size: 11.5px;
  letter-spacing: 0.16em;
  color: rgba(250, 225, 165, 0.82);
}
.fortune-header h2 {
  margin: 4px 0 4px;
  font-size: 24px;
  color: #ffe8ad;
  letter-spacing: 0.1em;
}
.fortune-header p {
  margin: 0;
  font-size: 13px;
  color: rgba(250, 225, 165, 0.78);
}

.fortune-stage-body {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.tube-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.fortune-tube {
  position: relative;
  width: 136px;
  height: 224px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  outline: none;
}
.fortune-tube.is-shaking {
  animation: tubeShake 0.65s ease-in-out infinite;
}
@keyframes tubeShake {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  20% { transform: rotate(-11deg) translateY(-4px); }
  40% { transform: rotate(10deg) translateY(-6px); }
  60% { transform: rotate(-9deg) translateY(-3px); }
  80% { transform: rotate(8deg) translateY(-5px); }
}

.tube-sticks {
  position: relative;
  width: 82px;
  height: 62px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 7px;
  margin-bottom: -14px;
  z-index: 1;
}
.tube-sticks span {
  width: 7px;
  height: 54px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(to bottom, #ffe7a8, #c98c32);
  border: 1px solid #fff1c8;
  transform-origin: bottom center;
}
.tube-sticks span:nth-child(1) { transform: rotate(-12deg); height: 48px; }
.tube-sticks span:nth-child(2) { transform: rotate(-5deg); height: 56px; }
.tube-sticks span:nth-child(3) { transform: rotate(1deg); height: 60px; }
.tube-sticks span:nth-child(4) { transform: rotate(6deg); height: 53px; }
.tube-sticks span:nth-child(5) { transform: rotate(13deg); height: 47px; }

.fortune-tube.is-popping .tube-sticks span:nth-child(3) {
  transform: translateY(-28px) scale(1.1);
  box-shadow: 0 0 14px #ffe49c;
  transition: transform 0.45s cubic-bezier(0.22, 1.4, 0.36, 1);
}

.tube-cylinder {
  position: relative;
  z-index: 2;
  width: 112px;
  height: 158px;
  border-radius: 12px 12px 18px 18px;
  background: linear-gradient(90deg, #4b0907 0%, #8e1713 38%, #6d100d 72%, #3a0605 100%);
  border: 2px solid #e4ba60;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.6), inset 0 0 18px rgba(242, 189, 86, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.tube-rim {
  position: absolute;
  top: -7px;
  left: -4px;
  right: -4px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #b87e28, #f7d98e, #b87e28);
  border: 1px solid #fff0c2;
}
.tube-label {
  writing-mode: vertical-rl;
  font-size: 20px;
  letter-spacing: 0.25em;
  color: #ffe8af;
  padding: 8px 6px;
  border: 1px solid rgba(242, 203, 120, 0.55);
  background: rgba(34, 5, 5, 0.52);
}
.tube-sub {
  font-size: 8px;
  letter-spacing: 0.14em;
  color: rgba(250, 225, 165, 0.72);
}

.fortune-result-card {
  width: 100%;
  padding: 22px 20px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 0%, rgba(212, 150, 56, 0.16), transparent 55%),
    linear-gradient(160deg, #faf1e2 0%, #edd9ba 100%);
  border: 2px solid #d39f45;
  outline: 1px solid rgba(130, 22, 18, 0.28);
  outline-offset: -8px;
  color: var(--ink-dark);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6);
  animation: fortuneUnfold 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes fortuneUnfold {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.fr-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.fr-num {
  font-size: 13px;
  font-weight: 700;
  color: #7c1411;
  letter-spacing: 0.1em;
}
.fr-rank {
  padding: 3px 12px;
  border-radius: 999px;
  background: #8b1713;
  color: #ffe5a3;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.fr-title {
  margin: 10px 0 6px;
  font-size: 24px;
  color: #5e0d0a;
  letter-spacing: 0.14em;
}
.fr-poem {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 19px;
  color: #7c1411;
  line-height: 1.6;
}
.fr-divider {
  height: 1px;
  margin: 12px 0;
  background: linear-gradient(to right, transparent, rgba(140, 34, 24, 0.35), transparent);
}
.fr-meaning {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.7;
  color: #3a1a15;
  text-align: left;
}
.fr-yiji {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(124, 20, 17, 0.08);
  text-align: left;
  font-size: 12.5px;
  color: #4b231c;
}
.yi-tag,
.ji-tag {
  display: inline-block;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: 4px;
  margin-right: 8px;
  font-weight: 700;
  font-size: 11px;
}
.yi-tag { background: #8b1713; color: #fae1a5; }
.ji-tag { background: #5a423a; color: #f6ede0; }

.fr-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}
.fr-actions .btn-ghost-gold {
  color: #7c1411;
  border-color: rgba(124, 20, 17, 0.4);
  background: rgba(255, 252, 245, 0.7);
}

/* ========================================== */
/* 快速编辑弹窗与提示                            */
/* ========================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10, 2, 2, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  border-radius: 16px;
  background: linear-gradient(160deg, #4f0c0a, #240505);
  border: 1.5px solid #d9a74c;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(235, 191, 102, 0.25);
}
.modal-head h3 {
  margin: 0;
  font-size: 16px;
  color: var(--gold-bright);
}
.icon-close {
  border: none;
  background: transparent;
  color: var(--gold-bright);
  font-size: 18px;
  cursor: pointer;
}
.modal-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: rgba(250, 225, 165, 0.85);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  color: var(--gold-bright);
}
.field input[type="text"] {
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid rgba(235, 191, 102, 0.35);
  background: rgba(22, 4, 4, 0.65);
  color: #fff2d4;
  font-family: var(--font-serif);
  font-size: 13.5px;
}
.inline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.modal-foot {
  padding: 12px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  border-top: 1px solid rgba(235, 191, 102, 0.2);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  z-index: 80;
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(29, 5, 5, 0.92);
  border: 1px solid #e3b85b;
  color: #ffe8ad;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  white-space: nowrap;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[hidden] {
  display: none !important;
}
