:root {
  --bg: #0a0a0c;
  --bg2: #0f0f12;
  --bg3: #14141a;
  --bg4: #1a1a22;
  --border: rgba(255,255,255,0.07);
  --border-bright: rgba(255,255,255,0.14);
  --accent: #e8d5a3;
  --accent2: #c9a84c;
  --accent-glow: rgba(232,213,163,0.15);
  --red: #c0392b;
  --red-glow: rgba(192,57,43,0.2);
  --text: #e8e6e0;
  --text2: #8a8880;
  --text3: #5a5856;
  --font-head: 'Rajdhani', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
  --font-body: 'Exo 2', sans-serif;
  --radius: 4px;
  --radius-lg: 8px;
}

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

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ── TEXTURE OVERLAYS ── */
.scanline {
  pointer-events: none;
  position: fixed; inset: 0; z-index: 9999;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px);
}
.noise {
  pointer-events: none;
  position: fixed; inset: 0; z-index: 9998;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

/* ── HEADER ── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,12,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1400px; margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}

.logo { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.logo-mark { flex-shrink: 0; }
.logo-text { display: flex; flex-direction: column; }
.logo-main {
  font-family: var(--font-head);
  font-weight: 700; font-size: 18px;
  letter-spacing: 0.12em;
  color: var(--text);
  line-height: 1;
}
.logo-sub {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 0.2em;
  color: var(--text3);
  margin-top: 2px;
}

.player-info { display: flex; align-items: center; gap: 12px; }
.player-avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border-bright); }
.player-name { font-family: var(--font-head); font-weight: 600; font-size: 14px; letter-spacing: 0.05em; }
.btn-logout {
  font-family: var(--font-head); font-weight: 700; font-size: 11px;
  letter-spacing: 0.15em; padding: 6px 14px;
  background: transparent; color: var(--red);
  border: 1px solid rgba(192,57,43,0.4);
  border-radius: var(--radius); cursor: pointer; text-decoration: none;
  transition: all 0.2s;
}
.btn-logout:hover { background: var(--red); color: #fff; }

/* ── HERO / LOGIN ── */
.hero-login {
  min-height: calc(100vh - 64px);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.hero-bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(232,213,163,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232,213,163,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 40%, transparent 100%);
}
.hero-content { position: relative; text-align: center; max-width: 560px; padding: 40px 24px; }
.hero-badge {
  display: inline-block;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.25em;
  color: var(--accent2); border: 1px solid rgba(201,168,76,0.3);
  padding: 5px 16px; border-radius: 2px;
  margin-bottom: 28px;
}
.hero-title {
  font-family: var(--font-head);
  font-weight: 700; font-size: clamp(40px, 7vw, 64px);
  line-height: 1.05; letter-spacing: 0.04em;
  color: var(--text); margin-bottom: 20px;
}
.hero-title em { font-style: normal; color: var(--accent); }
.hero-desc {
  font-size: 15px; color: var(--text2); line-height: 1.7;
  margin-bottom: 36px;
}
.hero-login-btn { margin-bottom: 48px; }
.hero-login-btn a, .hero-login-btn form { display: inline-block; }
.hero-stats { display: flex; justify-content: center; gap: 48px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-num { font-family: var(--font-head); font-weight: 700; font-size: 28px; color: var(--accent); }
.stat-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; color: var(--text3); }

/* ── LAYOUT ── */
.loadout-page {
  display: flex;
  max-width: 1400px; margin: 0 auto;
  padding: 24px;
  gap: 24px;
  min-height: calc(100vh - 64px - 48px);
}

/* ── SIDEBAR ── */
.sidebar {
  width: 200px; flex-shrink: 0;
  position: sticky; top: 88px;
  height: fit-content;
}
.sidebar-title {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.25em;
  color: var(--text3); padding: 0 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.cat-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 24px; }
.cat-btn {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-head); font-weight: 600; font-size: 13px;
  letter-spacing: 0.08em; color: var(--text2);
  background: transparent; border: none; cursor: pointer;
  padding: 9px 12px; border-radius: var(--radius);
  text-align: left; position: relative;
  transition: all 0.15s;
}
.cat-btn:hover { color: var(--text); background: var(--bg3); }
.cat-btn.active {
  color: var(--accent); background: rgba(232,213,163,0.07);
  border-left: 2px solid var(--accent);
  padding-left: 10px;
}
.cat-badge {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 10px;
  background: rgba(232,213,163,0.15); color: var(--accent);
  padding: 1px 6px; border-radius: 2px;
}
.cat-icon { width: 16px; height: 16px; background: var(--text3); display: inline-block; border-radius: 1px; flex-shrink: 0; }
.cat-btn.active .cat-icon { background: var(--accent); }

