/* ============================================================
   Alphabet Gunfire — page-specific styles
   Uses the same tokens as style.css (colors, radius, shadow, type).
   ============================================================ */

.ag-wrap { position: relative; }

.ag-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
}

/* ---- Letter select ---- */
.ag-letterselect h2 { font-size: 21px; margin-bottom: 6px; }
.ag-sub { color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: 18px; }

.ag-letters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 10px;
}

.ag-letter-btn {
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.ag-letter-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.ag-letter-btn:active { transform: translateY(0) scale(0.96); }

/* cycle the six existing pastel tones across the alphabet */
.ag-letter-btn.tone-mint     { background: var(--mint);     color: #0e5636; }
.ag-letter-btn.tone-peach    { background: var(--peach);    color: #7a3311; }
.ag-letter-btn.tone-lavender { background: var(--lavender); color: #4a2496; }
.ag-letter-btn.tone-sky      { background: var(--sky);      color: #123a5c; }
.ag-letter-btn.tone-rose     { background: var(--rose);     color: #6b1436; }
.ag-letter-btn.tone-butter   { background: var(--butter);   color: #6b4e05; }

/* ---- Live stage ---- */
.ag-stage-wrap { padding: 18px; }

.ag-hud {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.ag-hud-item { display: flex; flex-direction: column; line-height: 1.2; }
.ag-hud-label { font-size: 10.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ag-hud-value { font-family: var(--font-display); font-weight: 800; font-size: 19px; color: var(--ink); }

.ag-lives { display: flex; gap: 4px; margin-left: 4px; }
.ag-life {
  width: 20px; height: 20px;
  color: var(--pink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.ag-life.lost { opacity: 0.18; transform: scale(0.7); color: var(--muted); }

.ag-icon-btn {
  margin-left: auto;
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.ag-icon-btn:hover { border-color: var(--purple); }

.ag-quit {
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  padding: 9px 14px;
  border-radius: 999px;
}
.ag-quit:hover { border-color: var(--purple); color: var(--purple); }

.ag-stage {
  position: relative;
  width: 100%;
  height: 480px;
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 20% 20%, rgba(124,58,237,0.06), transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(236,73,153,0.06), transparent 45%),
    var(--bg);
  border: 1px dashed var(--border);
  overflow: hidden;
  cursor: crosshair;
  touch-action: manipulation;
}

.ag-target {
  position: absolute;
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-family: var(--font-display);
  font-weight: 700;
  white-space: nowrap;
  box-shadow: var(--shadow-card);
  transform: translate(-50%, -50%);
  will-change: left, top;
  transition: opacity 0.12s ease;
}
.ag-target:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.ag-target.correct-tone { background: var(--mint); color: #0e5636; }
.ag-target.decoy-tone-a { background: var(--peach); color: #7a3311; }
.ag-target.decoy-tone-b { background: var(--sky); color: #123a5c; }
.ag-target.decoy-tone-c { background: var(--rose); color: #6b1436; }
.ag-target.decoy-tone-d { background: var(--butter); color: #6b4e05; }
.ag-target.decoy-tone-e { background: var(--lavender); color: #4a2496; }

.ag-target.hit-good {
  animation: agPop 0.28s ease forwards;
}
.ag-target.hit-bad {
  animation: agShakePop 0.32s ease forwards;
}
@keyframes agPop {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
}
@keyframes agShakePop {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  30% { transform: translate(-58%, -50%) scale(1.05); }
  60% { transform: translate(-42%, -50%) scale(1.05); }
  100% { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
}

.ag-combo {
  position: absolute;
  top: 14px; left: 50%;
  transform: translateX(-50%);
  background: var(--brand-gradient);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13.5px;
  padding: 6px 14px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.ag-combo.show { opacity: 1; transform: translateX(-50%) translateY(4px); }

.ag-stage.shake { animation: agStageShake 0.28s ease; }
@keyframes agStageShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@media (prefers-reduced-motion: reduce) {
  .ag-target, .ag-stage.shake, .ag-life { animation: none !important; transition: none !important; }
}

/* ---- Game over overlay ---- */
.ag-gameover {
  position: fixed;
  inset: 0;
  background: rgba(20,21,43,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}
.ag-gameover[hidden] { display: none; }
.ag-gameover-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(20,21,43,0.25);
}
.ag-gameover-card h2 { font-size: 24px; margin-bottom: 10px; }
.ag-gameover-card p { color: var(--ink-soft); font-weight: 600; font-size: 14.5px; margin-bottom: 6px; }
.ag-newbest { color: var(--pink); font-weight: 800 !important; }
.ag-gameover-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.ag-gameover-actions .btn { flex: 1; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .ag-stage { height: 400px; }
  .ag-hud { gap: 14px; }
  .ag-hud-value { font-size: 16px; }
  .ag-letters { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
}
