/* EMBERFALL - layout only. Every game visual is drawn on the canvas by
   js/palette.js, so the only colours here are the frame around the canvas -
   and they are taken from the palette's own night ramp, not invented, so the
   page around the game never fights the game.

   Values below are the literal hex codes from js/palette.js NIGHT:
     #1A100A skyTop   (warm near-black, the darkest value in Emberfall - no #000)
     #2A1710 skyMid   (deep umber)
     #4A2412 skyLow   (burnt sienna, near the horizon)
     #FFD489 candleGold

   There used to be a purple-plum trio of variables here, one shade per line
   above. Klaudia named that colour specifically as the reason she rejected
   the build, so it is gone - every value below sits in the warm amber/umber
   band the rest of the game already lives in. */

:root {
  --cocoa-deep: #1A100A;
  --cocoa: #2A1710;
  --ember-glow: #4A2412;
  --candle-gold: #FFD489;
  --cream: #FFF3DE;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--cocoa-deep);
  color: var(--cream);
  font-family: "Georgia", "Iowan Old Style", "Times New Roman", serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

body {
  /* Kill mobile scroll / pull-to-refresh / double-tap zoom over the game. */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  /* Deliberately NOT centred here: #app stretches to fill (the flex default),
     and #stage - which fills #app via flex:1 1 auto - centres the canvas
     inside ITSELF. Centring #app too used to make #stage hug the canvas's
     current size instead of filling #app, which is a circular measurement:
     fit() reads #stage's rect to decide the canvas size, so #stage has to be
     the full box, not a box shaped by the canvas it is about to receive. */
  /* Respect iOS notches / home indicator. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  /* A warm glow behind the canvas, as if the page itself were lit by the
     lantern inside it. */
  background:
    radial-gradient(120% 90% at 50% 12%, var(--ember-glow) 0%, rgba(74, 36, 18, 0) 62%),
    linear-gradient(180deg, var(--cocoa) 0%, var(--cocoa-deep) 100%);
}

#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* On touch, js/main.js sizes the canvas to the WHOLE of #app's content box
   (see fit()), so #stage must stop centring a smaller box inside itself and
   simply match it - otherwise the flex centring here would fight the exact
   pixel size main.js just computed. */
body.touch #stage { flex: 0 0 auto; }

#game {
  display: block;
  touch-action: none;
  border-radius: 12px;
  /* Candle-gold rim instead of Skyhook's cyan neon: same job (the canvas
     reads as a lit window rather than a rectangle), opposite temperature. */
  box-shadow:
    0 0 0 1px rgba(255, 212, 137, 0.20),
    0 0 40px rgba(255, 158, 74, 0.10),
    0 18px 60px rgba(26, 16, 10, 0.72);
  image-rendering: auto;
}

/* On touch the canvas IS the screen - see js/main.js fit(). A rounded,
   drop-shadowed "window" reads as a picture sitting on a page; full-bleed
   edge-to-edge is what makes the valley read as the whole app rather than
   as an image floating on top of one. */
body.touch #game {
  border-radius: 0;
  box-shadow: none;
}

.noscript {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  font-size: 16px;
  color: var(--candle-gold);
}
