.play-section { padding-top: 0; }
.play-section .section-heading { align-items: center; }
.play-section .eyebrow { color: #a23c1b; }
.play-section .section-heading > p { max-width: 300px; }
.game-shell { border: 4px solid white; border-radius: 32px; background: #e7f5fc; box-shadow: 0 8px 0 #b2cdd4; overflow: hidden; }
.game-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; background: #fffdf3; border-bottom: 2px solid #e7dba8; }
.game-title { font-family: var(--display); font-weight: 900; font-size: 17px; }
.game-tools { display: flex; gap: 8px; }
.game-shell button { font: 900 13px/1.3 var(--display); cursor: pointer; }
.game-shell button:focus-visible, .game-stage:focus-visible { outline: 4px solid #175ca2; outline-offset: -5px; }
.game-tool { border: 1px solid #dac98d; background: #fff6d8; border-radius: 12px; padding: 10px 14px; color: #3c512e; min-height: 44px; }
.game-tool:hover { background: #ffe99a; }
.game-stage { position: relative; aspect-ratio: 16 / 9; isolation: isolate; outline: none; background: #b8e6f8; }
.game-stage canvas { width: 100%; height: 100%; display: block; }
.game-stage > .game-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.game-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: #173d372b; z-index: 3; }
.game-panel { background: #fffbedf7; border: 3px solid white; border-radius: 28px; box-shadow: 0 8px 30px #15392b30; padding: 24px 32px; text-align: center; max-width: 470px; width: 100%; }
.game-panel h3 { color: #b9341c; font-size: 30px; letter-spacing: -1px; margin-bottom: 8px; line-height: 1.1; }
.game-panel p { font-size: 14px; color: #47603e; margin-bottom: 14px; line-height: 1.5; }
.dragon-choices { border: 0; display: flex; gap: 12px; margin: 0 0 18px; padding: 0; }
.dragon-choices legend { width: 100%; font-weight: 900; font-size: 12px; margin-bottom: 8px; }
.dragon-choice { flex: 1; cursor: pointer; position: relative; border: 2px solid #d9cfb1; background: white; padding: 8px 16px; border-radius: 18px; font-weight: 900; }
.dragon-choice:has(input:checked) { border-color: #37832b; background: #eff8dd; box-shadow: 0 0 0 2px #37832b; }
.dragon-choice input { accent-color: #287921; }
.dragon-choice img { width: 72px; height: 70px; object-fit: contain; margin: 0 auto 4px; }
.game-start { width: 100%; }
.game-hud { position: absolute; inset: 14px 16px auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; pointer-events: none; z-index: 1; }
.game-hud > span { background: #fff9e9ed; border: 2px solid #fff; box-shadow: 0 3px 0 #997c3820; padding: 6px 14px; border-radius: 20px; font-weight: 900; font-size: 14px; color: #4e471f; }
.game-hearts { color: #cc321d !important; letter-spacing: 2px; }
.flight-hud { display: flex; align-items: center; gap: 8px; }
.flight-hud meter { width: 86px; height: 18px; accent-color: #20a8ae; }
.game-notice { position: absolute; top: 66px; left: 50%; transform: translateX(-50%); text-align: center; background: #fffbedeb; border-radius: 20px; padding: 5px 16px; max-width: 85%; font-size: 12px; font-weight: 900; pointer-events: none; z-index: 1; }
.game-controls { background: #fffdf3; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 22px; }
.game-controls p { margin: 0; font-size: 12px; color: #4f6043; line-height: 1.7; }
.game-controls strong { color: #284e2a; }
.touch-pad { display: flex; gap: 8px; flex-shrink: 0; }
.touch-pad button { min-width: 52px; min-height: 52px; border: 2px solid #d5bd71; border-radius: 16px; background: #fff0b9; color: #4a3e16; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.touch-pad button[data-control="jump"] { background: #ddf1d1; border-color: #9bc28a; }
.touch-pad button[data-control="fire"] { background: #ffe1cd; border-color: #e1a57d; }
.touch-pad button.is-held { filter: brightness(.88); transform: translateY(2px); }
.game-footnote { text-align: center; font-size: 12px; color: #526145; margin-top: 20px; }
.game-shell [hidden] { display: none !important; }
.game-shell:fullscreen { border: 0; border-radius: 0; background: #102a2c; display: flex; flex-direction: column; justify-content: center; }
.game-shell:fullscreen .game-stage { width: min(100%, calc((100dvh - 164px) * 16 / 9)); margin-inline: auto; flex-shrink: 0; }
.game-shell:fullscreen .game-controls, .game-shell:fullscreen .game-toolbar { flex-shrink: 0; }
@media (max-width: 760px) {
  .game-toolbar { padding: 10px 12px; }
  .game-title { font-size: 13px; }
  .game-tool { padding: 8px 10px; font-size: 11px !important; }
  .game-overlay { padding: 10px; }
  .game-panel { padding: 16px; max-width: 360px; }
  .game-panel h3 { font-size: 23px; }
  .game-panel p { font-size: 12px; margin-bottom: 10px; }
  .game-controls { flex-direction: column; gap: 12px; padding: 14px 10px; }
  .touch-pad { width: 100%; justify-content: space-between; }
  .touch-pad button { flex: 1; min-width: 44px; max-width: 100px; }
  .game-hud { inset: 6px 6px auto; gap: 4px; }
  .game-hud > span { font-size: 10px; padding: 4px 8px; }
  .flight-hud meter { width: 45px; }
  .game-notice { top: 40px; font-size: 10px; padding: 3px 8px; }
  .game-stage:has(.game-overlay:not([hidden])) { min-height: 340px; }
  .dragon-choice img { height: 48px; width: 58px; }
  .dragon-choices { margin-bottom: 12px; }
  .play-section .section-heading > p { max-width: none; }
  nav > a.play-nav { display: inline-flex; padding: 10px; font-size: 12px; }
}
@media (max-width: 400px) {
  .game-toolbar { flex-wrap: wrap; }
  .game-tools { margin-left: auto; }
  nav .nav-button { display: none; }
}
.game-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Primary pause action has its own row; secondary actions share an even grid. */
.game-menu-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; margin-top: 22px; }
.game-menu-actions button { width: 100%; min-height: 48px; display: flex; justify-content: center; align-items: center; padding: 12px; }
.game-menu-actions [data-resume] { grid-column: 1 / -1; min-height: 52px; }
.game-menu-actions .game-tool { line-height: 1.4; }
.game-tool:disabled { opacity: .55; cursor: default; }
@media (max-width: 760px) {
  .game-menu-actions { margin-top: 18px; gap: 14px 10px; }
  .game-menu-actions button { font-size: 12px; }
}

/* Handheld controls: a left directional pad and offset right action buttons. */
.console-directions, .console-actions { display: contents; }
.pad-caption, .pad-center, .console-mark, .console-help { display: none; }
.control-icon { display: inline-block; }
.control-name { margin-left: 4px; }
@media (max-width: 760px), (pointer: coarse), (max-width: 1000px) and (max-height: 600px) {
  .game-controls {
    --pad-size: 44px;
    --action-size: 58px;
    flex-direction: column; gap: 8px; padding: 12px 16px 14px;
    background: linear-gradient(180deg, #fff9e7, #f7e9b6);
    border-top: 3px solid #e8d28c;
    box-shadow: inset 0 3px 0 #fffdf6;
  }
  .game-controls > #game-instructions { display: none; }
  .touch-pad { width: 100%; max-width: 620px; justify-content: space-between; align-items: center; gap: 8px; position: relative; }
  .console-directions { display: grid; grid-template-columns: repeat(3, var(--pad-size)); grid-template-rows: 20px var(--pad-size) var(--pad-size); gap: 3px 0; flex-shrink: 0; }
  .pad-caption { display: block; grid-column: 1 / 4; text-align: center; align-self: center; font-size: 9px; font-weight: 900; letter-spacing: 2px; color: #52613e; }
  .pad-center { display: grid; place-items: center; grid-column: 2; grid-row: 2; background: #edcb65; color: #846522; box-shadow: inset 0 2px 3px #b39a4c55; font-size: 20px; border-radius: 8px; }
  .touch-pad .console-directions button {
    width: var(--pad-size); height: var(--pad-size); min-width: 44px; min-height: 44px; padding: 0;
    border: 2px solid #335f2c; background: #456e36; color: #fff8dd;
    box-shadow: 0 4px 0 #264a21, inset 0 2px 0 #ffffff38;
    border-radius: 12px; flex: none; max-width: none;
  }
  .console-directions [data-control="left"] { grid-column: 1; grid-row: 2; border-radius: 14px 6px 6px 14px !important; }
  .console-directions [data-control="right"] { grid-column: 3; grid-row: 2; border-radius: 6px 14px 14px 6px !important; }
  .console-directions [data-control="crouch"] { grid-column: 2; grid-row: 3; border-radius: 6px 6px 14px 14px !important; }
  .console-directions .control-icon { font-size: 25px; line-height: 1; }
  .console-directions [data-control="crouch"] .control-icon { font-size: 20px; display: block; }
  .console-directions .control-name { display: block; margin: 0; font-size: 8px; text-transform: uppercase; letter-spacing: .5px; }
  .console-actions { display: grid; grid-template-columns: repeat(2, var(--action-size)); grid-template-rows: repeat(2, var(--action-size)); gap: 2px; flex-shrink: 0; padding-block: 2px 6px; }
  .touch-pad .console-actions button {
    width: var(--action-size); height: var(--action-size); min-width: 44px; min-height: 44px; max-width: none;
    border-radius: 50%; border: 3px solid #fffdf2; padding: 4px; flex: none; color: white;
  }
  .touch-pad .console-actions button[data-control="jump"] { grid-column: 2; grid-row: 1; background: linear-gradient(#4ba83a, #2b7d28); box-shadow: 0 5px 0 #205b20, 0 0 0 1px #367a2c, inset 0 2px 0 #ffffff60; }
  .touch-pad .console-actions button[data-control="fire"] { grid-column: 1; grid-row: 2; background: linear-gradient(#ef6440, #ca361e); box-shadow: 0 5px 0 #96331c, 0 0 0 1px #bb4c2c, inset 0 2px 0 #ffffff60; }
  .console-actions .control-icon { display: block; font-size: 20px; line-height: 1; }
  .console-actions .control-name { display: block; margin: 2px 0 0; text-transform: uppercase; font-size: 10px; letter-spacing: .5px; }
  .touch-pad button.is-held { transform: translateY(4px); filter: brightness(.9); }
  .touch-pad .console-directions button.is-held { box-shadow: 0 0 0 #264a21, inset 0 2px 3px #19361755; }
  .touch-pad .console-actions button.is-held { box-shadow: 0 1px 0 #753c21, inset 0 3px 5px #173d2538; }
  .console-mark { display: flex; flex-direction: column; align-items: center; gap: 9px; font-size: 8px; font-weight: 900; letter-spacing: 1px; color: #6c653f; }
  .console-lights { display: flex; gap: 5px; }
  .console-lights i { width: 6px; height: 6px; border-radius: 50%; background: #d44a2b; box-shadow: inset 0 1px 1px #ffffff80; }
  .console-lights i:nth-child(2) { background: #e8b02a; }
  .console-lights i:nth-child(3) { background: #3c8c33; }
  .game-controls .console-help { display: block; text-align: center; font-size: 10px; line-height: 1.4; color: #5a633f; }
  .game-shell:fullscreen .game-stage { width: min(100%, calc((100dvh - 245px) * 16 / 9)); min-height: 0; }
  .game-shell:fullscreen .game-overlay { overflow-y: auto; align-items: start; }
  .game-shell:fullscreen .game-panel { margin: auto; }
}
@media (max-width: 400px) {
  .game-controls { --action-size: 50px; padding-inline: 10px; }
  .console-mark { display: none; }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 600px), (max-width: 1000px) and (orientation: landscape) and (max-height: 600px) {
  .game-controls { --action-size: 48px; padding-block: 6px 8px; gap: 4px; }
  .console-directions { grid-template-rows: 12px 44px 44px; }
  .pad-caption { font-size: 8px; }
  .game-controls .console-help { font-size: 9px; }
  .game-shell:fullscreen .game-stage { width: min(100%, calc((100dvh - 215px) * 16 / 9)); }
}

@media (pointer: coarse) and (orientation: landscape) and (max-height: 600px), (max-width: 1000px) and (orientation: landscape) and (max-height: 600px) {
  .game-shell:fullscreen .game-stage { width: min(calc(100% - 300px), calc((100dvh - 70px) * 16 / 9)); }
  .game-shell:fullscreen .game-controls { position: absolute; inset: 70px 0 0; justify-content: center; border: 0; box-shadow: none; background: transparent; pointer-events: none; padding-inline: 8px; }
  .game-shell:fullscreen .touch-pad { max-width: none; }
  .game-shell:fullscreen .touch-pad button { pointer-events: auto; }
  .game-shell:fullscreen .console-mark, .game-shell:fullscreen .console-help { display: none; }
  .game-shell:fullscreen .pad-caption { color: #fff8df; }
}

/* Keep the game inside its containing column, even when a menu needs height. */
.game-shell { --game-chrome: 170px; min-width: 0; max-width: 100%; }
.game-stage {
  width: 100%; max-width: 100%; min-width: 0;
  max-height: max(100px, calc(100dvh - var(--game-chrome) - 24px));
  overflow: hidden;
}
.game-stage canvas { position: absolute; inset: 0; object-fit: contain; }
.game-overlay {
  min-width: 0; min-height: 0;
  grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}
.game-panel { min-width: 0; min-height: 0; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; }
.game-panel h3, .game-panel p { overflow-wrap: anywhere; }
.dragon-choices, .dragon-choice, .game-menu-actions { min-width: 0; }
.game-shell:fullscreen .game-stage { max-height: none; }
.game-shell:fullscreen .game-overlay {
  position: fixed; inset: 0; padding: 16px;
  display: grid; place-items: center; background: #153c38b8;
}
.game-shell:fullscreen .game-overlay[hidden] { display: none !important; }
.game-shell:fullscreen .game-panel { width: min(100%, 470px); margin: 0; }
@media (max-width: 760px), (pointer: coarse), (max-width: 1000px) and (max-height: 600px) {
  .game-shell { --game-chrome: 240px; }
  .game-shell:not(:fullscreen) .game-stage:has(.game-overlay:not([hidden])) {
    min-height: min(340px, max(100px, calc(100dvh - var(--game-chrome) - 24px)));
  }
  .game-overlay { padding: 10px; }
  .game-panel { padding: clamp(12px, 3vw, 20px); }
}
@media (max-height: 600px) and (orientation: landscape) {
  .game-shell { --game-chrome: 190px; }
  .game-panel h3 { font-size: 23px; }
  .game-panel p { font-size: 12px; }
  .game-shell:fullscreen .game-panel { padding: 16px; }
}
