/* CS2 Skin Tracker */
:root {
  --bg: #08080d;
  --panel: #101018;
  --panel-2: #15151f;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.15);
  --text: #ededf3;
  --muted: #8d8da3;
  --dim: #5d5d70;
  --acc: #f59e0b;
  --acc-2: #fbbf24;
  --ok: #22c55e;
  --bad: #ef4444;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--text);
  font-family: var(--body); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
svg { display: block; flex: none; }

.glow {
  position: fixed; inset: 0 0 auto; height: 520px; pointer-events: none; z-index: 0;
  background:
    radial-gradient(600px 300px at 15% -10%, rgba(245, 158, 11, 0.16), transparent 70%),
    radial-gradient(500px 280px at 85% -20%, rgba(139, 92, 246, 0.12), transparent 70%);
}

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(8, 8, 13, 0.75);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 14px; padding: 8px 12px 8px 8px; border-radius: 10px;
  transition: color .2s, background .2s;
}
.back:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.back svg { transition: transform .3s var(--ease); }
.back:hover svg { transform: translateX(-3px); }
.brand { display: flex; align-items: center; gap: 10px; margin: 0 auto; }
.brand strong { font-family: var(--display); font-size: 17px; letter-spacing: -0.01em; }
.brand-ico { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: linear-gradient(135deg, var(--acc), #ea580c); color: #111; }
.brand-tag { font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 11px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: transform .2s var(--ease), background .2s, box-shadow .3s, border-color .2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--acc); color: #141008; }
.btn-primary:hover { background: var(--acc-2); box-shadow: 0 8px 26px -8px rgba(245, 158, 11, 0.7); }
.btn-ghost { background: transparent; border-color: var(--line-2); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: transparent; cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,0.05); }

/* Layout */
.wrap { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
.hero { padding: 48px 0 24px; }
.kicker { margin: 0 0 6px; font-family: var(--mono); font-size: 12px; color: var(--acc); }
.hero h1 { margin: 0; font-family: var(--display); font-size: clamp(34px, 5vw, 52px); line-height: 1; letter-spacing: -0.04em; }

/* Flash */
.flash { margin-bottom: 20px; animation: drop .5s var(--ease); }
.flash .success, .flash .error {
  padding: 12px 16px; border-radius: 12px; font-weight: 500; font-size: 14px;
  display: flex; align-items: center; gap: 10px;
}
.flash .success { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.35); color: #86efac; }
.flash .error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.35); color: #fca5a5; }
.flash .success::before { content: "✓"; font-weight: 700; }
.flash .error::before { content: "!"; font-weight: 700; }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }

/* Stats */
.stats { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 12px; margin-bottom: 28px; }
.stat {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  padding: 18px 20px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line);
  animation: rise .6s var(--ease) both;
}
.stat:nth-child(2) { animation-delay: .05s; } .stat:nth-child(3) { animation-delay: .1s; } .stat:nth-child(4) { animation-delay: .15s; }
.stat-main { background: linear-gradient(140deg, rgba(245, 158, 11, 0.16), rgba(245, 158, 11, 0.02) 60%), var(--panel); border-color: rgba(245, 158, 11, 0.3); }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 500; }
.stat-value { font-family: var(--display); font-size: 28px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat-main .stat-value { font-size: 36px; color: var(--acc-2); }
.stat-sub { font-size: 13px; color: var(--dim); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 20px; }
.search {
  flex: 1 1 260px; display: flex; align-items: center; gap: 10px;
  padding: 0 12px; height: 44px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); color: var(--dim);
  transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: rgba(245, 158, 11, 0.6); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12); color: var(--acc); }
