/* Tracker.gg-inspired CS2 theme */
:root {
  --trk-bg: #0a0c10;
  --trk-bg-elevated: #12151c;
  --trk-bg-card: #181c24;
  --trk-border: rgba(255, 255, 255, 0.08);
  --trk-text: #f4f5f7;
  --trk-muted: #9aa3b2;
  --trk-accent: #ff5500;
  --trk-accent-hover: #ff6a1f;
  --trk-accent-dim: rgba(255, 85, 0, 0.15);
  --trk-win: #22c55e;
  --trk-loss: #ef4444;
  --trk-draw: #94a3b8;
  --trk-radius: 10px;
  --trk-max: 1200px;
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--trk-bg);
  color: var(--trk-text);
  min-height: 100vh;
  line-height: 1.5;
}

a {
  color: var(--trk-accent);
  text-decoration: none;
}
a:hover {
  color: var(--trk-accent-hover);
}

/* Header */
.trk-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 12, 16, 0.92);
  border-bottom: 1px solid var(--trk-border);
  backdrop-filter: blur(12px);
}

.trk-header__inner {
  max-width: var(--trk-max);
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.trk-logo {
  display: flex;
  align-items: baseline;
  gap: 4px;
  text-decoration: none;
  flex-shrink: 0;
}

.trk-logo__mark {
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--trk-accent);
  letter-spacing: -0.02em;
}

.trk-logo__text {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--trk-text);
  letter-spacing: 0.12em;
}

.trk-nav {
  display: flex;
  gap: 8px;
  flex: 1;
}

.trk-nav a {
  color: var(--trk-muted);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
}

.trk-nav a:hover,
.trk-nav__active {
  color: var(--trk-text);
  background: rgba(255, 255, 255, 0.05);
}

.trk-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.trk-user {
  font-size: 0.85rem;
  color: var(--trk-muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trk-user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 200px;
}

.trk-user-chip__avatar {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--trk-border);
}

.trk-user-chip__name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--trk-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
}

.trk-btn--steam {
  background: linear-gradient(180deg, #2a475e 0%, #1b2838 100%);
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.trk-btn--steam:hover {
  filter: brightness(1.1);
  color: #fff !important;
}

.trk-btn--ghost {
  background: transparent;
  color: var(--trk-muted) !important;
  border: 1px solid var(--trk-border);
}

.trk-btn--ghost:hover {
  color: var(--trk-text) !important;
  background: rgba(255, 255, 255, 0.05);
}

.trk-btn--primary {
  background: var(--trk-accent);
  color: #0a0c10 !important;
}

.trk-btn--primary:hover {
  background: var(--trk-accent-hover);
  color: #0a0c10 !important;
}

.trk-btn--lg {
  padding: 14px 28px;
  font-size: 0.95rem;
}

/* Hero */
.trk-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--trk-border);
}

.trk-hero__bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 12, 16, 0.4) 0%, var(--trk-bg) 100%),
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(255, 85, 0, 0.25), transparent 55%),
    linear-gradient(135deg, #1a1520 0%, #0d1118 40%, #0a0c10 100%);
  pointer-events: none;
}

.trk-hero__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
}

.trk-hero__content {
  position: relative;
  max-width: var(--trk-max);
  margin: 0 auto;
  padding: 56px 24px 64px;
  text-align: center;
}

.trk-hero__eyebrow {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--trk-accent);
}

.trk-hero__title {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.trk-hero__sub {
  margin: 0 auto 32px;
  max-width: 520px;
  color: var(--trk-muted);
  font-size: 1.05rem;
}

.trk-search {
  display: flex;
  align-items: stretch;
  max-width: 640px;
  margin: 0 auto;
  background: var(--trk-bg-card);
  border: 1px solid var(--trk-border);
  border-radius: var(--trk-radius);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.trk-search:focus-within {
  border-color: rgba(255, 85, 0, 0.5);
  box-shadow: 0 0 0 3px var(--trk-accent-dim);
}

.trk-search__icon {
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: var(--trk-muted);
}

.trk-search__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--trk-text);
  font: inherit;
  font-size: 1rem;
  padding: 16px 0;
  outline: none;
}

