
/*
  卷包青年攀登记 - 宝塔竖屏适配版
  目标：
  1. 手机端直接竖屏游玩，不再出现横屏提示。
  2. 电脑端也显示为竖屏舞台，居中展示。
  3. 保留原红金蓝科技卡片 UI 风格。
  4. 任何答题/任务页面都允许滚动，底部按钮不再被裁剪。
*/

html,
body,
#app {
  width: 100%;
  min-height: 100%;
  height: 100%;
  overflow: hidden !important;
}

body {
  touch-action: manipulation;
}

/* 外层改为竖屏舞台 */
.app-shell {
  min-height: var(--jby-vh, 100dvh) !important;
  height: var(--jby-vh, 100dvh) !important;
  padding: 0 !important;
  display: grid !important;
  place-items: center !important;
  overflow: hidden !important;
}

/* 电脑端：竖屏手机舞台居中 */
.game-stage {
  width: min(100vw, 520px) !important;
  height: min(var(--jby-vh, 100dvh), 980px) !important;
  max-height: var(--jby-vh, 100dvh) !important;
  min-height: 0 !important;
  aspect-ratio: 9 / 16 !important;
  border-radius: 28px !important;
  overflow: hidden !important;
}

/* 手机端：铺满竖屏视口 */
@media (max-width: 720px) {
  .game-stage {
    width: 100vw !important;
    height: var(--jby-vh, 100dvh) !important;
    max-height: var(--jby-vh, 100dvh) !important;
    border-radius: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
  }
}

