/* =====================================================
   ONE WISH WILLOW — 主页面样式
   按《痴迷》(Obsession 2026) 道具规格：
   三面宝石状纸盒 + 灰底白斑枯枝（干枯仙人掌骨架感）
   ===================================================== */

/* ---------- 基础重置 ---------- */
*,*::before,*::after { margin:0; padding:0; box-sizing:border-box; }
html, body { width:100%; height:100%; overflow:hidden; }
body {
  font-family: 'Georgia', 'Times New Roman', serif;
  color: #e8e0d0;
  background: #0a0805;
  user-select: none;
}

/* ---------- 昏暗杂货店柜台 ---------- */
.counter {
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% 75%, rgba(120,90,50,0.35), transparent 70%),
    linear-gradient(180deg, #0d0b08 0%, #15110a 40%, #1a140d 60%, #0d0a06 100%);
  z-index: 0;
}
.counter::after {
  content:'';
  position:absolute; inset:0;
  background:
    repeating-linear-gradient(90deg, transparent 0 80px, rgba(255,255,255,0.008) 80px 81px),
    repeating-linear-gradient(0deg, transparent 0 60px, rgba(255,255,255,0.006) 60px 61px);
  pointer-events:none;
}

/* 漂浮微尘 */
.dust { position:fixed; inset:0; z-index:1; pointer-events:none; overflow:hidden; }
.dust::before, .dust::after {
  content:''; position:absolute; inset:-10%;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(220,200,160,0.4), transparent),
    radial-gradient(1px 1px at 30% 50%, rgba(220,200,160,0.3), transparent),
    radial-gradient(1.5px 1.5px at 50% 30%, rgba(220,200,160,0.35), transparent),
    radial-gradient(1px 1px at 70% 60%, rgba(220,200,160,0.25), transparent),
    radial-gradient(1px 1px at 90% 40%, rgba(220,200,160,0.3), transparent),
    radial-gradient(1.5px 1.5px at 20% 80%, rgba(220,200,160,0.2), transparent),
    radial-gradient(1px 1px at 60% 85%, rgba(220,200,160,0.3), transparent),
    radial-gradient(1px 1px at 80% 15%, rgba(220,200,160,0.25), transparent);
  animation: dustDrift 30s linear infinite;
}
.dust::after { animation-delay: -15s; opacity: 0.6; }
@keyframes dustDrift { to { transform: translateY(-40px) translateX(20px); } }

/* 暗角 */
.vignette {
  position:fixed; inset:0; z-index:2; pointer-events:none;
  background: radial-gradient(ellipse 80% 60% at 50% 50%, transparent 40%, rgba(0,0,0,0.7) 100%);
}

/* ---------- 主舞台 ---------- */
.stage {
  position: relative; z-index: 10;
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 28px;
  padding: 20px;
}

/* ---------- 标题 ---------- */
.title-block { text-align:center; }
.brand {
  font-size: clamp(28px, 5vw, 48px);
  letter-spacing: 0.3em;
  color: #c9b88a;
  text-shadow: 0 0 20px rgba(180,150,80,0.3), 0 2px 4px rgba(0,0,0,0.8);
  font-weight: normal;
}
.subtitle {
  margin-top: 6px;
  font-size: 14px;
  letter-spacing: 0.5em;
  color: #8a7a5a;
  font-style: italic;
}

/* ---------- 3D 盒子场景 ---------- */
.box-scene {
  perspective: 1200px;
  width: 320px; height: 260px;
  display: flex; align-items: center; justify-content: center;
}
.box {
  position: relative;
  width: 200px; height: 160px;
  transform-style: preserve-3d;
  transform: rotateX(-8deg) rotateY(-12deg);
  transition: transform 0.6s ease;
  cursor: pointer;
}
.box:hover { transform: rotateX(-8deg) rotateY(-6deg); }

/* 盒盖 */
.box-lid {
  position: absolute;
  top: -2px; left: -10px;
  width: 220px; height: 50px;
  transform-style: preserve-3d;
  transform-origin: top center;
  transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 5;
}
.box-lid .lid-inner {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #c9b88a, #a89868);
  border: 2px solid #6a5a30;
  display: flex; align-items: center; justify-content: center;
  transform: translateZ(1px);
}
.lid-text {
  font-size: 10px; letter-spacing: 0.2em; color: #5a4a20; font-style: italic;
}
/* 盒盖翻开后 */
.box.lid-open .box-lid {
  transform: rotateX(-140deg);
}

