:root {
  --bg-top: #0f172a;
  --bg-bottom: #1d4ed8;
  --card: rgba(15, 23, 42, 0.72);
  --text: #eff6ff;
  --muted: #bfdbfe;
  --accent: #38bdf8;
  --accent-2: #22c55e;
  --danger: #fb7185;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text);
}

body {
  display: flex;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
}

.app-shell {
  width: 100%;
  max-width: 440px;
}

.game-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(14px);
}

.hud {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 4px 14px;
}

.label {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--muted);
}

.value {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
}

.canvas-wrap {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(180deg, #38bdf8 0%, #0ea5e9 35%, #082f49 100%);
}

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

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.45);
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  width: 100%;
  background: rgba(15, 23, 42, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 24px 18px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

.badge {
  display: inline-block;
  margin: 0 0 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  color: #bae6fd;
  font-size: 12px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: 32px;
}

.desc,
.hint {
  color: var(--muted);
  line-height: 1.6;
}

.primary-btn,
.ghost-btn {
  border: 0;
  border-radius: 16px;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
}

.primary-btn {
  width: 100%;
  padding: 14px 18px;
  margin-top: 8px;
  color: #082f49;
  background: linear-gradient(180deg, #67e8f9, #38bdf8);
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.ghost-btn {
  padding: 14px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ghost-btn:active,
.primary-btn:active {
  transform: scale(0.98);
}

@media (max-width: 380px) {
  .value {
    font-size: 24px;
  }

  h1 {
    font-size: 28px;
  }
}
