/* Seven Steps — readable trivia over framed era artwork */

#gameScreen .question-stage {
  display: grid;
  grid-template-rows: minmax(140px, 32%) minmax(0, 1fr);
  align-content: stretch;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #050b14;
}

/* Framed artwork band — image is visible without fighting the text */
#gameScreen .era-art {
  position: relative;
  inset: auto;
  z-index: 1;
  min-height: 0;
  overflow: hidden;
  background: #03070f;
  border-bottom: 1px solid rgba(212, 175, 55, 0.28);
  filter: none;
  transition: background-image 0.35s ease;
}

#gameScreen .era-art:before {
  content: "";
  position: absolute;
  inset: -18px;
  background-image: var(--era-img);
  background-size: cover;
  background-position: center;
  filter: blur(18px) brightness(0.38) saturate(0.85);
  transform: scale(1.08);
  pointer-events: none;
}

#gameScreen .era-art:after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(180deg, rgba(2, 7, 14, 0.15), rgba(2, 7, 14, 0.55)),
    var(--era-img);
  background-size: contain, contain;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  pointer-events: none;
}

#gameScreen .question-stage:after {
  display: none;
}

/* Solid readable quiz panel under the art */
#gameScreen .question-panel {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: none;
  margin: 0;
  border-radius: 0;
  border: 0;
  border-top: 1px solid rgba(56, 88, 122, 0.45);
  background: linear-gradient(180deg, rgba(8, 20, 36, 0.98), rgba(3, 9, 18, 0.99));
  backdrop-filter: none;
  padding: clamp(16px, 2.2vw, 26px) clamp(16px, 2.4vw, 28px) 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#gameScreen .question-panel h2 {
  font: 800 clamp(22px, 2.6vw, 34px) var(--cinzel);
  line-height: 1.28;
  text-align: center;
  margin: 10px auto 18px;
  max-width: 34ch;
  color: #f4f7fb;
  text-shadow: none;
}

#gameScreen .answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: min(820px, 100%);
  margin: 0 auto;
}

#gameScreen .answer {
  min-height: 64px;
  border-radius: 14px;
  border: 1px solid #3a5d7d;
  background: linear-gradient(180deg, #1a3858, #0e243a);
  color: #f5f8fb;
  font: 700 clamp(15px, 1.45vw, 20px) var(--cinzel);
  padding: 12px 14px;
  text-align: center;
  line-height: 1.25;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.28);
}

#gameScreen .answer:hover:not(:disabled) {
  border-color: #e7af2b;
  background: linear-gradient(180deg, #214568, #12304a);
}

#gameScreen .explanation {
  width: min(820px, 100%);
  margin-left: auto;
  margin-right: auto;
  background: rgba(2, 8, 16, 0.55);
  border: 1px solid #27415b;
  border-radius: 12px;
  padding: 12px 14px;
}

#gameScreen .explanation.show {
  display: flex;
}

#gameScreen .feedback {
  width: min(820px, 100%);
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 900px) {
  #gameScreen .question-stage {
    /* Must shrink inside the phone viewport — fixed mins clipped answers */
    min-height: 0;
    grid-template-rows: minmax(72px, 18%) minmax(0, 1fr);
  }
  #gameScreen .era-art {
    min-height: 72px;
  }
  #gameScreen .answers {
    grid-template-columns: 1fr;
  }
  #gameScreen .question-panel h2 {
    font-size: clamp(16px, 4.6vw, 24px);
    max-width: none;
  }
}

@media (max-width: 620px) {
  #gameScreen .question-stage {
    grid-template-rows: minmax(64px, 14%) minmax(0, 1fr);
  }
  #gameScreen .era-art {
    min-height: 64px;
  }
}

/* ——— Desktop/tablet: lock game to viewport — no page scroll ——— */
@media (min-width: 901px) {
  body:has(#gameScreen.active),
  body:has(#gameScreen.active) .app-shell {
    overflow: hidden !important;
    height: 100dvh;
    max-height: 100dvh;
  }

  #gameScreen.active {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: min(1500px, 100%);
    height: calc(100dvh - var(--header-h)) !important;
    min-height: calc(100dvh - var(--header-h)) !important;
    max-height: calc(100dvh - var(--header-h)) !important;
    padding: 6px clamp(10px, 1.6vw, 22px) 10px !important;
    overflow: hidden !important;
    box-sizing: border-box;
  }

  #gameScreen .hud-top {
    flex: 0 0 auto;
    margin-bottom: 8px !important;
  }

  #gameScreen #raceRival:not([hidden]) {
    flex: 0 0 auto;
    margin-bottom: 6px;
  }

  #gameScreen .game-layout {
    flex: 1 1 auto;
    min-height: 0 !important;
    height: auto !important;
    max-height: none;
    align-items: stretch !important;
    overflow: hidden;
    gap: 10px !important;
  }

  #gameScreen .lifeline-panel,
  #gameScreen .climb-panel,
  #gameScreen .question-stage {
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    position: relative !important;
    top: auto !important;
    overflow: hidden;
  }

  #gameScreen .lifeline-panel,
  #gameScreen .climb-panel {
    display: flex;
    flex-direction: column;
  }

  #gameScreen .staircase-3d {
    flex: 1 1 auto;
    min-height: 0 !important;
    height: auto !important;
    max-height: 100%;
    justify-content: space-evenly;
    gap: 2px;
  }

  #gameScreen .game-step {
    height: auto !important;
    flex: 1 1 0;
    min-height: 28px;
    max-height: 58px;
    font-size: clamp(16px, 2.2vh, 26px);
  }

  #gameScreen .game-base {
    flex: 0 0 auto;
    height: 22px !important;
  }

  #gameScreen .player-character {
    width: clamp(84px, 12vh, 120px);
    height: clamp(104px, 15vh, 150px);
  }

  #gameScreen .question-panel {
    min-height: 0;
    overflow: hidden;
  }

  #gameScreen .question-panel h2 {
    font-size: clamp(18px, 2.4vh, 30px);
    margin: 6px auto 12px;
  }

  #gameScreen .answer {
    min-height: clamp(44px, 6.5vh, 60px);
    padding: 8px 12px;
  }
}

@media (min-width: 901px) and (max-height: 820px) {
  #gameScreen .era-art {
    min-height: 0;
  }

  #gameScreen .question-stage {
    grid-template-rows: minmax(96px, 26%) minmax(0, 1fr);
  }

  #gameScreen .hud-profile span,
  #gameScreen .hud-stats span {
    font-size: 9px;
  }
}

@media (min-width: 901px) and (max-height: 700px) {
  #gameScreen .question-stage {
    grid-template-rows: minmax(72px, 22%) minmax(0, 1fr);
  }

  #gameScreen .answer {
    min-height: 40px;
    font-size: clamp(13px, 1.8vh, 16px);
  }
}

