/* ==========================================================================
   第三章【山间与小店】专属样式（严格星露谷硬边像素风 · Zero Rounded, Zero Emoji）
   ========================================================================== */

#ch3-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1b2820;
  user-select: none;
  image-rendering: pixelated;
}

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

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

.ch3-stage.is-ski,
.ch3-stage.is-ski .ch3-canvas {
  image-rendering: auto;
}

/* 对话框内第三章人物头像（小宇 / 珊珊擦汗 / 土菜馆老板娘）—— 双类名高权重强制覆写 chapter1.css ✉ 与 repeat */
.dialogue.dialogue[data-who="小宇"]:before,
.dialogue.dialogue[data-who="小宇（开心）"]:before,
.dialogue.dialogue[data-who="小宇（鼓励）"]: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(xiaoyu-avatar.png?v=redpack2) !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="珊珊（擦汗）"]:before,
.dialogue.dialogue[data-who="珊珊（委屈）"]: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(shanshan-sweat-avatar.png) !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="徐霞客"]:before,
.dialogue.dialogue[data-who="徐霞客（好奇眨眼）"]:before,
.dialogue.dialogue[data-who="徐霞客（拱手大笑）"]: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(xu-xiake-avatar.png) !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;
}

/* 全局常驻碎片进度条（嵌入右上角 .hud-actions 最前端，严格星露谷木框） */
.frag-bar {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 38px;
  padding: 0 10px 0 8px;
  background: #F4E2C1;
  border: 3px solid #4A2E1B;
  box-shadow: inset 0 0 0 2px #C88C4B, 0 4px 0 rgba(48, 28, 14, 0.42);
  color: #4A2E1B;
  font-family: FusionPixel, 'Microsoft YaHei', sans-serif;
  border-radius: 0 !important;
  pointer-events: auto;
}

.frag-bar .frag-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  background: url(px-puzzle.png) center/contain no-repeat;
  image-rendering: pixelated;
  flex: none;
}

.frag-bar strong {
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #5E3418;
}

/* 底部常驻星露谷硬边提示条 */
.bottom-hint {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 8;
  max-width: min(88%, 740px);
  padding: 6px 14px;
  background: #F4E2C1;
  border: 3px solid #4A2E1B;
  box-shadow: inset 0 0 0 2px #B87A3D, 0 4px 0 rgba(48, 28, 14, 0.45);
  color: #4A2E1B;
  font-family: FusionPixel, 'Microsoft YaHei', sans-serif;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  border-radius: 0 !important;
  pointer-events: none;
}

.bottom-hint[hidden] {
  display: none !important;
}

/* 迷你像素气泡（用于小宇等待催促 & 山泉饮水 & 美食反馈，禁止大白框与圆角） */
.ch3-bubble-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  overflow: hidden;
}

.ch3-pixel-bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 5px 9px;
  max-width: 215px;
  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.35;
  text-align: center;
  border-radius: 0 !important;
  animation: ch3-bub-pop 0.2s steps(3, end);
}

.ch3-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%);
}

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

/* 右上角或场景角落第三章小状态角标（海拔 / 氛围） */
.ch3-alt-tag {
  position: absolute;
  left: 14px;
  top: 58px;
  z-index: 6;
  padding: 5px 10px;
  background: rgba(244, 226, 193, 0.94);
  border: 3px solid #4A2E1B;
  box-shadow: inset 0 0 0 2px #C88C4B, 0 3px 0 rgba(48, 28, 14, 0.4);
  color: #4A2E1B;
  font-family: FusionPixel, 'Microsoft YaHei', sans-serif;
  font-size: 12px;
  border-radius: 0 !important;
  pointer-events: none;
}

/* 3C 点菜星露谷木框面板 */
.ch3-menu-card {
  width: min(92vw, 590px) !important;
  padding: 22px 24px 20px !important;
  text-align: center;
}

.ch3-menu-card h2 {
  margin: 4px 0 6px;
  font-size: 20px;
  color: #4A2E1B;
}

.ch3-menu-sub {
  margin: 0 0 14px;
  font-size: 13px;
  color: #6E4C2D;
}

.ch3-dish-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.ch3-dish-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  background: #FFF6E3;
  border: 3px solid #4A2E1B;
  box-shadow: inset 0 0 0 2px #D5A362, 0 4px 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.08s steps(2);
}

.ch3-dish-btn:hover:not(:disabled) {
  background: #FFEAC2;
  transform: translateY(-2px);
}

.ch3-dish-btn.tasted {
  background: #E2F1CE;
  border-color: #365C2B;
  box-shadow: inset 0 0 0 2px #84AE64, 0 3px 0 rgba(36, 62, 26, 0.35);
}

.ch3-dish-icon {
  width: 56px;
  height: 56px;
  background-color: #F4E2C1;
  background-position: center;
  background-size: 46px 46px;
  background-repeat: no-repeat;
  border: 2px solid #8A5B32;
  image-rendering: pixelated;
}

