/* ============================================================
   主样式表 - BA风格视觉小说（西欧贵族配色）
   配色：米白 #FDF8F0 / 原木 #D4C5A0 #8B7A5A / 紫色 #B8A0C8 / 暖白 #FBF8F2
   ============================================================ */

* { margin:0; padding:0; box-sizing:border-box; }

/* 全局触摸优化 */
button, input, .puzzle-tile, canvas, .char-switch-btn {
  touch-action: manipulation;
}

button:active, .option-btn:active, .menu-btn:active,
.char-switch-btn:active, .confirm-btn:active, .puzzle-tile:active {
  transform: scale(0.96);
}

/* 图片占位通用规则（后续替换为真实图片） */
img, .char-poster-placeholder img, .char-illust-placeholder img {
  max-width: 100%;
  height: auto;
  display: block;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", Arial, sans-serif;
  background: #2a2218;
  color: #4A3728;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

#app {
  width: 100%;
  max-width: 780px;
  min-height: 100vh;
  min-height: 100dvh;
  background: #2a2218;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

/* ---- 顶部标题栏 ---- */
#title-bar {
  background: #8B7A5A;
  color: #FDF8F0;
  padding: 10px 20px;
  font-size: 14px;
  letter-spacing: 3px;
  text-align: center;
  border-bottom: 2px solid #B8A0C8;
  flex-shrink: 0;
  transition: all 0.4s ease;
}

#title-bar .char-indicator {
  font-size: 11px;
  color: #B8A0C8;
  letter-spacing: 1px;
  margin-left: 8px;
}

/* ---- 场景画面区（关卡显示区，约25%高度） ---- */
#scene-area {
  flex: 25 0 0;
  background: linear-gradient(180deg, #C9B896 0%, #D4C5A0 40%, #EBE0CC 80%, #F5F0E8 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.6s ease;
}

/* 幕布纹理叠加 */
#scene-area .scene-bg-curtain {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(201,184,150,0.3) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 80%, rgba(184,160,200,0.10) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(212,197,160,0.15) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ---- 关卡进度轨道（5格滑动窗口，×2.5 放大） ---- */
.level-track-wrapper {
  position: relative;
  z-index: 1;
  width: 600px;           /* 5圆(65*5) + 4线(45*4) = 505px + 余量 */
  overflow: hidden;
  margin: 0 auto;
}
.level-track-wrapper .level-track {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  padding: 20px 0;
  width: max-content;
  transition: transform 0.45s cubic-bezier(0.25, 0, 0.35, 1);
}

/* 关卡节点 */
.level-node {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.level-circle {
  width: 65px;
  height: 65px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.4);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.4s ease;
}

.level-num {
  font-size: 30px;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.6);
  font-family: "Courier New", monospace;
  line-height: 1;
  transition: color 0.4s ease;
}

/* 紫红色纤细圆环 — 当前关卡 */
.level-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 5px solid rgba(184, 160, 200, 0);
  pointer-events: none;
  transition: border-color 0.4s ease, transform 0.4s ease;
}

.level-node.active .level-ring {
  border-color: rgba(184, 160, 200, 0.75);
  animation: pulse-ring 1.8s ease-in-out infinite alternate;
}

.level-node.active .level-circle {
  border-color: rgba(255, 255, 255, 0.85);
}

.level-node.active .level-num {
  color: #fff;
}

@keyframes pulse-ring {
  0%   { transform: scale(1);    border-color: rgba(184, 160, 200, 0.6); }
  100% { transform: scale(1.18); border-color: rgba(184, 160, 200, 0.95); }
}

/* 紫红色斜杠 — 已完成关卡 */
.level-slash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.level-slash::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120%;
  height: 5px;
  background: rgba(184, 160, 200, 0.8);
  transform: translate(-50%, -50%) rotate(-45deg);
  border-radius: 3px;
}

.level-node.done .level-slash {
  opacity: 1;
}

.level-node.done .level-circle {
  border-color: rgba(255, 255, 255, 0.3);
}

.level-node.done .level-num {
  color: rgba(255, 255, 255, 0.3);
}

/* 连接短线 */
.level-arrow {
  flex-shrink: 0;
  width: 35px;
  height: 3px;
  background: rgba(255, 255, 255, 0.35);
  margin: 0 5px;
}

/* ---- 文本对话区（剧情框，约35%高度，30%半透明浮层 + 深色外框） ---- */
#text-area {
  flex: 37 0 0;
  margin-bottom: 2.5dvh;
  padding: 2% 2% 0 2%;
  background: rgba(200, 185, 160, 0.30);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid #3D3025;
  border-radius: 6px;
  min-height: 0;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* 发言人/地点标签（场景元信息） */
#text-area .speaker-tag {
  display: inline-block;
  align-self: flex-start;
  margin: 14px 20px 8px;
  padding: 4px 14px;
  font-size: 13px;
  color: #8B7A5A;
  background: rgba(212, 197, 160, 0.25);
  border-radius: 4px;
  letter-spacing: 2px;
  flex-shrink: 0;
  /* 与剧情文本之间的分割 */
  border-bottom: 1px solid rgba(212, 197, 160, 0.2);
  padding-bottom: 6px;
  margin-bottom: 0;
}

#text-area .speaker-tag:empty {
  display: none;
}

#text-area .narrative {
  flex: 1;
  padding: 16px 24px 20px;
  font-size: clamp(14px, 4vw, 17px);
  line-height: 1.9;
  color: #F2EBDE;
  transition: opacity 0.35s ease;
}

#text-area .narrative.fading {
  opacity: 0;
}

/* ---- 打字机光标动画 ---- */
#text-area .narrative.typing::after {
  content: "|";
  display: inline;
  color: #D4C5A0;
  animation: cursorBlink 0.6s step-end infinite;
  margin-left: 1px;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ---- 打字完成后：文本框下落动画 ---- */
