/* ==========================================================================
   第四章【长沙快乐之行】专属样式（星露谷硬边胡桃木框 + 羊皮纸像素风，Zero Rounded, Zero Emoji, Zero Cats）
   ========================================================================== */

#ch4-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #23183A;
  user-select: none;
  image-rendering: pixelated;
}

#ch4-stage[hidden] {
  display: none !important;
}

.ch4-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  cursor: pointer;
}

/* 对话框内珊珊 / 小A / 小C 头像前缀匹配（支持微表情后缀且绝不回退为邮箱图标） */
.dialogue.dialogue[data-who^="珊珊"]:before {
  content: '' !important;
  display: block !important;
  position: absolute !important;
  width: 140px !important;
  height: 145px !important;
  left: 2px !important;
  top: -143px !important;
  border: 0 !important;
  box-shadow: none !important;
  background-color: transparent !important;
  background-image: url(shanshan-v3.png) !important;
  background-size: 130% auto !important;
  background-repeat: no-repeat !important;
  background-position: 43% top !important;
  border-radius: 0 !important;
  image-rendering: pixelated !important;
  filter: drop-shadow(2px 2px 0 rgba(74, 46, 27, 0.55)) !important;
}

.dialogue.dialogue[data-who^="小A"]:before {
  content: '' !important;
  display: block !important;
  position: absolute !important;
  width: 100px !important;
  height: 100px !important;
  left: 2px !important;
  top: -98px !important;
  border: 0 !important;
  box-shadow: none !important;
  background-color: transparent !important;
  background-image: url(xiao-a-avatar.png?v=ch4a) !important;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  background-position: center bottom !important;
  border-radius: 0 !important;
  image-rendering: pixelated !important;
  filter: drop-shadow(2px 2px 0 rgba(74, 46, 27, 0.55)) !important;
}

.dialogue.dialogue[data-who^="小C"]:before {
  content: '' !important;
  display: block !important;
  position: absolute !important;
  width: 100px !important;
  height: 100px !important;
  left: 2px !important;
  top: -98px !important;
  border: 0 !important;
  box-shadow: none !important;
  background-color: transparent !important;
  background-image: url(xiao-c-avatar.png?v=ch4a) !important;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  background-position: center bottom !important;
  border-radius: 0 !important;
  image-rendering: pixelated !important;
  filter: drop-shadow(2px 2px 0 rgba(74, 46, 27, 0.55)) !important;
}

/* 冲浪对话压低，给水面和浪花留出完整一行。 */
.dialogue.ch4-river-dialogue {
  bottom: 2%;
  min-height: 0;
  padding-top: 8px;
  padding-bottom: 7px;
}

.dialogue.ch4-river-dialogue #dialogue-text {
  min-height: 0;
  margin: 3px 0 5px;
}

/* 顶部地标路牌提示 HUD */
.ch4-hud-pill {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: rgba(244, 226, 193, 0.94);
  border: 3px solid #4A2E1B;
  box-shadow: inset 0 0 0 2px #C88C4B, 0 4px 0 rgba(48, 28, 14, 0.45);
  color: #4A2E1B;
  font-family: FusionPixel, 'Microsoft YaHei', sans-serif;
  font-size: 13px;
  font-weight: 700;
  border-radius: 0 !important;
  pointer-events: none;
  white-space: nowrap;
}

.ch4-hud-pill[hidden] {
  display: none !important;
}

.ch4-hud-prog {
  width: 112px;
  height: 10px;
  background: #D9C398;
  border: 2px solid #4A2E1B;
  overflow: hidden;
  border-radius: 0 !important;
}

.ch4-hud-prog-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #E8823A, #F7C452);
  transition: width 0.15s linear;
}

/* 轻量像素漂浮气泡（车窗互动 / 零食反应） */
.ch4-bubble-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
  overflow: hidden;
}

