:root {
    --bg: #0e1116;
    --surface: #161b22;
    --surface-2: #1d242e;
    --border: #2a323d;
    --border-strong: #3a444f;
    --text: #e6edf3;
    --text-muted: #9aa7b4;
    --text-dim: #6b7682;
    --accent: #4ade80;
    --accent-soft: rgba(74, 222, 128, 0.12);
    --gold: #e8b23a;
    --blue: #4f9dda;
    --purple: #7c5cff;
    --up: #3fb984;
    --down: #e5564b;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: "SFMono-Regular", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.15; }
.dim { color: var(--text-dim); }
.muted { color: var(--text-muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }

/* ---- Shell ---- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 28px;
    padding: 14px 28px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface), var(--bg));
    position: sticky; top: 0; z-index: 50;
}
.brand { font-weight: 800; font-size: 1.25rem; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand-mark { font-size: 1.4rem; }
.brand-accent { color: var(--accent); }
.topnav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-link {
    color: var(--text-muted); padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 0.95rem;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-link.active { color: var(--accent); background: var(--accent-soft); }

.lang-switch { margin-left: auto; display: inline-flex; gap: 2px; border: 1px solid var(--border-strong); border-radius: 999px; padding: 3px; }
.lang-switch .lang {
    color: var(--text-muted); padding: 4px 11px; border-radius: 999px; font-weight: 700; font-size: 0.8rem; letter-spacing: 0.03em;
}
.lang-switch .lang:hover { color: var(--text); text-decoration: none; }
.lang-switch .lang.active { color: var(--accent); background: var(--accent-soft); }

.content { width: 100%; max-width: 1100px; margin: 0 auto; padding: 32px 24px 56px; flex: 1; }
.footer {
    border-top: 1px solid var(--border); padding: 20px 28px; max-width: 1100px; margin: 0 auto; width: 100%;
    display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--text-muted); font-size: 0.85rem;
}

/* ---- Cards & layout ---- */
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 820px) { .cols-2, .cols-3 { grid-template-columns: 1fr; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.eyebrow { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; }
h1 { font-size: 2rem; margin: 4px 0; }
/* <FocusOnNavigate Selector="h1"> focuses the heading after each navigation (a11y), which would
   otherwise draw the browser's focus ring around it. Suppress it just for the heading — interactive
   elements (buttons, links, inputs) keep their focus outline. */
h1:focus, h1:focus-visible { outline: none; }

/* ---- Hero ---- */
.hero {
    border-radius: var(--radius); border: 1px solid var(--border); padding: 40px;
    background: radial-gradient(80% 130% at 15% 0%, rgba(74,222,128,0.14), transparent 60%), var(--surface);
    margin-bottom: 28px;
}
.hero h1 { font-size: 2.6rem; max-width: 18ch; }
.hero p { color: var(--text-muted); max-width: 60ch; }

/* ---- Stat cards ---- */
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat-num { font-size: 1.8rem; font-weight: 800; line-height: 1.1; }
.stat-num.mono { font-family: var(--mono); }
.stat-lbl { color: var(--text-muted); font-size: 0.88rem; margin-top: 4px; }
.stat-sub { color: var(--text-dim); font-size: 0.78rem; margin-top: 2px; }

/* ---- Buttons & inputs ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 10px; border: 1px solid var(--border-strong);
    background: var(--surface-2); color: var(--text); font-weight: 600; cursor: pointer; font-size: 0.95rem;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); color: #07120b; border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 0.82rem; border-radius: 8px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.input {
    width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border-strong);
    background: var(--bg); color: var(--text); font-size: 0.95rem;
}
.input:focus { outline: none; border-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }

/* ---- Tables ---- */
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.data th { color: var(--text-dim); font-weight: 600; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; }
table.data td.num, table.data th.num { text-align: right; }
table.data tbody tr:hover { background: var(--surface-2); }
.rank-pos { font-weight: 800; color: var(--text-dim); width: 1%; white-space: nowrap; }
.rank-1 { color: var(--gold); }
.rank-2 { color: #cdd5dd; }
.rank-3 { color: #cd7f32; }

/* ---- Badges & chips ---- */
.badge {
    display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 700;
    padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-muted);
}
.badge-ok { color: var(--up); border-color: rgba(63,185,132,0.4); background: rgba(63,185,132,0.1); }
.badge-off { color: var(--down); border-color: rgba(229,86,75,0.4); background: rgba(229,86,75,0.1); }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin: 12px 0; border: 1px solid var(--border-strong); }
.alert-ok { color: var(--up); border-color: rgba(63,185,132,0.4); background: rgba(63,185,132,0.1); }
.alert-err { color: var(--down); border-color: rgba(229,86,75,0.4); background: rgba(229,86,75,0.1); }

.dot { width: 9px; height: 9px; border-radius: 999px; display: inline-block; }
.dot-on { background: var(--up); box-shadow: 0 0 8px var(--up); }
.dot-off { background: var(--down); }

/* ---- Rank badge ---- */
.rank-badge {
    display: inline-flex; align-items: center; white-space: nowrap; vertical-align: middle;
    font-size: 0.64rem; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase;
    padding: 1px 7px; border-radius: 999px; color: var(--tier, var(--accent));
    border: 1px solid color-mix(in srgb, var(--tier, var(--accent)) 45%, transparent);
    background: color-mix(in srgb, var(--tier, var(--accent)) 14%, transparent);
}

/* ---- Avatars / player chips ---- */
.avatar { border-radius: 6px; vertical-align: middle; image-rendering: pixelated; }
.player-chip { display: inline-flex; align-items: center; gap: 8px; }

/* ---- Rank tiers ---- */
.tier-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tier { background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--tier, var(--accent)); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; }
.tier-name { font-size: 1.3rem; font-weight: 800; color: var(--tier, var(--accent)); }
.tier-price { font-size: 1.9rem; font-weight: 800; margin: 8px 0 2px; }
.tier-per { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); margin-left: 3px; }
.tier-annual { font-size: 0.82rem; margin: 0 0 16px; }
.tier ul { padding-left: 18px; margin: 0 0 18px; color: var(--text-muted); }
.tier li { margin: 5px 0; }
/* Push the buy button to the bottom so it lines up across cards with different perk counts. */
.tier .btn { margin-top: auto; }

/* ---- Checkout ---- */
.checkout-grid { display: grid; gap: 24px; grid-template-columns: 1.3fr 1fr; align-items: start; }
@media (max-width: 820px) { .checkout-grid { grid-template-columns: 1fr; } }

.demo-banner {
    background: rgba(232,178,58,0.1); border: 1px solid rgba(232,178,58,0.4); color: var(--text);
    border-radius: var(--radius-sm); padding: 12px 14px; font-size: 0.88rem; margin-bottom: 18px;
}

.pay-methods { display: flex; gap: 10px; margin-bottom: 18px; }
.pay-method {
    flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border-strong);
    background: var(--surface-2); color: var(--text-muted); font-weight: 600; cursor: pointer; font-size: 0.92rem;
}
.pay-method:hover { color: var(--text); }
.pay-method.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.field-row { display: flex; gap: 14px; }

