:root {
  --sky: #5fb2ff;
  --panel: rgba(8, 22, 40, 0.84);
  --panel-border: #a7d7ff;
  --text: #f8f6ed;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 20% 10%, #8ad0ff, #4d8fd9 48%, #255a9b);
  color: var(--text);
  font-family: "Rubik", "Heebo", "Trebuchet MS", "Verdana", sans-serif;
}

body {
  display: grid;
  place-items: center;
}

#gameCanvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--sky);
  border: 2px solid rgba(223, 241, 255, 0.6);
  box-shadow: 0 12px 38px rgba(6, 16, 30, 0.55);
}

.hud {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  border: 2px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0.2px;
  font-weight: 700;
  backdrop-filter: blur(3px);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: linear-gradient(180deg, rgba(8, 18, 36, 0.76), rgba(10, 32, 58, 0.9));
}

.overlay h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 8vw, 66px);
  letter-spacing: 1px;
  color: #fff5c1;
  text-shadow: 0 3px 0 #5b2f00;
}

.overlay p {
  margin: 6px 0;
  max-width: 820px;
  color: #e8f4ff;
}

.overlay button {
  margin-top: 18px;
  border: 2px solid #603400;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffd65a, #f1a425);
  color: #2c1f00;
  font-size: 18px;
  font-weight: 800;
  padding: 10px 22px;
  cursor: pointer;
}

.overlay button:active {
  transform: translateY(1px);
}

.touch-controls {
  position: fixed;
  inset: auto 0 12px;
  z-index: 15;
  display: none;
  justify-content: space-between;
  padding: 0 14px;
  pointer-events: none;
}

.touch-controls .left-pad,
.touch-controls .right-pad {
  display: flex;
  gap: 12px;
}

.touch-controls button {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  border: 2px solid #bedfff;
  background: rgba(12, 34, 58, 0.74);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  pointer-events: auto;
  touch-action: none;
}

.hidden {
  display: none;
}

@media (max-width: 900px), (pointer: coarse) {
  .hud {
    top: 6px;
    gap: 8px;
    padding: 8px 9px;
    font-size: 11px;
  }

  .touch-controls {
    display: flex;
  }
}
