/* ============ MapWins — tactical CS2 HUD ============ */

:root {
  --t-orange: #ff6b1a;
  --t-orange-2: #ffa24b;
  --ct-blue: #4fa8e0;

  --bg: #0e1318;
  --bg-2: #121922;
  --surface: #18222d;
  --surface-2: #1e2a37;
  --border: #2a3845;
  --text: #e8edf3;
  --muted: #8a97a6;
  --good: #46d17f;

  --radius: 4px;
  --maxw: 860px;

  --font-display: "Chakra Petch", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

:root[data-theme="light"] {
  --bg: #eef1f5;
  --bg-2: #e6eaf0;
  --surface: #ffffff;
  --surface-2: #f3f6fa;
  --border: #d2dae3;
  --text: #16202b;
  --muted: #5e6b7a;
  --ct-blue: #2f7fb8;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }
:root[data-theme="light"] html { color-scheme: light; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  /* subtle tactical grid */
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 46px 46px, 46px 46px;
  background-position: center top;
  background-attachment: fixed;
}
:root[data-theme="dark"] body { background-blend-mode: soft-light; }
body::before {
  /* dim the grid so it reads as atmosphere, not a table */
  content: "";
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at 50% -10%, transparent 0%, var(--bg) 70%);
  pointer-events: none; z-index: 0;
}
body > * { position: relative; z-index: 1; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- banner ---------- */
.banner {
  display: flex; align-items: center; gap: 10px;
  justify-content: center; flex-wrap: wrap;
  background: linear-gradient(90deg, rgba(255,107,26,.14), transparent);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
}
.banner__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--good); box-shadow: 0 0 8px var(--good);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .35; } }
.banner__time { color: var(--t-orange-2); }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--maxw); margin: 0 auto; padding: 18px 20px 4px;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700; font-size: 22px; letter-spacing: .5px;
  text-decoration: none; color: var(--text);
  display: inline-flex; align-items: baseline;
}
.brand__tag { font-family: var(--font-mono); color: var(--t-orange); font-size: 18px; }
.brand__name { }
.icon-btn {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); width: 38px; height: 38px; border-radius: var(--radius);
  cursor: pointer; display: grid; place-items: center; transition: border-color .15s, background .15s;
}
.icon-btn:hover { border-color: var(--t-orange); }
.theme-icon { width: 16px; height: 16px; border-radius: 50%;
  background: var(--t-orange-2); box-shadow: inset -5px -3px 0 var(--surface); }
:root[data-theme="light"] .theme-icon { box-shadow: none; background: var(--ct-blue); }

/* ---------- hero ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 8px 20px 60px; }
.hero { padding: 28px 0 8px; }
.eyebrow {
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 2px;
  color: var(--t-orange); margin: 0 0 14px; text-transform: uppercase;
}
.hero__title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.1rem, 6.5vw, 3.6rem); line-height: 1.04;
  margin: 0 0 16px; letter-spacing: -.5px;
}
.hero__title em { font-style: normal; color: var(--t-orange); }
.hero__sub { font-size: 1.06rem; color: var(--muted); max-width: 56ch; margin: 0 0 26px; }

/* ---------- search ---------- */
.search { display: flex; gap: 10px; flex-wrap: wrap; }
.search__field {
  flex: 1 1 320px; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0 14px;
  transition: border-color .15s, box-shadow .15s;
}
.search__field:focus-within {
  border-color: var(--t-orange);
  box-shadow: 0 0 0 3px rgba(255,107,26,.18);
}
.search__icon { opacity: .6; font-size: 15px; }
#profile-input {
  flex: 1; background: transparent; border: 0; outline: none;
  color: var(--text); font-family: var(--font-mono); font-size: 14.5px;
  padding: 15px 0;
}
#profile-input::placeholder { color: var(--muted); opacity: .7; }

.btn {
  font-family: var(--font-display); font-weight: 600; font-size: 15px;
  letter-spacing: .3px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid transparent; padding: 0 22px; min-height: 50px;
  transition: transform .08s, filter .15s, background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: linear-gradient(180deg, var(--t-orange-2), var(--t-orange));
  color: #1a0f06; box-shadow: 0 6px 18px -8px var(--t-orange);
}
.btn--primary:hover { filter: brightness(1.07); }
.btn--ghost {
  background: transparent; border-color: var(--border); color: var(--text);
  min-height: 42px; padding: 0 16px; font-size: 14px;
}
.btn--ghost:hover { border-color: var(--t-orange); color: var(--t-orange); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.search__row { display: flex; align-items: center; gap: 18px; margin-top: 14px; flex-wrap: wrap; }
.linkbtn {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-family: var(--font-mono); font-size: 13px; padding: 6px 0;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border);
}
.linkbtn:hover { color: var(--ct-blue); text-decoration-color: var(--ct-blue); }
.hint { font-size: 13px; color: var(--muted); margin: 20px 0 0; }

/* ---------- error ---------- */
.error {
  margin-top: 22px; padding: 16px 18px;
  background: rgba(255,107,26,.08);
  border: 1px solid var(--t-orange);
  border-left-width: 4px; border-radius: var(--radius);
  color: var(--text); font-size: 14.5px;
}
.error a { color: var(--t-orange); }