.scene-wrap {
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

/* 页面统一允许纵向滚动，避免按钮被裁掉 */
.page {
  height: 100% !important;
  min-height: 0 !important;
  box-sizing: border-box !important;
  padding:
    calc(max(12px, env(safe-area-inset-top)) + 72px)
    max(15px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(15px, env(safe-area-inset-left)) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
}

/* 无顶部状态栏的页面 */
.home-page,
.story-page,
.ending,
.poster {
  padding-top: max(18px, env(safe-area-inset-top)) !important;
}

/* 顶部状态栏竖屏化 */
.header-bar {
  position: absolute !important;
  top: max(8px, env(safe-area-inset-top)) !important;
  left: max(10px, env(safe-area-inset-left)) !important;
  right: max(10px, env(safe-area-inset-right)) !important;
  min-height: 52px !important;
  grid-template-columns: minmax(118px, 1fr) auto !important;
  grid-template-rows: auto auto !important;
  gap: 5px 8px !important;
  padding: 6px 8px !important;
  border-radius: 15px !important;
}

.header-brand {
  grid-column: 1 / 2 !important;
  min-width: 0 !important;
}

.header-brand strong {
  max-width: 170px !important;
  font-size: 12px !important;
}

.header-brand small {
  font-size: 10px !important;
}

.stat-panel {
  grid-column: 1 / 3 !important;
  grid-row: 2 / 3 !important;
  justify-content: space-between !important;
  gap: 3px !important;
}

.stat-item,
.compact .stat-item {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  padding: 3px 3px !important;
  font-size: 10px !important;
}

.stat-icon {
  font-size: 11px !important;
}

.stat-item strong,
.compact .stat-item strong {
  font-size: 11px !important;
}

.profile-entry {
  grid-column: 2 / 3 !important;
  grid-row: 1 / 2 !important;
  min-height: 34px !important;
  padding: 0 9px !important;
  white-space: nowrap !important;
}

.profile-entry span:last-child {
  display: none !important;
}

/* 标题区域竖屏压缩 */
.page-heading {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  margin-bottom: 12px !important;
}

.page-heading > div {
  min-width: 0 !important;
}

.page-heading > b,
.page-heading > span,
.hero {
  align-self: flex-start !important;
}

.page-kicker {
  font-size: 12px !important;
  letter-spacing: .12em !important;
}

.page-title {
  margin-top: 4px !important;
  font-size: clamp(24px, 7vw, 34px) !important;
  line-height: 1.08 !important;
}

.page-subtitle {
  margin-top: 6px !important;
  font-size: 13px !important;
  line-height: 1.45 !important;
}

/* 首页竖屏 */
.home-content {
  min-height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  gap: 16px !important;
}

.home-left,
.home-right {
  width: 100% !important;
}

.home-left h1 {
  font-size: clamp(38px, 13vw, 62px) !important;
  line-height: .95 !important;
}

.home-intro {
  font-size: 14px !important;
  line-height: 1.55 !important;
}

.home-tags {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
}

.home-tags span {
  min-height: 34px !important;
  padding: 8px 9px !important;
  font-size: 12px !important;
}

.mountain-card {
  height: 240px !important;
  min-height: 220px !important;
}

.title-preview {
  margin-top: 10px !important;
}

/* 开场剧情竖屏 */
.story-page {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  gap: 14px !important;
}

.story-page .visual {
  width: 100% !important;
  min-height: 210px !important;
}

.dialog-area {
  width: 100% !important;
}

/* 通用横向布局改成竖向 */
.quiz-layout,
.layout,
.map-layout,
.role-grid,
.rolling,
.packing,
.body,
.profile .layout {
  display: flex !important;
  flex-direction: column !important;
  grid-template-columns: 1fr !important;
  gap: 12px !important;
  min-height: 0 !important;
}

/* 卡片不再固定撑满横屏高度 */
.content-card,
.glass-card,
.quiz-card,
.question,
.decision,
.sample,
.panel,
.side,
.visual,
.tree,
.jury,
.teamcard,
.materials,
.slots,
.map-side,
.profile .main,
.profile .summary {
  width: 100% !important;
  min-width: 0 !important;
  min-height: auto !important;
  box-sizing: border-box !important;
}

/* 装饰卡片竖屏时缩小，保留风格但不占过多空间 */
.quiz-side,
.teamcard,
.side,
.visual,
.tree,
.jury,
.map-side,
.profile .summary {
  padding: 14px !important;
}

.quiz-side > div,
.teamcard > div,
.side > div,
.visual > div,
.tree > div,
.jury > div {
  font-size: 34px !important;
}

/* 答题卡、决策卡留出底部按钮空间 */
.quiz-card,
.question,
.decision,
.slots,
.sample,
.panel {
  padding: 16px !important;
}

.quiz-card h2,
.question h2,
.decision h2 {
  margin: 10px 0 !important;
  font-size: clamp(18px, 5.3vw, 25px) !important;
  line-height: 1.35 !important;
}

.options {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 9px !important;
}

.choice-btn {
  min-height: 46px !important;
  padding: 10px 12px !important;
  font-size: 14px !important;
  line-height: 1.35 !important;
}

.feedback {
  min-height: 42px !important;
  margin-top: 10px !important;
  padding: 9px 11px !important;
  font-size: 13px !important;
  line-height: 1.4 !important;
}

/* 关键：底部按钮吸附在页面可视底部，滚动时也不会看不到 */
.action-row {
  position: sticky !important;
  bottom: 0 !important;
  z-index: 50 !important;
  margin-top: 14px !important;
  padding: 12px 0 max(4px, env(safe-area-inset-bottom)) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  background:
    linear-gradient(
      180deg,
      rgba(7, 22, 48, 0),
      rgba(7, 22, 48, .88) 18%,
      rgba(7, 22, 48, .98)
    ) !important;
}

.primary-btn,
.secondary-btn {
  width: 100% !important;
  min-height: 46px !important;
  padding: 0 18px !important;
  font-size: 14px !important;
}

/* 角色选择 */
.role-card {
  min-height: auto !important;
  padding: 16px !important;
}

.role-card h2 {
  font-size: 22px !important;
}

/* 设备点检 */
.inspect .layout {
  flex-direction: column !important;
}

.panel {
  min-height: 310px !important;
}

.machine {
  min-height: 210px !important;
}

.spot {
  transform: scale(.92) !important;
}

/* 岗位任务 */
.meter-list {
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}

.meter-card {
  padding: 13px !important;
}

.materials > div,
.slots > div {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 9px !important;
}

.material,
.slot {
  min-height: 76px !important;
  padding: 10px !important;
}

/* 质量快检 */
.quality .layout {
  flex-direction: column !important;
}

.paper {
  min-height: auto !important;
}

.paper .box {
  min-height: 130px !important;
}

.judges {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px !important;
}

.judges button {
  min-height: 72px !important;
}

/* 黄山杯分数盒 */
.scorebox {
  width: 100% !important;
  min-height: auto !important;
  padding: 12px !important;
  align-self: stretch !important;
}

/* 地图竖屏 */
.map-nodes {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}

.map-node {
  width: 100% !important;
  min-height: 76px !important;
}

/* 结局、海报 */
.ending .body,
.poster .body {
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
}

.result-poster {
  width: 100% !important;
  max-width: 100% !important;
  padding: 22px 16px !important;
}

.poster-title,
.result-poster h1 {
  font-size: clamp(25px, 8vw, 40px) !important;
}

/* 极小屏继续压缩装饰内容，确保玩法按钮优先可见 */
@media (max-height: 680px) {
  .page {
    padding-top: calc(max(8px, env(safe-area-inset-top)) + 62px) !important;
  }

  .home-page,
  .story-page,
  .ending,
  .poster {
    padding-top: max(12px, env(safe-area-inset-top)) !important;
  }

  .page-heading {
    margin-bottom: 8px !important;
  }

  .page-title {
    font-size: clamp(21px, 6.4vw, 28px) !important;
  }

  .page-subtitle {
    font-size: 12px !important;
  }

  .quiz-side,
  .teamcard,
  .side,
  .visual,
  .tree,
  .jury,
  .map-side {
    display: none !important;
  }

  .mountain-card {
    height: 190px !important;
    min-height: 180px !important;
  }

  .choice-btn {
    min-height: 42px !important;
    padding: 8px 10px !important;
  }
}
