@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap');

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #05030a;
  color: #ffffff;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

canvas {
  display: block;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top))
           calc(12px + env(safe-area-inset-right))
           8px
           calc(12px + env(safe-area-inset-left));
  pointer-events: none;
}

#hud > * {
  pointer-events: auto;
}

.hud-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hud-pill {
  background: rgba(10, 8, 22, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.45);
}

.hud-pill .label {
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
  text-transform: uppercase;
}

.hud-pill .value {
  color: #ffffff;
}

.hud-pill .multiplier {
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
}

.hud-pill .lives {
  color: #ff2a6d;
  letter-spacing: 3px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(10, 8, 22, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #ffffff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.45);
  transition: transform 0.08s ease;
}

.icon-btn:active {
  transform: scale(0.92);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top)
           env(safe-area-inset-right)
           env(safe-area-inset-bottom)
           env(safe-area-inset-left);
  background: radial-gradient(ellipse at center, rgba(15, 12, 35, 0.92) 0%, rgba(5, 3, 10, 0.98) 75%);
  opacity: 1;
  transition: opacity 0.25s ease;
}

.overlay.hidden {
  display: none !important;
}

.card {
  width: min(520px, calc(100% - 32px));
  max-height: calc(100% - 48px);
  overflow-y: auto;
  background: rgba(15, 12, 32, 0.86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 26px;
  padding: 30px 26px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
  text-align: center;
}

.title {
  font-size: clamp(38px, 10vw, 66px);
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 0 0 8px;
  line-height: 1;
  background: linear-gradient(135deg, #ffffff 0%, #a5a5ff 45%, #ff6ac1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 24px rgba(255, 255, 255, 0.25));
}

.subtitle {
  margin: 0 0 30px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 16px;
}

.card-title {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 22px;
}

.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.btn {
  appearance: none;
  border: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06));
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 16px 28px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  min-height: 58px;
  min-width: 200px;
  width: 100%;
  max-width: 280px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: transform 0.08s ease, filter 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, #00f0ff, #7d2eff);
  border: none;
}

.btn-danger {
  background: linear-gradient(135deg, #ff2a6d, #ff00aa);
  border: none;
}

.tips {
  text-align: left;
  margin-bottom: 24px;
}

.tip {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  font-size: 15px;
  line-height: 1.45;
}

.tip:last-child {
  border-bottom: none;
}

.swatch {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  margin-top: 2px;
  box-shadow: 0 0 12px currentColor;
}

.swatch.cyan { background: #00f0ff; color: #00f0ff; }
.swatch.magenta { background: #ff00aa; color: #ff00aa; }
.swatch.yellow { background: #ffee00; color: #ffee00; }
.swatch.white { background: #ffffff; color: #ffffff; }

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  font-size: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.score-row span:last-child {
  font-weight: 800;
  font-size: 22px;
}

.score-row.best {
  color: #00f0ff;
  border-bottom: none;
  margin-bottom: 24px;
}

@media (min-width: 640px) {
  .btn-stack {
    flex-direction: row;
    justify-content: center;
  }
  .btn {
    width: auto;
  }
}