/* ---------- advanced ---------- */
.advanced {
  margin-top: 22px; padding: 20px; background: var(--surface);
  border: 1px dashed var(--border); border-radius: var(--radius);
}
.advanced__title { font-family: var(--font-display); margin: 0 0 8px; font-size: 1.1rem; }
.advanced__help { color: var(--muted); font-size: 13.5px; margin: 0 0 10px; }
.advanced__url {
  display: block; font-family: var(--font-mono); font-size: 12px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; margin-bottom: 12px; overflow-x: auto; white-space: nowrap; color: var(--ct-blue);
}
.advanced__textarea {
  width: 100%; resize: vertical; font-family: var(--font-mono); font-size: 12.5px;
  background: var(--bg-2); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; margin-bottom: 12px; outline: none;
}
.advanced__textarea:focus { border-color: var(--t-orange); }

/* ---------- loading ---------- */
.loading { text-align: center; padding: 60px 0; color: var(--muted); font-family: var(--font-mono); }
.loading__radar {
  width: 60px; height: 60px; margin: 0 auto 18px; border-radius: 50%;
  border: 2px solid var(--border); position: relative; overflow: hidden;
}
.loading__radar::after {
  content: ""; position: absolute; inset: 0;
  background: conic-gradient(from 0deg, transparent 0deg, var(--t-orange) 60deg, transparent 90deg);
  animation: sweep 1.1s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }

/* ---------- results ---------- */
.results { padding-top: 8px; }
.results__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.results__head .eyebrow { margin: 0; }
.player { display: flex; align-items: center; gap: 10px; min-width: 0; }
.player__avatar { width: 36px; height: 36px; border-radius: var(--radius); border: 1px solid var(--border); flex-shrink: 0; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 26px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 16px; position: relative; overflow: hidden;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--border);
}
.card--hero::before { background: var(--t-orange); }
.card__label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--muted); margin: 0 0 8px;
}
.card__value { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.5rem, 5vw, 2.1rem); line-height: 1; }
.card__value--name { color: var(--t-orange); }
.card__sub { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- data note ---------- */
.note {
  font-size: 13px; line-height: 1.6; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--ct-blue); border-radius: var(--radius);
  padding: 13px 16px; margin: 0 0 22px;
}
.note strong { color: var(--text); font-weight: 600; }

/* ---------- highlights (Wrapped destaques) ---------- */
.highlights { margin: 0 0 26px; }
.highlights__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; gap: 10px; }
.highlights__title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; }
.highlights__tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.highlights__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.hl {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 14px; position: relative; overflow: hidden;
}
.hl::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--t-orange); opacity: .55; }
.hl__value { font-family: var(--font-display); font-weight: 700; font-size: 1.55rem; line-height: 1; color: var(--t-orange-2); }
.hl__label { font-family: var(--font-display); font-size: .98rem; margin-top: 7px; }
.hl__sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
@media (max-width: 720px) { .highlights__grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- per-mode panel ---------- */
.modes { margin: 0 0 26px; }
.modes__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; gap: 10px; }
.modes__title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; }
.modes__tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.modes__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.mode {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 14px;
}
.mode__value { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; line-height: 1; color: var(--ct-blue); }
.mode__label { font-family: var(--font-display); font-size: .95rem; margin-top: 6px; }
.mode__sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.modes__foot { font-size: 12px; color: var(--muted); margin: 10px 0 0; font-style: italic; }
@media (max-width: 560px) { .modes__grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- ranking rows ---------- */
.ranking__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.ranking__title { font-family: var(--font-display); font-size: 1.25rem; margin: 0; }
.ranking__hint { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }

.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.row {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; position: relative; overflow: hidden;
}
.row--top { border-color: var(--t-orange); background: linear-gradient(90deg, rgba(255,107,26,.10), var(--surface) 40%); }
.row__rank { font-family: var(--font-mono); font-weight: 700; font-size: 15px; color: var(--muted); text-align: center; }
.row--top .row__rank { color: var(--t-orange); }
.row__main { min-width: 0; }
.row__code { font-family: var(--font-mono); font-size: 11px; color: var(--muted); letter-spacing: .5px; }
.row__name { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; line-height: 1.1; }
.row__badge {
  display: inline-block; margin-left: 8px; font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 1px; color: #1a0f06; background: var(--t-orange);
  padding: 2px 6px; border-radius: 3px; vertical-align: middle;
}
.row__bar {
  grid-column: 1 / -1; height: 6px; background: var(--bg-2); border-radius: 3px; overflow: hidden; margin-top: 4px;
}
.row__fill {
  height: 100%; width: 0; border-radius: 3px;
  background: linear-gradient(90deg, var(--t-orange), var(--t-orange-2));
  transition: width .7s cubic-bezier(.2,.7,.2,1);
}
.row--top .row__fill { background: linear-gradient(90deg, var(--t-orange), #ffd089); }
.row__wins { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; text-align: right; }
.row__wins small { font-family: var(--font-mono); font-weight: 500; font-size: 11px; color: var(--muted); display: block; letter-spacing: 1px; }

/* ---------- share / footer ---------- */
.share { margin-top: 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.share__feedback { font-family: var(--font-mono); font-size: 13px; color: var(--good); }

.footer {
  max-width: var(--maxw); margin: 0 auto; padding: 30px 20px 50px;
  border-top: 1px solid var(--border); color: var(--muted); font-size: 13px;
}
.footer__meta { font-family: var(--font-mono); font-size: 12px; margin-top: 6px; }

/* ---------- responsive ---------- */
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .search__field { flex-basis: 100%; }
  .btn--primary { flex: 1; }
  .row__wins { font-size: 1.1rem; }
}

/* ---------- keyboard focus (a11y) ---------- */
:focus-visible {
  outline: 2px solid var(--ct-blue);
  outline-offset: 2px;
  border-radius: 3px;
}
.search__field:focus-within :focus-visible { outline: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .row__fill { transition: none !important; }
}