/* 起点 -35vh（中间/打字位置），终点 0（底部原位） */
#text-area.text-drop-in {
  animation: textBoxDrop 2.5s cubic-bezier(0.35, 0, 0.25, 1) forwards;
}

@keyframes textBoxDrop {
  /* 0~0.2s (0%~8%)：中间原地保持不动 */
  0%     { transform: translateY(-35vh); }
  8%     { transform: translateY(-35vh); }

  /* 0.2~0.5s (8%~20%)：缓慢向上微提 2vh */
  20%    { transform: translateY(-37vh); }

  /* 0.5~1.5s (20%~60%)：重力加速下落 1s，直冲底部归零 */
  60%    { transform: translateY(0); }

  /* 1.5~2.5s (60%~100%)：底部静置 1s */
  100%   { transform: translateY(0); }
}

/* ---- 选项按钮淡入动画 ---- */
#options-area.options-fade-in {
  animation: optionsFadeIn 0.3s ease forwards;
}

@keyframes optionsFadeIn {
  0%   { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

#text-area .narrative strong {
  color: #D4C5A0;
  font-weight: bold;
}

#text-area .narrator-tag {
  display: inline-block;
  background: #D4C5A0;
  color: #2a2218;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

/* ---- 选项按钮区（垂直排列，约40%高度，上下各3%留白） ---- */
#options-area {
  flex: 35 0 0;
  padding: 3% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #F8F2E8;
}

#options-area .option-btn {
  display: block;
  width: 76%;
  min-height: 44px;
  padding: 12px 20px;
  font-size: clamp(13px, 3.5vw, 15px);
  line-height: 1.5;
  text-align: center;
  background: #F0E8D5;
  border: 2px solid #C9B896;
  border-radius: 8px;
  color: #4A3728;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  touch-action: manipulation;
}

#options-area .option-btn:hover {
  border-color: #B8A0C8;
  background: #fff;
  box-shadow: 0 2px 14px rgba(184,160,200,0.28);
  transform: translateY(-1px);
}

#options-area .option-btn:active,
#options-area .option-btn.selected {
  background: #B8A0C8;
  color: #FFFFFF;
  border-color: #9B7BB8;
}

#options-area .option-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ---- 开始/菜单界面 ---- */
#menu-screen {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #2a2218 0%, #3d3224 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

#menu-screen .game-title {
  font-size: clamp(28px, 8vw, 42px);
  color: #D4C5A0;
  letter-spacing: 8px;
  margin-bottom: 6px;
  text-shadow: 0 0 30px rgba(212,197,160,0.3);
}

#menu-screen .game-subtitle {
  font-size: 14px;
  color: #B8A0C8;
  letter-spacing: 4px;
  margin-bottom: 40px;
}

#menu-screen .menu-btn {
  padding: clamp(12px, 3vw, 16px) clamp(32px, 10vw, 48px);
  font-size: clamp(14px, 3.5vw, 16px);
  min-height: 48px;
  background: transparent;
  border: 2px solid #D4C5A0;
  color: #D4C5A0;
  cursor: pointer;
  letter-spacing: 3px;
  border-radius: 6px;
  transition: all 0.3s;
  font-family: inherit;
  touch-action: manipulation;
}

#menu-screen .menu-btn:hover {
  background: #D4C5A0;
  color: #2a2218;
}

/* ---- 性别选择界面 ---- */
#gender-select {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #2a2218 0%, #3d3224 100%);
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gender-select-inner {
  text-align: center;
  padding: 30px;
}

.gender-title {
  font-size: clamp(20px, 5vw, 28px);
  color: #D4C5A0;
  letter-spacing: 4px;
  margin-bottom: 10px;
  font-weight: normal;
}

.gender-subtitle {
  font-size: 13px;
  color: rgba(240, 230, 211, 0.5);
  margin-bottom: 40px;
  letter-spacing: 1px;
}

.gender-btns {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
}

.gender-btn {
  width: 160px;
  padding: 28px 20px;
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(212, 197, 160, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  touch-action: manipulation;
}

.gender-btn:hover {
  border-color: #D4C5A0;
  background: rgba(212, 197, 160, 0.08);
  transform: translateY(-2px);
}

.gender-btn:active {
  transform: scale(0.96);
}

.gender-btn .gender-icon {
  font-size: 48px;
}

.gender-btn .gender-label {
  font-size: 18px;
  color: #D4C5A0;
  letter-spacing: 3px;
}

/* ---- 信息采集界面 ---- */
#info-collect {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #2a2218 0%, #3d3224 100%);
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-collect-inner {
  text-align: center;
  padding: 30px 24px;
  max-width: 440px;
  width: 90%;
}

.info-collect-title {
  font-size: clamp(20px, 5vw, 26px);
  color: #D4C5A0;
  letter-spacing: 4px;
  margin-bottom: 10px;
  font-weight: normal;
}

.info-collect-desc {
  font-size: 13px;
  color: rgba(240, 230, 211, 0.5);
  margin-bottom: 28px;
  line-height: 1.6;
}

.info-collect-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.info-option-btn {
  display: block;
  width: 100%;
  padding: 14px 18px;
  font-size: 15px;
  font-family: inherit;
  text-align: left;
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(212, 197, 160, 0.2);
  border-radius: 6px;
  color: rgba(240, 230, 211, 0.8);
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.25s;
  touch-action: manipulation;
  min-height: 48px;
}

.info-option-btn:hover {
  border-color: #D4C5A0;
  background: rgba(212, 197, 160, 0.08);
}

.info-option-btn.selected {
  border-color: #B8A0C8;
  background: rgba(184, 160, 200, 0.2);
  color: #D4C5A0;
}

.info-other-wrap {
  margin-bottom: 20px;
}

.info-other-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(212, 197, 160, 0.3);
  border-radius: 6px;
  color: #f0e6d3;
  outline: none;
  letter-spacing: 1px;
  transition: border-color 0.25s;
}

