/* =============================================
   古津门 - 津沽诡话
   点触式恐怖解谜游戏
   ============================================= */

/* ---------- 字体（使用系统回退，后期可替换为自定义字体） ---------- */

/* ---------- 全局重置 ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'GameBody', 'Microsoft YaHei', 'PingFang SC', 'SimSun', sans-serif;
  color: #ccc;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  cursor: default;
}

/* ---------- 游戏容器 ---------- */
#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #000;
}

/* ---------- 场景层 ---------- */
#scene-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  transition: opacity 0.5s ease;
}

#scene-layer.fading {
  opacity: 0;
}

#scene-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.5s ease;
}

/* ---------- 热区层 ---------- */
#hotspots-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.hotspot {
  position: absolute;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* 热区悬停提示 */
.hotspot::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #ccc;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  border: 1px solid rgba(139, 0, 0, 0.4);
  font-family: 'GameBody', 'Microsoft YaHei', sans-serif;
  letter-spacing: 0.05em;
}

.hotspot:hover::after {
  opacity: 1;
}

/* 热区发光效果 */
.hotspot-glow {
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border: 1px solid rgba(184, 134, 11, 0.3);
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  animation: hotspot-pulse 2s infinite;
}

.hotspot:hover .hotspot-glow,
.hotspot.show-glow .hotspot-glow {
  opacity: 1;
}

@keyframes hotspot-pulse {
  0%, 100% { border-color: rgba(184, 134, 11, 0.2); }
  50% { border-color: rgba(184, 134, 11, 0.6); }
}

/* 热区光标样式 */
.hotspot[data-cursor="eye"]:hover { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4" fill="none" stroke="%23b8860b" stroke-width="2"/><circle cx="12" cy="12" r="1.5" fill="%23b8860b"/></svg>') 12 12, pointer; }
.hotspot[data-cursor="grab"]:hover { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M8 6v10l-3-3-2 2 8 8 10-10-2-2-3 3V6H8z" fill="%23b8860b" opacity="0.8"/></svg>') 12 12, pointer; }
.hotspot[data-cursor="arrow"]:hover { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 2l8 10H4l8-10zm0 4l-4 5h8l-4-5z" fill="none" stroke="%23b8860b" stroke-width="2"/><line x1="12" y1="12" x2="12" y2="22" stroke="%23b8860b" stroke-width="2"/><path d="M8 18l4 4 4-4" fill="none" stroke="%23b8860b" stroke-width="2"/></svg>') 12 12, pointer; }
.hotspot[data-cursor="talk"]:hover { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><rect x="2" y="2" width="20" height="16" rx="3" fill="none" stroke="%23b8860b" stroke-width="2"/><polygon points="8,18 12,22 16,18" fill="none" stroke="%23b8860b" stroke-width="2"/></svg>') 12 12, pointer; }

/* 使用物品时，光标显示物品 */
#game-container.using-item {
  cursor: none;
}

/* ---------- 场景名称 ---------- */
#scene-name {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  font-family: 'GameTitle', 'SimSun', serif;
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
}

#scene-name.visible {
  opacity: 1;
}

/* ---------- 暗角 ---------- */
#vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.6) 100%);
}

/* ---------- 噪点 ---------- */
#noise {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

/* ---------- 物品栏 ---------- */
#inventory-bar {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.8);
  border-top: 1px solid rgba(139, 0, 0, 0.4);
  border-left: 1px solid rgba(139, 0, 0, 0.4);
  border-right: 1px solid rgba(139, 0, 0, 0.4);
  border-radius: 8px 8px 0 0;
  pointer-events: auto;
  min-height: 56px;
  align-items: center;
}

