:root {
  --bg-main: #0c0f14;
  --bg-card: #151921;
  --bg-card-hover: #1e2430;
  --bg-input: #0b0e14;
  --accent-gold: #f59e0b;
  --accent-gold-hover: #fbbf24;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-cyan: #06b6d4;
  --border-light: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(245, 158, 11, 0.5);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --font-chakra: 'Chakra Petch', sans-serif;
  --font-rajdhani: 'Rajdhani', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

/* Used throughout the app for closed modals, inactive panels, and controls. */
.hidden {
  display: none !important;
}

body {
  background-color: var(--bg-main);
  background-image: radial-gradient(circle at 50% 0%, #1c2433 0%, #0c0f14 70%);
  color: var(--text-main);
  font-family: var(--font-rajdhani);
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* TOP NAVBAR */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: rgba(15, 19, 26, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-left, .nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-chakra);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 1px;
}

.logo .highlight {
  color: var(--accent-gold);
}

.logo-badge {
  background: #262e3d;
  color: #60a5fa;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.nav-links {
  display: flex;
  gap: 8px;
  margin-left: 20px;
}

.nav-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-chakra);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-tab:hover, .nav-tab.active {
  color: #fff;
  background: #1c2331;
  border-color: var(--border-light);
}

.nav-tab.active {
  border-color: var(--accent-gold);
}

/* Currency & Sound */
.currency-toggle {
  display: flex;
  background: #090c10;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  overflow: hidden;
}

.currency-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 10px;
  font-family: var(--font-chakra);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.currency-btn.active {
  background: #252e3e;
  color: var(--accent-gold);
}

.icon-btn, .icon-btn-sm {
  background: #1c2331;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  color: #fff;
  font-size: 1rem;
}

.balance-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0d1117;
  border: 1px solid var(--border-light);
  padding: 4px 12px;
  border-radius: 8px;
}

.balance-label {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.balance-val {
  font-family: var(--font-chakra);
  font-weight: 700;
  color: var(--accent-green);
  font-size: 1.05rem;
}

.btn-deposit {
  background: #1b4d3e;
  color: #34d399;
  border: 1px solid #059669;
  font-family: var(--font-chakra);
  font-weight: 700;
  font-size: 0.75rem;
  width: 30px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.2s;
}

.btn-deposit:hover {
  background: #059669;
  color: #fff;
}

.btn-primary-steam {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  border: none;
  color: #000;
  font-family: var(--font-chakra);
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.1s, filter 0.2s;
}

.btn-primary-steam:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.user-badge-logged {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #151921;
  border: 1px solid var(--border-light);
  padding: 4px 10px;
  border-radius: 8px;
}

.header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #252e3e;
}

.header-name {
  font-weight: 700;
  color: #fff;
}

