:root {
  --bg: #0e0f11;
  --bg2: #15171a;
  --panel: #1a1c20;
  --line: #2a2d33;
  --text: #e8e6e3;
  --muted: #8b8f97;
  --red: #c8102e;
  --red-soft: rgba(200, 16, 46, .14);
  --ok: #3ecf6e;
  --ok-soft: rgba(62, 207, 110, .13);
  --no: #ef5555;
  --no-soft: rgba(239, 85, 85, .13);
  --amber: #e8a93a;
  --amber-soft: rgba(232, 169, 58, .13);
  --radius: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font);
  background-image: radial-gradient(1200px 400px at 10% -10%, rgba(200,16,46,.10), transparent 60%);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
a:hover { color: #fff; }
td a:hover strong, .card-title:hover { text-decoration: underline; text-decoration-color: var(--red); }
h1 { font-size: 28px; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0; font-weight: 650; }
code { font-family: var(--mono); background: var(--bg2); padding: 1px 5px; border-radius: 4px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px;
  padding: 10px 24px; background: rgba(14,15,17,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: .02em; }
.brand-mark { background: var(--red); color: #fff; padding: 3px 7px; border-radius: 6px; font-size: 14px; }
.brand-text { color: var(--muted); font-weight: 600; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 550; }
.nav a:hover { color: var(--text); background: var(--bg2); }
.nav a.active { color: #fff; background: var(--red-soft); box-shadow: inset 0 -2px 0 var(--red); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-size: 12px; font-weight: 700; }
.lang a { padding: 4px 8px; color: var(--muted); }
.lang a.on { background: var(--red); color: #fff; }
.me { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.me img { width: 28px; height: 28px; border-radius: 50%; }
.logout { color: var(--muted); font-size: 13px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section { margin: 28px 0 12px; color: var(--muted); text-transform: uppercase; font-size: 12.5px; letter-spacing: .08em; }
.count { display: inline-block; min-width: 22px; padding: 0 7px; margin-left: 4px; border-radius: 99px; background: var(--bg2);
  border: 1px solid var(--line); font-size: 12px; color: var(--muted); text-align: center; vertical-align: middle; letter-spacing: 0; }
.back { display: inline-block; color: var(--muted); margin-bottom: 14px; font-size: 14px; }

/* inputs + buttons */
input, select, textarea {
  background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 11px; font: inherit; outline: none; min-width: 0;
}
input:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.search input, .filter { width: 240px; max-width: 100%; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  background: var(--red); color: #fff; border: 1px solid var(--red); border-radius: 8px;
  padding: 8px 14px; font: inherit; font-weight: 650; white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); color: #fff; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.danger { background: transparent; border-color: var(--no); color: var(--no); }
.btn.discord { background: #5865f2; border-color: #5865f2; width: 100%; padding: 11px; }

/* pills, badges */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.pill.green { background: var(--ok-soft); color: var(--ok); }
.pill.red { background: var(--no-soft); color: var(--no); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.grey { background: var(--bg2); color: var(--muted); border: 1px solid var(--line); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; border: 1px solid var(--line); color: var(--muted); }
.badge.lvl1 { color: #b9c0cc; }
.badge.lvl2 { color: var(--amber); border-color: rgba(232,169,58,.4); }
.badge.lvl3 { color: #ff6b7f; border-color: rgba(200,16,46,.6); background: var(--red-soft); }

/* match cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--red); transform: translateY(-1px); }
.card.is-closed { opacity: .75; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.when { color: var(--red); font-weight: 700; font-size: 13px; letter-spacing: .01em; }
.when.big { font-size: 15px; margin-bottom: 4px; }
.card-title { font-size: 18px; font-weight: 750; margin: 8px 0 12px; }
.bar { height: 6px; border-radius: 99px; background: var(--no-soft); overflow: hidden; }
.bar-in { display: block; height: 100%; background: var(--ok); }
.card-foot { display: flex; align-items: center; gap: 12px; margin-top: 12px; font-size: 14px; }
.spacer { flex: 1; }
.stat { font-weight: 700; }
.ok { color: var(--ok); }
.no { color: var(--no); }

/* panels + tables */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
.dot.ok { background: var(--ok); } .dot.no { background: var(--no); } .dot.amber { background: var(--amber); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid rgba(42,45,51,.6); vertical-align: middle; }
tbody tr:hover { background: rgba(255,255,255,.02); }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.rowlink { cursor: pointer; }
.reason { color: #cfcac3; font-style: italic; max-width: 360px; }
tr.inactive { opacity: .55; }
.who { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.who img, .ava { width: 32px; height: 32px; border-radius: 50%; flex: none; }
.ava { display: inline-flex; align-items: center; justify-content: center; background: var(--red-soft); color: #ff6b7f; font-weight: 800; }
.empty { color: var(--muted); padding: 10px 0; }
.empty.big { text-align: center; padding: 80px 0; }
.empty .code { font-size: 64px; font-weight: 900; color: var(--red); }

/* match detail */
.match-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.desc { color: #cfcac3; margin: 10px 0 0; white-space: pre-line; max-width: 720px; }
.meta { margin-top: 10px; display: flex; gap: 10px; align-items: center; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 22px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi span { display: block; font-size: 30px; font-weight: 800; line-height: 1.1; color: var(--text); }
.kpi.ok { border-left: 3px solid var(--ok); } .kpi.no { border-left: 3px solid var(--no); } .kpi.amber { border-left: 3px solid var(--amber); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--bg2); border: 1px solid var(--line); border-radius: 99px; padding: 3px 11px; font-size: 13px; }
.act { font-weight: 650; font-size: 13px; }
.act-APPLIED { color: var(--ok); } .act-UNAVAILABLE { color: var(--no); }
.act-STEAM_SET, .act-STEAM_REMOVE { color: #8ab4ff; }

/* steam form, profile */
.steam-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.steam-form input { width: 200px; font-family: var(--mono); font-size: 13px; padding: 5px 9px; }
.profile { display: flex; align-items: center; gap: 18px; margin-bottom: 6px; }
.big-ava { width: 72px !important; height: 72px !important; border-radius: 50%; font-size: 28px; }
.profile h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* flash */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 550; }
.flash.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid rgba(62,207,110,.3); }
.flash.err { background: var(--no-soft); color: var(--no); border: 1px solid rgba(239,85,85,.3); }

/* login */
.login { display: flex; justify-content: center; padding-top: 8vh; }
.login-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 32px 28px; text-align: center; }
.login-mark { display: inline-block; background: var(--red); color: #fff; font-weight: 900; font-size: 26px; padding: 8px 14px; border-radius: 10px; margin-bottom: 16px; }
.login-card h1 { margin-bottom: 6px; }
.login-card .muted { margin: 0 0 22px; }
.dev { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line); display: grid; gap: 8px; text-align: left; }
.dev-title { color: var(--amber); font-weight: 700; font-size: 13px; }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .me span:not(.badge) { display: none; }
  .wrap { padding: 20px 16px 48px; }
  h1 { font-size: 23px; }
  .kpis { gap: 8px; }
  .kpi { padding: 10px; font-size: 11.5px; }
  .kpi span { font-size: 24px; }
  .search input, .filter { width: 100%; }
  .page-head > * { width: 100%; }
}

/* stats */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg a { padding: 6px 12px; color: var(--muted); font-size: 13px; font-weight: 650; border-right: 1px solid var(--line); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--red); color: #fff; }
.kpis.four { grid-template-columns: repeat(4, 1fr); margin-top: 0; }
.reasons { display: grid; gap: 10px; }
.reason-row { display: grid; grid-template-columns: minmax(120px, 260px) 1fr auto; gap: 14px; align-items: center; }
.reason-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reason-bar { height: 10px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.reason-bar span { display: block; height: 100%; background: var(--no); border-radius: 99px; }
.reason-num { white-space: nowrap; text-align: right; min-width: 150px; }
.rate { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.rate-bar { flex: 1; height: 6px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.rate-bar span { display: block; height: 100%; }
.rate-bar .hi { background: var(--ok); } .rate-bar .mid { background: var(--amber); } .rate-bar .lo { background: var(--no); }
.rate b { font-variant-numeric: tabular-nums; font-size: 13px; min-width: 36px; text-align: right; }
.amber-t { color: var(--amber); }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--text); }
th[data-dir="asc"]::after { content: " ▲"; } th[data-dir="desc"]::after { content: " ▼"; }
#stats .who { min-width: 160px; }
@media (max-width: 720px) {
  .kpis.four { grid-template-columns: repeat(2, 1fr); }
  .reason-row { grid-template-columns: 1fr auto; }
  .reason-bar { grid-column: 1 / -1; order: 3; }
  .reason-num { min-width: 0; }
  .seg { width: 100%; } .seg a { flex: 1; text-align: center; padding: 6px 4px; }
}

.sort-select { padding: 7px 10px; font-size: 13.5px; cursor: pointer; }
@media (max-width: 720px) { .sort-select { width: 100%; } }

/* sticky footer: page fills the window, footer sits at the bottom */
body { display: flex; flex-direction: column; }
.wrap { flex: 1 0 auto; width: 100%; }
.foot { flex-shrink: 0; width: 100%; max-width: 1180px; margin: 0 auto; padding: 16px 24px 20px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px; text-align: center; }