.inventory-slot {
  width: 44px;
  height: 44px;
  background: rgba(30, 30, 30, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.inventory-slot:hover {
  border-color: rgba(184, 134, 11, 0.6);
  background: rgba(40, 40, 40, 0.9);
}

.inventory-slot.selected {
  border-color: #b8860b;
  background: rgba(60, 40, 0, 0.5);
  box-shadow: 0 0 10px rgba(184, 134, 11, 0.3);
}

.inventory-slot .item-icon {
  font-size: 1.5rem;
  line-height: 1;
  pointer-events: none;
}

.inventory-slot .item-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: #ccc;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  border: 1px solid rgba(139, 0, 0, 0.3);
}

.inventory-slot:hover .item-tooltip {
  opacity: 1;
}

/* ---------- 对话框 ---------- */
#dialogue-box {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  width: 85%;
  max-width: 800px;
  min-height: 90px;
  background: rgba(0, 0, 0, 0.88);
  border: 2px solid #b8860b;
  border-radius: 6px;
  padding: 16px 24px;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.7), inset 0 0 30px rgba(139, 0, 0, 0.08);
  display: none;
  animation: dialogue-in 0.3s ease;
}

#dialogue-box.visible {
  display: block;
}

@keyframes dialogue-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#dialogue-speaker {
  color: #b8860b;
  font-size: 0.85rem;
  font-weight: bold;
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}

#dialogue-text {
  color: #e0e0e0;
  font-size: 0.95rem;
  line-height: 1.6;
  letter-spacing: 0.03em;
}

#dialogue-hint {
  position: absolute;
  bottom: 8px;
  right: 16px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.7rem;
  animation: text-flicker 2s infinite;
  pointer-events: none;
}

/* ---------- 菜单覆盖层 ---------- */
#menu-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  background: rgba(0, 0, 0, 0.88);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
}

#menu-overlay.active {
  display: flex;
}

.menu-title {
  font-family: 'GameTitle', 'SimSun', 'STSong', serif;
  font-size: 3rem;
  color: #8b0000;
  letter-spacing: 0.2em;
  margin-bottom: 8px;
  text-shadow: 0 0 20px rgba(139, 0, 0, 0.5);
  animation: text-flicker 3s infinite;
}

.menu-subtitle {
  font-size: 0.9rem;
  color: #555;
  letter-spacing: 0.3em;
  margin-bottom: 48px;
}

.menu-btn {
  width: 200px;
  padding: 12px 0;
  margin: 6px 0;
  background: transparent;
  border: 1px solid rgba(139, 0, 0, 0.35);
  color: #999;
  font-size: 0.95rem;
  font-family: 'GameBody', 'Microsoft YaHei', sans-serif;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}

.menu-btn:hover {
  color: #fff;
  border-color: #8b0000;
  background: rgba(139, 0, 0, 0.12);
  text-shadow: 0 0 8px rgba(255, 0, 0, 0.3);
}

.menu-btn:active {
  background: rgba(139, 0, 0, 0.25);
}

/* 存档槽位 */
.save-slot {
  width: 280px;
  padding: 12px 16px;
  margin: 4px 0;
  background: rgba(20, 20, 20, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: #aaa;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  font-family: 'GameBody', 'Microsoft YaHei', sans-serif;
}

.save-slot:hover {
  border-color: rgba(139, 0, 0, 0.5);
  color: #fff;
  background: rgba(30, 30, 30, 0.9);
}

.save-slot .slot-time {
  font-size: 0.7rem;
  color: #666;
  margin-top: 4px;
}

.save-slot .slot-empty {
  color: #444;
  text-align: center;
}

/* ---------- 加载画面 ---------- */
#loading-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  transition: opacity 0.5s ease;
}

#loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-text {
  color: #8b0000;
  font-size: 1.5rem;
  letter-spacing: 0.3em;
  font-family: 'GameTitle', 'SimSun', 'STSong', serif;
  animation: text-flicker 2s infinite;
}

/* ---------- 画面震动 ---------- */
#shake-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

#shake-container.shaking {
  animation: screen-shake 0.5s ease;
}

