:root {
  color-scheme: dark;
  --bg-1: #08101d;
  --bg-2: #111c31;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #eff8ff;
  --accent: #6fe3ff;
  --accent-2: #ffd05c;
  --danger: #ff6f91;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: Inter, system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #1c3560, var(--bg-1) 45%, #040813 100%);
}

.app {
  width: min(100vw, 560px);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: 10px 8px 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hud {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.brand {
  font-size: clamp(1.25rem, 2.8vw, 1.8rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.score-card {
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  text-align: center;
}

.score-card.highlight {
  border-color: rgba(255, 208, 92, 0.45);
  box-shadow: 0 0 0 1px rgba(255, 208, 92, 0.15) inset;
}

.label {
  display: block;
  font-size: 0.72rem;
  opacity: 0.82;
  margin-bottom: 2px;
  text-transform: uppercase;
}

.score-card span:last-child {
  font-size: 1.18rem;
  font-weight: 800;
}

.controls {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.action-btn {
  flex: 1;
  height: 44px;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  color: white;
  background: linear-gradient(135deg, #46d2ff, #6c88ff);
}

.action-btn.ghost {
  background: rgba(255, 255, 255, 0.1);
}

.status {
  margin: 0 2px 8px;
  text-align: center;
  min-height: 1rem;
  color: rgba(232, 244, 255, 0.88);
  font-size: 0.84rem;
}

.game-shell {
  margin: 0 auto;
  width: min(100%, calc((100dvh - 208px) * 42 / 76));
  max-width: 540px;
  height: min(calc(100dvh - 208px), calc((100vw - 16px) * 76 / 42));
  min-height: 320px;
  aspect-ratio: 42 / 76;
  border-radius: 24px;
  padding: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  flex: 1 1 auto;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 18px;
  background: linear-gradient(180deg, #0d1830, #111c31 30%, #182744 100%);
  touch-action: none;
}

.help {
  text-align: center;
  opacity: 0.82;
  margin-top: 8px;
  padding: 0 6px;
  font-size: 0.82rem;
}

@media (max-height: 760px) {
  .score-card {
    padding: 8px 9px;
  }

  .score-card span:last-child {
    font-size: 1rem;
  }

  .action-btn {
    height: 40px;
  }

  .game-shell {
    width: min(100%, calc((100dvh - 188px) * 42 / 76));
    height: min(calc(100dvh - 188px), calc((100vw - 16px) * 76 / 42));
  }
}
