:root {
  --bg-1: #100b2e;
  --bg-2: #241066;
  --panel: rgba(20, 16, 55, 0.78);
  --panel-strong: rgba(18, 14, 48, 0.94);
  --text: #ffffff;
  --muted: #cfc8ff;
  --accent: #7fffd4;
  --accent-2: #ffd166;
  --danger: #ff6b8a;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.38);
  --radius: 24px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background: radial-gradient(circle at top left, #5530ff 0%, var(--bg-2) 36%, var(--bg-1) 100%);
  touch-action: none;
  overscroll-behavior: none;
}

button {
  font: inherit;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 420px;
  overflow: hidden;
  isolation: isolate;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
}

.hud {
  position: absolute;
  inset: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) auto max(14px, env(safe-area-inset-left));
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.brand-pill,
.hud-stat,
.icon-button {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px);
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px rgba(127, 255, 212, 0.8);
}

.hud-stat {
  min-width: 88px;
  padding: 7px 12px;
  border-radius: 16px;
}

.hud-stat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hud-stat strong {
  display: block;
  margin-top: 1px;
  font-size: clamp(18px, 3vw, 24px);
  line-height: 1;
}

.icon-button {
  pointer-events: auto;
  margin-left: auto;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  color: var(--text);
  cursor: pointer;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(72, 56, 190, 0.42), rgba(9, 6, 28, 0.82));
  backdrop-filter: blur(8px);
}

.overlay-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.card {
  position: relative;
  width: min(560px, 92vw);
  padding: clamp(24px, 5vw, 38px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(49, 38, 130, 0.94), var(--panel-strong));
  box-shadow: var(--shadow);
  text-align: center;
}

.small-card {
  width: min(430px, 92vw);
}

.mascot-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  background: rgba(127, 255, 212, 0.16);
  color: var(--accent);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 12px;
  font-size: clamp(44px, 10vw, 76px);
  line-height: 0.92;
  letter-spacing: -0.06em;
}

h2 {
  margin-top: 12px;
  font-size: clamp(30px, 7vw, 44px);
  line-height: 1;
}

p {
  margin-top: 14px;
  color: var(--muted);
  font-size: clamp(15px, 3.8vw, 18px);
  line-height: 1.55;
}

.controls-hint {
  display: grid;
  gap: 8px;
  margin: 22px auto 24px;
  color: #f5f1ff;
  font-size: 13px;
  font-weight: 800;
}

.controls-hint span {
  padding: 9px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.primary-button,
.secondary-button,
.mobile-controls button {
  border: 0;
  cursor: pointer;
  font-weight: 950;
  letter-spacing: -0.01em;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 52px;
  margin-top: 12px;
  border-radius: 18px;
}

.primary-button {
  color: #140e34;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 34px rgba(127, 255, 212, 0.25);
}

.secondary-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.mobile-controls {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  left: max(14px, env(safe-area-inset-left));
  z-index: 5;
  display: none;
  gap: 12px;
  pointer-events: none;
}

.mobile-controls button {
  pointer-events: auto;
  flex: 1;
  min-height: 56px;
  border-radius: 20px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
}

@media (max-width: 760px), (pointer: coarse) {
  .game-shell {
    min-height: 360px;
  }

  .hud {
    gap: 8px;
  }

  .brand-pill {
    min-height: 38px;
    padding: 0 11px;
    font-size: 13px;
  }

  .hud-stat {
    min-width: 72px;
    padding: 6px 9px;
  }

  .desktop-only {
    display: none;
  }

  .mobile-controls {
    display: flex;
  }

  .card {
    padding: 24px;
  }
}

@media (max-height: 520px) {
  .card {
    transform: scale(0.92);
  }

  .controls-hint {
    margin: 14px auto 16px;
    gap: 6px;
  }

  p {
    margin-top: 10px;
  }
}