@keyframes screen-shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-4px, 2px); }
  20% { transform: translate(4px, -3px); }
  30% { transform: translate(-3px, -1px); }
  40% { transform: translate(2px, 3px); }
  50% { transform: translate(-1px, -2px); }
  60% { transform: translate(3px, 1px); }
  70% { transform: translate(-2px, -3px); }
  80% { transform: translate(1px, 2px); }
  90% { transform: translate(-3px, -1px); }
}

/* ---------- 闪屏效果 ---------- */
#flash-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 45;
  pointer-events: none;
  background: #fff;
  opacity: 0;
  transition: opacity 0.05s;
}

#flash-overlay.active {
  opacity: 0.8;
  transition: opacity 0s;
}

/* ---------- 动画 ---------- */
@keyframes text-flicker {
  0%, 100% { opacity: 0.9; }
  3% { opacity: 0.5; }
  6% { opacity: 1; }
  40% { opacity: 0.9; }
  42% { opacity: 0.6; }
  44% { opacity: 1; }
  80% { opacity: 0.9; }
  83% { opacity: 0.4; }
  86% { opacity: 1; }
}

@keyframes fade-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- 场景 CSS 背景（占位，后期替换为渲染图） ---------- */
.scene-bedroom {
  background: linear-gradient(180deg, #0a0505 0%, #150a08 30%, #1a0a08 60%, #0d0503 100%);
  background-color: #0a0404;
}

.scene-courtyard {
  background: linear-gradient(180deg, #020510 0%, #050a18 40%, #0a0d15 70%, #050810 100%);
  background-color: #030510;
}

.scene-study {
  background: linear-gradient(180deg, #0a0805 0%, #120d08 35%, #0f0a06 65%, #080503 100%);
  background-color: #0a0805;
}

.scene-entrance {
  background: linear-gradient(180deg, #050505 0%, #0a0808 30%, #080606 60%, #020202 100%);
  background-color: #050505;
}

/* 场景中的氛围元素（CSS 伪元素模拟） */
.scene-bedroom-ambient {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 40% 80%, rgba(100, 40, 20, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 20%, rgba(60, 30, 20, 0.08) 0%, transparent 40%);
}

.scene-courtyard-ambient {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 15%, rgba(80, 100, 140, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 30% 90%, rgba(60, 40, 20, 0.08) 0%, transparent 40%);
}

.scene-study-ambient {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 60%, rgba(120, 80, 30, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 30%, rgba(60, 40, 20, 0.06) 0%, transparent 40%);
}

.scene-entrance-ambient {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(40, 40, 50, 0.08) 0%, transparent 60%),
    linear-gradient(180deg, transparent 60%, rgba(100, 80, 40, 0.08) 70%, transparent 80%);
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .menu-title {
    font-size: 2rem;
  }

  .menu-btn {
    width: 160px;
    padding: 10px 0;
    font-size: 0.85rem;
  }

  #dialogue-box {
    width: 92%;
    min-height: 80px;
    padding: 12px 16px;
    bottom: 70px;
  }

  #dialogue-text {
    font-size: 0.85rem;
  }

  .inventory-slot {
    width: 38px;
    height: 38px;
  }

  #inventory-bar {
    gap: 4px;
    padding: 6px 10px;
  }

  .save-slot {
    width: 240px;
  }
}

@media (max-width: 480px) {
  .menu-title {
    font-size: 1.5rem;
  }

  .menu-btn {
    width: 140px;
    padding: 8px 0;
    font-size: 0.8rem;
  }

  #dialogue-box {
    width: 95%;
    bottom: 60px;
    padding: 10px 12px;
  }

  .inventory-slot {
    width: 34px;
    height: 34px;
  }

  #inventory-bar {
    gap: 3px;
    padding: 4px 8px;
    min-height: 48px;
  }
}

/* =============================================
   开场先导片
   ============================================= */
#cutscene-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 90;
  background: #000;
  display: none;
  pointer-events: auto;
  cursor: pointer;
  overflow: hidden;
}

#cutscene-overlay.active {
  display: block;
}

/* 先导片背景 */
#cutscene-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center, #0a0a0a 0%, #000 70%);
  z-index: 1;
}