.info-other-input:focus {
  border-color: #D4C5A0;
}

.info-confirm-btn {
  padding: 12px 44px;
  font-size: 15px;
  font-family: inherit;
  background: #8B7A5A;
  color: #FDF8F0;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 2px;
  transition: all 0.3s;
  min-height: 48px;
  touch-action: manipulation;
}

.info-confirm-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.info-confirm-btn:not(:disabled):hover {
  background: #9B7BB8;
}

/* ---- 角色选择动画关键帧 ---- */
@keyframes fadeOutChar {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes slideInLeftChar {
  0%   { transform: translateX(-100%); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes slideInRightChar {
  0%   { transform: translateX(100%); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

/* ---- 角色选择界面（双面板滑动动画） ---- */
#char-select {
  position: absolute;
  inset: 0;
  background: #1a1a2e url("../assets/images/bg_char_select.svg") center/cover no-repeat;
  z-index: 99;
  overflow: hidden;
}

.char-select-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

/* == 双面板行 == */
.char-panels-row {
  display: flex;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

/* == 左栏：磨砂玻璃 == */
.char-left-panel {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f0e6d3;
  position: relative;
  overflow: hidden;
}

.char-left-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(201, 169, 110, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 70%, rgba(139, 0, 0, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

.char-poster-area {
  margin-bottom: 20px;
  flex-shrink: 0;
}

.char-poster-placeholder {
  width: 200px;
  height: 280px;
  background: linear-gradient(150deg, #3E2723 0%, #6b3a3a 35%, #8B0000 70%, #2d1414 100%);
  border: 2px solid rgba(201, 169, 110, 0.4);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(201, 169, 110, 0.6);
  font-size: 13px;
  letter-spacing: 2px;
  position: relative;
  overflow: hidden;
}

.char-poster-placeholder::after {
  content: "海 报";
  position: absolute;
  font-size: 28px;
  font-weight: bold;
  letter-spacing: 10px;
  color: rgba(201, 169, 110, 0.15);
  transform: rotate(-15deg);
}

.char-intro-section {
  text-align: center;
  max-width: 320px;
}

.char-intro-heading {
  font-size: 20px;
  color: #C9A96E;
  letter-spacing: 3px;
  margin-bottom: 12px;
  font-weight: normal;
}

.char-intro-desc {
  font-size: 13px;
  line-height: 1.8;
  color: rgba(240, 230, 211, 0.75);
}

/* == 右栏：深色实体背景 == */
.char-right-panel {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  background: rgba(26, 26, 46, 0.88);
  color: #f0e6d3;
  position: relative;
}

.char-right-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center top, rgba(201, 169, 110, 0.06) 0%, transparent 60%),
    linear-gradient(180deg, rgba(26, 26, 46, 0) 0%, rgba(26, 26, 46, 1) 95%);
  pointer-events: none;
  z-index: 0;
}

.char-illust-area {
  margin-bottom: 20px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.char-illust-img {
  width: 260px;
  height: 360px;
  object-fit: cover;
  border: none;
  border-radius: 6px;
  display: block;
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.35),
    0 2px 16px rgba(0, 0, 0, 0.3);
  transition: opacity 0.2s ease;
  background: linear-gradient(180deg, #2d2d44 0%, #1a1a2e 60%, #0d0d1a 100%);
}

.char-illust-placeholder {
  width: 260px;
  height: 360px;
  background: linear-gradient(180deg, #2d2d44 0%, #1a1a2e 60%, #0d0d1a 100%);
  border: 1px solid rgba(201, 169, 110, 0.25);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(201, 169, 110, 0.4);
  font-size: 12px;
  letter-spacing: 2px;
}

.char-info-section {
  text-align: center;
  max-width: 320px;
  position: relative;
  z-index: 1;
}

.char-name-display {
  font-size: 24px;
  color: #C9A96E;
  letter-spacing: 4px;
  margin-bottom: 6px;
  font-weight: normal;
}

.char-title-display {
  font-size: 13px;
  color: #8B0000;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.char-bio-display {
  font-size: 13px;
  line-height: 1.8;
  color: rgba(240, 230, 211, 0.7);
}

/* == 动画状态类 == */
.char-left-panel.fading-out {
  animation: fadeOutChar 0.15s ease forwards;
}

.char-right-panel.fading-out {
  animation: fadeOutChar 0.15s ease forwards;
}

.char-left-panel.slide-in-left {
  animation: slideInLeftChar 0.8s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

.char-right-panel.slide-in-right {
  animation: slideInRightChar 0.8s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

/* == 底部角色切换按钮栏 == */
.char-switch-bar {
  flex-shrink: 0;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.5);
  border-top: 1px solid rgba(201, 169, 110, 0.15);
  display: flex;
  justify-content: center;
}

.char-switch-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.char-switch-btn {
  padding: 8px 18px;
  font-size: 13px;
  font-family: inherit;
  background: transparent;
  border: 1px solid rgba(201, 169, 110, 0.3);
  color: rgba(240, 230, 211, 0.7);
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 2px;
  transition: all 0.25s ease;
}

.char-switch-btn:hover {
  border-color: #C9A96E;
  color: #C9A96E;
  background: rgba(201, 169, 110, 0.08);
}

.char-switch-btn.active {
  border-color: #9B7BB8;
  background: #9B7BB8;
  color: #f0e6d3;
}

/* == 确认按钮 == */
#char-select .confirm-btn-wrap {
  flex-shrink: 0;
  text-align: center;
  padding: 10px 20px 18px;
  background: rgba(0, 0, 0, 0.5);
}

#char-select .confirm-btn {
  padding: 12px 44px;
  font-size: 15px;
  background: #8B7A5A;
  color: #FDF8F0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 2px;
  font-family: inherit;
  opacity: 0.5;
  pointer-events: none;
  transition: all 0.3s;
}

#char-select .confirm-btn.active {
  opacity: 1;
  pointer-events: auto;
}

#char-select .confirm-btn.active:hover {
  background: #9B7BB8;
}

/* ---- 模态框（小游戏） ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box {
  background: #FBF8F2;
  border: 2px solid #D4C5A0;
  border-radius: 8px;
  padding: 28px 24px;
  width: 90%;
  max-width: 500px;
  text-align: center;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-box h3 {
  color: #4A3728;
  margin-bottom: 16px;
  letter-spacing: 2px;
}

/* ---- 搜证游戏：全屏覆盖容器 ---- */
.search-game-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #1a1a2e;
  /* 底部安全区适配 */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---- 背景图堆叠 ---- */
.search-bg-stack {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.search-bg-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 0.5s ease;
}

/* ---- 上半区（55%）— Canvas 游戏 ---- */
.search-upper {
  position: relative;
  z-index: 1;
  flex: 0 0 55%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
}

/* 倒计时 — 右上角 */
.search-countdown-wrap {
  position: absolute;
  top: 12px;
  right: 20px;
  display: flex;
  align-items: baseline;
  gap: 4px;
  z-index: 5;
}

.search-countdown-label {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 1px;
}

.search-countdown {
  font-size: 36px;
  color: #C9A96E;
  font-weight: bold;
  font-family: "Courier New", monospace;
  line-height: 1;
}

.search-countdown.warning {
  color: #e74c3c;
  animation: blink 0.5s infinite;
}

.search-countdown-unit {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

/* Canvas 容器 */
.search-canvas-wrap {
  position: relative;
  display: inline-block;
}

#search-game-canvas {
  background: #0d0d1a;
  border-radius: 8px;
  cursor: crosshair;
  display: block;
  border: 1px solid rgba(201, 169, 110, 0.15);
}

/* 教程遮罩 */
#search-tutorial {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  z-index: 10;
}

.search-tutorial-inner {
  text-align: center;
}

.search-tutorial-red {
  color: #e74c3c;
  font-size: clamp(16px, 5vw, 24px);
  margin-bottom: 4px;
}

.search-tutorial-green {
  color: #27ae60;
  font-size: clamp(14px, 4.5vw, 22px);
  margin-bottom: 16px;
}

.search-tutorial-num {
  font-size: clamp(40px, 12vw, 64px);
  color: #C9A96E;
  font-weight: bold;
}

/* ---- 下半区（45%）— 对话面板 ---- */
.search-lower {
  position: relative;
  z-index: 1;
  flex: 1 1 45%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: 0 12px 12px;
  background: rgba(20, 18, 15, 0.92);
  border-radius: 10px;
  border: 1px solid rgba(201, 169, 110, 0.12);
  overflow: hidden;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* 聊天头部 */
.chat-header {
  flex-shrink: 0;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header-icon {
  font-size: 16px;
}

.chat-header-title {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 2px;
}

/* 聊天消息区 */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.chat-placeholder {
  text-align: center;
  color: rgba(255, 255, 255, 0.2);
  font-size: 12px;
  padding: 30px 0;
  letter-spacing: 1px;
}

/* 单条消息 */
.chat-msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  animation: chatMsgIn 0.35s ease;
}

@keyframes chatMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-msg-left {
  justify-content: flex-start;
}

.chat-msg-right {
  justify-content: flex-end;
}

/* 头像 */
.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 1px;
}

/* 聊天气泡 */
.chat-bubble {
  max-width: 65%;
  padding: 10px 14px;
  font-size: clamp(13px, 3.5vw, 15px);
  line-height: 1.6;
  border-radius: 12px;
  position: relative;
  word-break: break-word;
}

/* 左侧气泡（NPC）— 白色背景 */
.chat-bubble-left {
  background: #fff;
  color: #333;
  border-top-left-radius: 4px;
}

/* 右侧气泡（玩家）— 蓝色背景 */
.chat-bubble-right {
  background: #4A90D9;
  color: #fff;
  border-top-right-radius: 4px;
}

/* 气泡小尾巴（左侧） */
.chat-bubble-left::before {
  content: "";
  position: absolute;
  top: 8px;
  left: -6px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 6px solid #fff;
}

/* 气泡小尾巴（右侧） */
.chat-bubble-right::after {
  content: "";
  position: absolute;
  top: 8px;
  right: -6px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 6px solid #4A90D9;
}

/* ---- 搜证游戏 Canvas 触摸适配 ---- */
#search-game-canvas {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ---- 密码游戏 ---- */
#password-input {
  width: 200px;
  padding: 10px;
  font-size: 24px;
  text-align: center;
  letter-spacing: 6px;
  border: 2px solid #8B0000;
  border-radius: 4px;
  background: #1a1a2e;
  color: #C9A96E;
  font-family: "Courier New", monospace;
}

/* ---- 华容道游戏 ---- */
.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(3, clamp(56px, 16vw, 90px));
  grid-template-rows: repeat(3, clamp(56px, 16vw, 90px));
  gap: clamp(2px, 0.6vw, 3px);
  margin: 16px auto;
  justify-content: center;
}

.puzzle-tile {
  width: clamp(56px, 16vw, 90px);
  height: clamp(56px, 16vw, 90px);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(11px, 3vw, 14px);
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.15s;
  user-select: none;
  /* background 由 JS 动态设置（此处后续将替换为图片切图） */
}

.puzzle-empty {
  background: rgba(255,255,255,0.08) !important;
  cursor: default;
  pointer-events: none;
}

/* ---- 倒计时显示 ---- */
.countdown {
  font-size: 48px;
  color: #8B0000;
  font-weight: bold;
  font-family: "Courier New", monospace;
  margin: 8px 0;
}

.countdown.warning {
  animation: blink 0.5s infinite;
}

@keyframes blink {
  50% { opacity: 0.3; }
}

/* ---- 结果页 ---- */
#result-screen {
  position: absolute;
  inset: 0;
  background: #FDF8F0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 24px;
  text-align: center;
  overflow-y: auto;
}

#result-screen h2 {
  font-size: 24px;
  color: #4A3728;
  letter-spacing: 3px;
  margin-bottom: 20px;
}

