/* 《回声老宅》样式 — 恐怖暗黑 UI */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; }
body { font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif; color: #cfc8bc; -webkit-user-select: none; user-select: none; }

#app { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #000; }
#scene { display: block; background: #000; box-shadow: 0 0 80px rgba(0,0,0,0.9); }

/* ---------- 通用覆盖层 ---------- */
.screen { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 30; }
.screen.show { display: flex; }
.overlay-bg { position: absolute; inset: 0; background: rgba(2, 3, 6, 0.82); backdrop-filter: blur(2px); }
.panel {
  position: relative; background: rgba(10, 8, 10, 0.96);
  border: 1px solid #3a2a26; box-shadow: 0 0 0 3px rgba(0,0,0,0.6), 0 0 40px rgba(80, 10, 10, 0.25), inset 0 0 60px rgba(0,0,0,0.8);
  padding: 34px 42px; max-width: 86vw; max-height: 86vh; overflow: auto;
  text-align: center;
}
.panel h1, .panel h2 { font-family: Georgia, "Times New Roman", serif; letter-spacing: 6px; color: #d8c8b0; text-shadow: 0 0 18px rgba(200, 60, 40, 0.5); margin-bottom: 18px; }
.panel h2 { font-size: 22px; letter-spacing: 4px; }
.panel p { line-height: 1.9; color: #a89e8e; font-size: 14px; }

.btn {
  display: inline-block; min-width: 210px; margin: 8px 6px; padding: 12px 26px;
  font-family: inherit; font-size: 15px; letter-spacing: 4px; cursor: pointer;
  color: #d8c8b0; background: linear-gradient(#241a16, #1a120e);
  border: 1px solid #4a342a; outline: none;
  transition: all 0.18s; text-shadow: 0 1px 2px #000;
}
.btn:hover { background: linear-gradient(#3a2418, #241208); border-color: #8a4a2a; box-shadow: 0 0 14px rgba(200, 80, 30, 0.35); color: #fff; transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.danger { border-color: #6a1a12; color: #e8b0a0; }
.btn.danger:hover { background: linear-gradient(#4a1208, #2a0a04); border-color: #b02010; box-shadow: 0 0 16px rgba(220, 30, 10, 0.45); }
.btn.ghost { background: transparent; border-color: #3a2a22; color: #a89e8e; }
.btn.ghost:hover { color: #fff; border-color: #6a4a32; background: rgba(255,255,255,0.04); }
.btn.small { min-width: 130px; padding: 8px 14px; font-size: 13px; letter-spacing: 2px; }

/* ---------- 主菜单 ---------- */
#scr-menu .title-wrap { position: relative; }
#title-main {
  font-family: Georgia, "STKaiti", "KaiTi", serif; font-size: clamp(40px, 8vw, 76px);
  color: #d8c8b0; letter-spacing: 18px; text-shadow: 0 0 26px rgba(190, 50, 30, 0.55), 0 0 80px rgba(120, 20, 10, 0.35);
  animation: flicker 4s infinite;
}
#title-sub { font-size: 13px; letter-spacing: 10px; color: #7a6a5a; margin: 6px 0 26px; animation: fadeIn 3s; }
@keyframes flicker {
  0%, 100% { opacity: 1; } 92% { opacity: 1; } 93% { opacity: 0.6; } 94% { opacity: 1; }
  96% { opacity: 0.8; } 97% { opacity: 1; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes pulseRed { 0%,100% { opacity: 0.25; } 50% { opacity: 0.5; } }
#menu-hint { margin-top: 22px; font-size: 12px; color: #5a5248; letter-spacing: 3px; }
#menu-hint .key { color: #9a8a78; border: 1px solid #3a3228; padding: 1px 6px; margin: 0 2px; }

/* ---------- 开场剧情 ---------- */
#scr-intro { cursor: pointer; }
#intro-text {
  white-space: pre-line; font-family: Georgia, "STKaiti", serif; font-size: clamp(15px, 2.2vw, 21px);
  line-height: 2.1; color: #b8aa96; letter-spacing: 2px; min-height: 40vh; max-width: 620px;
  text-shadow: 0 0 12px rgba(0,0,0,0.9);
}
#intro-hint { display: none; margin-top: 26px; color: #8a5a4a; letter-spacing: 6px; animation: pulseRed 1.6s infinite; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; display: none; }
#hud.show { display: block; }
#hud.hunt { animation: huntShake 0.28s infinite; }
@keyframes huntShake { 0% { transform: translate(0,0); } 25% { transform: translate(1.5px,-1px); } 50% { transform: translate(-1px,1.5px); } 75% { transform: translate(-1.5px,-1px); } 100% { transform: translate(0,0); } }

#obj-box { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); text-align: center; max-width: 46vw; }
#obj-title { font-size: 11px; letter-spacing: 6px; color: #8a5a4a; margin-bottom: 4px; }
#obj-text { font-size: 14px; color: #d8c8b0; letter-spacing: 1.5px; min-height: 20px; text-shadow: 0 0 8px rgba(0,0,0,0.9); }

#minimap { position: absolute; top: 14px; left: 14px; width: 132px; height: 132px; border: 1px solid rgba(120,90,70,0.45); box-shadow: 0 0 14px rgba(0,0,0,0.8); opacity: 0.88; }
#timer { position: absolute; top: 14px; right: 16px; font-family: "Courier New", monospace; font-size: 16px; color: #c8a878; letter-spacing: 2px; text-shadow: 0 0 10px #000; }
#frags { position: absolute; top: 38px; right: 16px; font-size: 12px; color: #d8b878; letter-spacing: 2px; }

#inventory { position: absolute; left: 16px; bottom: 18px; display: flex; gap: 8px; }
.inv-hand, .inv-item {
  display: inline-block; padding: 4px 10px; font-size: 12px; letter-spacing: 1px;
  border: 1px solid #4a3a2a; background: rgba(10,8,10,0.8); color: #c8bca8;
}
.inv-hand.red { border-color: #8a2a2a; color: #ff8a7a; }
.inv-hand.gold { border-color: #8a7420; color: #e8c860; }
.inv-hand.blue { border-color: #2a4a8a; color: #8ab8ff; }
.inv-hand.green { border-color: #2a6a3a; color: #8ae0a0; }
.inv-empty { color: #4a4438; font-size: 12px; }

#bars { position: absolute; right: 16px; bottom: 18px; width: 190px; }
.bar { height: 12px; border: 1px solid #3a3228; background: rgba(8,8,10,0.85); margin-bottom: 7px; position: relative; overflow: hidden; }
.bar span { position: absolute; right: 6px; top: -1px; font-size: 10px; color: #9a8e7a; letter-spacing: 1px; }
#stamina-fill { width: 100%; height: 100%; background: linear-gradient(#6a8a5a, #4a6a3a); transition: width 0.12s; }
#fear-fill { width: 20%; height: 100%; background: linear-gradient(#7a3a3a, #3a1515); transition: width 0.2s; }
#fear-fill.high { background: linear-gradient(#9a2a2a, #6a1010); box-shadow: 0 0 10px rgba(220,30,30,0.6); }

#prompt { position: absolute; left: 50%; bottom: 21%; transform: translateX(-50%); display: none; font-size: 15px; color: #e8dcc8; letter-spacing: 3px; background: rgba(8,6,8,0.72); padding: 8px 18px; border: 1px solid #4a3a2a; box-shadow: 0 0 16px rgba(0,0,0,0.8); }
#prompt.show { display: block; animation: toastIn 0.25s; }
#hint { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); font-size: 11px; color: #6a6052; letter-spacing: 1px; white-space: nowrap; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -1.5px 0 0 -1.5px; background: rgba(255,250,240,0.75); border-radius: 50%; box-shadow: 0 0 4px rgba(0,0,0,0.9); }
#pause-btn { position: absolute; top: 12px; right: 150px; pointer-events: auto; background: rgba(10,8,10,0.7); border: 1px solid #3a2e22; color: #9a8e7a; padding: 4px 10px; font-size: 12px; cursor: pointer; letter-spacing: 2px; }
#pause-btn:hover { color: #fff; border-color: #6a4a32; }

/* ---------- 谜题面板 ---------- */
.pzl-row { display: flex; justify-content: center; gap: 14px; margin: 18px 0; flex-wrap: wrap; }
.c-slot { width: 58px; height: 58px; border: 2px dashed #4a3a2a; display: flex; align-items: center; justify-content: center; font-size: 18px; color: #e8dcc8; background: rgba(0,0,0,0.4); }
.c-hand { width: 52px; height: 52px; border: 1px solid #4a3a2a; background: #1a1410; color: #e8dcc8; font-size: 16px; cursor: pointer; }
.c-hand:disabled { opacity: 0.25; cursor: default; }
.c-hand.red { border-color: #8a2a2a; } .c-hand.gold { border-color: #8a7420; }
.c-hand.blue { border-color: #2a4a8a; } .c-hand.green { border-color: #2a6a3a; }
.p-thumb { width: 96px; padding: 6px; background: #14100c; border: 1px solid #3a2a22; cursor: pointer; transition: all 0.15s; }
.p-thumb img { width: 100%; display: block; }
.p-thumb div { font-size: 12px; color: #a89e8e; margin-top: 4px; letter-spacing: 2px; }
.p-thumb:hover { border-color: #8a5a2a; transform: scale(1.05); box-shadow: 0 0 12px rgba(200,120,40,0.3); }
#p-progress { font-size: 13px; color: #8a7a5a; letter-spacing: 3px; margin-bottom: 6px; min-height: 18px; }
.d-dial { display: flex; align-items: center; gap: 10px; margin: 0 10px; }
.d-btn { width: 42px; height: 42px; background: #1a1410; border: 1px solid #4a3a2a; color: #d8c8b0; font-size: 16px; cursor: pointer; }
.d-btn:hover { background: #2a2018; border-color: #8a5a2a; }
.d-val { width: 92px; height: 62px; display: flex; align-items: center; justify-content: center; border: 2px solid #4a3a2a; background: #0c0a0c; font-size: 16px; letter-spacing: 4px; color: #e8dcc8; }

/* ---------- 纸条 ---------- */
#note-title { font-family: "KaiTi", Georgia, serif; font-size: 19px; color: #c8b890; letter-spacing: 4px; margin-bottom: 14px; }
#note-body { font-family: "KaiTi", Georgia, serif; font-size: 16px; line-height: 2; color: #b0a488; white-space: pre-line; text-align: left; max-width: 480px; }

/* ---------- 跳杀 / 结局 ---------- */
#jumpscare {
  position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 42%, rgba(160,10,10,0.55), rgba(0,0,0,0.98) 75%);
}
#jumpscare.show { display: flex; }
#jumpscare .face {
  width: min(78vh, 82vw); height: min(78vh, 82vw);
  background-size: contain; background-repeat: no-repeat; background-position: center;
  animation: scareIn 0.22s cubic-bezier(0.1, 0.9, 0.3, 1.4) forwards, scareShake 0.12s 2;
}
@keyframes scareIn { from { transform: scale(0.15) rotate(-8deg); opacity: 0; } to { transform: scale(1.12) rotate(2deg); opacity: 1; } }
@keyframes scareShake { 0% { transform: translateX(0); } 25% { transform: translateX(-14px); } 50% { transform: translateX(12px); } 75% { transform: translateX(-8px); } 100% { transform: translateX(0); } }

#redpulse { position: fixed; inset: 0; z-index: 18; pointer-events: none; display: none; background: radial-gradient(ellipse at center, rgba(0,0,0,0) 42%, rgba(180,10,10,0.42) 100%); }

#fade { position: fixed; inset: 0; z-index: 70; background: #000; opacity: 0; pointer-events: none; }

#toast {
  position: fixed; top: 12%; left: 50%; transform: translateX(-50%); z-index: 40;
  display: none; font-size: 15px; letter-spacing: 3px; color: #e8dcc8;
  background: rgba(8,6,8,0.85); border: 1px solid #6a3a2a; padding: 10px 22px;
  box-shadow: 0 0 24px rgba(120,20,10,0.4); text-align: center; white-space: nowrap; max-width: 80vw;
}
#toast.show { display: block; animation: toastIn 0.3s; }

/* ---------- 设置 ---------- */
.set-row { display: flex; align-items: center; justify-content: space-between; width: 320px; margin: 10px auto; font-size: 14px; color: #a89e8e; }
.set-row label { letter-spacing: 3px; }
input[type=range] { width: 150px; accent-color: #8a4a2a; background: #1a1410; }

/* ---------- 统计 ---------- */
.stat-line { font-size: 14px; color: #a89e8e; margin: 6px 0; letter-spacing: 2px; }
.stat-line b { color: #d8c8b0; font-size: 16px; }

/* ---------- 仪式 ---------- */
#ritual-ui { background: rgba(2,2,4,0.55); }
#ritual-progress { position: fixed; top: 18%; left: 50%; transform: translateX(-50%); font-size: 17px; letter-spacing: 6px; color: #ffd76a; text-shadow: 0 0 16px rgba(255,180,60,0.7); z-index: 31; }
#chant-btn {
  position: fixed; z-index: 32; display: none; width: 150px; height: 150px; border-radius: 50%;
  border: 2px solid #ffd76a; color: #ffd76a; font-size: 26px; letter-spacing: 8px; cursor: pointer;
  background: radial-gradient(circle, rgba(120,70,10,0.55), rgba(40,20,4,0.85));
  box-shadow: 0 0 40px rgba(255,190,80,0.55); text-shadow: 0 0 10px #000;
  animation: chantPulse 0.5s infinite;
}
@keyframes chantPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }

/* ---------- 移动端 ---------- */
#touch-ui { position: fixed; inset: 0; z-index: 22; display: none; pointer-events: none; }
#touch-ui .tbtn {
  pointer-events: auto; position: absolute; width: 54px; height: 54px; border-radius: 50%;
  background: rgba(20,16,18,0.72); border: 1px solid #4a3a2a; color: #c8bca8;
  font-size: 20px; display: flex; align-items: center; justify-content: center;
}
#btn-touch-int { right: 14px; bottom: 96px; }
#btn-touch-light { right: 78px; bottom: 34px; }
#btn-touch-rock { right: 14px; bottom: 158px; }
#btn-touch-run { right: 84px; bottom: 96px; width: 66px; height: 66px; font-size: 13px; letter-spacing: 2px; }
#joy { position: fixed; z-index: 21; width: 110px; height: 110px; border-radius: 50%; border: 1px solid rgba(140,110,80,0.4); background: rgba(10,10,14,0.35); display: none; pointer-events: none; }
#joy-knob { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: rgba(180,150,120,0.5); border: 1px solid rgba(220,190,150,0.5); }

@media (max-width: 700px) {
  #obj-box { max-width: 72vw; }
  #minimap { width: 96px; height: 96px; }
  #hint { display: none; }
}

/* 无障碍: 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01s !important; animation-iteration-count: 1 !important; transition-duration: 0.01s !important; }
}

/* HUD 全屏按钮 */
#btn-fullscreen { position: absolute; top: 12px; right: 110px; pointer-events: auto; background: rgba(10,8,10,0.7); border: 1px solid #3a2e22; color: #9a8e7a; padding: 4px 10px; font-size: 13px; cursor: pointer; }
#btn-fullscreen:hover { color: #fff; border-color: #6a4a32; }