/* 老照片 */
#cutscene-photo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  opacity: 0;
  transition: opacity 0.5s ease;
  border: 4px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  filter: sepia(0.6) brightness(0.8);
  /* 固定比例，边框紧跟图片 */
  width: 55vw;
  aspect-ratio: 4 / 3;
  max-width: 70vw;
  max-height: 50vh;
}

#cutscene-photo.visible {
  opacity: 0.85;
}

/* 文字入场动画 */
#cutscene-text-area {
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  max-width: 700px;
  z-index: 5;
  text-align: center;
}

#cutscene-speaker {
  color: #b8860b;
  font-size: 1.3rem;
  letter-spacing: 0.15em;
  margin-bottom: 6px;
  font-family: 'SimSun', 'STSong', 'Microsoft YaHei', serif;
  opacity: 0.9;
  min-height: 1.5em;
}

#cutscene-text {
  color: #c0c0c0;
  font-size: 1.1rem;
  line-height: 1.8;
  letter-spacing: 0.08em;
  font-family: 'SimSun', 'STSong', 'Microsoft YaHei', serif;
  text-shadow: 0 0 3px rgba(200, 200, 200, 0.3);
  transition: opacity 0.3s;
}

/* 年份时间线 */
#cutscene-timeline {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  text-align: center;
}

#cutscene-year {
  color: #8b0000;
  font-size: 2.5rem;
  letter-spacing: 0.3em;
  font-family: 'SimSun', 'STSong', serif;
  text-shadow: 0 0 30px rgba(139, 0, 0, 0.6);
  animation: text-flicker 3s infinite;
  opacity: 0;
  transition: opacity 0.5s;
}

#cutscene-year.visible {
  opacity: 1;
}

/* 点击提示 */
#cutscene-hint {
  position: absolute;
  bottom: 6%;
  right: 8%;
  z-index: 5;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  animation: text-flicker 2.5s infinite;
  pointer-events: none;
}

/* =============================================
   雪花点 / 信号不良 文字效果
   ============================================= */
#cutscene-static {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  animation: static-shift 0.15s steps(3) infinite;
}

@keyframes static-shift {
  0%   { background-position: 0 0; opacity: 0.04; }
  33%  { background-position: -50px 20px; opacity: 0.07; }
  66%  { background-position: 30px -30px; opacity: 0.05; }
  100% { background-position: -20px 10px; opacity: 0.06; }
}

/* 信号干扰横纹 */
#cutscene-overlay::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
  opacity: 0.03;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.3) 2px,
    rgba(255, 255, 255, 0.3) 3px
  );
  animation: scanlines 8s linear infinite;
}

@keyframes scanlines {
  0%   { transform: translateY(0); }
  100% { transform: translateY(100px); }
}

/* 文字入场动画 */
#cutscene-text.fade-in {
  animation: text-fade-in 0.8s ease forwards;
}

@keyframes text-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 照片入场（保留 keyframes 供容器使用） */
#cutscene-photo-container.fade-in {
  animation: photo-fade-in 1.5s ease forwards;
}

@keyframes photo-fade-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
  to   { opacity: 0.85; transform: translate(-50%, -50%) scale(1); }
}

/* 年份闪烁出现 */
#cutscene-year.pop-in {
  animation: year-pop 0.6s ease forwards;
}

@keyframes year-pop {
  0%   { opacity: 0; transform: scale(1.5); }
  60%  { opacity: 1; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}

/* =============================================
   家具图层
   ============================================= */
#scene-furniture {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.furniture-layer {
  position: absolute;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
}

/* 场景切换时的图层动画 */
.furniture-layer.entering {
  animation: furniture-in 0.6s ease forwards;
}

@keyframes furniture-in {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

/* 响应式 - 先导片 */
@media (max-width: 768px) {
  #cutscene-text {
    font-size: 0.9rem;
  }

  #cutscene-year {
    font-size: 1.8rem;
  }

  #cutscene-speaker {
    font-size: 1.1rem;
  }

  #cutscene-text-area {
    width: 90%;
    bottom: 8%;
  }
}