#result-screen .score-display {
  font-size: 52px;
  color: #8B7A5A;
  font-weight: bold;
  margin: 10px 0;
}

#result-screen .level-badge {
  display: inline-block;
  padding: 8px 24px;
  font-size: 16px;
  letter-spacing: 2px;
  border-radius: 20px;
  margin: 12px 0 24px;
}

#result-screen .level-low  { background: #d4c5b2; color: #4A3728; }
#result-screen .level-mid  { background: #D4C5A0; color: #2a2218; }
#result-screen .level-high { background: #8B7A5A; color: #FDF8F0; }

#result-screen .feedback-text {
  font-size: 14px;
  line-height: 1.8;
  color: #5d4037;
  max-width: 500px;
  margin-bottom: 24px;
}

#result-screen .export-btn {
  padding: 10px 28px;
  font-size: 13px;
  background: #8B7A5A;
  color: #FDF8F0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 2px;
  font-family: inherit;
  margin-bottom: 12px;
}

#result-screen .export-btn:hover { background: #6B5A4A; }

#result-screen .detail-table {
  width: 100%;
  max-width: 500px;
  margin: 20px auto;
  font-size: 12px;
  border-collapse: collapse;
}

#result-screen .detail-table th {
  background: #8B7A5A;
  color: #FDF8F0;
  padding: 8px;
  font-weight: normal;
  letter-spacing: 1px;
}

