/* ============================================================
   老屋 · 中式梦核 逃脱游戏 — 样式表
   怀旧 CRT / 黄昏色调 / 纯 CSS 场景美术
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0d0c0a; }
body {
  font-family: "STKaiti", "KaiTi", "楷体", "SimSun", "宋体", serif;
  color: #e8dcba;
  user-select: none;
  -webkit-user-select: none;
}
.hidden { display: none !important; }

/* ---------------- CRT 覆层 ---------------- */
#noise {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 3; pointer-events: none; opacity: .22; mix-blend-mode: overlay;
}
#scanlines {
  position: fixed; inset: 0; z-index: 4; pointer-events: none;
  background: repeating-linear-gradient(to bottom,
    rgba(0,0,0,.14) 0px, rgba(0,0,0,.14) 1px, transparent 1px, transparent 3px);
  animation: flicker 6s steps(60) infinite;
}
#vignette {
  position: fixed; inset: 0; z-index: 5; pointer-events: none;
  background: radial-gradient(ellipse at center,
    transparent 52%, rgba(12,8,4,.42) 82%, rgba(6,4,2,.72) 100%);
}
@keyframes flicker {
  0%,100% { opacity: .85; } 8% { opacity: .6; } 12% { opacity: .9; }
  45% { opacity: .75; } 50% { opacity: .95; } 70% { opacity: .7; } 78% { opacity: .9; }
}
#dust-layer { position: fixed; inset: 0; z-index: 6; pointer-events: none; overflow: hidden; }
.dust {
  position: absolute; bottom: -8px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,214,150,.9), rgba(255,214,150,0) 70%);
  opacity: 0; animation: dustUp linear infinite;
}
@keyframes dustUp {
  0% { transform: translate(0,0); opacity: 0; }
  12% { opacity: .55; }
  88% { opacity: .3; }
  100% { transform: translate(18px,-108vh); opacity: 0; }
}

/* ---------------- 全局 UI ---------------- */
#ui-top {
  position: fixed; top: 12px; right: 14px; z-index: 30; display: flex; gap: 10px;
}
#ui-top button {
  background: rgba(20,16,10,.55); color: #d8c49a; border: 1px solid rgba(216,196,154,.45);
  border-radius: 6px; padding: 6px 14px; cursor: pointer;
  font-family: inherit; font-size: 15px; letter-spacing: 2px;
  transition: all .25s;
}
#ui-top button:hover { background: rgba(120,70,30,.55); color: #fff; box-shadow: 0 0 12px rgba(255,180,90,.4); }

#inventory {
  position: fixed; top: 12px; left: 14px; z-index: 30;
  display: flex; gap: 8px; align-items: center; max-width: 55vw; flex-wrap: wrap;
}
.inv-label { font-size: 13px; letter-spacing: 3px; color: #a08c5e; }
.inv-chip {
  background: rgba(40,26,14,.75); border: 1px solid rgba(216,172,110,.5);
  color: #f0dcae; padding: 4px 12px; border-radius: 14px; font-size: 14px;
  cursor: default; box-shadow: 0 2px 6px rgba(0,0,0,.4);
  animation: popIn .45s ease;
}
@keyframes popIn { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------------- 场景框架 ---------------- */
#game { position: fixed; inset: 0; z-index: 1; }
.scene {
  position: absolute; inset: 0; overflow: hidden;
  animation: breath 9s ease-in-out infinite;
}
@keyframes breath {
  0%,100% { transform: scale(1); } 50% { transform: scale(1.012); }
}
.interact { cursor: pointer; position: relative; transition: filter .25s, transform .2s; }
.interact:hover { filter: brightness(1.15) drop-shadow(0 0 10px rgba(255,210,140,.55)); transform: scale(1.02); }
.interact:active { transform: scale(.98); }
.shake { animation: shakeX .5s; }
@keyframes shakeX {
  0%,100% { transform: translateX(0); } 20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); }
}