@media (max-width: 480px) {
  #cutscene-text {
    font-size: 0.8rem;
  }

  #cutscene-year {
    font-size: 1.5rem;
  }

  #cutscene-speaker {
    font-size: 1rem;
  }

  #cutscene-text-area {
    width: 92%;
    bottom: 6%;
  }
}

/* =============================================
   菜单增强：灰显按钮、滑块、开关、设置面板
   ============================================= */

/* 灰显按钮 */
.menu-btn.disabled {
  color: #333 !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
  cursor: not-allowed !important;
  pointer-events: none;
}

.menu-btn.disabled:hover {
  background: transparent !important;
  text-shadow: none !important;
}

/* 高亮按钮（新游戏） */
.menu-btn.primary {
  color: #fff;
  border-color: rgba(139, 0, 0, 0.7);
  background: rgba(139, 0, 0, 0.08);
}

.menu-btn.primary:hover {
  border-color: #b8860b;
  text-shadow: 0 0 10px rgba(184, 134, 11, 0.5);
}

/* 存档槽位增强 */
.save-slot {
  position: relative;
}

.save-slot.has-data {
  border-color: rgba(139, 0, 0, 0.3);
}

.save-slot.has-data .slot-indicator {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8b0000;
  box-shadow: 0 0 6px rgba(139, 0, 0, 0.6);
}

.save-slot.current-slot {
  border-color: #b8860b;
  background: rgba(60, 40, 0, 0.3);
}

.save-slot .slot-scene {
  font-size: 0.7rem;
  color: #666;
  margin-top: 2px;
}

.save-slot .slot-playtime {
  font-size: 0.7rem;
  color: #555;
  margin-top: 2px;
}

/* 设置项 */
.settings-group {
  width: 320px;
  margin-bottom: 24px;
}

.settings-label {
  color: #aaa;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-value {
  color: #b8860b;
  font-size: 0.8rem;
}

/* 滑块 */
.settings-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #8b0000;
  border: 2px solid #b8860b;
  cursor: pointer;
  transition: transform 0.15s;
}

.settings-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* 开关 */
.settings-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  cursor: pointer;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  transition: background 0.3s;
  flex-shrink: 0;
}

.toggle-switch.active {
  background: rgba(139, 0, 0, 0.6);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ccc;
  transition: transform 0.3s;
}

.toggle-switch.active::after {
  transform: translateX(20px);
  background: #fff;
}

/* 设置分隔线 */
.settings-divider {
  width: 280px;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 8px 0 16px;
}

/* 确认对话框 */
.confirm-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 10, 10, 0.95);
  border: 1px solid rgba(139, 0, 0, 0.5);
  border-radius: 8px;
  padding: 24px;
  z-index: 25;
  text-align: center;
  min-width: 280px;
  animation: fade-in 0.2s ease;
}

.confirm-dialog .confirm-text {
  color: #ccc;
  font-size: 0.9rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

.confirm-dialog .confirm-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-dialog .confirm-btn {
  padding: 8px 24px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #aaa;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  font-family: inherit;
}

.confirm-dialog .confirm-btn:hover {
  border-color: #8b0000;
  color: #fff;
}

.confirm-dialog .confirm-btn.danger {
  border-color: rgba(139, 0, 0, 0.6);
  color: #d32f2f;
}

.confirm-dialog .confirm-btn.danger:hover {
  background: rgba(139, 0, 0, 0.3);
}

/* 返回按钮 */
.menu-back {
  margin-top: 16px;
  color: #555;
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 0.2s;
  text-align: center;
}

.menu-back:hover {
  color: #999;
}

/* =============================================
   免责声明画面
   ============================================= */
#disclaimer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 110;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
}

#disclaimer-overlay.hidden {
  display: none;
}

.disclaimer-scroll {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px 60px;
}

.disclaimer-content {
  max-width: 560px;
  width: 100%;
  text-align: center;
  padding-bottom: 40px;
}