.ch4-pixel-bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 6px 10px;
  max-width: 240px;
  background: #F4E2C1;
  border: 3px solid #4A2E1B;
  box-shadow: inset 0 0 0 2px #B87A3D, 0 3px 0 rgba(48, 28, 14, 0.45);
  color: #4A2E1B;
  font-family: FusionPixel, 'Microsoft YaHei', sans-serif;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  border-radius: 0 !important;
  animation: ch4-bub-pop 0.2s steps(3, end);
}

.ch4-pixel-bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 8px;
  height: 6px;
  transform: translateX(-50%);
  background: #4A2E1B;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.ch4-pixel-bubble.ch4-travel-chat {
  width: max-content;
  max-width: min(48%, 350px);
  font-size: clamp(12px, 1.25vw, 16px);
  padding: 7px 12px;
}

.ch4-travel-chat span {
  color: #8d4b31;
  margin-right: 0.55em;
}

.ch4-travel-chat[data-speaker="小C"] span {
  color: #515889;
}

@media (prefers-reduced-motion: reduce) {
  .ch4-pixel-bubble.ch4-travel-chat { animation: none; }
}

@keyframes ch4-bub-pop {
  from { opacity: 0; transform: translate(-50%, -86%); }
  to { opacity: 1; transform: translate(-50%, -100%); }
}

/* 沿途打卡星露谷胡桃木牌按钮（节点 ① / ③ 与 汽笛喇叭提示） */
.ch4-action-dock {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.ch4-action-dock[hidden] {
  display: none !important;
}

.ch4-wood-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: #F6E6C6;
  border: 4px solid #4A2E1B;
  box-shadow: inset 0 0 0 2px #D6974E, 0 5px 0 #3E2414;
  color: #4A2E1B;
  font-family: FusionPixel, 'Microsoft YaHei', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 0 !important;
  animation: ch4-btn-pulse 1.3s ease-in-out infinite;
}

.ch4-wood-btn:hover {
  background: #FFF2D6;
  transform: translateY(-2px);
}

.ch4-wood-btn:active {
  transform: translateY(2px);
  box-shadow: inset 0 0 0 2px #D6974E, 0 2px 0 #3E2414;
}

.ch4-wood-btn .ch4-btn-ico {
  width: 20px;
  height: 20px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  image-rendering: pixelated;
  flex: none;
}

@keyframes ch4-btn-pulse {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(255, 200, 90, 0)); }
  50% { filter: drop-shadow(0 0 8px rgba(255, 208, 92, 0.75)); }
}

/* 柔和白光快门闪烁 */
.ch4-flash {
  position: absolute;
  inset: 0;
  z-index: 12;
  background: #FFF9EA;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease-out;
}

.ch4-flash.is-on {
  opacity: 0.88;
}

/* 终点【零食王国】大采购星露谷货架点选面板 */
.ch4-snack-overlay .chapter-card {
  width: min(92vw, 680px) !important;
  padding: 20px 22px 18px !important;
  text-align: center;
  border-radius: 0 !important;
}

.ch4-snack-status {
  display: inline-block;
  margin: 4px 0 12px;
  padding: 4px 12px;
  background: #EBD3A7;
  border: 2px solid #4A2E1B;
  color: #5E3418;
  font-size: 13px;
  font-weight: 700;
  border-radius: 0 !important;
}

.ch4-snack-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.ch4-snack-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  background: #F9EBD0;
  border: 3px solid #4A2E1B;
  box-shadow: inset 0 0 0 2px #C88C4B, 0 3px 0 rgba(48, 28, 14, 0.35);
  color: #4A2E1B;
  font-family: FusionPixel, 'Microsoft YaHei', sans-serif;
  cursor: pointer;
  border-radius: 0 !important;
  transition: transform 0.1s ease, background 0.12s ease;
}

.ch4-snack-item:hover {
  background: #FFF6E2;
  transform: translateY(-2px);
}

.ch4-snack-item.is-picked {
  background: #FCE3A6;
  border-color: #9E3D1C;
  box-shadow: inset 0 0 0 2px #E8933A, 0 3px 0 #702612;
}

