/* The landing page is the game. A slim bar above it carries the links,
   and the canvas takes everything under the bar. Same colours as the
   pages (style.css) and the game itself. */
:root {
  --ground: #08090c;
  --panel: #0f1117;
  --edge: #1e2230;
  --ink: #e8ecf2;
  --dim: #98a1b0;
  --ok: #4fd8e8;
  --gold: #e0a33a;
  --bar: 40px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

.bar {
  flex: 0 0 var(--bar);
  height: var(--bar);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 0.9rem;
  border-bottom: 1px solid var(--edge);
  background: var(--panel);
  white-space: nowrap;
}

.bar-mark {
  color: var(--gold);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.bar-links {
  display: flex;
  gap: 1rem;
  overflow: hidden;
}

.bar-links a, .bar-button {
  color: var(--dim);
  text-decoration: none;
  font-size: 0.92rem;
}

.bar-links a:hover, .bar-button:hover { color: var(--ink); }

.bar-button {
  margin-left: auto;
  background: none;
  border: 1px solid var(--edge);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
}

/* The menus' themes (MenuSkin), worn by the page round the game: its
   lit edge, its dim edge and its ground. The game names the one in use
   (play.js wear). */
body { --frame: #5ee6ff; --frame-dim: rgba(128, 163, 204, 0.35); --frame-ground: #080a0d; }
body[data-theme="armour"] { --frame: #5ee6ff; --frame-dim: rgba(117, 138, 163, 0.6); --frame-ground: #0a0c0f; }
body[data-theme="ember"] { --frame: #ffd680; --frame-dim: rgba(204, 133, 56, 0.5); --frame-ground: #0d0705; }
body[data-theme="blueprint"] { --frame: #cceffe; --frame-dim: rgba(158, 204, 255, 0.5); --frame-ground: #05142e; }
body[data-theme="terminal"] { --frame: #66ffcc; --frame-dim: rgba(64, 184, 153, 0.5); --frame-ground: #000605; }

#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background-color: var(--frame-ground);
  /* A faint grid, as behind the menus. */
  background-image:
    linear-gradient(color-mix(in srgb, var(--frame-dim) 40%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--frame-dim) 40%, transparent) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: center;
  /* The canvas is centred in it when it takes less than all of it (play.js). */
  display: flex;
  align-items: center;
  justify-content: center;
}

#frame {
  position: relative;
  flex: none;
  background: #000;
  outline: 1px solid var(--frame-dim);
  box-shadow: 0 0 40px 2px color-mix(in srgb, var(--frame) 22%, transparent);
}

/* Lit corners, as on the game's panels. */
#frame::before, #frame::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  pointer-events: none;
  z-index: 2;
}
#frame::before {
  top: -4px;
  left: -4px;
  border-top: 2px solid var(--frame);
  border-left: 2px solid var(--frame);
}
#frame::after {
  bottom: -4px;
  right: -4px;
  border-bottom: 2px solid var(--frame);
  border-right: 2px solid var(--frame);
}

/* Full screen or a phone: the game is all there is. */
#frame.whole { outline: 0; box-shadow: none; }
#frame.whole::before, #frame.whole::after { display: none; }

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#canvas:focus { outline: none; }

/* The loading screen: the game's splash, as a loop that starts on the boot
   image, and a thin bar under it. */
#status {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #090c12;
  visibility: hidden;
}

#status-splash {
  max-width: 100%;
  max-height: 100%;
  margin: auto;
}

#status-splash.show-image--false { display: none; }

#status-splash.fullsize--true {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#status-splash.use-filter--false { image-rendering: pixelated; }

#status-progress, #status-notice {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
}

#status-progress {
  bottom: 8%;
  width: min(50%, 420px);
  height: 6px;
  margin: 0 auto;
  appearance: none;
  border: 0;
  background: var(--edge);
}

#status-progress::-webkit-progress-bar { background: var(--edge); }
#status-progress::-webkit-progress-value { background: var(--ok); }
#status-progress::-moz-progress-bar { background: var(--ok); }

#status-notice {
  bottom: 12%;
  margin: 0 auto;
  width: min(90%, 560px);
  background: #2a1218;
  border: 1px solid #7a2a3a;
  border-radius: 6px;
  color: var(--ink);
  padding: 0.8rem 1rem;
  text-align: center;
  line-height: 1.4;
}

/* On a phone the app is the better way to play, so the page says so
   first and offers the browser second. */
.phone {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 1.5rem;
  background: var(--ground);
}

.phone[hidden] { display: none; }

.phone h1 {
  margin: 0 0 0.5rem;
  color: var(--gold);
  font-size: 2.2rem;
}

.phone p {
  margin: 0.4rem 0;
  color: var(--dim);
  max-width: 28rem;
}

.phone-play, .phone-anyway {
  display: inline-block;
  padding: 0.7rem 1.3rem;
  border-radius: 6px;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
}

.phone-play {
  color: var(--ground);
  background: var(--ok);
  font-weight: 600;
}

.phone-anyway {
  color: var(--dim);
  background: none;
  border: 1px solid var(--edge);
}

/* Google's own sign-in button, over the game while the game asks. */
.google {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  text-align: center;
  padding: 1.5rem;
  background: rgba(8, 9, 12, 0.88);
}

.google[hidden] { display: none; }

.google p {
  margin: 0.2rem 0;
  color: var(--ink);
  max-width: 28rem;
}

.note {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.3rem 0.9rem;
  color: var(--dim);
  font-size: 0.8rem;
  background: var(--panel);
  border-top: 1px solid var(--edge);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note[hidden] { display: none; }

.notice {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
}

/* Full screen: the stage alone, edge to edge. */
#stage:fullscreen { background: #000; }

@media (max-width: 640px) {
  .bar { gap: 0.7rem; padding: 0 0.7rem; }
  .bar-links { gap: 0.7rem; }
  .bar-links a:nth-child(n+3) { display: none; }
}