#result-screen .detail-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #d4c5b2;
}

/* ---- 维度得分条形图 ---- */
.dim-chart-container {
  width: 100%;
  max-width: 480px;
  margin: 16px auto 20px;
  padding: 0 8px;
}

.dim-chart-title {
  font-size: 13px;
  color: #8B7A5A;
  letter-spacing: 2px;
  text-align: center;
  margin-bottom: 16px;
}

.dim-chart-row {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.dim-chart-label {
  width: 72px;
  text-align: right;
  padding-right: 10px;
  font-size: 13px;
  color: #4A3728;
  letter-spacing: 1px;
  flex-shrink: 0;
  line-height: 1.3;
}

.dim-chart-label small {
  display: block;
  font-size: 10px;
  color: #a09080;
  letter-spacing: 0;
}

.dim-chart-track {
  flex: 1;
  position: relative;
  height: 26px;
  background: rgba(139, 122, 90, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.dim-chart-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, #8B7A5A, #D4C5A0);
  transition: width 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
  min-width: 0;
}

.dim-chart-pct {
  width: 56px;
  text-align: right;
  padding-left: 10px;
  font-size: 14px;
  color: #4A3728;
  flex-shrink: 0;
  font-weight: bold;
  font-family: "Courier New", monospace;
}

.dim-chart-summary {
  text-align: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #d4c5b2;
  font-size: 14px;
  color: #4A3728;
  letter-spacing: 1px;
}

.dim-chart-summary strong {
  color: #8B7A5A;
  font-family: "Courier New", monospace;
  font-size: 16px;
}

/* ---- 响应式适配 ---- */
@media (max-width: 600px) {
  #app { max-width: 100%; }

  /* 移动端：保持垂直布局，但调整比例 */
  #scene-area {
    flex: 22 0 0;  /* 移动端缩小幕布区 */
  }
  /* 关卡轨道响应式 */
  .level-track-wrapper {
    width: 500px;  /* 5圆(55*5) + 4线(35*4) = 415px + 余量 */
  }
  .level-track-wrapper .level-track {
    padding: 15px 0;
  }
  .level-circle {
    width: 55px;
    height: 55px;
    border-width: 4px;
  }
  .level-num {
    font-size: 25px;
  }
  .level-ring {
    inset: -8px;
    border-width: 5px;
  }
  .level-arrow {
    width: 25px;
    margin: 0 3px;
  }
  #options-area {
    flex: 37 0 0;
    padding: 3% 0;
    gap: 5px;
  }
  #options-area .option-btn {
    width: 88%;
    font-size: clamp(13px, 3.5vw, 14px);
    padding: 11px 14px;
    min-height: 44px;
  }
  #text-area {
    flex: 38 0 0;
  }
  #text-area .speaker-tag {
    margin: 10px 14px 0;
    font-size: 12px;
    padding: 3px 10px;
  }
  #text-area .narrative {
    font-size: clamp(13px, 4vw, 15px);
    line-height: 1.8;
    padding: 12px 16px 14px;
  }

  .char-panels-row { flex-direction: column; }
  .char-left-panel { flex: 0 0 auto; padding: 20px 16px; }
  .char-right-panel { flex: 0 0 auto; padding: 20px 16px; }
  .char-illust-img { width: clamp(150px, 40vw, 180px); height: clamp(216px, 58vw, 260px); }
  .char-poster-placeholder { width: clamp(110px, 30vw, 140px); height: clamp(154px, 42vw, 196px); }
  .char-illust-placeholder { width: clamp(150px, 40vw, 180px); height: clamp(216px, 58vw, 260px); }
  .char-intro-heading { font-size: clamp(15px, 4vw, 17px); }
  .char-name-display { font-size: clamp(18px, 5vw, 20px); }
  .char-switch-btn { padding: 6px 14px; font-size: 12px; min-height: 40px; }
  .puzzle-grid { grid-template-columns: repeat(3, clamp(56px, 16vw, 72px)); grid-template-rows: repeat(3, clamp(56px, 16vw, 72px)); }
  .puzzle-tile { width: clamp(56px, 16vw, 72px); height: clamp(56px, 16vw, 72px); font-size: clamp(10px, 3vw, 12px); }
  #menu-screen .game-title { font-size: clamp(26px, 7vw, 30px); letter-spacing: 5px; }
  #menu-screen .game-subtitle { font-size: clamp(12px, 3vw, 14px); }
  .modal-box { padding: 20px 16px; width: 94%; max-height: 92vh; max-height: 92dvh; overflow-y: auto; }
  .modal-box h3 { font-size: clamp(16px, 4vw, 18px); }

  /* 密码游戏：底部抽屉线索面板 */
  .pwd-clue-overlay {
    position: fixed;
    inset: 0;
    align-items: flex-end;
    border-radius: 0;
    background: rgba(0,0,0,0.72);
    z-index: 9999;
  }
  .pwd-clue-panel {
    width: 100%;
    max-width: 100%;
    max-height: 60vh;
    max-height: 60dvh;
    border-radius: 12px 12px 0 0;
    animation: clueSlideUp 0.3s ease;
  }
  @keyframes clueSlideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  .pwd-clue-btn {
    position: absolute; top: 8px; left: 8px;
    padding: 8px 14px; font-size: 13px; min-height: 40px;
  }
  .pwd-confirm-btn {
    min-height: 48px !important;
    padding: 12px 36px !important;
    font-size: 15px !important;
  }

  /* 结果页响应式 */
  #result-screen h2 { font-size: clamp(18px, 5vw, 22px); }
  #result-screen .score-display { font-size: clamp(38px, 10vw, 48px); }
  #result-screen .feedback-text { font-size: clamp(12px, 3vw, 14px); }
  #result-screen .detail-table { font-size: clamp(10px, 2.5vw, 12px); }
  .dim-chart-container { max-width: 100%; padding: 0 4px; }
  .dim-chart-label { width: 56px; font-size: 11px; padding-right: 6px; }
  .dim-chart-label small { font-size: 9px; }
  .dim-chart-track { height: 22px; }
  .dim-chart-pct { width: 48px; font-size: 12px; padding-left: 6px; }
  .gender-btns { gap: 16px; }
  .gender-btn { width: 130px; padding: 22px 16px; }
  .gender-btn .gender-icon { font-size: 38px; }
  .info-option-btn { font-size: 13px; padding: 12px 14px; }

  /* 搜证游戏响应式 */
  .search-upper { flex: 0 0 48%; }
  .search-countdown { font-size: 26px; }
  .search-countdown-label { font-size: 10px; }
  .search-countdown-wrap { top: 8px; right: 12px; }
  .chat-bubble { max-width: 78%; font-size: 12px; padding: 8px 12px; }
  .chat-messages { padding: 10px 10px; gap: 10px; }
  .chat-avatar { width: 30px; height: 30px; font-size: 13px; }
}

