/* Asteroids - the frame around the canvas. The field itself is all drawn. */

:root {
  --bg:      #05060d;
  --edge:    #202a44;
  --ink:     #e9f0ff;
  --ink-dim: #7d88a8;
  --accent:  #7ad7f0;
  --good:    #6ee7a8;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  display: block;
  overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #101a33 0%, #080b18 55%, var(--bg) 100%);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/*
 * The canvas fills the window. It is never stretched, because the backing store
 * is cut to the viewport's own aspect ratio in fitToViewport() rather than a
 * fixed one being scaled to fit.
 */
#stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;          /* wins where supported; the line above is the fallback */
  overflow: hidden;
}

#screen {
  display: block;
  width: 100%;
  height: 100%;
  background: #05060d;
  touch-action: none;
}

/* ---------------------------------------------------------------- tools */

#tools {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 4;
  display: flex;
  gap: 8px;
}

.pad {
  font: inherit;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .08em;
  height: 38px;
  padding: 0 13px;
  color: var(--accent);
  background: rgba(10, 8, 24, .6);
  border: 2px solid var(--edge);
  border-radius: 7px;
  backdrop-filter: blur(3px);
  cursor: pointer;
  touch-action: manipulation;
}

.pad:hover { border-color: var(--accent); }

.pad:active {
  color: #05060d;
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(1px);
}

.pad:focus-visible { outline: 2px solid var(--good); outline-offset: 2px; }

/* ---------------------------------------------------------------- build stamp */

#build_stamp {
  position: absolute;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 3;
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--ink-dim);
  opacity: .6;
  pointer-events: none;
}

/* ---------------------------------------------------------------- update notice */

#update_banner {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px 11px 18px;
  background: rgba(10, 8, 24, .95);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
}

#update_banner[hidden] { display: none; }

#update_reload {
  font: inherit;
  font-weight: 700;
  padding: 7px 14px;
  color: #05060d;
  background: var(--accent);
  border: 0;
  border-radius: 5px;
  cursor: pointer;
}

.noscript {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: var(--bg); color: var(--ink); font-size: 18px;
}

@media (prefers-reduced-motion: reduce) {
  .pad:active { transform: none; }
}
