/**
 * 课堂电视触摸带：1–3 年级够得到的中下方
 *
 * 字母课（body.deck 16:9 板）与国家地理分级课件（body > .app）
 * 都在高挂电视上操作。标题/配图可以偏上，热区、拖放格、检查按钮
 * 尽量落在舞台下半区，避免小朋友够不到。
 */

/* ── 字母课 16:9 舞台 ── */
body.deck .slide.is-story {
  justify-content: flex-end;
  gap: 4px;
  padding-bottom: 2px;
}

body.deck .slide.is-story .slide-kicker,
body.deck .slide.is-story .hint {
  flex-shrink: 0;
}

/* 漫画吃掉标题与底栏之间的剩余高度，气泡叠层跟着图走 */
body.deck .slide.is-story .story-hero,
body.deck .slide:has(.story-hero) .story-hero {
  margin: 0 auto;
  width: min(98%, 1100px);
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

body.deck .story-comic {
  position: relative;
  height: 100%;
  width: auto;
  max-width: 100%;
  line-height: 0;
}

body.deck .story-hero > img,
body.deck .story-comic img {
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

/* 单字母页：单词大图、见面卡；匹配页四格图 */
body.deck .word-hero {
  width: min(100%, 520px);
}

body.deck .meet-row {
  width: min(100%, 820px);
}

body.deck .story-match-board {
  width: min(100%, 1040px);
}

/* 复习课 learn.html 用 .page 包 slide，原先 max-width:920px 把故事图又卡住了 */
body.deck .board > .page {
  flex: 1 1 auto;
  min-height: 0;
  max-width: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: 8px 22px 12px;
  overflow: hidden;
}

body.deck .board > .page > .slide,
body.deck .board > .page > #play {
  flex: 1 1 auto;
  min-height: 0;
}

body.deck .slide.is-story .btn-row,
body.deck .slide.is-match .btn-row {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
  padding: 2px 0 0;
  flex-shrink: 0;
}

body.deck .slide.is-story .btn-row .btn,
body.deck .slide.is-match .btn-row .btn,
body.deck .slide:has(.story-hero) > .btn.btn-apple {
  min-height: 52px;
  min-width: 7.2rem;
  padding: 12px 22px;
  font-size: 1.05rem;
}

body.deck .slide.is-story .story-chip,
body.deck .slide.is-match .story-chip {
  min-height: 44px;
  padding: 10px 16px;
  font-size: 1.02rem;
}

body.deck .slide.is-match .story-match-board {
  margin-top: auto;
}

body.deck .slide:has(.story-hero) {
  justify-content: flex-end;
}

body.deck .slide:has(.story-hero) .story-lines,
body.deck .slide:has(.story-hero) > .btn {
  flex-shrink: 0;
}

body.deck .story-lines {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: min(100%, 1040px);
  margin: 4px auto;
}

body.deck .slide:has(.story-hero) > .btn {
  margin-top: 6px;
}

/* 游戏页：题板与操作钮沉到中下方，说明留在上方 */
body.deck .deck-main {
  display: flex;
  flex-direction: column;
}

body.deck .deck-main #play {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.deck .play-panel {
  flex: 1 1 auto;
  min-height: 0;
  justify-content: flex-end;
}

body.deck .play-panel .lead,
body.deck .play-panel #play-tools {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  flex-shrink: 0;
}

body.deck .play-panel #play-board {
  margin-top: auto;
}

body.deck .play-panel .play-actions,
body.deck .play-panel #play-actions {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
  flex-shrink: 0;
}

/* ── 国家地理分级 · 横屏 16:9 课件（手机长页不套用） ── */
@media (pointer: fine) and (min-width: 821px), (min-width: 1025px) {
  html:not(.ng-courseware-portrait) .word-col-panel {
    justify-content: flex-end;
  }

  html:not(.ng-courseware-portrait) .view-body--story {
    display: flex;
    flex-direction: column;
  }

  html:not(.ng-courseware-portrait) .view-body--story > h2 {
    order: 0;
    flex-shrink: 0;
  }

  html:not(.ng-courseware-portrait) .view-body--story > #storyProgress {
    order: 1;
    flex-shrink: 0;
  }

  html:not(.ng-courseware-portrait) .view-body--story > .story-slide {
    order: 2;
    flex: 1 1 auto;
    min-height: 0;
  }

  /* 听本句 / 循环 / 金字塔 等操作钮移到课文下方 */
  html:not(.ng-courseware-portrait) .view-body--story > .panel-lite {
    order: 4;
    margin-top: 0.2rem;
    flex-shrink: 0;
  }

  html:not(.ng-courseware-portrait) .view-body--story > .btns {
    order: 5;
    margin-top: 0.28rem;
    flex-shrink: 0;
  }

  html:not(.ng-courseware-portrait) .story-pyramid {
    justify-content: flex-end;
  }

  html:not(.ng-courseware-portrait) #view-review > .view-body {
    display: flex;
    flex-direction: column;
  }

  html:not(.ng-courseware-portrait) #view-review #rBody {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }

  html:not(.ng-courseware-portrait) #view-review .view-nav-row {
    margin-top: auto;
  }

  html:not(.ng-courseware-portrait) .review-center-block:not(.jumble-hold) {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  /* 句子排序：左图右答题，热区仍在右下，避免整句被底栏按钮挡住 */
  html:not(.ng-courseware-portrait) .jumble-hold {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(18rem, 1fr);
    column-gap: clamp(0.7rem, 1.8vw, 1.6rem);
    align-items: stretch;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
  }

  html:not(.ng-courseware-portrait) .jumble-col-art {
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  html:not(.ng-courseware-portrait) .jumble-hold .jumble-col-art .hero-art {
    max-width: 100%;
    margin: 0;
  }

  html:not(.ng-courseware-portrait) .jumble-hold .jumble-col-art .art-img {
    max-height: min(52vh, calc(100dvh - 11rem));
  }

  html:not(.ng-courseware-portrait) .jumble-col-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.15rem;
  }

  html:not(.ng-courseware-portrait) .review-center-block:not(.jumble-hold) > .btns {
    order: 20;
    margin-top: 0.45rem;
  }

  html:not(.ng-courseware-portrait) .jumble-col-panel > .btns {
    margin-top: 0.25rem;
  }

  html:not(.ng-courseware-portrait) .word-step-nav,
  html:not(.ng-courseware-portrait) .view-body--words .btns#wActions {
    margin-top: 0.35rem;
  }
}
