:root {
  --bg-0: #ffffff;
  --bg-1: #f7f7f8;
  --text: #0a0a0a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #111827;
  --accent: #2563eb; /* minimal single accent */
  --good: #16a34a;
  --shadow: 0 8px 24px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-0), var(--bg-1));
}

/* Prevent page scroll; layout is a column filling the viewport */
body { display: grid; grid-template-rows: auto 1fr auto; min-height: 100svh; height: 100svh; overflow: hidden; }

.app-header, .app-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(14px, 3vw, 24px);
  background: var(--bg-0);
  border-bottom: 1px solid var(--border);
}
.app-footer { justify-content: center; color: var(--muted); border-top: 1px solid var(--border); border-bottom: none; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: clamp(18px, 3vw, 22px); margin: 0; letter-spacing: 0.2px; font-weight: 700; }
.logo-glow { width: 10px; height: 10px; border-radius: 999px; background: var(--accent); }

.header-actions { display: flex; gap: 6px; align-items: center; }

.game-shell { display: grid; grid-template-rows: auto 1fr; max-width: 1100px; margin: 0 auto; padding: 10px clamp(14px, 3vw, 24px); width: 100%; height: 100%; min-height: 0; }
.hud {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.hud-item { display: grid; grid-auto-flow: row; }
.hud-item .label { font-size: 12px; color: var(--muted); }
.hud-item .value { font-weight: 700; letter-spacing: 0.3px; }
.hud-spacer { flex: 1; }

/* Canvas wraps to fill remaining vertical space; no scroll */
.canvas-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
  /* Maintain 9:16 but fit within available height */
  display: grid;
  height: 100%;
  min-height: 0;
}
#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  min-height: 0;
}
.touch-hint {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: var(--muted); background: rgba(255,255,255,0.8);
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border);
}

.modal { border: none; padding: 0; background: transparent; }
.modal::backdrop { background: rgba(0,0,0,0.25); }
.modal-card {
  min-width: min(92vw, 520px);
  max-width: 92vw;
  margin: 0 auto;
  padding: 18px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.modal-card h2 { margin: 0 0 8px; }
.modal-card .muted { color: var(--muted); }

.row { display: flex; gap: 10px; margin-top: 12px; }
.row.small { gap: 8px; }
.row .grow { flex: 1; }

.bullets { margin: 6px 0 0; padding-left: 18px; }
.bullets li { margin: 4px 0; color: var(--text); }

.btn {
  appearance: none; border: 1px solid var(--border); color: var(--text);
  background: #fff;
  padding: 9px 12px; border-radius: 10px; cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.2s ease, background 0.2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,0.06); }
.btn:active { transform: translateY(0); }
.btn.primary { border-color: #d1d5db; color: #fff; background: var(--primary); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.pill { border-radius: 999px; }
.btn.text { background: transparent; border: none; padding: 8px 10px; color: var(--text); }
.btn.icon { background: transparent; border: 1px solid var(--border); width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; }

.input { display: grid; gap: 6px; margin-top: 12px; }
.input input {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: #fff; color: var(--text);
}

.leaderboard { margin: 10px 0 0; padding-left: 18px; }
.leaderboard li { margin: 4px 0; display: flex; justify-content: space-between; gap: 12px; }
.leaderboard li .name { color: var(--text); }
.leaderboard li .score { color: var(--good); font-weight: 700; }

/* Make the canvas area fill available height under the header and HUD */
@media (min-width: 1px) {
  .canvas-wrap { height: 100%; }
}

@media (min-width: 900px) {
  .game-shell { grid-template-columns: 1fr; }
} 