.disclaimer-title {
  font-family: 'GameTitle', 'SimSun', 'STSong', serif;
  font-size: 2.5rem;
  color: #8b0000;
  letter-spacing: 0.25em;
  margin-bottom: 4px;
  text-shadow: 0 0 20px rgba(139, 0, 0, 0.5);
  animation: text-flicker 3s infinite;
}

.disclaimer-subtitle {
  font-size: 0.9rem;
  color: #555;
  letter-spacing: 0.3em;
  margin-bottom: 36px;
}

.disclaimer-section {
  text-align: left;
  margin-bottom: 24px;
  padding: 0 8px;
}

.disclaimer-section h3 {
  color: #b8860b;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  border-left: 2px solid #8b0000;
  padding-left: 10px;
}

.disclaimer-section p {
  color: #999;
  font-size: 0.82rem;
  line-height: 1.8;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.disclaimer-section .highlight {
  color: #b8860b;
  font-weight: bold;
}

.disclaimer-section kbd {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  padding: 1px 7px;
  font-family: inherit;
  font-size: 0.78rem;
  color: #ccc;
  letter-spacing: 0.05em;
}

.pause-icon-inline {
  display: inline-block;
  background: rgba(139, 0, 0, 0.3);
  border: 1px solid rgba(139, 0, 0, 0.5);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.75rem;
  color: #b8860b;
  letter-spacing: 0;
  vertical-align: middle;
}

.disclaimer-warn {
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(139, 0, 0, 0.08);
  border: 1px solid rgba(139, 0, 0, 0.25);
  border-radius: 4px;
}

.disclaimer-warn p {
  color: #c44;
  font-size: 0.78rem;
  margin: 0;
}

.disclaimer-agree {
  text-align: center;
  margin-top: 28px;
  margin-bottom: 16px;
}

.disclaimer-agree p {
  color: #666;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.disclaimer-btn {
  display: inline-block;
  width: 200px;
  padding: 12px 0;
  background: rgba(139, 0, 0, 0.12);
  border: 1px solid rgba(139, 0, 0, 0.6);
  color: #fff;
  font-size: 1rem;
  font-family: 'GameBody', 'Microsoft YaHei', sans-serif;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
}

.disclaimer-btn:hover {
  background: rgba(139, 0, 0, 0.3);
  border-color: #b8860b;
  text-shadow: 0 0 10px rgba(184, 134, 11, 0.5);
}

/* 桌面端/手机端提示切换 */
@media (min-width: 769px) {
  .tip-mobile-only { display: none; }
}

@media (max-width: 768px) {
  .tip-desktop-only { display: none; }
  .disclaimer-title { font-size: 1.8rem; }
  .disclaimer-section p { font-size: 0.78rem; }
  .disclaimer-btn { width: 160px; font-size: 0.9rem; }
}

/* =============================================
   右上角菜单按钮（暂停符号 ||）
   ============================================= */
#menu-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 30;
  width: 42px;
  height: 42px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.25s;
  pointer-events: auto;
  /* 桌面端淡入淡出，不太显眼 */
  opacity: 0;
  transition: opacity 0.4s;
}

#menu-btn.menu-btn-visible {
  opacity: 0.55;
}

#menu-btn.menu-btn-hidden {
  opacity: 0;
  pointer-events: none;
}

#menu-btn:hover {
  opacity: 1;
  border-color: rgba(139, 0, 0, 0.6);
  background: rgba(20, 0, 0, 0.85);
}

.menu-btn-icon {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.pause-line {
  display: block;
  width: 4px;
  height: 16px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 1px;
  transition: background 0.2s;
}

#menu-btn:hover .pause-line {
  background: rgba(255, 255, 255, 0.9);
}

/* 手机端：菜单按钮更大、更醒目 */
@media (max-width: 768px) {
  #menu-btn {
    width: 48px;
    height: 48px;
    top: 10px;
    right: 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.18);
  }

  #menu-btn.menu-btn-visible {
    opacity: 0.7;
  }

  .pause-line {
    width: 5px;
    height: 20px;
  }
}

