body {
    margin: 0;
    padding: 0;
    color: rgba(255, 255, 255, 0.87);
    /*
      The game's own background, not black. The canvas is authored at 1280x720
      and scaled to fit, so on any viewport with a different aspect there is
      letterboxing either side of it — and pure black behind a warm, painted
      forest reads as a rendering failure rather than as a frame.
    */
    background-color: #151820;
}

#app {
    width: 100%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/*
  Pin Phaser's DOM container out of page flow. It is born `position: absolute`,
  but portal ad SDKs (GameDistribution / GameMonetize) rewrite it to
  `position: relative` — then its full render-size layout box enters flow and
  shoves the canvas a full render-height off-screen (the canvas keeps rendering
  fine, just off-viewport: the whole game reads as a black screen behind the
  overlay's floating inputs). Does NOT reproduce off-portal, so local and
  headless tests never catch it. The `!important` is load-bearing: it must beat
  inline styles written by third-party JS. `#game-container` supplies the
  positioning context. Ported from dragon-power lesson L4 (2026-07-29) after
  the same bug recurred on little-red (2026-07-31); mirrored in src/main.ts as
  an injected `<style>` because un-hashed public/ assets can be served stale.
*/
#game-container {
    position: relative;
}

#game-container > div {
    position: absolute !important;
    top: 0;
    left: 0;
}

/* ---------------------------------------------------------------------------
   Landscape gate
   --------------------------------------------------------------------------- */

#rotate-gate {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10;
    background-color: #151820;
    color: #f4f7fb;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    text-align: center;
    padding: 24px;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
}

/*
  Two conditions, both required.

  `orientation: portrait` alone would also catch a desktop browser resized
  taller than it is wide — including a reviewer poking at the window — and
  blocking them would be a worse bug than the one this fixes. `pointer: coarse`
  narrows it to touch input, which is the case the gate is actually for.

  Inside a portal iframe this evaluates against the IFRAME's box, so a portal
  that frames the game landscape never triggers the gate even on a phone held
  upright. That is the correct behaviour: in that case the game is not sideways.
*/
@media (orientation: portrait) and (pointer: coarse) {
    #rotate-gate:not([data-dismissed]) {
        display: flex;
    }
}

.rotate-gate__panel {
    max-width: 22rem;
}

.rotate-gate__icon {
    width: 96px;
    height: 96px;
    color: #45d19f;
}

.rotate-gate__title {
    margin: 8px 0 0;
    font-size: 1.35rem;
    font-weight: 700;
}

.rotate-gate__body {
    margin: 8px 0 0;
    font-size: 1rem;
    color: #aeb8c6;
    line-height: 1.45;
}

/*
  The escape hatch, deliberately quiet.

  A player whose device has rotation locked — sometimes for mobility reasons —
  cannot satisfy this gate by turning the phone: the browser keeps reporting
  portrait however they hold it. Without a way past, the game is simply bricked
  for them. It is styled as a link rather than a button so it reads as a last
  resort rather than an equal choice.
*/
.rotate-gate__dismiss {
    margin-top: 22px;
    padding: 8px 4px;
    background: none;
    border: 0;
    color: #8b94a3;
    font: inherit;
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
}

.rotate-gate__dismiss:hover,
.rotate-gate__dismiss:focus-visible {
    color: #aeb8c6;
}