.check-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; margin-top: 2px; }
.check-ok { color: var(--up); }
.check-bad { color: var(--down); }

.summary { position: sticky; top: 88px; }
.summary-tier { margin: 6px 0 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.summary-tier .tier-name { font-size: 1.4rem; }
.summary-perks { padding-left: 18px; margin: 0 0 16px; color: var(--text-muted); font-size: 0.9rem; }
.summary-perks li { margin: 4px 0; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 0.95rem; }
.summary-row.total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 12px; font-weight: 800; font-size: 1.15rem; }

.receipt { margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 14px; }
.receipt-icon { font-size: 2.4rem; line-height: 1; margin-bottom: 6px; }

/* ---- Match detail / timeline ---- */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { display: grid; grid-template-columns: 52px 24px 1fr; align-items: center; gap: 10px; padding: 8px 0; }
.tl-item + .tl-item { border-top: 1px solid var(--border); }
.tl-time { color: var(--text-dim); font-size: 0.82rem; text-align: right; }
.tl-icon { text-align: center; }
.tl-text { color: var(--text); }
.tl-start .tl-text, .tl-end .tl-text { color: var(--text-muted); font-weight: 700; }
.tl-envdeath .tl-text { color: var(--text-muted); }
.tl-left .tl-text { color: var(--down); }

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    background: #b3261e; color: #fff; padding: 10px 16px;
}
#blazor-error-ui .reload, #blazor-error-ui .dismiss { color: #fff; cursor: pointer; margin-left: 10px; }
