/* The page around the browser build: the game in a phone-shaped column on
   wide screens, star sand in the rails either side, ads in the rails. On
   phones the game fills the screen. Ink black + pale brass, like the game. */

:root {
  --ink: #09090b;
  --ink-2: #131316;
  --brass: #b89656;
  --brass-hi: #cdb07a;
  --brass-glow: #e2c98f;
  --text: #e6e2da;
  --muted: #8e8c88;
  --faint: #5a5852;
  --font: 'Montserrat', system-ui, -apple-system, sans-serif;

  /* Set by shell.js. --col-b is the gap under the column, --bottom the
     strip kept for the phone ad. */
  --col-x: 0px;
  --col-y: 0px;
  --col-w: 100vw;
  --col-b: 0px;
  --bottom: 0px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#sand {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  touch-action: none;
}

#column {
  position: fixed;
  top: var(--col-y);
  bottom: var(--col-b);
  left: var(--col-x);
  width: var(--col-w);
  z-index: 2;
  background: var(--ink);
  overflow: hidden;
}
/* The column sinks into the sand rather than sitting on a drawn edge. */
body.wide #column {
  box-shadow: 0 0 48px 18px rgba(9, 9, 11, 0.95), 0 0 120px 40px rgba(9, 9, 11, 0.6);
}

#game {
  position: absolute;
  inset: 0;
}

/* ── Start gate ─────────────────────────────────────────────────────────── */

#gate {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 32px 28px calc(32px + env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% 42%, #17171a 0%, var(--ink) 62%);
  transition: opacity 0.9s ease, visibility 0s linear 0.9s;
  text-align: center;
}
#gate.gone { opacity: 0; visibility: hidden; pointer-events: none; }

.gate-logo {
  width: min(78%, 360px);
  height: auto;
  filter: drop-shadow(0 6px 28px rgba(226, 201, 143, 0.12));
  user-select: none;
  -webkit-user-drag: none;
}

#play {
  min-width: 200px;
  height: 52px;
  padding: 0 34px;
  border-radius: 9px;
  border: 1px solid rgba(255, 233, 168, 0.55);
  background: linear-gradient(180deg, #f4d684 0%, #d9a443 50%, #a9711f 100%);
  color: #1b1205;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.2s ease, opacity 0.3s ease;
}
#play:hover:not(:disabled) { filter: brightness(1.08); }
#play:active:not(:disabled) { transform: translateY(1px); }
#play:disabled {
  cursor: default;
  background: #15100a;
  border-color: #4a3618;
  color: var(--muted);
}
#play:focus-visible { outline: 2px solid var(--brass-glow); outline-offset: 3px; }

.gate-note {
  max-width: 320px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.gate-apps {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.gate-apps-title {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--brass-hi);
}
.gate-apps-row { display: flex; gap: 10px; }
.gate-store {
  min-width: 128px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid rgba(205, 176, 122, 0.45);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-align: center;
  transition: border-color 0.2s ease, color 0.2s ease;
}
a.gate-store[href]:hover { border-color: var(--brass-glow); color: var(--brass-glow); }
.gate-store.soon {
  border-color: #33333a;
  color: var(--muted);
  cursor: default;
}
.gate-store.soon::after {
  content: ' · soon';
  color: var(--faint);
}
.gate-apps-note {
  max-width: 300px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--faint);
}
.gate-links {
  display: flex;
  gap: 18px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.gate-links a { color: var(--faint); text-decoration: none; transition: color 0.2s ease; }
.gate-links a:hover { color: var(--brass-hi); }

/* ── Rails and ads ──────────────────────────────────────────────────────── */

.rail-ad {
  position: fixed;
  z-index: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 18px; /* clear of the unit's 10px ink mat */
}
body.wide .rail-ad.on { display: flex; visibility: hidden; }
body.wide .rail-ad.on.filled { visibility: visible; }
/* No room beside the column laid on its side: out of sight until it stands
   up again (kept mounted, so the ad is not reloaded). */
body.wide .rail-ad.on.filled.tucked { visibility: hidden; }

.ad-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--faint);
}
.ad-box {
  background: var(--ink-2);
  box-shadow: 0 0 0 10px var(--ink), 0 10px 40px rgba(0, 0, 0, 0.6);
  line-height: 0;
}

#bottom-ad {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--bottom);
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
}
/* Laid out off-screen-height until filled, so AdSense can size the unit
   without the game giving up the strip for an empty slot. */
#bottom-ad.on { display: flex; visibility: hidden; height: 60px; }
#bottom-ad.on.filled { visibility: visible; height: var(--bottom); }

.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a1e;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
  #gate { transition: none; }
}