/* =============================================
   保存警告提示
   ============================================= */
.save-warning {
  margin: 8px 0 16px;
  padding: 8px 12px;
  background: rgba(200, 150, 0, 0.06);
  border: 1px solid rgba(200, 150, 0, 0.15);
  border-radius: 4px;
  text-align: center;
}

.save-warning p {
  color: #a08040;
  font-size: 0.7rem;
  line-height: 1.5;
  margin: 0;
  letter-spacing: 0.04em;
}

/* =============================================
   场景入场提示（右下角：地点 + 时间）
   ============================================= */
#scene-entry-overlay {
  position: absolute;
  bottom: 90px;
  right: 28px;
  z-index: 10;
  text-align: right;
  opacity: 0;
  pointer-events: none;
}

#scene-entry-overlay.visible {
  animation: scene-entry-flash 3.5s ease forwards;
}

.scene-entry-location {
  color: #8b0000;
  font-size: 2.2rem;
  letter-spacing: 0.25em;
  font-family: 'SimSun', 'STSong', serif;
  text-shadow: 0 0 24px rgba(139, 0, 0, 0.7), 0 0 60px rgba(139, 0, 0, 0.3);
  line-height: 1.2;
}

.scene-entry-time {
  color: #b8860b;
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  font-family: 'SimSun', 'STSong', serif;
  text-shadow: 0 0 10px rgba(184, 134, 11, 0.4);
  margin-top: 2px;
}

@keyframes scene-entry-flash {
  0%   { opacity: 0; }
  8%   { opacity: 1; }
  16%  { opacity: 0.6; }
  24%  { opacity: 1; }
  40%  { opacity: 0.9; }
  60%  { opacity: 0.4; }
  80%  { opacity: 0.15; }
  100% { opacity: 0; }
}

/* 手机端调整 */
@media (max-width: 768px) {
  #scene-entry-overlay {
    bottom: 80px;
    right: 16px;
  }

  .scene-entry-location {
    font-size: 1.6rem;
    letter-spacing: 0.2em;
  }

  .scene-entry-time {
    font-size: 0.95rem;
  }
}

/* =============================================
   笔记本阅读弹窗
   ============================================= */
#notebook-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 95;
  background: rgba(0, 0, 0, 0.88);
  display: none;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
}

#notebook-overlay.active {
  display: flex;
}

.notebook-container {
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.notebook-paper {
  width: 100%;
  background: linear-gradient(180deg, #f5f0e8 0%, #ede4d4 5%, #f2ece0 50%, #e8dcc8 95%, #d4c8b0 100%);
  border: 1px solid #8b7355;
  border-radius: 4px;
  padding: 28px 24px 20px;
  box-shadow:
    0 0 30px rgba(0, 0, 0, 0.7),
    inset 0 0 60px rgba(139, 115, 85, 0.15);
  position: relative;
  overflow: hidden;
  min-height: 300px;
  max-height: 55vh;
  overflow-y: auto;
}

/* 纸张横线纹理 */
.notebook-paper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 27px,
    rgba(139, 115, 85, 0.12) 27px,
    rgba(139, 115, 85, 0.12) 28px
  );
  z-index: 0;
}

.notebook-content {
  position: relative;
  z-index: 1;
  color: #3a2a1a;
  font-size: 0.95rem;
  line-height: 2;
  letter-spacing: 0.05em;
  font-family: 'SimSun', 'STSong', 'KaiTi', serif;
  white-space: pre-wrap;
  word-break: break-word;
}

.notebook-content .nb-title {
  font-size: 1.3rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 16px;
  color: #1a0a00;
  letter-spacing: 0.15em;
}

.notebook-content .nb-date {
  text-align: right;
  color: #6b5a4a;
  font-size: 0.8rem;
  margin-bottom: 16px;
}

