/* === Pixel-art Theme === */

:root {
  --bg: #0f0f13;
  --panel: #1c1c22;
  --text: #e7e7e7;
  --accent: #f7d51d;   /* yellow */
  --accent-2: #7ebc59; /* green */
  --accent-3: #e74c3c; /* red */
  --shadow: #000000;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: monospace; /* Optional: swap for a pixel font in HTML */
  letter-spacing: 0.5px;
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none; /* Safari */
  -khtml-user-select: none; /* Konqueror HTML */
  -moz-user-select: none; /* Old versions of Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
  user-select: none;
}

.main,
.game-root,
.wrapper {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* Crisp pixel rendering for game visuals */
canvas,
img.pixel,
.sprite {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
}

/* Pixel frame around the game canvas */
canvas {
  background: var(--panel);
  border: 8px solid var(--accent);
  box-shadow:
    0 0 0 4px var(--shadow),
    inset -4px -4px 0 0 rgba(0,0,0,0.35);
}

/* Panels/HUD */
.panel,
.hud,
.info {
  background: var(--panel);
  border: 6px solid var(--accent-2);
  padding: 10px 14px;
  color: var(--text);
  box-shadow: 0 6px 0 0 var(--shadow);
}

/* Headings with pixel-style shadow */
h1, h2, h3 {
  margin: 0.25em 0 0.5em;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 var(--shadow);
}

/* Buttons */
button,
.btn {
  display: inline-block;
  background: var(--accent);
  color: #1b1b1b;
  border: 4px solid var(--shadow);
  padding: 8px 14px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 0 0 var(--shadow);
  transition: transform 40ms linear, box-shadow 40ms linear, filter 80ms ease;
}

button:hover,
.btn:hover {
  filter: brightness(1.05);
  transform: translateY(-2px);
}

button:active,
.btn:active {
  transform: translateY(0);
  box-shadow: 0 0 0 0 var(--shadow);
}

/* Accent variants */
.btn--green { background: var(--accent-2); color: #0d0d0d; }
.btn--red   { background: var(--accent-3); color: #0d0d0d; }

/* Layout for a centered game area */
.game-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: center;
  justify-items: center;
}

/* Optional CRT scanlines effect: apply .crt to the canvas wrapper */
.crt {
  position: relative;
}
.crt::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.045) 0 2px,
      transparent 2px 4px
    );
  mix-blend-mode: overlay;
}

/* Utility for pixel-block elements */
.pixel-block {
  background: var(--panel);
  border: 6px solid var(--accent);
  box-shadow: 0 6px 0 0 var(--shadow), inset -4px -4px 0 rgba(0,0,0,0.35);
  padding: 8px 12px;
}

/* Keep links readable */
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* --- Game-specific overrides (canvas + HUD + overlay) --- */

/* Fullscreen canvas (placed behind the UI). Use `#game` id from index.html */
#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  border: 0 !important;
  box-shadow: none !important;
  background: linear-gradient(180deg, #8fd3ff 0%, #1e88c7 60%, #083a57 100%);
  image-rendering: auto; /* let game draw crisply as intended */
}

/* HUD at top-left */
#hud {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 30;
  display: flex;
  gap: 10px;
  align-items: center;
}

#hud > div {
  background: rgba(0,0,0,0.35);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 700;
}

/* Center the overlay vertically/horizontally */
#overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 40;
  background: linear-gradient(180deg, rgba(0,0,0,0.08), rgba(0,0,0,0.28));
  height: 100vh;
  min-height: 100vh;
  padding: 24px;
  box-sizing: border-box;
}

/* Hide overlay when it's not marked visible */
#overlay:not(.visible){
  display: none;
}

#overlay h1 { margin: 0 0 8px 0; text-align:center; }
#overlay p { margin: 0 0 16px 0; text-align:center; max-width:540px; }
#startBtn { appearance:none; border:0; padding:10px 18px; border-radius:10px; cursor:pointer; }

@media (max-width: 600px) {
  #overlay h1 { font-size: 24px; }
  #overlay p { font-size: 14px; }
}