* { box-sizing: border-box; }

:root {
  --bg: #07130e;
  --panel: rgba(12, 34, 24, 0.94);
  --panel-border: rgba(255,255,255,.10);
  --text: #f4fff8;
  --muted: #b8c8bf;
  --accent: #f3c852;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at top, rgba(28,94,58,.24), transparent 34rem), var(--bg);
  color: var(--text);
  font-family: "Courier New", Courier, monospace;
}

body { min-height: 100vh; padding: 20px; }
button { font: inherit; }
.app-shell { width: min(1180px, 100%); margin: 0 auto; }

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.eyebrow, .kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .14em;
}

h1,h2,p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2rem, 5vw, 3.5rem); line-height: .95; text-transform: uppercase; }

.score-panel { display: flex; gap: 10px; flex-wrap: wrap; }
.score-panel span {
  background: var(--panel);
  border: 2px solid rgba(255,255,255,.12);
  padding: 10px 14px;
  color: var(--muted);
  font-size: .9rem;
}
.score-panel strong { margin-left: 5px; color: var(--text); }

.game-layout {
  display: grid;
  grid-template-columns: minmax(0,1fr) 320px;
  gap: 18px;
  align-items: start;
}

.game-card, .side-card {
  background: var(--panel);
  border: 2px solid var(--panel-border);
  box-shadow: 8px 8px 0 rgba(0,0,0,.22);
}

.game-card { padding: 12px; }
.side-card { padding: 22px; position: sticky; top: 20px; }
.side-card p { color: var(--muted); line-height: 1.5; }

.canvas-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #0d6436;
  aspect-ratio: 2 / 3;
  max-height: min(76vh, 900px);
  image-rendering: pixelated;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  image-rendering: pixelated;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2,12,8,.62);
}

.hidden { display: none !important; }

.overlay-card {
  width: min(440px,100%);
  padding: 26px;
  background: rgba(6,24,16,.97);
  border: 3px solid rgba(255,255,255,.18);
  box-shadow: 10px 10px 0 rgba(0,0,0,.35);
}

.overlay-card h2 { margin-bottom: 12px; font-size: clamp(1.7rem,5vw,2.5rem); text-transform: uppercase; }
.overlay-card p { color: var(--muted); line-height: 1.55; }

.primary-btn, .secondary-btn, .mobile-controls button {
  border: 2px solid rgba(255,255,255,.15);
  cursor: pointer;
  font-weight: 900;
  border-radius: 0;
}

.primary-btn, .secondary-btn {
  min-height: 48px;
  padding: 0 18px;
  margin-right: 8px;
  margin-top: 8px;
}

.primary-btn { background: var(--accent); color: #181405; }
.secondary-btn { background: #173f2c; color: var(--text); }

.primary-btn:focus-visible,
.secondary-btn:focus-visible,
.mobile-controls button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.mobile-controls {
  display: none;
  margin-top: 12px;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mobile-controls button {
  min-height: 58px;
  background: #173f2c;
  color: var(--text);
  font-size: 1rem;
}

@media (max-width: 900px) {
  body { padding: 12px; }
  .game-layout { grid-template-columns: 1fr; }
  .side-card { position: static; }
  .canvas-wrap { max-height: none; }
  .mobile-controls { display: grid; }
}

@media (max-width: 620px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .score-panel { width: 100%; }
  .score-panel span { flex: 1; text-align: center; }
  .game-card { padding: 8px; }
  .overlay-card { padding: 20px; }
}