.notebook-content .nb-divider {
  text-align: center;
  color: #8b7355;
  margin: 12px 0;
  letter-spacing: 0.3em;
}

.notebook-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(139, 115, 85, 0.2);
}

.notebook-page-num {
  color: #8b7355;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
}

.notebook-controls {
  display: flex;
  gap: 16px;
  align-items: center;
}

.notebook-nav-btn,
.notebook-close-btn {
  padding: 8px 18px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(139, 115, 85, 0.4);
  color: #c0b090;
  font-size: 0.85rem;
  font-family: 'GameBody', 'Microsoft YaHei', sans-serif;
  letter-spacing: 0.08em;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.notebook-nav-btn:hover,
.notebook-close-btn:hover {
  border-color: #b8860b;
  color: #e0d0b0;
  background: rgba(30, 20, 0, 0.7);
}

.notebook-close-btn {
  border-color: rgba(139, 0, 0, 0.4);
  color: #c08080;
}

.notebook-close-btn:hover {
  border-color: #8b0000;
  color: #e0a0a0;
}

.notebook-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* 手机端笔记本 */
@media (max-width: 768px) {
  .notebook-paper {
    padding: 20px 16px 16px;
    min-height: 250px;
    max-height: 50vh;
  }

  .notebook-content {
    font-size: 0.85rem;
    line-height: 1.9;
  }
}

/* =============================================
   华容道拼图弹窗
   ============================================= */
#puzzle-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 95;
  background: rgba(0, 0, 0, 0.88);
  display: none;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
}

#puzzle-overlay.active {
  display: flex;
}

.puzzle-container {
  text-align: center;
}

.puzzle-title {
  color: #b8860b;
  font-size: 1.5rem;
  letter-spacing: 0.2em;
  font-family: 'SimSun', 'STSong', serif;
  margin-bottom: 16px;
}

.puzzle-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 4px;
  width: 320px;
  height: 320px;
  margin: 0 auto 16px;
  background: rgba(139, 115, 85, 0.2);
  border: 2px solid rgba(139, 115, 85, 0.4);
  border-radius: 4px;
  padding: 4px;
  user-select: none;
  -webkit-user-select: none;
}

.puzzle-tile {
  background: linear-gradient(135deg, #5a3a1a 0%, #3a2010 50%, #4a2a15 100%);
  border: 1px solid rgba(184, 134, 11, 0.4);
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: transform 0.15s ease;
  font-size: 1.4rem;
  color: #e0d0b0;
  font-family: 'SimSun', 'STSong', serif;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.puzzle-tile:hover {
  border-color: #b8860b;
  background: linear-gradient(135deg, #6a4a2a 0%, #4a2a18 50%, #5a3a20 100%);
}

.puzzle-tile.empty {
  background: rgba(0, 0, 0, 0.3);
  border-color: transparent;
  cursor: default;
  box-shadow: none;
}

.puzzle-tile.empty:hover {
  background: rgba(0, 0, 0, 0.3);
  border-color: transparent;
}

.puzzle-hint {
  color: #888;
  font-size: 0.8rem;
  margin-bottom: 12px;
  letter-spacing: 0.05em;
  min-height: 1.5em;
}

.puzzle-close-btn {
  padding: 8px 24px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(139, 0, 0, 0.4);
  color: #c08080;
  font-size: 0.85rem;
  font-family: 'GameBody', 'Microsoft YaHei', sans-serif;
  letter-spacing: 0.08em;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.puzzle-close-btn:hover {
  border-color: #8b0000;
  color: #e0a0a0;
  background: rgba(30, 10, 10, 0.7);
}

/* 手机端拼图 */
@media (max-width: 768px) {
  .puzzle-board {
    width: 280px;
    height: 280px;
    gap: 3px;
  }

  .puzzle-tile {
    font-size: 1.2rem;
  }
}

@media (max-width: 400px) {
  .puzzle-board {
    width: 240px;
    height: 240px;
    gap: 2px;
  }

  .puzzle-tile {
    font-size: 1rem;
  }
}