.ch3-dish-name {
  font-size: 14px;
  font-weight: 700;
  color: #4A2E1B;
}

.ch3-dish-desc {
  font-size: 11px;
  line-height: 1.35;
  color: #704E2E;
}

.ch3-dish-tag {
  margin-top: 2px;
  padding: 2px 7px;
  background: #E8C794;
  border: 2px solid #4A2E1B;
  font-size: 11px;
  color: #4A2E1B;
}

.ch3-dish-btn.tasted .ch3-dish-tag {
  background: #629A45;
  color: #FFF8E6;
}

.ch3-health-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 4px 12px;
  background: #FFF6E3;
  border: 2px solid #4A2E1B;
  font-size: 12px;
  color: #4A2E1B;
}

.ch3-health-bar {
  width: 96px;
  height: 10px;
  background: #6E4726;
  border: 2px solid #4A2E1B;
  overflow: hidden;
}

.ch3-health-fill {
  height: 100%;
  background: #68B24B;
  transition: width 0.3s steps(6);
}

/* 3B 后半段乱石平台跳跃按钮（仅跳跃段显示，星露谷硬边胡桃木+羊皮纸风格） */
.ch3-jump-btn {
  position: absolute;
  right: 22px;
  bottom: 22px;
  z-index: 9;
  padding: 10px 18px;
  background: #F4E2C1;
  border: 3px solid #4A2E1B;
  box-shadow: inset 0 0 0 2px #C88C4B, 0 5px 0 rgba(48, 28, 14, 0.55);
  color: #4A2E1B;
  font-family: FusionPixel, 'Microsoft YaHei', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 0 !important;
  cursor: pointer;
  user-select: none;
  transition: transform 0.08s steps(2);
}

.ch3-jump-btn:hover {
  background: #FFEAC2;
}

.ch3-jump-btn:active {
  transform: translateY(3px);
  box-shadow: inset 0 0 0 2px #C88C4B, 0 2px 0 rgba(48, 28, 14, 0.55);
}

.ch3-jump-btn[hidden] {
  display: none !important;
}

/* 第三章山顶单张固定纪念合照：取消 3 选 1 网格，居中大画幅相纸展示 */
.pl-album-card.is-single-summit {
  max-width: 560px;
}

.pl-album-grid.is-single-photo {
  grid-template-columns: 1fr;
  justify-items: center;
  margin-bottom: 12px;
}

.pl-photo-choice.is-single-choice {
  width: min(440px, 100%);
  padding: 10px 10px 12px;
  cursor: default;
}

.pl-photo-choice.is-single-choice .pl-photo-mat img {
  height: 235px;
  object-fit: cover;
}

/* =========================================================================
   徐霞客 · 古今驴友翻牌配对记忆小游戏（星露谷硬边胡桃木框 + 古风宣纸牌 + 朱砂印章）
   ========================================================================= */
.ch3-xiake-overlay {
  position: fixed;
  inset: 0;
  z-index: 68;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(18, 22, 16, 0.78);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: auto;
}

.ch3-xiake-overlay.is-open {
  opacity: 1;
}

.ch3-xiake-board {
  position: relative;
  width: min(680px, 95vw);
  background: #4E2F1B;
  border: 4px solid #2A1609;
  box-shadow:
    inset 0 0 0 3px #C79348,
    inset 0 0 0 6px #6B4226,
    0 18px 44px rgba(0, 0, 0, 0.68);
  padding: 14px 16px 16px;
  border-radius: 0 !important;
  color: #4A2E1B;
  font-family: FusionPixel, 'Microsoft YaHei', sans-serif;
  user-select: none;
}

.ch3-xiake-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 2px solid #8A5B32;
}

.ch3-xiake-title {
  margin: 0;
  font-size: clamp(16px, 2.2vw, 20px);
  font-weight: 700;
  color: #FCE6B2;
  letter-spacing: 0.08em;
}

.ch3-xiake-badge {
  padding: 3px 9px;
  background: #A92820;
  border: 2px solid #4A110C;
  box-shadow: inset 0 0 0 1px #E89678;
  color: #FFF4DC;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ch3-xiake-xu-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 12px;
  background: #F4E2C1;
  border: 3px solid #2B170A;
  box-shadow: inset 0 0 0 2px #B87A3D;
}

.ch3-xiake-xu-avatar {
  position: relative;
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  background: #E4CA99 url(xu-xiake-avatar.png) center/contain no-repeat;
  border: 2px solid #593319;
  image-rendering: pixelated;
}

.ch3-xiake-xu-avatar.is-thumb::after {
  content: '赞!';
  position: absolute;
  right: -8px;
  top: -8px;
  padding: 1px 4px;
  background: #A92820;
  border: 2px solid #4A110C;
  color: #FFF6DC;
  font-size: 10px;
  font-weight: 700;
  animation: ch3-bub-pop 0.25s steps(3, end);
}

