/* ═══════════════════════════════════════════════════════════
   NERF ARENA — Stylesheet
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Outfit', sans-serif;
  background: #0a0e1a;
  color: #e0e6f0;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
}

canvas#gameCanvas {
  display: block;
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  image-rendering: pixelated;
}

/* ─── Overlays ────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 14, 0.92);
  backdrop-filter: blur(14px);
}

/* ─── Setup Panel ─────────────────────────────────────────── */
.setup-panel {
  background: linear-gradient(145deg, rgba(18, 26, 56, 0.97), rgba(10, 14, 28, 0.99));
  border: 1px solid rgba(255, 120, 30, 0.18);
  border-radius: 26px;
  padding: 38px 48px;
  max-width: 720px;
  width: 96vw;
  text-align: center;
  box-shadow:
    0 0 70px rgba(255, 100, 20, 0.06),
    0 24px 64px rgba(0, 0, 0, 0.55);
}

.back-link {
  display: inline-block;
  color: rgba(255, 255, 255, 0.38);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 14px;
  transition: color 0.2s;
}
.back-link:hover { color: #ff7820; }

.setup-panel h1 {
  font-size: 2.4rem;
  font-weight: 900;
  background: linear-gradient(135deg, #ff9240, #ff4520);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.subtitle {
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.95rem;
  margin-bottom: 30px;
}

/* ─── Option Groups ───────────────────────────────────────── */
.option-group { margin-bottom: 22px; }
.option-group h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: rgba(255, 255, 255, 0.3);
  margin-bottom: 10px;
}

.option-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Arena picker: 4 per row */
.arena-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  justify-items: center;
}

@media (max-width: 580px) {
  .arena-row { grid-template-columns: repeat(2, 1fr); }
}

.diff-opt {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: all 0.22s ease;
  position: relative;
}
.diff-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.diff-opt:hover {
  border-color: rgba(255, 120, 30, 0.28);
  background: rgba(255, 120, 30, 0.06);
}
.diff-opt.selected {
  border-color: rgba(255, 120, 30, 0.65);
  background: rgba(255, 100, 20, 0.1);
  box-shadow: 0 0 22px rgba(255, 100, 20, 0.08);
}

.opt-label { font-weight: 700; font-size: 0.85rem; color: #fff; }
.opt-desc  { font-size: 0.68rem; color: rgba(255,255,255,0.4); }

/* ─── Controls Display ────────────────────────────────────── */
.controls-display {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 20px 0 26px;
  padding: 16px 20px;
  border-radius: 14px;
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.05);
}

.ctrl-col h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 6px;
}

.ctrl-col p {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.58);
  margin-bottom: 3px;
}

.ctrl-divider {
  width: 1px;
  background: rgba(255,255,255,0.1);
  align-self: stretch;
}

.ctrl-col .player-color-1 { color: #ff6b35; font-weight: 700; }
.ctrl-col .player-color-2 { color: #38bdf8; font-weight: 700; }

/* ─── Start Button ────────────────────────────────────────── */
.start-btn {
  display: inline-block;
  padding: 15px 52px;
  border: none;
  border-radius: 15px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #ff5a14, #ff9240);
  cursor: pointer;
  transition: all 0.22s ease;
  box-shadow: 0 4px 22px rgba(255, 90, 20, 0.32);
  letter-spacing: 0.4px;
}
.start-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 7px 32px rgba(255, 90, 20, 0.48);
}
.start-btn:active { transform: translateY(0) scale(0.98); }

/* ─── Results Panel ───────────────────────────────────────── */
.results-panel {
  background: linear-gradient(145deg, rgba(18, 26, 56, 0.97), rgba(10, 14, 28, 0.99));
  border: 1px solid rgba(255, 120, 30, 0.18);
  border-radius: 26px;
  padding: 38px 48px;
  max-width: 500px;
  width: 92vw;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.55);
}

.results-icon {
  font-size: 3.8rem;
  margin-bottom: 10px;
  display: block;
  animation: popIn 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes popIn {
  from { transform: scale(0.2) rotate(-15deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}

.results-panel h2 {
  font-size: 1.9rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 22px;
  letter-spacing: -0.02em;
}

.result-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  margin-bottom: 10px;
}

.result-pos   { font-size: 1.05rem; min-width: 60px; text-align: left; font-weight: 700; }
.result-swatch { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.result-name  { flex: 1; text-align: left; font-weight: 600; }
.result-stats { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.result-stat  { font-size: 0.88rem; color: rgba(255,255,255,0.55); }
.result-acc   { font-size: 0.82rem; color: #38bdf8; font-weight: 700; }
.result-shots { font-size: 0.80rem; color: rgba(255,255,255,0.3); }

.results-panel .start-btn { margin-top: 22px; }

.hub-link {
  display: inline-block;
  margin-top: 13px;
  color: rgba(255,255,255,0.32);
  text-decoration: none;
  font-size: 0.84rem;
  transition: color 0.2s;
}
.hub-link:hover { color: #ff7820; }

/* ─── Countdown Banner ────────────────────────────────────── */
#levelBanner {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  font-size: 2.2rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 30px rgba(255, 130, 40, 0.55);
  pointer-events: none;
  opacity: 0;
}
#levelBanner.show {
  animation: bannerAnim 1.6s ease-out forwards;
}
@keyframes bannerAnim {
  0%   { transform: translate(-50%,-50%) scale(0.5); opacity: 0; }
  18%  { transform: translate(-50%,-50%) scale(1.08); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(1); opacity: 0; }
}

/* ── GAME FEEL: SCREEN SHAKE ────────────────────────────── */
.shake-light {
  animation: shakeLight 0.2s cubic-bezier(.36,.07,.19,.97) both;
}
.shake-heavy {
  animation: shakeHeavy 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shakeLight {
  0% { transform: translate(0, 0) rotate(0deg); }
  20% { transform: translate(-2px, 2px) rotate(-0.5deg); }
  40% { transform: translate(2px, -1px) rotate(0.5deg); }
  60% { transform: translate(-1px, 2px) rotate(0deg); }
  80% { transform: translate(1px, -2px) rotate(-0.5deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes shakeHeavy {
  0% { transform: translate(0, 0) rotate(0deg); }
  10% { transform: translate(-6px, 4px) rotate(-1.5deg); }
  30% { transform: translate(5px, -6px) rotate(1.5deg); }
  50% { transform: translate(-4px, 5px) rotate(-1deg); }
  70% { transform: translate(3px, -4px) rotate(1deg); }
  90% { transform: translate(-2px, 2px) rotate(-0.5deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
