:root {
  --sky-1: #8ad7ff;
  --sky-2: #49a8ff;
  --grass-1: #67c554;
  --ground-1: #bd8a4a;
  --ground-2: #9f6a35;
  --ui-dark: #1e2430;
  --ui-light: #f5f8ff;
  --accent: #ffcf3f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: "Press Start 2P", monospace;
  color: var(--ui-light);
  background:
    radial-gradient(circle at 20% 20%, #ffffff55 0 16%, transparent 16%),
    radial-gradient(circle at 80% 30%, #ffffff40 0 12%, transparent 12%),
    linear-gradient(160deg, #0f7fd3 0%, #64d8ff 45%, #9be5ff 100%);
  padding: 24px;
}

.app {
  width: min(94vw, 560px);
}

.title-wrap {
  text-align: center;
  margin-bottom: 14px;
  text-shadow: 0 2px 0 #00000033;
}

.title-wrap h1 {
  margin: 0 0 10px;
  font-size: clamp(20px, 3.2vw, 30px);
  color: #fff6c8;
}

.title-wrap p {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
}

kbd {
  background: #ffffff22;
  border: 1px solid #ffffff55;
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 10px;
}

.game-card {
  position: relative;
  border: 4px solid #143f70;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 40px #0b2b4a66;
  background: #1f4469;
}

#gameCanvas {
  width: 100%;
  height: auto;
  display: block;
  touch-action: manipulation;
}

.controls {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  z-index: 2;
  width: calc(100% - 24px);
  padding: 10px;
  background: #0e2435cc;
  border: 2px solid #ffffff33;
  border-radius: 10px;
}

.controls label {
  font-size: 9px;
  color: #fff;
  text-shadow: 0 2px 0 #00000044;
}

.controls select {
  font-family: inherit;
  font-size: 9px;
  border: 2px solid #143f70;
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff9db;
  color: #1e2430;
}

.controls input[type="range"] {
  width: 84px;
  accent-color: #ffd43f;
}

.mini-btn {
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 9px;
}

.hud {
  position: absolute;
  inset: 14px 12px auto;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #fff;
  text-shadow: 0 2px 0 #00000044;
  font-size: 11px;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 14px;
  padding: 28px;
  background: linear-gradient(0deg, #0e243580, #0e243540);
}

.overlay.hidden {
  display: none;
}

.overlay h2 {
  margin: 0;
  color: #fff6c8;
  font-size: clamp(16px, 3.2vw, 20px);
}

.overlay p {
  margin: 0;
  font-size: 11px;
  line-height: 1.6;
}

.overlay-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.skins-panel {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.skin-option {
  padding: 8px 10px;
  font-size: 9px;
  border-bottom-width: 2px;
}

.skin-option.active {
  background: linear-gradient(180deg, #8dffb0, #4bd86f);
  border-bottom-color: #248f41;
}

button {
  justify-self: center;
  font: inherit;
  color: var(--ui-dark);
  background: linear-gradient(180deg, #ffe16e, var(--accent));
  border: 0;
  border-bottom: 4px solid #d69a00;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
}

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

.secondary-btn {
  background: linear-gradient(180deg, #f4f7ff, #dde8ff);
  border-bottom-color: #9fb3e6;
}

.hidden {
  display: none;
}

@media (max-width: 520px) {
  body {
    padding: 12px;
  }

  .hud,
  .title-wrap p,
  .overlay p,
  kbd {
    font-size: 10px;
  }

  .controls {
    width: calc(100% - 16px);
    bottom: 8px;
    gap: 6px;
  }
}