.ch4-snack-item canvas {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
}

.ch4-snack-item strong {
  font-size: 14px;
  color: #4A2E1B;
}

.ch4-snack-item small {
  font-size: 11px;
  line-height: 1.3;
  color: #7A5236;
}

.ch4-snack-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* 收银台生日幸运大抽奖九宫格转盘（星露谷硬边胡桃木框 + 羊皮纸） */
.ch4-lottery-overlay .chapter-card {
  width: min(94vw, 660px) !important;
  padding: 20px 22px 18px !important;
  text-align: center;
  border-radius: 0 !important;
}

.ch4-lottery-badge {
  display: inline-block;
  margin: 2px 0 12px;
  padding: 4px 12px;
  background: #DFEFE0;
  border: 2px solid #2D6B3F;
  color: #1F512D;
  font-size: 12px;
  font-weight: 700;
  border-radius: 0 !important;
}

.ch4-lottery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.ch4-lottery-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 92px;
  padding: 8px 6px;
  background: #F9EBD0;
  border: 3px solid #4A2E1B;
  box-shadow: inset 0 0 0 2px #C88C4B, 0 3px 0 rgba(48, 28, 14, 0.3);
  color: #4A2E1B;
  font-family: FusionPixel, 'Microsoft YaHei', sans-serif;
  border-radius: 0 !important;
  transition: transform 0.08s ease, background 0.08s ease;
}

.ch4-lottery-slot.is-grand {
  background: #FDF1C7;
  box-shadow: inset 0 0 0 2px #E5A636, 0 3px 0 rgba(48, 28, 14, 0.35);
}

.ch4-lottery-slot.is-active {
  background: #FFE285;
  border-color: #B83D18;
  box-shadow: inset 0 0 0 3px #FF9F2E, 0 0 12px rgba(255, 200, 72, 0.9);
  transform: translateY(-2px);
}

.ch4-lottery-slot.is-won {
  background: #FFE89A;
  border-color: #9E2A12;
  box-shadow: inset 0 0 0 3px #E87D24, 0 0 16px rgba(255, 212, 82, 0.95);
  animation: ch4-btn-pulse 1s ease-in-out infinite;
}

.ch4-lottery-slot canvas {
  width: 36px;
  height: 36px;
  image-rendering: pixelated;
}

.ch4-lottery-slot strong {
  font-size: 12px;
  line-height: 1.25;
  color: #4A2E1B;
}

.ch4-lottery-slot small {
  font-size: 10px;
  color: #7A5236;
}

.ch4-lottery-result {
  min-height: 24px;
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: #8C3216;
}

/* 零食王国 · 3D 全息拆卡互动弹窗（星露谷胡桃木硬边框架 + 全息舞台） */
.ch4-holo-overlay {
  padding: 12px !important;
  background: rgba(18, 12, 8, 0.78) !important;
}

.ch4-holo-modal {
  position: relative;
  width: min(1180px, calc(100vw - 24px));
  height: min(760px, calc(100vh - 24px));
  display: flex;
  flex-direction: column;
  padding: 8px;
  background: #562C16;
  border: 4px solid #2A160B;
  box-shadow:
    inset 0 0 0 3px #E8C794,
    inset 0 0 0 6px #784828,
    0 12px 0 rgba(20, 10, 4, 0.65);
  border-radius: 0 !important;
  box-sizing: border-box;
  overflow: hidden;
}

.ch4-holo-frame-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border: 3px solid #2A160B;
  box-shadow: inset 0 0 0 2px #9C6536;
  background: #2B170C;
  overflow: hidden;
}

.ch4-holo-iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #2B170C;
}

.wealth-bar strong {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .ch4-holo-subnote {
    display: none;
  }
  .ch4-holo-modal {
    width: calc(100vw - 12px);
    height: calc(100vh - 12px);
    padding: 8px;
  }
}