.ch3-xiake-danmu {
  flex: 1;
  font-size: 13px;
  line-height: 1.45;
  color: #4A2E1B;
  font-weight: 700;
}

.ch3-xiake-status {
  flex-shrink: 0;
  padding: 3px 8px;
  background: #E8C794;
  border: 2px solid #593319;
  font-size: 12px;
  color: #4A2E1B;
}

.ch3-xiake-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  touch-action: manipulation;
}

.ch3-xiake-card {
  position: relative;
  height: clamp(78px, 13vh, 102px);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  perspective: 700px;
  border-radius: 0 !important;
  -webkit-tap-highlight-color: transparent;
}

.ch3-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.ch3-xiake-card.is-flipped .ch3-card-inner,
.ch3-xiake-card.is-matched .ch3-card-inner {
  transform: rotateY(180deg);
}

.ch3-card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 3px solid #3E2414;
}

.ch3-card-back {
  background: #EED9AF;
  box-shadow:
    inset 0 0 0 2px #C79348,
    inset 0 0 0 5px #DFC18B,
    0 4px 0 rgba(36, 18, 8, 0.48);
}

.ch3-card-seal {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: #A92820;
  border: 2px solid #59140E;
  box-shadow: inset 0 0 0 1px #EAA27C;
  color: #FFF2D8;
  font-size: 13px;
  font-weight: 700;
}

.ch3-card-cloud-bar {
  width: 62%;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    #B68134 0 6px,
    transparent 6px 10px
  );
}

.ch3-card-front {
  transform: rotateY(180deg);
  background: #FFF9EB;
  box-shadow:
    inset 0 0 0 2px #D5A362,
    0 4px 0 rgba(36, 18, 8, 0.42);
}

.ch3-xiake-card.is-matched .ch3-card-front {
  background: #F4FBE4;
  border-color: #467832;
  box-shadow:
    inset 0 0 0 2px #E5B94C,
    0 0 12px rgba(255, 224, 110, 0.7);
}

.ch3-card-icon-canvas {
  width: 44px;
  height: 44px;
  image-rendering: pixelated;
}

.ch3-card-label {
  font-size: 11px;
  font-weight: 700;
  color: #4A2E1B;
  line-height: 1.1;
}

.ch3-ink-spark {
  position: absolute;
  width: 7px;
  height: 7px;
  background: #F8D458;
  border: 1px solid #8A4614;
  pointer-events: none;
  z-index: 4;
  animation: ch3-ink-burst 0.65s steps(6, end) forwards;
}

@keyframes ch3-ink-burst {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.35); opacity: 0; }
}

/* =========================================================================
   踏云上升（Doodle Jump 踩云冲顶） & 下山木滑车接落叶 HUD 指示条
   ========================================================================= */
.ch3-cloud-hud,
.ch3-coaster-hud {
  position: absolute;
  left: 50%;
  top: 56px;
  transform: translateX(-50%);
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  background: rgba(34, 24, 18, 0.86);
  border: 3px solid #D4A153;
  box-shadow: inset 0 0 0 2px #5B3B22, 0 4px 0 rgba(0, 0, 0, 0.42);
  color: #FFF4DC;
  font-family: FusionPixel, 'Microsoft YaHei', sans-serif;
  font-size: 13px;
  border-radius: 0 !important;
  pointer-events: none;
  white-space: nowrap;
}

.ch3-cloud-hud[hidden],
.ch3-coaster-hud[hidden] {
  display: none !important;
}

.ch3-cloud-prog {
  width: 116px;
  height: 10px;
  background: #23160E;
  border: 2px solid #D4A153;
  overflow: hidden;
}

.ch3-cloud-prog-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #F0C44C, #FFF29C);
  transition: width 0.14s linear;
}

@media (max-width: 720px) {
  .frag-bar {
    height: 32px;
    padding: 0 7px 0 5px;
  }
  .frag-bar strong {
    font-size: 12px;
  }
  .ch3-xiake-grid {
    gap: 7px;
  }
  .ch3-xiake-card {
    height: 74px;
  }
  .ch3-card-icon-canvas {
    width: 36px;
    height: 36px;
  }
  .dialogue.dialogue[data-who="小宇"]:before,
  .dialogue.dialogue[data-who="小宇（开心）"]:before,
  .dialogue.dialogue[data-who="小宇（鼓励）"]:before,
  .dialogue.dialogue[data-who="徐霞客"]:before,
  .dialogue.dialogue[data-who="徐霞客（好奇眨眼）"]:before,
  .dialogue.dialogue[data-who="徐霞客（拱手大笑）"]:before,
  .dialogue.dialogue[data-who="珊珊（擦汗）"]:before,
  .dialogue.dialogue[data-who="珊珊（委屈）"]:before {
    width: 76px !important;
    height: 76px !important;
    top: -74px !important;
  }
}
