:root {
  --bg-top: #17324d;
  --bg-bottom: #6abf69;
  --panel: rgba(9, 24, 39, 0.78);
  --panel-border: rgba(255, 255, 255, 0.16);
  --ink: #f4f7fb;
  --accent: #ffd166;
  --accent-2: #6ef3a5;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Verdana, Geneva, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 209, 102, 0.18) 0 16%, transparent 16% 100%),
    linear-gradient(315deg, rgba(255, 107, 107, 0.18) 0 18%, transparent 18% 100%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

.shell {
  width: min(1240px, calc(100vw - 20px));
  margin: 0 auto;
  padding: 12px 0 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 48px;
  margin-bottom: 10px;
}

h1,
.hud,
.touch-controls button {
  font-family: "Courier New", Courier, monospace;
  font-weight: 800;
}

h1 {
  font-size: 2rem;
  margin: 0;
  line-height: 1.1;
}

.badge {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 8px 12px;
  color: #102038;
  background: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
}

.game-wrap {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
}

.game-wrap {
  border-radius: 12px;
  overflow: hidden;
}

.hud {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.32);
  font-size: 0.78rem;
  line-height: 1.5;
}

.hud-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: linear-gradient(180deg, #7bdff6 0%, #d9ed92 100%);
}

.touch-controls {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.34);
}

.touch-controls button {
  border: 0;
  border-radius: 8px;
  padding: 16px;
  font-size: 1rem;
  color: #102038;
  background: linear-gradient(180deg, #fff5cc, #ffd166);
}

@media (max-width: 840px) {
  .hud {
    flex-direction: column;
  }

  .touch-controls {
    display: grid;
  }
}

@media (max-width: 520px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 1.55rem;
  }
}