/* MAIN VIEW LAYOUT */
.main-wrapper {
  flex: 1;
  padding: 24px;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.tab-view {
  display: block;
}

.tab-view.hidden {
  display: none !important;
}

/* CONTROLS RIBBON */
.controls-ribbon {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  padding: 12px 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.ribbon-lbl {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-right: 10px;
  text-transform: uppercase;
}

.anim-buttons, .mult-buttons {
  display: inline-flex;
  gap: 6px;
}

.anim-btn, .mult-btn {
  background: #0f131a;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-family: var(--font-chakra);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.2s;
}

.anim-btn.active, .mult-btn:hover {
  background: #252e3e;
  color: #fff;
  border-color: var(--accent-gold);
}

/* ARENA 3 COLUMNS */
.arena-grid {
  display: grid;
  grid-template-columns: 1fr 380px 1fr;
  gap: 20px;
  align-items: start;
}

.arena-column {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  height: 640px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 12px;
}

.panel-header h3 {
  font-family: var(--font-chakra);
  font-size: 1rem;
  color: #fff;
}

.panel-counter {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Selected Slots */
.selected-target-slot {
  height: 140px;
  background: #0d1017;
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.selected-target-slot.active-skin {
  border-style: solid;
  border-color: var(--accent-gold);
  background: radial-gradient(circle at center, #262115 0%, #0d1017 100%);
}

.slot-placeholder {
  text-align: center;
  color: var(--text-muted);
}

.slot-placeholder p {
  font-weight: 600;
  font-size: 0.95rem;
}

.slot-placeholder small {
  color: #6b7280;
  font-size: 0.75rem;
}

/* Inventory Grids */
.inventory-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inv-filter-bar {
  margin-bottom: 10px;
}

.input-tactical {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 12px;
  color: #fff;
  font-family: var(--font-rajdhani);
  font-size: 0.9rem;
  outline: none;
}

.input-tactical:focus {
  border-color: var(--border-focus);
}

.inventory-scroll-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
  grid-auto-rows: 178px;
  align-content: start;
  gap: 10px;
  padding-right: 4px;
}

.target-multiplier-tools {
  padding: 10px;
  margin: -2px 0 12px;
  background: #0d1017;
  border: 1px solid var(--border-light);
  border-radius: 8px;
}

.multiplier-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.multiplier-heading .ribbon-lbl { margin: 0; }

.mult-buttons {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.btn-edit-multipliers {
  flex: 0 0 auto;
  background: #1b212c;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  border-radius: 5px;
  padding: 4px 7px;
  font: 600 0.72rem var(--font-chakra);
  cursor: pointer;
}

.btn-edit-multipliers:hover { border-color: var(--accent-gold); color: #fff; }

/* Skin Card Element */
.skin-card {
  background: #0f131a;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
  min-height: 0;
  transition: 0.15s ease;
}

.skin-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.skin-card.selected {
  border-color: var(--accent-gold);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
}

.skin-card img {
  width: 90px;
  height: 65px;
  object-fit: contain;
  margin: 6px 0;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6));
}

.skin-card-name {
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.skin-card-weapon {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.skin-card-price {
  font-family: var(--font-chakra);
  font-weight: 700;
  color: var(--accent-gold);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* RARITY STRIPES */
.rarity-Covert { border-bottom: 3px solid #eb4b4b; }
.rarity-Classified { border-bottom: 3px solid #d32ce6; }
.rarity-Restricted { border-bottom: 3px solid #8847ff; }
.rarity-Mil-Spec { border-bottom: 3px solid #4b69ff; }
.rarity-Extraordinary { border-bottom: 3px solid #e4ae39; }

/* CENTER ENGINE */
.arena-center {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.engine-screen {
  width: 340px;
  height: 340px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.engine-box {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.engine-box.hidden {
  display: none !important;
}

.radar-center-info {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.chance-tag {
  font-family: var(--font-chakra);
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 15px rgba(245, 158, 11, 0.6);
}

.status-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 2px;
}

/* REEL ANIMATION */
.reel-container {
  width: 320px;
  height: 180px;
  background: #0a0d13;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.reel-pointer {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 190px;
  background: var(--accent-gold);
  z-index: 20;
  box-shadow: 0 0 10px var(--accent-gold);
}

.reel-track {
  display: flex;
  gap: 12px;
  height: 100%;
  align-items: center;
  padding: 0 20px;
  transform: translateX(0px);
  will-change: transform;
}

.reel-item {
  min-width: 120px;
  height: 140px;
  background: #141923;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-light);
}

.reel-item.win-item {
  border-color: var(--accent-green);
  background: #11261d;
}

.reel-item.miss-item {
  opacity: 0.45;
}

/* ACTION DOCK */
.action-dock {
  width: 100%;
  margin-top: 24px;
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  background: #0d1017;
  border: 1px solid var(--border-light);
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.stat-cell {
  min-width: 220px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cell-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cell-val {
  font-family: var(--font-chakra);
  font-weight: 700;
  font-size: 1.1rem;
}

.win-val { color: var(--accent-green); }
.mult-val { color: var(--accent-gold); }

.roll-mode-toggle {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 4px;
}

.mode-btn {
  background: #1b212c;
  border: none;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 4px 7px;
  white-space: nowrap;
  border-radius: 4px;
  cursor: pointer;
}

.mode-btn.active {
  background: var(--accent-gold);
  color: #000;
}

.btn-upgrade-fire {
  width: 100%;
  height: 56px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  border-radius: 8px;
  font-family: var(--font-chakra);
  font-weight: 700;
  font-size: 1.15rem;
  color: #000;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.35);
  transition: all 0.2s;
}

.btn-upgrade-fire:not(:disabled):hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 6px 24px rgba(245, 158, 11, 0.5);
}

.btn-upgrade-fire:disabled {
  background: #252b36;
  color: #555e6d;
  box-shadow: none;
  cursor: not-allowed;
}

/* STORE VIEW */
.store-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  padding: 20px 24px;
  border-radius: 12px;
  margin-bottom: 24px;
}

.store-banner h2 {
  font-family: var(--font-chakra);
  color: #fff;
  font-size: 1.5rem;
}

.store-banner p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.store-filter-wrap {
  display: flex;
  gap: 12px;
}

.select-tactical {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 12px;
  color: #fff;
  font-family: var(--font-rajdhani);
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.store-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: 0.2s;
}

.store-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.25);
}

.store-card img {
  width: 140px;
  height: 95px;
  object-fit: contain;
  margin: 12px 0;
}

.btn-buy-skin {
  width: 100%;
  margin-top: 10px;
  background: #1e293b;
  border: 1px solid var(--border-light);
  color: #fff;
  font-family: var(--font-chakra);
  font-weight: 700;
  padding: 8px 0;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.2s;
}

.btn-buy-skin:hover {
  background: var(--accent-gold);
  color: #000;
  border-color: var(--accent-gold);
}

/* MODAL WINDOWS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  background: #141822;
  border: 1px solid var(--border-light);
  width: 420px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}

.inventory-empty-state {
  grid-column: 1 / -1;
  min-height: 120px;
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.5;
}

.modal-hint {
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.4;
}

.multipliers-modal-card { width: min(440px, calc(100vw - 32px)); }
.deposit-modal-card { width: min(420px, calc(100vw - 32px)); }

.multiplier-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.multiplier-edit-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.mult-btn {
  width: 100%;
  padding: 6px 3px;
  font-size: 0.72rem;
}

@media (max-width: 1050px) {
  .top-nav { flex-wrap: wrap; gap: 12px; }
  .nav-right { flex-wrap: wrap; justify-content: flex-end; }
  .arena-grid { grid-template-columns: minmax(220px, 1fr) minmax(320px, 1fr); }
  .arena-center { grid-column: 1 / -1; grid-row: 2; }
  .arena-column:nth-child(3) { grid-column: 2; grid-row: 1; }
}

@media (max-width: 700px) {
  .top-nav { padding: 10px 12px; }
  .nav-left, .nav-right { width: 100%; justify-content: space-between; gap: 8px; }
  .nav-links { margin-left: 0; }
  .main-wrapper { padding: 12px; }
  .arena-grid { display: flex; flex-direction: column; }
  .arena-column, .arena-center { width: 100%; height: auto; min-height: 520px; }
  .arena-center { min-height: 0; }
  .inventory-container { min-height: 280px; }
  .engine-screen { width: min(340px, 100%); height: auto; aspect-ratio: 1; }
  #radarCanvas { width: 100%; height: 100%; }
  .stats-row { display: flex; }
  .stat-cell { min-width: 0; width: 100%; }
  .store-banner, .store-filter-wrap { flex-direction: column; align-items: stretch; }
  .store-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: #0f131a;
  border-bottom: 1px solid var(--border-light);
}

.modal-title {
  font-family: var(--font-chakra);
  font-weight: 700;
  font-size: 1.1rem;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-light);
}

.m-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-chakra);
  font-weight: 700;
  padding: 10px;
  cursor: pointer;
}

.m-tab.active {
  color: var(--accent-gold);
  border-bottom: 2px solid var(--accent-gold);
  background: #171d29;
}

.modal-body {
  padding: 20px;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.input-field label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.input-field input {
  background: #0a0d13;
  border: 1px solid var(--border-light);
  padding: 10px;
  border-radius: 6px;
  color: #fff;
  font-family: var(--font-rajdhani);
  font-size: 1rem;
}

.btn-submit-gold {
  width: 100%;
  background: var(--accent-gold);
  border: none;
  color: #000;
  font-family: var(--font-chakra);
  font-weight: 700;
  padding: 12px;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 6px;
}

.auth-divider {
  text-align: center;
  margin: 18px 0;
  position: relative;
}

.auth-divider span {
  background: #141822;
  padding: 0 10px;
  color: #555e6d;
  font-size: 0.75rem;
  font-weight: 700;
}

.btn-guest {
  width: 100%;
  background: #1c2432;
  border: 1px solid var(--border-light);
  color: #fff;
  font-family: var(--font-chakra);
  font-weight: 700;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
}

.auth-error {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

/* PROFILE MODAL */
.profile-card {
  width: 480px;
}

.profile-body {
  padding: 20px;
}

.user-info-row {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.profile-big-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #252e3e;
  border: 2px solid var(--accent-gold);
}

.avatar-seeds {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.avatar-pick-btn {
  background: #1e2635;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  cursor: pointer;
  padding: 2px 6px;
}

.stats-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.stat-p-card {
  background: #0c0f14;
  border: 1px solid var(--border-light);
  padding: 12px;
  border-radius: 8px;
}

.sc-lbl {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sc-val {
  font-family: var(--font-chakra);
  font-size: 1.25rem;
  font-weight: 700;
}

.sc-val.win { color: var(--accent-green); }

.btn-logout {
  width: 100%;
  background: #391e22;
  border: 1px solid #7f1d1d;
  color: #f87171;
  font-family: var(--font-chakra);
  font-weight: 700;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1f2937;
  border: 1px solid var(--accent-gold);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  z-index: 2000;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.toast.hidden { display: none; }