.sidebar-info { padding: 14px; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.info-row { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--text3); padding: 3px 0; }
.info-row .mono { font-family: var(--font-mono); color: var(--text2); }

/* ── WEAPON GRID ── */
.weapon-grid-area { flex: 1; min-width: 0; }
.weapon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.weapon-card {
  position: relative; border-radius: var(--radius-lg);
  background: var(--bg3);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.15s;
  cursor: default;
}
.weapon-card:hover { border-color: var(--border-bright); transform: translateY(-2px); }
.weapon-card.has-skin { border-color: rgba(232,213,163,0.2); }
.weapon-card.has-skin:hover { border-color: rgba(232,213,163,0.4); }

.card-glow {
  pointer-events: none;
  position: absolute; inset: 0;
  opacity: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(232,213,163,0.06), transparent 70%);
  transition: opacity 0.3s;
}
.weapon-card:hover .card-glow { opacity: 1; }

.weapon-card-inner { display: flex; flex-direction: column; height: 100%; }
.weapon-img-wrap {
  position: relative;
  background: linear-gradient(135deg, var(--bg2) 0%, var(--bg4) 100%);
  padding: 20px 16px 12px;
  display: flex; align-items: center; justify-content: center;
  min-height: 110px;
}
.weapon-img { width: 100%; max-height: 90px; object-fit: contain; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5)); }
.wear-tag {
  position: absolute; top: 8px; right: 8px;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em;
  color: var(--accent2); background: rgba(201,168,76,0.1);
  border: 1px solid rgba(201,168,76,0.2);
  padding: 2px 6px; border-radius: 2px;
}
.weapon-info { padding: 10px 12px 6px; flex: 1; }
.weapon-name { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.15em; color: var(--text3); margin-bottom: 3px; }
.weapon-skin-name { font-family: var(--font-head); font-weight: 600; font-size: 13px; color: var(--text); line-height: 1.2; }
.no-skin { color: var(--text3); font-weight: 400; }
.btn-edit {
  display: block; width: calc(100% - 16px); margin: 6px 8px 8px;
  font-family: var(--font-head); font-weight: 700; font-size: 11px;
  letter-spacing: 0.15em; padding: 8px;
  background: rgba(255,255,255,0.04); color: var(--text2);
  border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  transition: all 0.2s;
}
.btn-edit:hover { background: var(--accent); color: #000; border-color: var(--accent); }

/* ── MODAL ── */
.skin-modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.skin-modal-overlay.open { opacity: 1; pointer-events: all; }
.skin-modal {
  width: min(560px, 96vw);
  max-height: 88vh;
  background: var(--bg3);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  transform: translateY(16px);
  transition: transform 0.2s;
}
.skin-modal-overlay.open .skin-modal { transform: translateY(0); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg4);
}
.modal-weapon-name { font-family: var(--font-head); font-weight: 700; font-size: 16px; letter-spacing: 0.1em; }
.modal-close { background: none; border: none; color: var(--text3); font-size: 16px; cursor: pointer; padding: 4px; transition: color 0.15s; }
.modal-close:hover { color: var(--text); }

.modal-body { overflow-y: auto; flex: 1; }
.modal-preview {
  background: linear-gradient(135deg, var(--bg2), var(--bg4));
  padding: 24px; text-align: center;
  border-bottom: 1px solid var(--border);
}
.modal-weapon-img { max-height: 120px; object-fit: contain; filter: drop-shadow(0 8px 24px rgba(0,0,0,0.6)); }
.modal-skin-label { font-family: var(--font-head); font-size: 14px; color: var(--accent); margin-top: 10px; letter-spacing: 0.05em; }

