/* AGame5.com - Drift Boss, Moto Stunts & Physics Driving Games */
:root {
  --bg: #0c0d12;
  --panel: #161821;
  --panel-alt: #212432;
  --ink: #f8fafc;
  --muted: #9ca3af;
  --accent: #f59e0b;
  --gold: #ef4444;
  --crimson: #ef4444;
  --emerald: #10b981;
  --border: rgba(255, 255, 255, 0.1);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, #1f161a 0%, #11131b 38%, var(--bg) 75%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1060px; margin: 0 auto; padding: 0 14px; }

.site-header {
  background: rgba(12, 13, 18, 0.94);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
}
.header-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: #fff; letter-spacing: 0.01em; }
.brand-badge {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  padding: 2px 8px;
  border-radius: 7px;
  font-size: 0.88rem;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.35);
}
.nav-links { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nav-link { color: var(--muted); padding: 6px 11px; border-radius: 7px; font-size: 0.9rem; font-weight: 600; }
.nav-link:hover, .nav-link.active { background: rgba(255, 255, 255, 0.08); color: #fff; text-decoration: none; }
.nav-link.active { border: 1px solid rgba(245, 158, 11, 0.55); color: var(--accent); }

.ad-slot { margin: 12px auto; display: flex; align-items: center; justify-content: center; width: 100%; overflow: hidden; }
.ad-leaderboard { min-height: 90px; max-width: 970px; }
.ad-rectangle { min-height: 250px; max-width: 728px; }
.ad-placeholder {
  width: 100%;
  min-height: inherit;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.game-shell {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-top: 8px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.5);
}
.game-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 12px;
}
.game-title-wrap h1 { margin: 0; font-size: 1.38rem; }
.game-subtitle { margin: 2px 0 0; font-size: 0.84rem; color: var(--muted); }
.hud-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-pill {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.84rem;
  color: var(--muted);
}
.stat-pill strong { color: #fff; margin-left: 4px; font-variant-numeric: tabular-nums; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--panel-alt);
  color: #fff;
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}
.btn:hover:not(:disabled) { background: #2d3145; border-color: rgba(245, 158, 11, 0.45); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-accent { background: linear-gradient(135deg, #f59e0b, #d97706); border-color: #fbbf24; color: #0c0d12; font-weight: 800; }
.btn-accent:hover:not(:disabled) { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.btn-crimson { background: linear-gradient(135deg, #ef4444, #dc2626); border-color: #f87171; color: #fff; font-weight: 800; }
.btn-crimson:hover:not(:disabled) { background: linear-gradient(135deg, #f87171, #ef4444); }
.select-ctrl {
  background: var(--panel-alt);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.86rem;
  font-weight: 600;
}
.toast {
  min-height: 24px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
  text-align: center;
}
.toast.alert { color: var(--gold); }

/* Quick-Start Bar */
.quickstart-bar {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
  margin-bottom: 12px; background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px;
}
.qs-item { font-size: 0.8rem; color: var(--muted); display: flex; gap: 6px; align-items: flex-start; }
.qs-num {
  background: var(--accent); color: #0c0d12; font-weight: 800; border-radius: 50%;
  width: 18px; height: 18px; min-width: 18px; display: inline-flex; align-items: center; justify-content: center; font-size: 0.72rem; margin-top: 2px;
}
.qs-item strong { color: #fff; }

/* Driving Viewport & Motorsport Canvas */
.drive-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.drive-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid rgba(245, 158, 11, 0.35);
  background: #090a0f;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.drive-canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

/* Mobile Steer / Gas / Brake Touch Pedal Pads */
.drive-controls {
  width: 100%;
  max-width: 820px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 6px 4px 2px;
  user-select: none;
  -webkit-user-select: none;
}
.drive-pad-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.pedal-btn {
  appearance: none;
  min-width: 78px;
  min-height: 52px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(180deg, #272b3b 0%, #181b26 100%);
  color: #f8fafc;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45);
  transition: transform 0.06s ease, border-color 0.1s ease, background 0.1s ease;
}
.pedal-btn:active, .pedal-btn.active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}
.pedal-gas {
  border-color: rgba(16, 185, 129, 0.65);
  background: linear-gradient(180deg, #065f46 0%, #064e3b 100%);
}
.pedal-gas:active, .pedal-gas.active { background: #10b981; color: #052e16; }
.pedal-brake {
  border-color: rgba(239, 68, 68, 0.7);
  background: linear-gradient(180deg, #7f1d1d 0%, #450a0a 100%);
}
.pedal-brake:active, .pedal-brake.active { background: #ef4444; color: #fff; }
.pedal-steer {
  border-color: rgba(245, 158, 11, 0.55);
  min-width: 72px;
}
.pedal-steer:active, .pedal-steer.active { background: #f59e0b; color: #0c0d12; }
.pedal-action {
  border-color: rgba(245, 158, 11, 0.85);
  background: linear-gradient(180deg, #d97706 0%, #b45309 100%);
  color: #fff;
  min-width: 112px;
}
.pedal-action:active, .pedal-action.active { background: #fbbf24; color: #0c0d12; }

/* RPM / Gear / Fuel / Boost Gauge Bars */
.rpm-panel {
  width: 100%;
  max-width: 820px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
}
.gear-badge {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-weight: 900;
  font-size: 1rem;
  min-width: 58px;
  text-align: center;
  padding: 5px 10px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}
.rpm-bar-track, .gauge-track {
  position: relative;
  height: 18px;
  background: #0c0d12;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  overflow: hidden;
}
.rpm-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(16, 185, 129, 0.34);
  border-left: 2px solid #34d399;
  border-right: 2px solid #34d399;
  z-index: 1;
}
.rpm-redline {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 12%;
  background: rgba(239, 68, 68, 0.35);
  z-index: 1;
}
.rpm-bar-fill, .gauge-fill {
  position: relative;
  z-index: 2;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f59e0b 0%, #10b981 74%, #ef4444 94%);
  transition: width 0.04s linear;
}
.gauge-readout {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  min-width: 76px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.shop-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 820px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}
.swatch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
.swatch-btn.selected { border-color: var(--accent); background: rgba(245, 158, 11, 0.16); }
.swatch-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

/* Sections, Catalog & FAQ */
.section-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin: 18px 0;
}
.section-card h2 { margin-top: 0; font-size: 1.28rem; color: var(--accent); }
.variant-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.variant-card {
  display: block;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  color: #fff;
}
.variant-card:hover { border-color: var(--accent); text-decoration: none; }
.variant-card p { margin: 6px 0 0; font-size: 0.86rem; color: var(--muted); }
.faq-item { border-bottom: 1px solid var(--border); padding: 10px 0; }
.faq-item:last-child { border-bottom: none; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 14px 36px;
  margin-top: 24px;
  text-align: center;
  font-size: 0.84rem;
  color: var(--muted);
}
.footer-links { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }

/* Tutorial Modal */
.tut-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 14px;
}
.tut-backdrop.open { display: flex; }
.tut-modal {
  background: var(--panel); color: var(--ink); border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 16px; max-width: 560px; width: 100%; padding: 20px; box-shadow: 0 24px 60px rgba(0,0,0,0.65);
  max-height: 90vh; overflow-y: auto;
}
.tut-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.tut-head h2 { margin: 4px 0 2px; font-size: 1.3rem; color: var(--accent); }
.tut-sub { margin: 0; font-size: 0.84rem; color: var(--muted); }
.tut-badge { background: rgba(245, 158, 11, 0.18); color: var(--accent); padding: 2px 8px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; }
.tut-close { background: transparent; border: none; color: var(--muted); font-size: 1.6rem; cursor: pointer; line-height: 1; }
.tut-goal { background: var(--panel-alt); border-left: 3px solid var(--accent); padding: 8px 12px; border-radius: 6px; font-size: 0.88rem; margin-bottom: 12px; }
.tut-steps { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.tut-step { display: flex; gap: 10px; align-items: flex-start; background: rgba(255,255,255,0.04); padding: 9px 11px; border-radius: 9px; }
.tut-num { background: var(--accent); color: #0c0d12; font-weight: 800; width: 22px; height: 22px; min-width: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; }
.tut-step p { margin: 2px 0 0; font-size: 0.82rem; color: var(--muted); }
.tut-box { font-size: 0.84rem; margin-bottom: 10px; }
.tut-box ul { margin: 4px 0 0 18px; padding: 0; color: var(--muted); }
.tut-tip { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.35); padding: 8px 11px; border-radius: 8px; font-size: 0.84rem; margin-bottom: 14px; }
.tut-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 12px; }
.tut-check { font-size: 0.82rem; color: var(--muted); display: flex; gap: 6px; align-items: center; cursor: pointer; }
.tut-start { background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; border: none; padding: 9px 18px; border-radius: 8px; font-weight: 800; cursor: pointer; font-size: 0.9rem; }

.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 10px; }
.catalog-card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
  background: var(--panel-alt); border: 1px solid var(--border); border-radius: 10px; padding: 12px; color: #fff;
}
.catalog-card:hover { border-color: var(--accent); text-decoration: none; }
.catalog-card.current { border-color: var(--accent); background: rgba(245, 158, 11, 0.12); }
.catalog-card p { margin: 0; font-size: 0.8rem; color: var(--muted); }
.badge-pill { display: inline-block; align-self: flex-start; font-size: 0.7rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(245, 158, 11, 0.2); color: var(--accent); }

@media (max-width: 720px) {
  .quickstart-bar { grid-template-columns: 1fr; }
  .drive-controls { justify-content: center; }
  .pedal-btn { min-width: 68px; min-height: 48px; padding: 8px 12px; font-size: 0.86rem; }
  .rpm-panel { grid-template-columns: auto 1fr; }
  .gauge-readout { grid-column: 1 / -1; text-align: left; }
}

/* Extra Driving, Rail Switcher & Rescue Controls */
.pedal-siren {
  border-color: rgba(56, 189, 248, 0.8);
  background: linear-gradient(135deg, #1d4ed8 0%, #dc2626 100%);
  color: #fff;
  min-width: 140px;
}
.pedal-siren:hover:not(:disabled) { filter: brightness(1.1); }
.pedal-siren:disabled { opacity: 0.45; cursor: not-allowed; }
.pedal-siren:active:not(:disabled), .pedal-siren.active { background: #38bdf8; color: #0c0d12; }

.switch-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  width: 100%;
  max-width: 820px;
}
.switch-btn {
  appearance: none;
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: var(--panel-alt);
  color: #f8fafc;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}
.switch-btn:hover { border-color: var(--accent); }
.switch-btn.active {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0c0d12;
  border-color: #fbbf24;
}

/* Batch 2 Driving, Stunt, Bridge & Boost Controls */
.pedal-boost {
  border-color: rgba(56, 189, 248, 0.85);
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
  min-width: 112px;
}
.pedal-boost:active:not(:disabled), .pedal-boost.active { background: #38bdf8; color: #082f49; }

.gauge-fill-ice {
  background: linear-gradient(90deg, #38bdf8 0%, #fbbf24 65%, #ef4444 100%);
}
.gauge-fill-nitro {
  background: linear-gradient(90deg, #06b6d4 0%, #3b82f6 60%, #a855f7 100%);
}

.upg-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  width: 100%;
  max-width: 820px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}
.upg-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--panel-alt);
  color: #f8fafc;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.upg-btn:hover:not(:disabled) { border-color: var(--accent); background: #292d40; }
.upg-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.upg-lvl {
  background: rgba(245, 158, 11, 0.22);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.ink-panel {
  width: 100%;
  max-width: 820px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 700;
}
.ink-panel .gauge-track { flex: 1; height: 14px; }


/* Batch 3 Pit Stop, Wash Bay & Telemetry Controls */
.pedal-btn.fp-done {
  border-color: rgba(52, 211, 153, 0.85);
  background: linear-gradient(180deg, #065f46 0%, #064e3b 100%);
  color: #a7f3d0;
  opacity: 0.72;
}
.pedal-btn.fp-jam {
  border-color: #ef4444;
  background: #7f1d1d;
  color: #fecaca;
}
.pedal-btn.fp-jack-ready {
  border-color: #34d399;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #052e16;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.55);
}
.gauge-fill-temp {
  background: linear-gradient(90deg, #38bdf8 0%, #f59e0b 62%, #ef4444 92%);
}

/* Batch 4 Pit Lane Dash active wheel highlight */
.pedal-btn.pl-next {
  border-color: #fbbf24;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0c0d12;
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.55);
}