.trk-search__input::placeholder {
  color: var(--trk-muted);
}

.trk-search__input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.trk-search__btn {
  margin: 6px;
  padding: 0 24px;
  border: none;
  border-radius: 6px;
  background: var(--trk-accent);
  color: #0a0c10;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
}

.trk-search__btn:hover:not(:disabled) {
  background: var(--trk-accent-hover);
}

.trk-search__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.trk-hero__hint {
  margin: 16px 0 0;
  font-size: 0.88rem;
  color: var(--trk-muted);
}

/* Main */
.trk-main {
  max-width: var(--trk-max);
  margin: 0 auto;
  padding: 0 24px 48px;
}

.trk-alert {
  margin-top: 24px;
  padding: 16px 18px;
  border-radius: var(--trk-radius);
  font-size: 0.9rem;
  line-height: 1.55;
}

.trk-alert--error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.trk-alert--ok {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #bbf7d0;
}

.trk-setup-banner {
  background: rgba(239, 68, 68, 0.18);
  border-bottom: 2px solid #ef4444;
  animation: trk-setup-blink 1.25s ease-in-out infinite;
}

.trk-setup-banner__inner {
  max-width: var(--trk-max);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  font-size: 0.92rem;
  color: #fecaca;
}

.trk-setup-banner__inner strong {
  color: #fff;
  font-weight: 700;
}

.trk-setup-banner__cta {
  margin-left: auto;
  flex-shrink: 0;
}

@keyframes trk-setup-blink {
  0%,
  100% {
    opacity: 1;
    box-shadow: inset 0 0 0 0 rgba(239, 68, 68, 0);
  }
  50% {
    opacity: 0.88;
    box-shadow: inset 0 0 24px rgba(239, 68, 68, 0.25);
  }
}

.trk-alert code {
  font-size: 0.82rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 6px;
  border-radius: 4px;
}

.trk-results {
  margin-top: -32px;
  position: relative;
  z-index: 2;
}

.trk-results:not([hidden]) {
  display: block;
}

/* Profile card (search result) */
.trk-profile {
  background: var(--trk-bg-card);
  border: 1px solid var(--trk-border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}

.trk-profile__banner {
  height: 100px;
  background: linear-gradient(90deg, #2d1810 0%, #1a2744 50%, #0f1419 100%);
}

.trk-profile__body {
  padding: 0 24px 24px;
  margin-top: -40px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-end;
}

.trk-profile__avatar {
  width: 88px;
  height: 88px;
  border-radius: 8px;
  border: 4px solid var(--trk-bg-card);
  background: var(--trk-bg-elevated);
  object-fit: cover;
}

.trk-profile__avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--trk-muted);
}

.trk-profile__info {
  flex: 1;
  min-width: 200px;
}

.trk-profile__name {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.trk-profile__sid {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--trk-muted);
  font-family: ui-monospace, monospace;
}

.trk-profile__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.trk-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.trk-badge--vac {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.trk-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1px;
  background: var(--trk-border);
  border-top: 1px solid var(--trk-border);
}

.trk-stat {
  background: var(--trk-bg-elevated);
  padding: 16px;
  text-align: center;
}

.trk-stat__val {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.trk-stat__lab {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--trk-muted);
  margin-top: 4px;
  letter-spacing: 0.06em;
}

.trk-recent {
  margin-top: 48px;
  padding-top: 8px;
  border-top: 1px solid var(--trk-border);
}

.trk-recent__head {
  margin-bottom: 20px;
}