/* ---------------- 通用：窗 / 钟 / 门 / 地板 ---------------- */
.window, .window-lr {
  position: absolute; overflow: hidden; background: #f4b27a;
  border: 10px solid #8a5a38; box-shadow: inset 0 0 30px rgba(0,0,0,.35), 0 6px 18px rgba(0,0,0,.45);
}
.window { left: 43%; top: 12%; width: 15%; height: 27%; }
.window-lr { left: 34%; top: 13%; width: 15%; height: 26%; }
.window .sky, .window-lr .sky {
  position: absolute; inset: 0;
  background: linear-gradient(#5a4038 0%, #8a5a4a 34%, #c96f4a 62%, #f4b27a 88%, #d8a86a 100%);
}
.window .bar, .window-lr .bar { position: absolute; background: #8a5a38; }
.window .bar-v, .window-lr .bar-v { left: 50%; top: 0; bottom: 0; width: 8px; transform: translateX(-50%); }
.window .bar-h, .window-lr .bar-h { top: 50%; left: 0; right: 0; height: 8px; transform: translateY(-50%); }
.window .glow, .window-lr .glow {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 85%, rgba(255,205,130,.4), transparent 72%);
}

.clock {
  position: absolute; width: 84px; height: 84px; border-radius: 50%;
  background: #6b4527; padding: 5px; box-shadow: 0 5px 14px rgba(0,0,0,.5), inset 0 0 8px rgba(0,0,0,.6);
}
.clock { right: 13%; top: 13%; }
.clock-lr { right: 9%; top: 16%; }
.clock-face {
  position: relative; width: 100%; height: 100%; border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #fdf8ea, #efe4c8);
  border: 1px solid #8a6b4a; overflow: hidden;
}
.clock-face .tick {
  position: absolute; left: 50%; top: 4px; width: 2px; height: 8px;
  margin-left: -1px; background: #8a6b4a; opacity: .65;
  transform-origin: 50% 33px;
}
.hand { position: absolute; left: calc(50% - 2px); bottom: 50%; width: 4px; background: #2b2b28; transform-origin: 50% 100%; border-radius: 2px; }
.hand-h { height: 26%; }
.hand-m { height: 37%; width: 3px; }
.center-dot { position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -4.5px; background: #2b2b28; border-radius: 50%; }

.door {
  position: absolute; bottom: 0; height: 46%; width: 13%;
  background: linear-gradient(90deg, #a05a32, #7a4527 60%, #8a4e2c);
  border: 4px solid #5d3a1e; border-bottom: none;
  border-radius: 6px 6px 0 0; box-shadow: inset -12px 0 20px rgba(0,0,0,.35), 0 4px 14px rgba(0,0,0,.5);
}
.door { right: 8%; }
.door-lr { right: 6%; width: 12%; }
.door-sign {
  position: absolute; top: 12%; left: 50%; transform: translateX(-50%);
  background: #efe8d8; color: #6b4527; font-size: 13px; letter-spacing: 2px;
  padding: 3px 10px; border-radius: 4px; box-shadow: 0 2px 5px rgba(0,0,0,.4);
}
.door-handle {
  position: absolute; right: 14%; top: 52%; width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe9b8, #c89a58); box-shadow: 0 1px 4px rgba(0,0,0,.5);
}

.floor, .floor-lr, .hall-floor, .bd-floor, .roof-floor { position: absolute; left: 0; right: 0; bottom: 0; }
.floor { height: 15%; background: linear-gradient(#8a5a38, #5d3a1e); }
.floor { background: repeating-linear-gradient(90deg, #7a4a2e 0 46px, #6b3f24 46px 47px, #8a5a38 47px 94px), linear-gradient(#8a5a38,#5d3a1e); }
.floor-lr { height: 13%; background: repeating-linear-gradient(90deg, #8a5a38 0 40px, #7a4e2c 40px 41px), linear-gradient(#8a5a38,#64401f); }

/* ---------------- 教室 ---------------- */
#scene-classroom {
  background: linear-gradient(#e0d6bc 0%, #d8cdb4 40%, #cbbd9e 62%, #7d9377 62%, #6f8a6a 100%);
}
.wall { position: absolute; inset: 0; }

.chalkboard {
  position: absolute; left: 7%; top: 12%; width: 33%; height: 27%;
  background: #2e4a3e; border: 12px solid #7a5233; border-radius: 6px;
  box-shadow: inset 0 0 24px rgba(0,0,0,.55), 0 8px 20px rgba(0,0,0,.4);
}
.chalkboard::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.02) 3px 4px);
}
.chalk-text {
  position: absolute; inset: 6% 6%; display: flex; align-items: center; justify-content: center;
  font-family: inherit; font-size: clamp(16px, 2.8vw, 32px); color: #e8e2cf;
  text-shadow: 1px 1px 0 rgba(0,0,0,.35); letter-spacing: 3px; white-space: nowrap;
}
.blank { display: inline-block; width: 1.3em; border-bottom: 3px dashed #e8e2cf; }
.chalk-corner {
  position: absolute; bottom: 8%; right: 6%; font-size: clamp(11px, 1.4vw, 15px); color: #cfc8b2;
}

.desk-rows { position: absolute; left: 6%; bottom: 15.5%; width: 46%; display: flex; flex-direction: column; gap: 10px; }
.desk-rows .row { display: flex; gap: 14px; }
.desk {
  position: relative; width: 130px; height: 62px; flex: none;
  background: linear-gradient(#9a6138, #7a4a2e); border-radius: 5px 5px 9px 9px;
  box-shadow: 0 8px 10px rgba(0,0,0,.35), inset 0 4px 6px rgba(255,220,170,.25);
}
.desk::after { /* 桌面下的影 */
  content: ""; position: absolute; left: 6px; right: 6px; bottom: -6px; height: 10px;
  background: #5d3a1e; border-radius: 2px;
}
.desk-open { animation: deskGlow 2.4s ease-in-out infinite; }
@keyframes deskGlow { 0%,100% { box-shadow: 0 8px 10px rgba(0,0,0,.35); } 50% { box-shadow: 0 0 16px rgba(255,190,110,.55), 0 8px 10px rgba(0,0,0,.35); } }
.open-drawer {
  position: absolute; right: -18px; top: 18px; width: 46px; height: 30px;
  background: #6b4527; border: 2px solid #4e3017; border-radius: 3px;
  box-shadow: 4px 6px 8px rgba(0,0,0,.4);
}
.drawer-photo {
  position: absolute; left: 6px; top: 5px; width: 30px; height: 20px;
  background: linear-gradient(135deg, #e8d8b8 0%, #cbb27e 100%);
  border: 1px solid #a08c5e; transform: rotate(-6deg);
  box-shadow: 0 0 8px rgba(255,230,170,.7);
}

.podium {
  position: absolute; right: 27%; bottom: 15.5%; width: 148px; height: 78px;
  background: linear-gradient(#7a4a2e, #5d3a1e); border-radius: 6px;
  box-shadow: 0 8px 14px rgba(0,0,0,.45), inset 0 3px 5px rgba(255,220,170,.2);
}
.iron-box {
  position: absolute; left: 50%; top: -34px; margin-left: -30px;
  width: 60px; height: 46px; background: linear-gradient(#6a7078, #4a4f56);
  border: 3px solid #33383f; border-radius: 7px;
  box-shadow: 0 6px 12px rgba(0,0,0,.5), inset 0 2px 4px rgba(255,255,255,.12);
}
.box-engrave {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; letter-spacing: 1px; color: #b8b0a0; opacity: .85;
}
.padlock { position: absolute; left: 50%; top: -12px; transform: translateX(-50%); }
.padlock-shackle {
  width: 22px; height: 14px; border: 3px solid #a08a5a; border-bottom: none; border-radius: 8px 8px 0 0; margin: 0 auto;
}
.padlock::after {
  content: ""; position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  width: 16px; height: 12px; background: #a08a5a; border-radius: 3px;
}

/* ---------------- 老宅客厅 ---------------- */
#scene-livingroom {
  background: linear-gradient(#e2d8c0 0%, #d4c8a8 55%, #9c8a66 62%, #8a7a58 100%);
}
.wall-lr { position: absolute; inset: 0; }
.frame {
  position: absolute; left: 12%; top: 12%; width: 118px; height: 92px;
  background: #d8cbb0; border: 7px solid #6b4527; padding: 5px;
  box-shadow: 0 6px 14px rgba(0,0,0,.4), inset 0 0 6px rgba(0,0,0,.3);
  transform: rotate(-1.5deg);
}
.frame:hover { transform: rotate(-1.5deg) scale(1.02); }
.frame-pic {
  width: 100%; height: 100%;
  background: linear-gradient(160deg, #cbbba0 0%, #a8956e 100%);
  position: relative; overflow: hidden;
}
.frame-pic::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 24% 68%, rgba(70,50,30,.55) 0 9px, transparent 10px),
    radial-gradient(circle at 50% 72%, rgba(70,50,30,.5) 0 10px, transparent 11px),
    radial-gradient(circle at 76% 66%, rgba(70,50,30,.52) 0 9px, transparent 10px),
    linear-gradient(#9c8a66 0 30%, transparent 30%);
}

.sofa { position: absolute; left: 5%; bottom: 11%; width: 30%; height: 22%; }
.sofa-base {
  position: absolute; left: 8%; right: 8%; bottom: 0; top: 24%;
  background: linear-gradient(#c04a38, #9a3526); border-radius: 16px 16px 6px 6px;
  box-shadow: 0 10px 16px rgba(0,0,0,.4);
}
.sofa-arm {
  position: absolute; top: 6%; width: 12%; height: 86%;
  background: linear-gradient(#a83c2c, #7e2a1e); border-radius: 12px 12px 5px 5px;
  box-shadow: 0 8px 12px rgba(0,0,0,.35);
}
.sofa-arm.a-l { left: 0; } .sofa-arm.a-r { right: 0; }
.sofa-cushion {
  position: absolute; top: 30%; width: 34%; height: 60%;
  background: linear-gradient(#d45844, #b03a2e); border-radius: 10px;
  box-shadow: inset 0 3px 6px rgba(255,255,255,.15);
}
.sofa-cushion.c-1 { left: 16%; } .sofa-cushion.c-2 { right: 16%; }
.sofa-lace {
  position: absolute; left: 8%; right: 8%; bottom: 0; height: 12px;
  background: radial-gradient(circle at 8px 0, #f4efe6 5px, transparent 6px);
  background-size: 16px 12px; background-repeat: repeat-x; opacity: .85;
}

.tv-stand {
  position: absolute; left: 44%; bottom: 11%; width: 30%;
  background: linear-gradient(#8a5a38, #5d3a1e); height: 7%; border-radius: 4px;
  box-shadow: 0 8px 12px rgba(0,0,0,.4);
}
.tv { position: absolute; left: 50%; bottom: 100%; width: 96%; margin-left: -48%; margin-bottom: 6px; }
.tv-screen {
  position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden;
  background: #171a1d; border: 9px solid #7a5233; border-radius: 7px;
  box-shadow: 0 10px 20px rgba(0,0,0,.5);
}
.tv-static {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(120,130,140,.5) 0 2px, rgba(30,34,38,.6) 2px 4px),
    repeating-linear-gradient(90deg, rgba(140,150,160,.35) 0 3px, rgba(20,24,28,.55) 3px 6px);
  animation: tvstatic .45s steps(2) infinite;
}
@keyframes tvstatic {
  0% { background-position: 0 0, 0 0; }
  50% { background-position: -14px 9px, 7px -11px; }
  100% { background-position: 8px -6px, -9px 5px; }
}
.tv-body {
  height: 14px; background: linear-gradient(#7a5233, #5d3a1e); border-radius: 0 0 6px 6px;
}
.tv-knob { position: absolute; right: 12%; bottom: 2px; width: 14px; height: 14px; border-radius: 50%; background: #3a2a18; border: 2px solid #241a0e; }
.tv-ant { position: absolute; top: -26px; width: 34%; height: 26px; border-bottom: 4px solid #3a3a36; }
.tv-ant.a1 { left: 8%; transform: rotate(-24deg); transform-origin: 100% 100%; }
.tv-ant.a2 { right: 8%; transform: rotate(24deg); transform-origin: 0 100%; }

.coffee-table {
  position: absolute; left: 33%; bottom: 3%; width: 30%; height: 7%;
  background: linear-gradient(#9a6138, #6b4527); border-radius: 7px;
  box-shadow: 0 10px 16px rgba(0,0,0,.45), inset 0 3px 5px rgba(255,220,170,.25);
}
.diary {
  position: absolute; left: 6%; top: -34px; width: 74px; height: 54px;
  background: linear-gradient(#8a6b4a, #6b4e30); border-radius: 4px 8px 8px 4px;
  box-shadow: 4px 6px 10px rgba(0,0,0,.45);
  animation: deskGlow 3s ease-in-out infinite;
}
.diary-tab { position: absolute; left: -7px; top: 18px; width: 9px; height: 22px; background: #b03a2e; border-radius: 3px 0 0 3px; }
.radio {
  position: absolute; right: 8%; top: -58px; width: 108px; height: 66px;
  background: linear-gradient(#8a5a38, #5d3a1e); border: 3px solid #3e2a12; border-radius: 10px;
  box-shadow: 0 8px 14px rgba(0,0,0,.5);
}
.radio-dial {
  position: absolute; left: 8px; top: 8px; right: 8px; height: 18px;
  background: #efe4c0; color: #5a3a1e; font-size: 13px; letter-spacing: 2px;
  display: flex; align-items: center; justify-content: center; border-radius: 3px;
  box-shadow: inset 0 0 4px rgba(0,0,0,.4);
}
.radio-grill {
  position: absolute; left: 10px; right: 40px; top: 34px; height: 24px;
  background: repeating-linear-gradient(90deg, #2a1c0c 0 4px, transparent 4px 8px);
  border-radius: 3px;
}
.radio-knob { position: absolute; top: 32px; width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #d8b27a, #7a4a2e); box-shadow: 0 2px 5px rgba(0,0,0,.5); }
.radio-knob.k1 { right: 10px; } .radio-knob.k2 { right: 38px; width: 14px; height: 14px; top: 36px; }

/* ---------------- 走廊 ---------------- */
#scene-hallway {
  background: linear-gradient(#4a4640 0%, #332f2a 55%, #26221e 100%);
}
.hall-lamp { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 14px; height: 90px; }
.hall-bulb {
  position: absolute; top: 78px; left: 50%; transform: translateX(-50%);
  width: 22px; height: 26px; background: radial-gradient(circle at 50% 40%, #ffe9a8, #d8a64a 70%);
  border-radius: 50% 50% 45% 45%; box-shadow: 0 0 30px rgba(255,210,120,.8);
}
.hall-glow {
  position: absolute; top: 60px; left: 50%; transform: translateX(-50%);
  width: 320px; height: 220px; pointer-events: none;
  background: radial-gradient(ellipse, rgba(255,200,110,.2), transparent 70%);
}
.hall-door {
  position: absolute; bottom: 10%; width: 14%; height: 44%;
  background: linear-gradient(90deg, #a8342a, #8a241c 60%, #942a20);
  border: 4px solid #5e1c14; border-radius: 5px 5px 0 0;
  box-shadow: inset -14px 0 22px rgba(0,0,0,.45), 0 6px 14px rgba(0,0,0,.6);
}
.hall-door:nth-of-type(2) { left: 8%; }
.hall-door:nth-of-type(3) { left: 29%; }
.hall-door:nth-of-type(4) { left: 50%; }
.hall-door:nth-of-type(5) { left: 71%; }
.hd-panel {
  position: absolute; left: 10%; right: 10%; top: 12%; bottom: 14%;
  border: 2px solid rgba(0,0,0,.35); border-radius: 3px;
  background: rgba(0,0,0,.12);
}
.hd-char {
  position: absolute; top: 20%; left: 50%; transform: translateX(-50%);
  font-size: clamp(28px, 4vw, 46px); color: #f0d48a; text-shadow: 0 2px 4px rgba(0,0,0,.6);
}
.hd-char.dao { transform: translateX(-50%) rotate(180deg); }
.hd-handle { position: absolute; right: 14%; top: 56%; width: 8px; height: 8px; border-radius: 50%; background: #d8b27a; }
.hd-gray { background: linear-gradient(90deg, #6a6a66, #555550 60%, #60605c); border-color: #3a3a36; }
.hd-photo {
  position: absolute; top: 16%; left: 50%; transform: translateX(-50%);
  width: 52%; height: 34%;
  background: linear-gradient(160deg, #cbbba0, #a8956e); border: 3px solid #4e3a22;
}
.hd-photo::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 25% 70%, rgba(60,40,20,.5) 0 6px, transparent 7px),
    radial-gradient(circle at 50% 74%, rgba(60,40,20,.48) 0 7px, transparent 8px),
    radial-gradient(circle at 75% 68%, rgba(60,40,20,.5) 0 6px, transparent 7px);
}
.hd-wood { background: linear-gradient(90deg, #8a5a38, #6b4527 60%, #754a2c); border-color: #452b14; }
.hd-num {
  position: absolute; top: 16%; left: 50%; transform: translateX(-50%);
  background: #d8c49a; color: #3a2a14; font-size: clamp(14px, 2vw, 22px); padding: 2px 10px;
  border-radius: 3px; letter-spacing: 2px;
}
.hall-floor {
  height: 10%; background: repeating-linear-gradient(90deg, #4a3a28 0 60px, #3d301f 60px 61px), linear-gradient(#5d4c36, #3a2e1e);
}
.hall-floor::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 100%;
  background: linear-gradient(rgba(0,0,0,.5), transparent 70%);
  pointer-events: none;
}

/* ---------------- 天台 ---------------- */
#scene-rooftop { background: linear-gradient(#2c2440 0%, #6b3f5a 42%, #c96f4a 72%, #f4b27a 100%); }
.rt-sky { position: absolute; inset: 0; }
.skyline { position: absolute; left: 0; right: 0; bottom: 36%; height: 26%; }
.bldg {
  position: absolute; bottom: 0; width: 9%; background: linear-gradient(#241c30, #181220);
  box-shadow: 0 0 12px rgba(255,190,120,.18);
}
.bldg::after { content: ""; position: absolute; top: -8px; left: 8%; right: 8%; height: 8px; background: #3a2c48; }
.bldg::before { /* 一点灯火 */
  content: ""; position: absolute; top: 20%; left: 20%; width: 4px; height: 4px;
  background: rgba(255,210,130,.7); box-shadow: 18px 22px 0 rgba(255,210,130,.5), 8px -10px 0 rgba(255,210,130,.6);
}
.b1 { left: 4%; height: 55%; } .b2 { left: 15%; height: 78%; } .b3 { left: 28%; height: 46%; }
.b4 { left: 44%; height: 66%; } .b5 { left: 60%; height: 88%; }
.roof-floor {
  height: 36%;
  background: linear-gradient(#8a8880 0%, #6e6c64 30%, #58564f 100%);
}
.roof-floor::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 10px;
  background: linear-gradient(#c8c4b8, #a09c90); box-shadow: 0 4px 8px rgba(0,0,0,.4);
}
.rt-tv {
  position: absolute; left: 6%; bottom: 30%; width: 20%; max-width: 210px;
  animation: none;
}
.rt-tv .tv-screen { aspect-ratio: 4 / 3; border-width: 7px; }
.rt-tv .tv-static { opacity: .85; }

.swing { position: absolute; right: 10%; bottom: 28%; width: 180px; height: 200px; }
.swing-frame { position: absolute; left: 6px; right: 6px; top: 0; height: 10px; background: #5d5d58; border-radius: 5px; box-shadow: 0 3px 6px rgba(0,0,0,.5); }
.swing-frame::before, .swing-frame::after {
  content: ""; position: absolute; top: 10px; width: 8px; height: 180px; background: #4a4a46;
}
.swing-frame::before { left: 6px; } .swing-frame::after { right: 6px; }
.rope { position: absolute; top: 10px; width: 3px; height: 150px; background: #3a3a36; }
.rope.r-l { left: 34px; } .rope.r-r { right: 34px; }
.seat {
  position: absolute; top: 152px; left: 26px; right: 26px; height: 16px;
  background: linear-gradient(#8a5a38, #6b4527); border-radius: 6px;
  box-shadow: 0 5px 8px rgba(0,0,0,.4);
}
.swing { animation: sway 4.5s ease-in-out infinite; transform-origin: 50% 0; }
@keyframes sway { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }

.iron-door { position: absolute; left: 50%; bottom: 14%; margin-left: -9%; width: 18%; max-width: 220px; height: 46%; }
.iron-glow {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 420%; aspect-ratio: 1; pointer-events: none;
  background: radial-gradient(circle, rgba(255,250,235,.85), rgba(255,250,235,.25) 40%, transparent 68%);
  animation: glowPulse 3.2s ease-in-out infinite;
}
@keyframes glowPulse { 0%,100% { opacity: .75; } 50% { opacity: 1; } }
.iron-door-body {
  position: absolute; inset: 0; border-radius: 4px;
  background: linear-gradient(90deg, #26262a, #3a3a40 55%, #26262a);
  border: 4px solid #121216; box-shadow: 0 0 30px rgba(255,255,255,.25), inset 0 0 20px rgba(255,255,255,.12);
}
.iron-door-body::before {
  content: ""; position: absolute; left: 50%; top: 10%; bottom: 10%; width: 4px; transform: translateX(-50%);
  background: #0e0e12;
}

/* ---------------- 结局卧室 ---------------- */
#scene-bedroom { background: linear-gradient(#efe6d2 0%, #e0d3b8 60%, #c8b68e 100%); }
.bd-wall { position: absolute; inset: 0; }
.curtain {
  position: absolute; top: 0; bottom: 0; width: 18%;
  background: repeating-linear-gradient(90deg, #b85a3c 0 18px, #a84e34 18px 22px);
  opacity: .9;
}
.curtain.c-l { left: 0; border-right: 4px solid #8a3a24; }
.curtain.c-r { right: 0; border-left: 4px solid #8a3a24; }
.bd-window {
  position: absolute; left: 50%; top: 14%; transform: translateX(-50%);
  width: 30%; height: 40%;
  background: linear-gradient(#fff6dd, #ffe9b8);
  border: 12px solid #8a6b4a; overflow: hidden;
  box-shadow: inset 0 0 40px rgba(255,220,140,.5);
}
.bd-sun {
  position: absolute; right: -30%; bottom: -30%; width: 90%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, #fff8dc, #ffdf8a 60%, rgba(255,223,138,0));
}
.bedside {
  position: absolute; right: 10%; bottom: 12%; width: 190px;
  background: linear-gradient(#8a5a38, #5d3a1e); height: 70px; border-radius: 6px;
  box-shadow: 0 10px 16px rgba(0,0,0,.4);
}
.frame-bd {
  position: absolute; left: 50%; bottom: calc(100% + 8px); margin-left: -48px;
  width: 96px; height: 76px; background: #d8cbb0; border: 6px solid #5d3a1e; padding: 4px;
  box-shadow: 0 8px 16px rgba(0,0,0,.45);
  animation: deskGlow 3.4s ease-in-out infinite;
}
.phone {
  position: absolute; right: 12px; top: 18px; font-size: 26px; color: #d8c49a;
  text-shadow: 0 2px 4px rgba(0,0,0,.5);
}
.bd-floor { height: 10%; background: repeating-linear-gradient(90deg, #8a5a38 0 40px, #7a4e2c 40px 41px), linear-gradient(#8a5a38, #64401f); }

/* ---------------- 小孩（梦中人） ---------------- */
.child { position: absolute; width: 44px; height: 116px; animation: childSway 5s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes childSway { 0%,100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } }
.c-head {
  width: 28px; height: 28px; border-radius: 50%; margin: 0 auto;
  background: radial-gradient(circle at 40% 35%, #f0d2ae, #d9b08a);
  position: relative; z-index: 2;
}
.c-head::before {
  content: ""; position: absolute; left: 2px; right: 2px; top: -2px; height: 16px;
  background: #2c2620; border-radius: 50% 50% 35% 35%;
}
.c-head::after {
  content: ""; position: absolute; left: -4px; top: 10px; width: 36px; height: 14px;
  background: #2c2620; border-radius: 6px;
}
.c-dress {
  width: 40px; height: 68px; margin: 2px auto 0;
  background: linear-gradient(#b03a2e, #8a241c);
  clip-path: polygon(0 0, 100% 0, 84% 100%, 16% 100%);
  box-shadow: 0 6px 10px rgba(0,0,0,.4);
  position: relative;
}
.c-dress::after {
  content: ""; position: absolute; left: 4px; right: 4px; bottom: 0; height: 8px;
  background: repeating-linear-gradient(90deg, #e8dcba 0 6px, transparent 6px 12px);
}
.child-classroom { left: 41%; bottom: 26%; }
.child-lr { right: 18%; bottom: 20%; }
.child-hw { left: 43%; bottom: 12%; filter: blur(.6px); opacity: .9; animation: childSwayS 5s ease-in-out infinite; }
@keyframes childSwayS {
  0%,100% { transform: scale(.8) rotate(-2.5deg); }
  50% { transform: scale(.8) rotate(2.5deg); }
}
.child-rt { right: 13%; bottom: 32%; }

/* ---------------- 标题 ---------------- */
#scene-title {
  background: radial-gradient(ellipse at 50% 60%, #2a1c12 0%, #14100c 70%, #0d0a08 100%);
  display: flex; align-items: center; justify-content: center;
}
.title-wrap { text-align: center; position: relative; z-index: 2; padding: 0 20px; }
.game-title {
  font-size: clamp(54px, 11vw, 118px); letter-spacing: 26px; color: #e8c06a;
  text-shadow: 0 0 22px rgba(255,170,70,.45), 0 4px 0 #5a2a12;
  font-weight: normal; margin-bottom: 6px; transform: translateX(13px);
  animation: titleFlicker 4s steps(40) infinite;
}
@keyframes titleFlicker {
  0%,100% { opacity: 1; } 92% { opacity: 1; } 93% { opacity: .6; } 94% { opacity: 1; } 96% { opacity: .8; }
}
.game-sub { font-size: clamp(15px, 2.4vw, 22px); letter-spacing: 12px; color: #b8a074; margin-bottom: 26px; }
.game-note { font-size: clamp(13px, 1.8vw, 16px); color: #8a7a5a; letter-spacing: 3px; margin-bottom: 34px; }
.game-hint { margin-top: 40px; font-size: 12px; letter-spacing: 2px; color: #5d543c; }
.btn-old {
  font-family: inherit; font-size: clamp(17px, 2.2vw, 21px); letter-spacing: 8px;
  color: #f0dcae; background: transparent;
  border: 1px solid #b8964a; padding: 12px 44px 12px 52px; cursor: pointer;
  border-radius: 4px; transition: all .3s; box-shadow: 0 0 12px rgba(200,150,60,.15);
}
.btn-old:hover { background: rgba(160,90,30,.35); box-shadow: 0 0 26px rgba(255,190,90,.5); text-shadow: 0 0 8px rgba(255,220,150,.8); }
.btn-small { font-size: 14px; letter-spacing: 4px; padding: 7px 22px 7px 26px; }
.lantern { position: absolute; top: -6px; width: 74px; height: 150px; animation: lanternSwing 3.6s ease-in-out infinite; transform-origin: 50% 0; }
.lantern.l-l { left: 9%; } .lantern.l-r { right: 9%; animation-delay: -1.8s; }
@keyframes lanternSwing { 0%,100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
.lantern-glow {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%,-50%);
  width: 150px; height: 150px;
  background: radial-gradient(circle, rgba(255,120,60,.4), transparent 70%);
}
.lantern-body {
  position: absolute; left: 50%; top: 30%; transform: translateX(-50%);
  width: 52px; height: 68px; border-radius: 50% 50% 42% 42%;
  background: radial-gradient(circle at 50% 35%, #e8563a, #a82814 78%);
  box-shadow: 0 0 24px rgba(255,90,50,.55), inset 0 0 14px rgba(255,220,120,.5);
}
.lantern-body::before, .lantern-body::after {
  content: ""; position: absolute; left: 0; right: 0; height: 5px; background: #8a2a18;
}
.lantern-body::before { top: -2px; } .lantern-body::after { bottom: -2px; }
.lantern-tassel {
  position: absolute; left: 50%; top: 99%; transform: translateX(-50%);
  width: 4px; height: 34px; background: #c89a58;
}
.lantern-tassel::after {
  content: ""; position: absolute; top: 30px; left: 50%; transform: translateX(-50%);
  width: 26px; height: 26px;
  background: repeating-linear-gradient(0deg, #e8c06a 0 4px, transparent 4px 8px);
  clip-path: polygon(0 0, 100% 0, 55% 100%, 45% 100%);
}

/* ---------------- 对话 ---------------- */
#dialogue {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  width: min(640px, 90vw); z-index: 50; cursor: pointer;
  background: rgba(18,14,10,.88); border: 1px solid rgba(216,180,110,.4);
  border-radius: 8px; padding: 14px 18px 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,.6);
  animation: dlgIn .3s ease;
}
@keyframes dlgIn { from { transform: translate(-50%, 16px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.d-name {
  display: inline-block; color: #f0c06a; letter-spacing: 3px; font-size: 15px;
  border-bottom: 1px solid rgba(240,192,106,.4); padding-bottom: 4px; margin-bottom: 8px;
}
.d-text { font-size: clamp(16px, 2.3vw, 19px); line-height: 1.85; color: #efe4cc; letter-spacing: 1px; min-height: 3.7em; }
.d-arrow {
  position: absolute; right: 16px; bottom: 10px; color: #f0c06a; font-size: 13px;
  opacity: 0; transition: opacity .2s; animation: blinkA 1s steps(2) infinite;
}
.d-arrow.show { opacity: 1; }
@keyframes blinkA { 50% { opacity: .15; } }

/* ---------------- 弹窗 ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(8,6,4,.68); animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: linear-gradient(#241c12, #181208); border: 1px solid rgba(216,180,110,.5);
  border-radius: 10px; padding: 26px 30px; min-width: min(320px, 88vw);
  text-align: center; box-shadow: 0 18px 50px rgba(0,0,0,.7), inset 0 0 40px rgba(120,80,30,.12);
  animation: boxIn .3s ease;
}
@keyframes boxIn { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-title { font-size: 20px; letter-spacing: 6px; color: #f0c06a; margin-bottom: 8px; }
.keypad-sub { font-size: 13px; letter-spacing: 4px; color: #8a7a5a; margin-bottom: 16px; }
.k-digits { display: flex; gap: 12px; justify-content: center; margin: 4px 0 20px; }
.kdigit {
  width: 44px; height: 54px; border: 1px solid #b8964a; border-radius: 6px;
  font-size: 30px; color: #f0dcae; display: flex; align-items: center; justify-content: center;
  background: rgba(10,8,6,.6);
}
.kdigit.empty { border-style: dashed; border-color: #5d543c; }
.k-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; max-width: 210px; margin-left: auto; margin-right: auto; }
.k-buttons button {
  font-family: inherit; font-size: 19px; padding: 10px 0; color: #f0dcae; cursor: pointer;
  background: rgba(60,42,22,.6); border: 1px solid rgba(216,180,110,.4); border-radius: 6px;
  transition: all .15s;
}
.k-buttons button:hover { background: rgba(160,90,30,.5); box-shadow: 0 0 12px rgba(255,190,90,.4); }
.k-buttons button:active { transform: scale(.95); }

.radio-m .radio-face {
  background: linear-gradient(#8a5a38, #5d3a1e); border: 3px solid #3e2a12;
  border-radius: 10px; padding: 14px; margin-bottom: 16px;
}
.rf-label { color: #d8c49a; letter-spacing: 4px; font-size: 13px; margin-bottom: 8px; }
.rf-digits { display: flex; gap: 10px; justify-content: center; align-items: center; }
.rf-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.rf-col button {
  font-family: inherit; width: 40px; height: 26px; cursor: pointer; font-size: 16px; color: #f0dcae;
  background: rgba(30,20,10,.8); border: 1px solid rgba(216,180,110,.5); border-radius: 4px;
}
.rf-col button:hover { background: rgba(160,90,30,.5); }
.rf-digit {
  width: 42px; height: 46px; border: 1px solid #b8964a; border-radius: 6px; background: #efe4c0;
  color: #3a2a14; font-size: 28px; display: flex; align-items: center; justify-content: center;
}
.rf-dot { color: #d8c49a; font-size: 24px; }
.radio-btn-row { display: flex; gap: 12px; justify-content: center; }

.choice-text { font-size: clamp(16px, 2.4vw, 20px); line-height: 1.9; color: #efe4cc; margin-bottom: 22px; letter-spacing: 1px; }
.choice-buttons { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.choice-btn {
  font-family: inherit; font-size: 17px; letter-spacing: 4px; color: #f0dcae; cursor: pointer;
  background: rgba(60,42,22,.6); border: 1px solid rgba(216,180,110,.5); padding: 10px 26px;
  border-radius: 6px; transition: all .2s;
}
.choice-btn:hover { background: rgba(160,90,30,.5); box-shadow: 0 0 16px rgba(255,190,90,.5); }

/* ---------------- 联系客服 ---------------- */
.contact-tip { color: #c8b894; font-size: 14px; margin: 6px 0 16px; letter-spacing: 1px; }
.contact-wx {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: rgba(60,42,22,.55); border: 1px dashed rgba(216,180,110,.55);
  border-radius: 8px; padding: 14px 10px; margin-bottom: 12px;
}
.wx-label { color: #8a7a5a; letter-spacing: 2px; font-size: 14px; }
.wx-id {
  font-size: 26px; letter-spacing: 3px; color: #f0dcae; font-weight: bold;
  text-shadow: 0 0 12px rgba(255,190,90,.55);
}
.contact-note { color: #a08c5e; font-size: 13px; letter-spacing: 1px; margin-bottom: 18px; }
.contact .btn-old { margin: 0 4px; }

/* ---------------- Toast ---------------- */
#toast {
  position: fixed; left: 50%; bottom: 108px; transform: translateX(-50%);
  z-index: 65; background: rgba(18,14,10,.92); border: 1px solid rgba(216,180,110,.5);
  color: #f0dcae; padding: 10px 22px; border-radius: 22px; font-size: 15px; letter-spacing: 2px;
  opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s; white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ---------------- 过场 ---------------- */
#transition {
  position: fixed; inset: 0; z-index: 70; pointer-events: none;
  background: #050403; opacity: 0; transition: opacity .55s ease;
}
#transition.show { opacity: 1; pointer-events: auto; }

/* ---------------- 结局 ---------------- */
#ending-card {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(30,20,10,.94), rgba(8,6,4,.98));
}
.end-inner { text-align: center; padding: 0 24px; max-width: 640px; animation: boxIn .6s ease; }
.end-title {
  font-size: clamp(40px, 8vw, 84px); letter-spacing: 20px; color: #e8c06a;
  text-shadow: 0 0 26px rgba(255,170,70,.4); margin-bottom: 34px; transform: translateX(10px);
}
.end-body { font-size: clamp(16px, 2.3vw, 19px); line-height: 2.1; color: #efe4cc; letter-spacing: 1px; margin-bottom: 44px; }
.end-body p { margin-bottom: 10px; opacity: 0; animation: lineIn 1s ease forwards; }
.end-body p:nth-child(1) { animation-delay: .2s; } .end-body p:nth-child(2) { animation-delay: .7s; }
.end-body p:nth-child(3) { animation-delay: 1.2s; } .end-body p:nth-child(4) { animation-delay: 1.7s; }
.end-body p:nth-child(5) { animation-delay: 2.2s; } .end-body p:nth-child(6) { animation-delay: 2.7s; }
@keyframes lineIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* 忙碌时禁止误触场景 */
body.busy .interact { pointer-events: none; }

/* ---------------- 移动端微调 ---------------- */
@media (max-width: 720px) {
  .chalkboard { left: 5%; width: 44%; }
  .window { left: 55%; width: 18%; }
  .clock { right: 4%; }
  .desk-rows { width: 56%; }
  .desk { width: 88px; }
  .podium { right: 16%; }
  .sofa { width: 40%; }
  .tv-stand { left: 42%; width: 34%; }
  .coffee-table { width: 40%; left: 26%; }
  .hall-door:nth-of-type(2) { left: 4%; } .hall-door:nth-of-type(3) { left: 26%; }
  .hall-door:nth-of-type(4) { left: 48%; } .hall-door:nth-of-type(5) { left: 70%; }
}

/* ---------------- 触屏：点击提示标签 ---------------- */
html { -webkit-text-size-adjust: 100%; }
body { touch-action: manipulation; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
.label-tip {
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  background: rgba(15,12,8,.84); color: #e8dcba; font-size: 12px; letter-spacing: 2px;
  padding: 2px 8px; border-radius: 4px; white-space: nowrap; pointer-events: none;
  border: 1px solid rgba(216,180,110,.35); z-index: 12;
}
@media (hover: none), (max-width: 720px) {
  .interact { animation: hintPulse 2.8s ease-in-out infinite; }
  .label-tip { font-size: 11px; }
  /* 恢复被脉冲覆盖的场景动画 */
  .swing { animation: sway 4.5s ease-in-out infinite; transform-origin: 50% 0; }
  .child-classroom, .child-lr, .child-rt { animation: childSway 5s ease-in-out infinite; }
  .child-hw { animation: childSwayS 5s ease-in-out infinite; }
  .frame-bd { animation: deskGlow 3.4s ease-in-out infinite; }
}
@keyframes hintPulse {
  0%, 100% { filter: none; }
  50% { filter: brightness(1.1) drop-shadow(0 0 7px rgba(255,200,120,.3)); }
}

/* ---------------- 手机竖屏适配 ---------------- */
@media (max-width: 640px) {
  .game-title { font-size: clamp(42px, 15vw, 64px); letter-spacing: 12px; transform: translateX(6px); }
  .game-sub { letter-spacing: 6px; }
  .game-hint { font-size: 11px; letter-spacing: 1px; }

  /* 教室 */
  .chalkboard { left: 4%; top: 9%; width: 52%; height: 22%; border-width: 8px; }
  .chalk-text { font-size: clamp(13px, 4.5vw, 20px); }
  .window { left: 60%; top: 9%; width: 20%; height: 22%; border-width: 6px; }
  .clock { right: 3%; top: 35%; width: 60px; height: 60px; padding: 4px; }
  .clock-face .tick { top: 3px; transform-origin: 50% 23px; }
  .desk-rows { left: 3%; bottom: 16%; width: 64%; gap: 6px; }
  .desk-rows .row { gap: 6px; }
  .desk { width: 78px; height: 46px; }
  .podium { right: 5%; bottom: 17%; width: 104px; height: 56px; }
  .iron-box { width: 46px; height: 36px; margin-left: -23px; top: -28px; }
  .door { width: 17%; }
  .child-classroom { left: 57%; bottom: 30%; }

  /* 老宅 */
  .frame { left: 3%; top: 8%; width: 84px; height: 68px; }
  .window-lr { left: 28%; top: 10%; width: 22%; height: 20%; border-width: 6px; }
  .clock-lr { right: 3%; top: 34%; width: 60px; height: 60px; padding: 4px; }
  .sofa { left: 2%; bottom: 14%; width: 46%; height: 15%; }
  .tv-stand { left: 46%; bottom: 13%; width: 34%; height: 6%; }
  .coffee-table { left: 18%; bottom: 2%; width: 50%; height: 8%; }
  .diary { width: 60px; height: 44px; top: -30px; }
  .radio { width: 84px; height: 54px; top: -48px; }
  .radio-grill { right: 34px; }
  .door-lr { right: 4%; width: 15%; }
  .child-lr { right: 14%; bottom: 26%; }

  /* 走廊 */
  .hall-door { width: 17%; height: 38%; }
  .hall-door:nth-of-type(2) { left: 4%; } .hall-door:nth-of-type(3) { left: 27%; }
  .hall-door:nth-of-type(4) { left: 50%; } .hall-door:nth-of-type(5) { left: 73%; }
  .hd-char { font-size: clamp(20px, 9vw, 30px); }
  .child-hw { left: 45%; bottom: 13%; }

  /* 天台 */
  .rt-tv { left: 4%; bottom: 34%; width: 30%; }
  .swing { right: -26px; bottom: 34%; }
  .iron-door { bottom: 9%; width: 26%; margin-left: -13%; }
  .child-rt { right: 2%; bottom: 36%; }
  .roof-floor { height: 40%; }

  /* 卧室 */
  .bd-window { width: 58%; top: 9%; height: 32%; border-width: 8px; }
  .curtain { width: 12%; }
  .bedside { right: 5%; bottom: 16%; width: 150px; height: 56px; }
  .frame-bd { width: 76px; height: 60px; margin-left: -38px; }

  /* 对话与弹窗 */
  #dialogue { width: 94vw; bottom: 10px; padding: 10px 12px 12px; }
  .d-name { font-size: 13px; }
  .d-text { font-size: 15px; line-height: 1.75; min-height: 3.3em; }
  #toast { bottom: 96px; font-size: 13px; white-space: normal; max-width: 86vw; text-align: center; }
  .modal-box { padding: 20px 16px; min-width: 0; max-width: 92vw; }
  .kdigit { width: 38px; height: 48px; font-size: 24px; }
  .rf-digit { width: 36px; height: 42px; font-size: 24px; }
  .contact-wx { flex-wrap: wrap; }
  #ui-top button { padding: 8px 12px; font-size: 14px; }
  .end-title { letter-spacing: 10px; transform: translateX(5px); }
}
