/* 3D Scene Viewport & Overrides */
.scene.has-3d {
  height: 420px;
  min-height: 380px;
  background: #f7f7f7;
}

.scene-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Ẩn các đối tượng 2D SVG khi 3D WebGL đang hoạt động */
.scene.has-3d .ground,
.scene.has-3d .cloud,
.scene.has-3d .sun,
.scene.has-3d .hill,
.scene.has-3d .dino svg,
.scene.has-3d .obstacle svg {
  visibility: hidden;
}

.scene.has-3d .dino {
  width: 70px;
  height: 95px;
  bottom: 40px;
}

.scene.has-3d .obstacle {
  width: 40px;
  height: 70px;
  bottom: 40px;
}

.scene.has-3d .obstacle small {
  visibility: visible;
  bottom: 84px;
  font-size: 12.5px;
  padding: 5px 12px;
}

.scene.has-3d .game.running .dino {
  animation: none;
}

/* Responsive cho màn hình nhỏ */
@media (max-width: 960px) {
  .scene.has-3d {
    min-height: 280px;
  }
}

@media (max-width: 650px) {
  .scene.has-3d {
    min-height: 240px;
  }
  .scene.has-3d .dino {
    left: 15%;
    width: 52px;
    height: 70px;
  }
  .scene.has-3d .obstacle {
    width: 32px;
    height: 55px;
  }
  .scene.has-3d .obstacle small {
    bottom: 68px;
    font-size: 11px;
  }
}

/* A shorter play scene leaves room for the word and answer controls on phones. */
@media (max-width: 650px) {
  body.game-active .scene.has-3d { height: 165px; min-height: 165px; flex: none; }
  body.game-active .scene:not(.has-3d) { height: 165px; min-height: 165px; flex: none; }
  body.game-active main { padding: 6px; }
  body.game-active .stage-footer-bar { padding: 7px 9px; gap: 4px; }
  body.game-active .footer-hint-row { padding: 5px 8px; font-size: 12px; line-height: 1.35; }
  body.game-active .stage-column .temp-choice-panel { padding: 7px 9px 9px; gap: 6px; }
  body.game-active .temp-speech-status { min-height: 0; padding: 6px 10px; font-size: 12px; line-height: 1.3; }
  body.game-active .choice-grid { gap: 6px; }
  body.game-active .choice-btn { min-height: 44px; padding: 7px 9px; line-height: 1.2; }
  body.game-active .game-stop { min-height: 40px; padding: 7px 14px; }
}
/* Place the game surface directly against the host section. */
body { background: transparent; }
main, body.game-active main { padding: 0; }
.stage-column { box-shadow: none; }

/* Stable game layout, with independently scrollable text and controls. */
html,body{height:100%;min-height:0}
body{overflow:hidden}
main,body.game-active main{height:100%;padding:0}
.game-split-container,.stage-column{height:100%;min-height:0}
.stage-column{display:flex;flex-direction:column}
.scene,.scene.has-3d,body.game-active .scene.has-3d,body.game-active .scene:not(.has-3d){height:auto;min-height:0;flex:0 0 53%}
.stage-footer-bar,body.game-active .stage-footer-bar{flex:0 1 auto;min-height:0;max-height:25%;overflow:auto}
.footer-definition-box{min-width:0}
.stage-column .temp-choice-panel,body.game-active .stage-column .temp-choice-panel{flex:1 1 0;min-height:0;overflow:auto;overscroll-behavior:contain}
.modal-overlay{position:fixed;inset:0;overflow-y:auto}
@media(max-width:650px){
 .scene,.scene.has-3d,body.game-active .scene.has-3d,body.game-active .scene:not(.has-3d){flex-basis:43%}
 .stage-footer-bar,body.game-active .stage-footer-bar{max-height:25%}
 .stage-action-overlay{gap:8px;padding:8px}
 .overlay-scoreboard{padding:5px 15px}
 .stage-action-overlay .temp-choice-header{gap:4px}
 .stage-start-btn,.stage-howto-btn{padding:8px 14px;min-height:40px}
 .stage-column .temp-choice-panel,body.game-active .stage-column .temp-choice-panel{padding:8px 10px;gap:6px}
}

/* Use spare space for the scene when the answer grid is not displayed. */
body:not(.game-active) .scene,
body:not(.game-active) .scene.has-3d,
body.game-active:not(.choice-mode) .scene,
body.game-active:not(.choice-mode) .scene.has-3d { flex: 1 1 0; }
body:not(.game-active) .stage-column .temp-choice-panel,
body.game-active:not(.choice-mode) .stage-column .temp-choice-panel { flex: 0 0 auto; }