/* 盒体 */
.box-body {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
}
.box-face {
  position: absolute;
  border: 2px solid #5a4a20;
  backface-visibility: hidden;
}
/* 正面 */
.box-front {
  width: 200px; height: 160px;
  background: linear-gradient(160deg, #d4c4a0 0%, #c0b080 50%, #a89868 100%);
  transform: translateZ(60px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px;
  box-shadow: inset 0 0 30px rgba(100,80,40,0.2);
}
.box-brand {
  font-size: 18px; font-weight: bold; letter-spacing: 0.15em;
  color: #2a1a0a; text-align: center; line-height: 1.2;
}
.box-tagline {
  margin-top: 6px; font-size: 10px; color: #5a3a1a; text-align: center; line-height: 1.3;
}
.box-tagline b { color: #8b0000; font-size: 11px; }
.box-crack {
  margin-top: 4px; font-size: 14px; font-weight: bold; color: #8b0000;
  letter-spacing: 0.3em; text-shadow: 0 0 6px rgba(139,0,0,0.4);
}
.box-figures { display:flex; gap:16px; margin-top:6px; }
.box-boy, .box-girl {
  width:18px; height:24px; border-radius:50% 50% 40% 40%;
  background: #4a3a2a; position:relative;
}
.box-boy::after, .box-girl::after {
  content:''; position:absolute; bottom:-6px; left:50%; transform:translateX(-50%);
  width:14px; height:8px; background:#4a3a2a; border-radius:0 0 50% 50%;
}
.box-price {
  position:absolute; bottom:6px; right:10px;
  font-size:11px; color:#2a1a0a; font-weight:bold;
}

/* 左侧面 */
.box-left {
  width: 120px; height: 160px;
  background: linear-gradient(160deg, #c0b080, #a08858);
  transform: rotateY(-90deg) translateZ(60px);
  padding: 12px 8px;
}
/* 右侧面 */
.box-right {
  width: 120px; height: 160px;
  background: linear-gradient(160deg, #c0b080, #a08858);
  transform: rotateY(90deg) translateZ(140px);
  padding: 12px 8px;
}
.side-title {
  font-size: 13px; font-weight: bold; color: #8b0000;
  letter-spacing: 0.2em; margin-bottom: 8px; text-align: center;
  border-bottom: 1px solid #8b0000; padding-bottom: 4px;
}
.side-list { list-style: none; font-size: 9px; color: #3a2a1a; line-height: 1.8; }

/* 顶面（盒内） */
.box-top {
  width: 200px; height: 120px;
  background: #1a1208;
  transform: rotateX(90deg) translateZ(60px);
  transform-origin: top center;
}
.velvet {
  position: absolute; inset: 4px;
  background:
    radial-gradient(ellipse 70% 60% at 50% 50%, #2a1a0e, #150d06);
  border-radius: 4px;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 10px;
  overflow: hidden;
}

/* ---------- 柳枝（干枯仙人掌骨架感） ---------- */
.willow {
  position: relative;
  width: 60px; height: 140px;
  transform-origin: bottom center;
  animation: willowSway 4s ease-in-out infinite;
}
@keyframes willowSway {
  0%, 100% { transform: rotate(-2deg); }
  50%      { transform: rotate(2deg); }
}

.stem { position: relative; width:100%; height:100%; }
.stem-main {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 8px; height: 130px;
  background: linear-gradient(90deg, #6a6050 0%, #8a8070 40%, #7a7058 70%, #5a5040 100%);
  border-radius: 4px 4px 2px 2px;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.4);
}

/* 白椭圆斑点（史酷比阴森森林上色风） */
.spot {
  position: absolute;
  width: 5px; height: 3px;
  background: rgba(230,225,210,0.85);
  border-radius: 50%;
  box-shadow: 0 0 2px rgba(230,225,210,0.4);
}

/* 预切断点 */
.break-notch {
  position: absolute;
  left: 50%; top: 45%;
  transform: translateX(-50%);
  width: 12px; height: 4px;
  background: rgba(0,0,0,0.5);
  border-radius: 2px;
  box-shadow: 0 0 4px rgba(0,0,0,0.6);
  z-index: 2;
}

/* 分叉枝条 */
.branch {
  position: absolute;
  background: linear-gradient(90deg, #7a7058, #5a5040);
  border-radius: 2px;
  transform-origin: bottom center;
}
.b1 { width:3px; height:28px; left:52%; top:8%;  transform:rotate(15deg); }
.b2 { width:2px; height:22px; left:48%; top:18%; transform:rotate(-20deg); }
.b3 { width:3px; height:35px; left:54%; top:28%; transform:rotate(25deg); }
.b4 { width:2px; height:18px; left:46%; top:38%; transform:rotate(-30deg); }
.b5 { width:3px; height:24px; left:52%; top:48%; transform:rotate(10deg); }

/* 折断时的上半截（坠落动画用） */
.stem-snapped {
  position: absolute;
  width: 60px; height: 70px;
  left: 50%; top: 0;
  transform: translateX(-50%);
  transform-origin: top center;
  z-index: 3;
  pointer-events: none;
}
.stem-snapped .stem-main {
  height: 65px;
  background: linear-gradient(90deg, #5a5040 0%, #7a7058 40%, #6a6050 100%);
}
.stem-snapped .branch { display:none; }
.stem-snapped .spot { opacity: 0.7; }

/* ---------- 弯曲 / 断裂动画 ---------- */
.willow.bending { animation: bendWillow 1.2s ease-in forwards; }
@keyframes bendWillow {
  0%   { transform: rotate(0deg) scale(1); }
  30%  { transform: rotate(-8deg) scale(1.02); }
  60%  { transform: rotate(6deg) scale(1.05); }
  80%  { transform: rotate(-4deg) scale(1.03); }
  100% { transform: rotate(0deg) scale(0.95); opacity: 0.3; }
}

.willow.snapped { opacity: 0; transition: opacity 0.3s; }

/* 坠落的上半截 */
.stem-snapped.falling {
  animation: fallSnapped 1.5s ease-in forwards;
}
@keyframes fallSnapped {
  0%   { transform: translateX(-50%) rotate(0deg) translateY(0); opacity:1; }
  40%  { transform: translateX(-30%) rotate(45deg) translateY(40px); opacity:0.9; }
  100% { transform: translateX(10%) rotate(120deg) translateY(180px); opacity:0; }
}

/* ---------- 许愿表单 ---------- */
.wish-form {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: min(420px, 90vw);
  z-index: 10;
}
.form-label {
  font-size: 13px; color: #8a7a5a; letter-spacing: 0.3em; font-style: italic;
}
#wishInput {
  width: 100%; min-height: 70px; max-height: 120px;
  padding: 12px 16px;
  background: rgba(20,16,10,0.85);
  border: 1px solid #4a3a20;
  border-radius: 6px;
  color: #e8e0d0;
  font-family: inherit; font-size: 15px;
  resize: vertical;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}
#wishInput:focus {
  border-color: #8a7a4a;
  box-shadow: 0 0 12px rgba(180,150,80,0.2);
}
#wishInput::placeholder { color: #5a4a30; font-style: italic; }

.crack-btn {
  position: relative; overflow: hidden;
  padding: 12px 36px;
  background: linear-gradient(135deg, #2a1a0a, #3a2a1a);
  border: 1px solid #6a5a30;
  border-radius: 4px;
  color: #c9b88a;
  font-family: inherit; font-size: 15px; letter-spacing: 0.2em;
  cursor: pointer;
  transition: all 0.3s;
}
.crack-btn:hover {
  background: linear-gradient(135deg, #3a2a1a, #4a3a2a);
  box-shadow: 0 0 20px rgba(180,150,80,0.3);
  transform: translateY(-1px);
}
.crack-btn:active { transform: translateY(0); }
.btn-shine {
  position:absolute; top:0; left:-100%; width:50%; height:100%;
  background: linear-gradient(90deg, transparent, rgba(255,240,200,0.15), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s;
}
.crack-btn:hover .btn-shine { left: 150%; }
.crack-btn:disabled { opacity:0.4; cursor:not-allowed; }

.form-hint { font-size: 11px; color: #5a4a30; letter-spacing: 0.2em; }

/* ---------- 折断演出遮罩 ---------- */
.ritual-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5,3,1,0.92);
  display: none;
  align-items: center; justify-content: center;
  flex-direction: column;
}
.ritual-overlay.active { display: flex; }

.ritual-stage { position: relative; text-align: center; }

.ritual-lines { position: relative; z-index: 2; }
.line {
  font-size: clamp(22px, 4vw, 38px);
  color: #c9b88a;
  letter-spacing: 0.4em;
  opacity: 0;
  margin: 18px 0;
  text-shadow: 0 0 30px rgba(180,150,80,0.5);
  transition: opacity 0.8s ease;
}
.line.show { opacity: 1; }
#line3 { color: #ff6a4a; text-shadow: 0 0 40px rgba(255,80,40,0.6); font-size: clamp(28px,5vw,48px); }
#line4 { color: #8a7a5a; font-style: italic; }

/* 闪光 */
.flash-bang {
  position: absolute; top:50%; left:50%;
  width: 0; height: 0;
  background: radial-gradient(circle, rgba(255,250,230,0.95) 0%, transparent 70%);
  transform: translate(-50%,-50%);
  z-index: 3;
  pointer-events: none;
}
.flash-bang.fire {
  animation: flashFire 0.6s ease-out forwards;
}
@keyframes flashFire {
  0%   { width:0; height:0; opacity:1; }
  30%  { width:120vmax; height:120vmax; opacity:0.9; }
  100% { width:120vmax; height:120vmax; opacity:0; }
}

/* 粒子 */
.particles { position:absolute; inset:0; pointer-events:none; z-index:2; }
.particle {
  position:absolute; top:50%; left:50%;
  width:4px; height:4px; border-radius:50%;
  background: #8a8070;
  opacity:0;
}
.particle.p1 { background:#a89878; }
.particle.p2 { background:#6a6050; }
.particle.p3 { background:#c9b88a; }
.particle.p4 { background:#5a5040; }
.particle.p5 { background:#d4c4a0; }

/* 屏幕震动 */
body.shaking { animation: screenShake 0.5s ease-in-out; }
@keyframes screenShake {
  0%,100% { transform:translate(0,0); }
  10% { transform:translate(-4px,2px); }
  20% { transform:translate(3px,-3px); }
  30% { transform:translate(-3px,3px); }
  40% { transform:translate(2px,-2px); }
  50% { transform:translate(-2px,1px); }
  60% { transform:translate(1px,-1px); }
  70% { transform:translate(-1px,1px); }
  80% { transform:translate(1px,0); }
  90% { transform:translate(-1px,0); }
}

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.8);
  display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal.active { display: flex; }
.modal-card {
  background: linear-gradient(160deg, #1a140d, #0f0c08);
  border: 1px solid #4a3a20;
  border-radius: 8px;
  padding: 36px 40px;
  text-align: center;
  max-width: 420px;
  animation: modalIn 0.5s ease-out;
  box-shadow: 0 0 60px rgba(0,0,0,0.8), inset 0 0 30px rgba(100,80,40,0.05);
}
@keyframes modalIn {
  from { opacity:0; transform:scale(0.9) translateY(20px); }
  to   { opacity:1; transform:scale(1) translateY(0); }
}
.modal-title {
  font-size: 28px; color: #c9b88a; letter-spacing: 0.3em; margin-bottom: 4px;
}
.modal-sub {
  font-size: 14px; color: #8b0000; letter-spacing: 0.5em; margin-bottom: 20px;
  font-style: italic;
}
.modal-wish {
  font-size: 16px; color: #e8e0d0;
  background: rgba(40,30,15,0.5);
  border-left: 3px solid #6a5a30;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-style: italic;
  line-height: 1.5;
}
.modal-epitaph {
  font-size: 13px; color: #6a5a40; letter-spacing: 0.2em; margin-bottom: 24px;
}
.confirm-btn {
  padding: 10px 32px;
  background: transparent;
  border: 1px solid #6a5a30;
  border-radius: 4px;
  color: #8a7a5a;
  font-family: inherit; font-size: 13px; letter-spacing: 0.3em;
  cursor: pointer;
  transition: all 0.3s;
}
.confirm-btn:hover { background: rgba(100,80,40,0.2); color: #c9b88a; }

/* ---------- 再次来访遮罩 ---------- */
.return-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: #0a0805;
  display: none; align-items: center; justify-content: center;
}
.return-overlay.active { display: flex; }
.return-overlay p {
  font-size: 18px; color: #5a4a30; letter-spacing: 0.4em; font-style: italic;
}

/* ---------- 渐隐过渡 ---------- */
body.fading { animation: fadeOut 1.2s ease-in forwards; }
@keyframes fadeOut {
  to { opacity: 0; }
}
