:root {
  --bg: #0e1118;
  --bg-grad-1: #131826;
  --bg-grad-2: #0a0c12;
  --fg: #f1f3f8;
  --fg-dim: #98a0b3;
  --card: #1a2030;
  --card-edge: #262d40;
  --accent: #8ab4ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, var(--bg-grad-1) 0%, var(--bg-grad-2) 80%);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  z-index: 2;
  pointer-events: none;
}

.hud-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: auto;
}

.hud-right { justify-content: flex-end; }

.target,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(20, 24, 35, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--card-edge);
  border-radius: 14px;
  padding: 6px 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
}

.target { padding: 6px 10px 6px 12px; gap: 10px; }

.target-label,
.chip-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-dim);
  font-weight: 600;
}

.chip-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.streak-chip {
  background: linear-gradient(135deg, rgba(255, 138, 76, 0.28), rgba(255, 76, 138, 0.22));
  border-color: rgba(255, 138, 76, 0.55);
  box-shadow: 0 0 18px rgba(255, 138, 76, 0.25), 0 6px 24px rgba(0, 0, 0, 0.35);
}

.streak-flame {
  font-size: 16px;
  filter: drop-shadow(0 0 6px rgba(255, 138, 76, 0.65));
}

.streak-chip .chip-value {
  font-size: 16px;
  color: #ffd9b5;
}

.best-chip { opacity: 0.85; }

.hidden { display: none !important; }

.target-swatch {
  display: inline-block;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: #888;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    inset 0 -5px 10px rgba(0, 0, 0, 0.25),
    0 2px 6px rgba(0, 0, 0, 0.4);
  transition: background-color 0.2s ease;
}

.target-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 8px;
  background: rgba(138, 180, 255, 0.16);
  border: 1px solid rgba(138, 180, 255, 0.42);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-left: 2px;
}

.reset-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--card-edge);
  background: rgba(20, 24, 35, 0.75);
  color: var(--fg);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.12s ease, background 0.12s ease;
}

.reset-btn:hover { background: rgba(40, 48, 70, 0.85); }
.reset-btn:active { transform: scale(0.94); }

.game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.game.grabbing { cursor: grabbing; }

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 16, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 3;
  animation: fade-in 0.25s ease;
}

.score-popup {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translate(-50%, 0);
  font-size: 28px;
  font-weight: 700;
  color: #ffd9b5;
  text-shadow: 0 0 18px rgba(255, 165, 90, 0.6), 0 2px 12px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 4;
  font-variant-numeric: tabular-nums;
}

.score-popup.show {
  animation: score-rise 1.05s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

@keyframes score-rise {
  0%   { opacity: 0; transform: translate(-50%, 12px) scale(0.85); }
  18%  { opacity: 1; transform: translate(-50%, 0) scale(1.05); }
  35%  { transform: translate(-50%, -4px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -52px) scale(0.95); }
}

.overlay-card {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 18px;
  padding: 28px 32px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  min-width: 240px;
}

.overlay-card h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 600;
}

.overlay-card p {
  margin: 0 0 18px;
  color: var(--fg-dim);
  font-size: 14px;
}

.primary-btn {
  background: var(--accent);
  color: #0b1120;
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:active { transform: scale(0.97); }

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