.trk-recent__title {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.trk-recent__sub {
  margin: 0;
  color: var(--trk-muted);
  font-size: 0.9rem;
}

.trk-recent__empty {
  margin: 0;
}

.trk-match-grid--feed {
  margin-top: 4px;
}

.trk-match--feed {
  cursor: default;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
}

.trk-match--feed[data-search-sid] {
  cursor: pointer;
}

.trk-match--feed[data-search-sid]:hover {
  border-color: rgba(255, 85, 0, 0.45);
  background: rgba(255, 85, 0, 0.04);
}

.trk-match__player {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--trk-accent);
}

.trk-matches-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--trk-muted);
  margin: 0 0 12px;
}

.trk-match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.trk-match {
  background: var(--trk-bg-card);
  border: 1px solid var(--trk-border);
  border-radius: var(--trk-radius);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  transition: border-color 0.15s;
}

.trk-match:hover {
  border-color: rgba(255, 85, 0, 0.35);
}

.trk-match__map {
  font-weight: 700;
  font-size: 0.95rem;
}

.trk-match__meta {
  font-size: 0.8rem;
  color: var(--trk-muted);
  grid-column: 1 / -1;
}

.trk-match__score {
  font-weight: 800;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

.trk-result {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.trk-result--w {
  background: rgba(34, 197, 94, 0.15);
  color: var(--trk-win);
}

.trk-result--l {
  background: rgba(239, 68, 68, 0.15);
  color: var(--trk-loss);
}

.trk-result--d {
  background: rgba(148, 163, 184, 0.15);
  color: var(--trk-draw);
}

.trk-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--trk-muted);
  background: var(--trk-bg-card);
  border: 1px dashed var(--trk-border);
  border-radius: var(--trk-radius);
}

/* Features */
.trk-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 48px;
}

.trk-feature {
  background: var(--trk-bg-card);
  border: 1px solid var(--trk-border);
  border-radius: var(--trk-radius);
  padding: 24px;
}

.trk-feature__icon {
  font-size: 1.75rem;
  margin-bottom: 12px;
}

.trk-feature h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
}

.trk-feature p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--trk-muted);
  line-height: 1.55;
}

/* CTA */
.trk-cta {
  margin-top: 40px;
}

.trk-cta__card {
  background: linear-gradient(135deg, rgba(255, 85, 0, 0.12) 0%, var(--trk-bg-card) 50%);
  border: 1px solid var(--trk-border);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
}

.trk-cta__card h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.trk-cta__card > p {
  color: var(--trk-muted);
  margin: 0 0 20px;
}

.trk-cta__steps {
  text-align: left;
  max-width: 360px;
  margin: 0 auto 24px;
  padding-left: 1.2rem;
  color: var(--trk-muted);
  font-size: 0.9rem;
}

.trk-cta__steps strong {
  color: var(--trk-text);
}

/* Footer */
.trk-footer {
  border-top: 1px solid var(--trk-border);
  padding: 24px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--trk-muted);
}

.trk-footer p {
  margin: 0;
}

/* Legacy / panel.php compatibility */
.site-header,
.hero,
.setup,
.search-box,
.match-card,
.sub,
.hint,
.logo,
.user-pill,
.btn-steam,
.panel-wrap,
.gear-note {
  /* panel uses trk-* where updated; legacy classes still work */
}

.panel-wrap {
  max-width: var(--trk-max);
  margin: 40px auto;
  padding: 20px 24px;
}

.card {
  background: var(--trk-bg-card);
  border: 1px solid var(--trk-border);
  border-radius: var(--trk-radius);
  padding: 20px;
  margin-bottom: 16px;
}

@media (max-width: 640px) {
  .trk-header__inner {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 16px;
  }
  .trk-nav {
    order: 3;
    width: 100%;
  }
  .trk-search {
    flex-direction: column;
  }
  .trk-search__btn {
    margin: 0 6px 6px;
    padding: 14px;
  }
  .trk-profile__body {
    flex-direction: column;
    align-items: flex-start;
  }
}