@media (max-width: 380px) {
  #scene-area {
    flex: 20 0 0;
  }
  /* 关卡轨道超小屏 */
  .level-track-wrapper {
    width: 425px;  /* 5圆(50*5) + 4线(32*4) = 378px + 余量 */
  }
  .level-track-wrapper .level-track {
    padding: 12px 0;
  }
  .level-circle {
    width: 50px;
    height: 50px;
  }
  .level-num {
    font-size: 22px;
  }
  .level-ring {
    inset: -5px;
    border-width: 4px;
  }
  .level-arrow {
    width: 20px;
    margin: 0 2px;
  }
  #options-area {
    flex: 39 0 0;
    padding: 3% 0;
  }
  #options-area .option-btn {
    font-size: 12px;
    padding: 10px 12px;
    width: 92%;
  }
  #text-area {
    flex: 38 0 0;
  }
  #text-area .speaker-tag {
    margin: 8px 10px 0;
    font-size: 11px;
  }
  #text-area .narrative {
    font-size: clamp(12px, 3.8vw, 14px);
    padding: 10px 12px 12px;
  }
  .char-illust-img { width: clamp(120px, 34vw, 150px); height: clamp(172px, 49vw, 216px); }
  .char-poster-placeholder { width: clamp(90px, 26vw, 110px); height: clamp(126px, 36vw, 154px); }
  .char-illust-placeholder { width: clamp(120px, 34vw, 150px); height: clamp(172px, 49vw, 216px); }
  .char-switch-btn { padding: 5px 10px; font-size: 11px; letter-spacing: 1px; min-height: 36px; }
  .puzzle-grid { grid-template-columns: repeat(3, clamp(50px, 15vw, 56px)); grid-template-rows: repeat(3, clamp(50px, 15vw, 56px)); }
  .puzzle-tile { width: clamp(50px, 15vw, 56px); height: clamp(50px, 15vw, 56px); }

  /* 搜证游戏超小屏 */
  .search-upper { flex: 0 0 42%; }
  .search-countdown { font-size: 22px; }
  .chat-panel { margin: 0 6px 6px; }
  .chat-bubble { max-width: 85%; font-size: 11px; }
  .chat-messages { padding: 8px 6px; gap: 8px; }

  /* 接物游戏超小屏 */
  .catch-stars-display { font-size: 13px; letter-spacing: 0; }
  .catch-progress-track { max-width: 150px; height: 7px; }
  .catch-progress-text { font-size: 10px; }
  .catch-score-value { font-size: 20px; }
  .catch-countdown { font-size: 18px; }
}