.modal-form { padding: 20px; display: flex; flex-direction: column; gap: 16px; }

.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; color: var(--text3); }

.skin-search-wrap { position: relative; }
.skin-search {
  width: 100%; padding: 8px 12px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font-body); font-size: 13px;
  outline: none; transition: border-color 0.15s;
}
.skin-search:focus { border-color: var(--accent2); }

.skin-list {
  max-height: 220px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column;
}
.skin-list::-webkit-scrollbar { width: 4px; }
.skin-list::-webkit-scrollbar-track { background: transparent; }
.skin-list::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 2px; }

.skin-option {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; cursor: pointer;
  font-size: 12px; color: var(--text2);
  transition: all 0.1s; border-bottom: 1px solid var(--border);
}
.skin-option:last-child { border-bottom: none; }
.skin-option:hover { background: var(--bg4); color: var(--text); }
.skin-option.selected { background: rgba(232,213,163,0.08); color: var(--accent); }
.skin-thumb { width: 40px; height: 28px; object-fit: contain; flex-shrink: 0; }

.field-select, .field-input {
  padding: 8px 12px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font-body); font-size: 13px;
  outline: none; width: 100%; transition: border-color 0.15s;
}
.field-select:focus, .field-input:focus { border-color: var(--accent2); }
.field-select option { background: var(--bg3); }

.modal-actions { display: flex; gap: 10px; padding-top: 4px; }
.btn-cancel {
  flex: 1; padding: 10px;
  font-family: var(--font-head); font-weight: 700; font-size: 12px;
  letter-spacing: 0.15em; background: transparent;
  color: var(--text3); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; transition: all 0.2s;
}
.btn-cancel:hover { color: var(--text); border-color: var(--border-bright); }
.btn-apply {
  flex: 2; padding: 10px;
  font-family: var(--font-head); font-weight: 700; font-size: 12px;
  letter-spacing: 0.15em; background: var(--accent);
  color: #0a0a0c; border: none;
  border-radius: var(--radius); cursor: pointer; transition: all 0.2s;
}
.btn-apply:hover { background: #f5e8c0; }

/* ── SPECIAL (KNIVES / GLOVES) ── */
.special-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.special-card {
  position: relative;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 14px 14px;
  cursor: pointer; text-align: center;
  transition: all 0.2s; display: flex; flex-direction: column;
  align-items: center; gap: 10px;
}
.special-card:hover { border-color: var(--border-bright); transform: translateY(-2px); }
.special-card.selected { border-color: rgba(232,213,163,0.5); background: rgba(232,213,163,0.06); }
.special-img { width: 100%; max-height: 80px; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5)); }
.special-name { font-family: var(--font-head); font-weight: 600; font-size: 12px; color: var(--text2); letter-spacing: 0.05em; }
.special-card.selected .special-name { color: var(--accent); }
.selected-badge {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.15em;
  color: var(--accent); background: rgba(232,213,163,0.12);
  border: 1px solid rgba(232,213,163,0.3);
  padding: 3px 8px; border-radius: 2px;
}

/* ── FOOTER ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  text-align: center;
  font-family: var(--font-mono); font-size: 11px; color: var(--text3);
  letter-spacing: 0.1em;
}

/* ── STEAM AUTH BUTTON OVERRIDE ── */
.login-prompt a img, .hero-login-btn a img {
  height: 40px; border-radius: var(--radius); opacity: 0.85;
  transition: opacity 0.2s;
}
.login-prompt a:hover img, .hero-login-btn a:hover img { opacity: 1; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-bright); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .loadout-page { flex-direction: column; padding: 12px; }
  .sidebar { width: 100%; position: static; }
  .cat-nav { flex-direction: row; flex-wrap: wrap; }
  .cat-btn { font-size: 11px; padding: 6px 10px; }
  .weapon-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
}
