:root {
  --bg: #07080c;
  --text: #ece7dc;
  --muted: #6f6a62;
  --line: rgba(226, 196, 138, 0.2);
  --accent: #e2c48a;
  --font: "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.4rem 0.4rem 0;
}

.game-hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  flex: 0 0 auto;
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.35rem 0.4rem;
}

.game-hud strong {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
  letter-spacing: 0;
  font-weight: 600;
  text-transform: none;
}

#game {
  flex: 1;
  display: block;
  width: 100%;
  min-height: 0;
  height: auto;
  object-fit: contain;
  background: #07080c;
  touch-action: none;
}

.touch-controls {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 0.5rem;
  flex: 0 0 auto;
  padding: 0.5rem 0.15rem 0.35rem;
}

.touch-controls[hidden] { display: none; }

.touch-controls button {
  appearance: none;
  border: 1px solid var(--line);
  background: #14151c;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  min-height: 3rem;
  border-radius: 0.7rem;
  cursor: pointer;
}

.touch-controls button:active,
.touch-controls button.is-down {
  background: #22232d;
  border-color: var(--accent);
}

.site-footer {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.35rem 0.75rem calc(0.4rem + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  line-height: 1.35;
}

body.error { overflow: auto; }
.error-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  color: var(--muted);
  text-align: center;
}
.error-main a { color: var(--accent); }

@media (max-width: 640px) {
  .game-hud { grid-template-columns: repeat(2, 1fr); }
}