/* ---- 密码游戏：6位数字输入与线索面板 ---- */
.pwd-digits-row {
  display: flex; justify-content: center; gap: 8px; margin: 16px 0;
}
.pwd-digit {
  width: clamp(36px, 10vw, 56px);
  height: clamp(44px, 12vw, 62px);
  text-align: center;
  font-size: clamp(22px, 6vw, 30px);
  font-family: "Courier New", monospace;
  background: #1a1a2e; color: #C9A96E;
  border: 2px solid #5d4037; border-radius: 4px; outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.pwd-digit:focus { border-color: #C9A96E; box-shadow: 0 0 8px rgba(201,169,110,0.3); }
.pwd-digit.filled { border-color: #8B0000; }
.pwd-clue-btn {
  position: absolute; top: 12px; left: 12px;
  padding: 6px 12px; font-size: 12px;
  background: rgba(0,0,0,0.5); color: #C9A96E;
  border: 1px solid #C9A96E; border-radius: 4px;
  cursor: pointer; font-family: inherit; letter-spacing: 1px; z-index: 10;
}
.pwd-clue-btn:hover { background: rgba(201,169,110,0.2); }
.pwd-clue-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.72);
  z-index: 20; display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
}
.pwd-clue-panel {
  width: 88%; max-width: 420px; max-height: 72%;
  overflow-y: auto; background: #2a2218;
  border: 1px solid #C9A96E; border-radius: 6px; padding: 16px 18px; color: #d4c5b2;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.pwd-clue-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #5d4037;
}
.pwd-clue-header span { font-size: 15px; color: #C9A96E; letter-spacing: 2px; }
.pwd-clue-close {
  background: none; border: none; color: #a09080;
  font-size: 20px; cursor: pointer; padding: 0 4px;
}
.pwd-clue-close:hover { color: #e74c3c; }
.pwd-clue-item {
  margin-bottom: 6px; border: 1px solid #3d3028; border-radius: 4px; overflow: hidden;
}
.pwd-clue-title {
  padding: 10px 12px; font-size: 13px; color: #C9A96E;
  cursor: pointer; background: rgba(201,169,110,0.06);
  user-select: none; transition: background 0.2s;
}
.pwd-clue-title:hover { background: rgba(201,169,110,0.14); }
.pwd-clue-body {
  padding: 10px 14px; font-size: 12px; line-height: 1.7;
  color: #b0a090; background: rgba(0,0,0,0.2);
  border-top: 1px solid #3d3028; display: none;
}
.pwd-clue-item.open .pwd-clue-body { display: block; }
.pwd-attempt-counter {
  font-size: 12px; color: #a09080; margin: 4px 0 8px;
}
.pwd-attempt-counter .attempts-num {
  color: #C9A96E; font-weight: bold; font-family: "Courier New", monospace;
}
.pwd-attempt-counter.danger .attempts-num { color: #e74c3c; }

/* 密码确认按钮 */
.pwd-confirm-btn {
  padding: 10px 32px; font-size: 14px;
  background: #8B0000; color: #F5F0E8;
  border: none; border-radius: 4px;
  cursor: pointer; font-family: inherit;
  letter-spacing: 2px; min-height: 48px;
  touch-action: manipulation;
  transition: background 0.2s;
}
.pwd-confirm-btn:hover { background: #a00000; }
.pwd-confirm-btn:active { background: #6b0000; }
.pwd-confirm-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- 密码游戏：炸弹展示区 ---- */
.pwd-modal-box {
  max-width: 420px !important;
  padding: 0 !important;
  overflow: hidden !important;
  position: relative;
}

/* 炸弹图片展示区（正方形，宽度撑满） */
.pwd-bomb-area {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #1a1a2e;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.pwd-bomb-area::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(201,169,110,0.06) 0%, transparent 65%);
  pointer-events: none;
}

.pwd-bomb-img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  display: block;
}

/* 分割线 */
.pwd-separator {
  height: 2px;
  background: linear-gradient(90deg, transparent, #8B0000, #C9A96E, #8B0000, transparent);
  opacity: 0.7;
}

/* 密码主区域 */
.pwd-main-area {
  padding: 16px 24px 24px;
  position: relative;
}

/* 顶部操作栏（线索按钮 + 倒计时） */
.pwd-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.pwd-top-bar .pwd-clue-btn {
  position: static;
  padding: 6px 14px;
  font-size: 12px;
  background: rgba(0,0,0,0.5);
  color: #C9A96E;
  border: 1px solid #C9A96E;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 1px;
}

.pwd-top-bar .pwd-clue-btn:hover {
  background: rgba(201,169,110,0.2);
}

.pwd-countdown-wrap {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.pwd-countdown-label {
  font-size: 11px;
  color: #a09080;
}

.pwd-countdown {
  font-size: 28px;
  margin: 0 !important;
}

.pwd-countdown.warning {
  color: #e74c3c !important;
  animation: blink 0.5s infinite;
}

.pwd-countdown-unit {
  font-size: 11px;
  color: #a09080;
}

/* 密码标题和描述 */
.pwd-title {
  color: #3E2723;
  margin-bottom: 4px;
  letter-spacing: 2px;
  font-size: 18px;
}

.pwd-desc {
  font-size: 13px;
  color: #5d4037;
  margin-bottom: 12px;
}

/* 响应式：密码游戏 */
@media (max-width: 600px) {
  .pwd-modal-box {
    max-width: 94% !important;
  }
  .pwd-main-area {
    padding: 12px 14px 20px;
  }
  .pwd-top-bar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .pwd-title {
    font-size: 16px;
  }
  .pwd-countdown {
    font-size: 24px;
  }
}

/* ---- 接物游戏（Game 3） ---- */
.catch-modal-box {
  max-width: 480px !important;
  padding: 20px 16px 18px !important;
}

.catch-desc {
  font-size: 13px;
  color: #5d4037;
  margin-bottom: 8px;
}

.catch-score-bar {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

.catch-score-label {
  font-size: 13px;
  color: #a09080;
  letter-spacing: 1px;
}

.catch-countdown {
  font-size: 24px;
  color: #C9A96E;
  font-weight: bold;
  font-family: "Courier New", monospace;
  transition: color 0.3s;
}

.catch-countdown.warning {
  color: #e74c3c;
  animation: blink 0.5s infinite;
}

.catch-score-spacer {
  width: 20px;
}

.catch-score-value {
  font-size: 28px;
  color: #C9A96E;
  font-weight: bold;
  font-family: "Courier New", monospace;
  transition: transform 0.15s ease, color 0.15s ease;
}

.catch-score-value.catch-score-pop {
  transform: scale(1.3);
  color: #f1c40f;
}

/* 星星展示 */
.catch-stars-display {
  font-size: 18px;
  letter-spacing: 2px;
  transition: all 0.3s ease;
}

/* 积分进度条 */
.catch-progress-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 0 4px;
}

.catch-progress-track {
  flex: 1;
  max-width: 280px;
  height: 10px;
  background: rgba(62, 39, 35, 0.12);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.catch-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #8B0000, #C9A96E);
  border-radius: 5px;
  width: 0%;
  transition: width 0.35s cubic-bezier(0.22, 0.61, 0.36, 1), background 0.4s ease;
}

.catch-progress-fill.silver {
  background: linear-gradient(90deg, #7f8c8d, #bdc3c7);
}

.catch-progress-fill.gold {
  background: linear-gradient(90deg, #f39c12, #f1c40f);
  box-shadow: 0 0 8px rgba(241, 196, 15, 0.4);
}

.catch-progress-text {
  font-size: 12px;
  color: #a09080;
  font-family: "Courier New", monospace;
  white-space: nowrap;
  min-width: 42px;
  text-align: right;
}

.catch-canvas-wrap {
  margin: 0 auto;
}

#catch-game-canvas {
  display: block;
  margin: 0 auto;
  border-radius: 6px;
  border: 1px solid rgba(201, 169, 110, 0.2);
  cursor: none;
  touch-action: none;
  max-width: 100%;
}

.catch-skip-btn {
  margin-top: 12px;
  padding: 10px 28px;
  font-size: 13px;
  background: transparent;
  color: #8B0000;
  border: 2px solid #8B0000;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 2px;
  transition: all 0.25s;
  min-height: 44px;
  touch-action: manipulation;
}

.catch-skip-btn:hover {
  background: #8B0000;
  color: #F5F0E8;
}

.catch-skip-btn:active {
  transform: scale(0.96);
}

/* 接物游戏响应式 */
@media (max-width: 600px) {
  .catch-modal-box {
    max-width: 94% !important;
    padding: 14px 10px 14px !important;
  }
  .catch-score-value {
    font-size: 24px;
  }
  .catch-countdown {
    font-size: 20px;
  }
  .catch-score-spacer {
    width: 10px;
  }
  .catch-score-label {
    font-size: 11px;
  }
  .catch-stars-display {
    font-size: 15px;
    letter-spacing: 1px;
  }
  .catch-progress-track {
    max-width: 200px;
    height: 8px;
  }
  .catch-progress-text {
    font-size: 10px;
    min-width: 36px;
  }
}

/* ---- 小游戏开场倒计时覆盖层 ---- */
.minigame-countdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  animation: countdownFadeIn 0.25s ease;
}

@keyframes countdownFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.minigame-countdown-number {
  font-size: clamp(72px, 18vw, 120px);
  color: #D4C5A0;
  font-weight: bold;
  font-family: "Courier New", monospace;
  text-shadow: 0 0 40px rgba(212, 197, 160, 0.4);
  animation: countdownPop 1s ease;
}

@keyframes countdownPop {
  0%   { transform: scale(1.4); opacity: 0; }
  30%  { transform: scale(0.95); opacity: 1; }
  60%  { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 0.6; }
}

.minigame-countdown-label {
  margin-top: 16px;
  font-size: clamp(18px, 5vw, 28px);
  color: #B8A0C8;
  letter-spacing: 6px;
  animation: countdownLabelIn 0.5s ease;
}

@keyframes countdownLabelIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- 作弊模式：跳过按钮（全局浮层） ---- */
#cheat-skip-btn {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 99999;
  padding: 10px 18px;
  font-size: 13px;
  font-family: inherit;
  background: rgba(139, 0, 0, 0.85);
  color: #f0e6d3;
  border: 1px solid rgba(201, 169, 110, 0.5);
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 2px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: all 0.25s;
  animation: cheatBtnIn 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

#cheat-skip-btn:hover {
  background: rgba(180, 0, 0, 0.95);
  border-color: #C9A96E;
  transform: scale(1.04);
}

#cheat-skip-btn:active {
  transform: scale(0.95);
  background: rgba(100, 0, 0, 0.95);
}

/* 作弊模式角标（激活后持续显示） */
#cheat-indicator {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 99998;
  padding: 5px 12px;
  font-size: 11px;
  font-family: inherit;
  background: rgba(0, 0, 0, 0.75);
  color: #f1c40f;
  border: 1px solid rgba(241, 196, 15, 0.35);
  border-radius: 4px;
  letter-spacing: 1px;
  pointer-events: none;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: cheatBtnIn 0.35s ease;
}

/* 作弊模式指示器（结果页） */
.cheat-indicator {
  display: inline-block;
  padding: 6px 16px;
  font-size: 12px;
  color: #f0e6d3;
  background: rgba(139, 0, 0, 0.7);
  border: 1px solid rgba(241, 196, 15, 0.4);
  border-radius: 4px;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

@keyframes cheatBtnIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
  #cheat-skip-btn {
    bottom: 16px;
    right: 12px;
    padding: 8px 14px;
    font-size: 12px;
  }
}
