/* ============================================================
   INKBLAKE — compat-envelope.css  (Layout Compatibility Program, T4)
   The playfield is clamped to 16:9–20:9. Inside the envelope it is
   edge-to-edge; outside it is centered with a decorative paper
   letterbox instead of a black void or a reflowed HUD.
   ============================================================ */
#app {
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(255, 251, 238, .34), rgba(255, 251, 238, 0) 55%),
    radial-gradient(130% 120% at 50% 110%, rgba(120, 95, 54, .28), rgba(120, 95, 54, 0) 62%),
    repeating-linear-gradient(90deg, rgba(90, 72, 43, .028) 0 1px, transparent 1px 7px),
    var(--paper0);
}

#playfield {
  position: absolute;
  left: var(--play-x, 0px);
  top: var(--play-y, 0px);
  width: var(--play-w, 100%);
  height: var(--play-h, 100%);
  overflow: hidden;
  isolation: isolate;
  background: var(--paper0);
}

/* Every layer that belongs to the game lives inside the frame. */
#playfield > #game-canvas,
#playfield > #boot-screen,
#playfield > #fit-root,
#playfield > #hud-root {
  position: absolute;
  inset: 0;
}
#playfield > #game-canvas { width: 100%; height: 100%; }

/* Letterbox edge: a hand-cut sheet edge, never a black bar. */
#app.letterboxed #playfield {
  box-shadow:
    0 0 0 1px rgba(90, 72, 43, .18),
    0 18px 55px rgba(38, 31, 18, .22),
    inset 0 0 0 1px rgba(255, 253, 244, .4);
}
#app.letterboxed #playfield::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 80;
  box-shadow: inset 0 0 0 1px rgba(255, 253, 244, .28);
  background:
    linear-gradient(90deg, rgba(38, 31, 18, .06), transparent 3%, transparent 97%, rgba(38, 31, 18, .06)),
    linear-gradient(180deg, rgba(38, 31, 18, .05), transparent 3%, transparent 97%, rgba(38, 31, 18, .05));
}

/* Reverse landscape uses the same frame; no extra rule needed. */