.search input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none; color: var(--text); }
.search input::placeholder { color: var(--dim); }
.search kbd { font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--dim); }
.seg { display: flex; gap: 2px; padding: 4px; height: 44px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.seg::-webkit-scrollbar { display: none; }
.seg-btn { padding: 0 14px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; font-size: 14px; font-weight: 500; white-space: nowrap; transition: background .2s, color .2s; }
.seg-btn:hover { color: var(--text); }
.seg-btn.is-active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.select { position: relative; }
.select::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.select select, .field select {
  appearance: none; -webkit-appearance: none;
  height: 44px; padding: 0 38px 0 14px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); cursor: pointer; outline: none;
}
.select select:focus { border-color: rgba(245, 158, 11, 0.6); }
select option { background: #15151f; }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.skin {
  --mx: 50%; --my: 50%;
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 16px; background: var(--panel); border: 1px solid var(--line);
  transition: transform .35s var(--ease), border-color .25s, box-shadow .35s;
  animation: rise .55s var(--ease) both; animation-delay: calc(min(var(--i), 12) * 35ms);
}
.skin[hidden] { display: none; }
.skin::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(260px circle at var(--mx) var(--my), rgba(245, 158, 11, 0.12), transparent 60%);
  opacity: 0; transition: opacity .3s;
}
.skin:hover { transform: translateY(-4px); border-color: rgba(245, 158, 11, 0.4); box-shadow: 0 18px 40px -20px rgba(245, 158, 11, 0.45); }
.skin:hover::before { opacity: 1; }
.skin-media {
  position: relative; height: 150px; display: grid; place-items: center;
  background: radial-gradient(70% 80% at 50% 60%, rgba(255,255,255,0.07), transparent 70%), var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.skin-media { overflow: hidden; }
.skin-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease), filter .4s; filter: saturate(0.9); }
.skin-media::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,0.25), transparent 35%, transparent 70%, rgba(16,16,24,0.6)); }
.skin:hover .skin-media img { transform: scale(1.08); filter: saturate(1.1); }
.no-img { font-size: 13px; color: var(--dim); }
.cond {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  padding: 3px 8px; border-radius: 6px; border: 1px solid currentColor; background: rgba(0,0,0,0.35);
}
.c-sv { color: #facc15; } .c-fn { color: #4ade80; } .c-mw { color: #a3e635; }
.c-ft { color: #fbbf24; } .c-ww { color: #fb923c; } .c-bs { color: #f87171; }
.skin-body { position: relative; z-index: 2; padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.skin-weapon { font-size: 12px; color: var(--muted); font-weight: 500; }
.skin-finish { margin: 2px 0 6px; font-family: var(--display); font-size: 18px; line-height: 1.2; letter-spacing: -0.02em; }
.skin-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--dim); margin-bottom: 14px; }
.skin-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.price { font-family: var(--mono); font-size: 18px; font-weight: 500; color: var(--acc-2); font-variant-numeric: tabular-nums; }
.price.pending { font-family: var(--body); font-size: 13px; color: var(--dim); }
.ext { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); color: var(--muted); transition: background .25s, color .25s, border-color .25s; }
.skin:hover .ext { background: var(--acc); color: #141008; border-color: var(--acc); }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 16px; }

/* Footer */
.foot {
  position: relative; z-index: 1;
  max-width: 1240px; margin: 60px auto 0; padding: 22px clamp(16px, 4vw, 40px) 30px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  border-top: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.muted { color: var(--dim); }
code { font-family: var(--mono); font-size: 12px; padding: 1px 5px; border-radius: 5px; background: rgba(255,255,255,0.06); }

/* Dialog */
.dialog { padding: 0; border: 0; background: transparent; color: var(--text); width: min(520px, calc(100% - 32px)); max-height: calc(100vh - 32px); }
.dialog::backdrop { background: rgba(4, 4, 8, 0.7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.dialog[open] .dialog-card { animation: pop .4s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(0.97); } }
.dialog-card { padding: 22px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: 0 40px 80px -20px rgba(0,0,0,0.7); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.dialog-head h2 { margin: 0; font-family: var(--display); font-size: 22px; letter-spacing: -0.02em; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 500; }
.field input, .field select {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 11px;
  background: var(--panel-2); border: 1px solid var(--line); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field select { padding-right: 14px; background-image: none; }
.field input:focus, .field select:focus { border-color: rgba(245, 158, 11, 0.6); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12); }
.field input::placeholder { color: var(--dim); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { margin: 2px 0 18px; font-size: 13px; color: var(--dim); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 900px) {
  .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .brand-tag { display: none; }
  .back { font-size: 0; gap: 0; }
  .back { padding: 8px; }
  .btn-primary span { display: none; }
  .btn-primary { padding: 10px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat-main { grid-column: 1 / -1; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .skin-media { height: 120px; }
  .skin-finish { font-size: 16px; }
  .price { font-size: 16px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .search kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
