:root {
    color-scheme: dark;
    --bg: #070d18;
    --panel: rgba(18, 29, 49, 0.72);
    --panel-solid: #111c30;
    --line: rgba(140, 180, 230, 0.14);
    --line-strong: rgba(140, 180, 230, 0.28);
    --text: #e8f0fb;
    --muted: #8fa3bf;
    --ice: #6ff0ec;
    --violet: #8f7bff;
    --win: #4fd1a5;
    --loss: #f0708a;
    --gold: #ffc857;
    --radius: 14px;
    --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
img { display: block; }
[hidden] { display: none !important; }

.aurora {
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(60% 45% at 15% 0%, rgba(99, 230, 226, 0.16), transparent 70%),
        radial-gradient(50% 40% at 90% 5%, rgba(143, 123, 255, 0.18), transparent 70%),
        radial-gradient(70% 50% at 50% 110%, rgba(64, 120, 220, 0.12), transparent 70%);
}

/* ---- top bar ---- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 24px;
    padding: 12px max(16px, calc((100vw - 1180px) / 2));
    background: rgba(7, 13, 24, 0.82);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; letter-spacing: 0.04em; font-weight: 300; }
.brand b { font-weight: 800; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 7px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 14px; }
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); background: rgba(99, 230, 226, 0.12); }
.region-picker { margin-left: auto; display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,0.03); }
.region-picker button { border: 0; background: none; padding: 5px 12px; border-radius: 999px; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 700; }
.region-picker button:hover { color: var(--text); }
.region-picker button.active { background: linear-gradient(90deg, var(--ice), var(--violet)); color: #06101e; }

.notice { margin: 14px auto 0; width: min(1180px, calc(100% - 32px)); padding: 10px 16px; border-radius: 10px; border: 1px solid rgba(240, 112, 138, 0.4); background: rgba(240, 112, 138, 0.1); color: #ffc2cd; font-size: 14px; }

main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 56px; flex: 1; }

/* ---- hero + search ---- */
.hero { text-align: center; padding: 26px 0 30px; }
.hero h1 { margin: 0 0 8px; font-size: clamp(30px, 5vw, 48px); font-weight: 800; letter-spacing: -0.01em; line-height: 1.1; }

.hero p { margin: 0 auto 22px; max-width: 620px; color: var(--muted); }
.search { position: relative; max-width: 560px; margin: 0 auto; }
.search form { display: flex; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel-solid); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.search form:focus-within { border-color: var(--ice); box-shadow: 0 0 0 4px rgba(99, 230, 226, 0.12); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; padding: 13px 20px; font-size: 16px; }
.search input::placeholder { color: #5f7391; }
.search button { border: 0; cursor: pointer; padding: 0 24px; font-weight: 800; color: #06101e; background: linear-gradient(90deg, var(--ice), var(--violet)); }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 10; text-align: left; background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; box-shadow: 0 18px 40px rgba(0,0,0,0.5); }
.search-results a, .search-results div.msg { display: flex; align-items: center; gap: 10px; padding: 9px 14px; }
.search-results a:hover { background: rgba(99, 230, 226, 0.08); }
.search-results .msg { color: var(--muted); font-size: 14px; }
.search-results .msg.err { color: #ffc2cd; }
.search-results .meta { margin-left: auto; color: var(--muted); font-size: 13px; }

/* ---- shared ---- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(6px); }
.section-title { display: flex; align-items: baseline; gap: 12px; margin: 30px 0 12px; }
.section-title h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: 0.02em; }
.section-title small { color: var(--muted); }
.muted { color: var(--muted); }
.tag { color: var(--muted); font-weight: 400; }
.avatar { border-radius: 50%; background: #1a2740; object-fit: cover; flex: none; }
.champ { border-radius: 8px; background: #1a2740; flex: none; }
.tier-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; border: 1px solid currentColor; background: color-mix(in srgb, currentColor 12%, transparent); white-space: nowrap; }
.tier-pill { padding-left: 7px; }
.tier-pill img { width: 17px; height: 15px; flex: none; }
/* The emblem PNGs are 1280x720 with the crest in the middle: show just that 340x264 region. */
.emblem { display: block; width: var(--w); aspect-ratio: 340 / 264; margin: 0 auto; background-repeat: no-repeat;
    background-size: calc(var(--w) * 1280 / 340) auto;
    background-position: calc(var(--w) * -472 / 340) calc(var(--w) * -207 / 340); }
.emblem-box { margin-left: auto; }
.win { color: var(--win); } .loss { color: var(--loss); }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }
.spinner { width: 26px; height: 26px; margin: 48px auto; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--ice); animation: spin .8s linear infinite; }
.spinner.small { width: 14px; height: 14px; margin: 0; border-width: 2px; display: inline-block; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn { border: 1px solid var(--line-strong); background: rgba(255,255,255,0.04); padding: 8px 16px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 14px; }
.btn:hover:not(:disabled) { border-color: var(--ice); color: var(--ice); }
.btn:disabled { opacity: .5; cursor: default; }

/* ---- podium ---- */
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: end; }
.podium a { position: relative; padding: 20px 16px 18px; text-align: center; transition: transform .15s, border-color .15s; overflow: hidden; }
.podium a:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.podium a::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent); }
.podium .place { font-size: 13px; font-weight: 800; letter-spacing: 0.1em; color: var(--accent); }
.podium .avatar { margin: 10px auto 2px; border: 2px solid var(--accent); }
.podium .emblem { margin-top: -4px; margin-bottom: -10px; }
.podium .name { font-weight: 800; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .rating { font-size: 28px; font-weight: 800; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.podium .p1 { --accent: var(--gold); padding-top: 30px; padding-bottom: 26px; }
.podium .p2 { --accent: #c5d3e6; order: -1; }
.podium .p3 { --accent: #d99a6c; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 11px 14px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line); white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover, th.sorted { color: var(--ice); }
td { padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.link { cursor: pointer; transition: background .12s; }
tbody tr.link:hover { background: rgba(99, 230, 226, 0.06); }
.num { text-align: right; }
th.num { text-align: right; }
.rank-cell { width: 54px; color: var(--muted); font-weight: 800; }
.player-cell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.player-cell .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.rating-cell { font-weight: 800; font-size: 16px; }
.champ-row { display: flex; gap: 4px; }
.bar { position: relative; height: 6px; width: 90px; border-radius: 3px; background: rgba(240, 112, 138, 0.35); overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 8px; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--win); border-radius: 3px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 16px; color: var(--muted); font-size: 14px; }

/* ---- profile ---- */
.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; padding: 22px; }
.profile-head .avatar { border: 3px solid var(--tier, var(--line-strong)); }
.profile-head h1 { margin: 0; font-size: 28px; line-height: 1.15; overflow-wrap: anywhere; }
.profile-head .sub { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 6px; color: var(--muted); font-size: 14px; }
.profile-head .rating-box { margin-left: auto; text-align: right; }
.profile-head .rating-box .big { font-size: 40px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.profile-head .rating-box .lbl { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.profile-head .actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 14px; }
.stat { padding: 14px 16px; }
.stat .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.stat .val { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .val small { font-size: 13px; font-weight: 600; color: var(--muted); }
.cols { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
.cols > * { min-width: 0; }
.spark { padding: 14px 16px 10px; }
.spark svg { width: 100%; height: 90px; display: block; }
.spark .range { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px; }
.badge { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 999px; border: 1px solid var(--line-strong); background: rgba(143, 123, 255, 0.1); font-size: 13px; font-weight: 700; cursor: default; }
.badge span { font-size: 16px; }
.champ-list { padding: 6px 0; }
.champ-list .row { display: flex; align-items: center; gap: 12px; padding: 8px 16px; }
.champ-list .row .grow { flex: 1; min-width: 0; }
.champ-list .row .n { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.champ-list .row .s { font-size: 12px; color: var(--muted); }
.champ-list .row .wr { font-weight: 800; }

/* ---- match history ---- */
.match { margin-bottom: 8px; overflow: hidden; border-left: 4px solid var(--res); }
.match.w { --res: var(--win); } .match.l { --res: var(--loss); }
.match-main { display: grid; grid-template-columns: 92px 44px minmax(0, 1fr) 104px 92px auto 40px; gap: 12px; align-items: center; padding: 10px 14px; cursor: pointer; }
.match-main:hover { background: rgba(255,255,255,0.03); }
.match .res { font-weight: 800; color: var(--res); }
.match .when { font-size: 12px; color: var(--muted); }
.match .kda b { font-size: 16px; }
.match .kda small, .match .dmg small { display: block; font-size: 12px; color: var(--muted); }
.items { display: flex; gap: 3px; }
.items img, .items i { width: 26px; height: 26px; border-radius: 5px; background: rgba(255,255,255,0.05); display: block; }
.delta { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.match-detail { border-top: 1px solid var(--line); background: rgba(0,0,0,0.18); }
.match-detail table { font-size: 13px; }
.match-detail td, .match-detail th { padding: 6px 12px; }
.match-detail tr.me { background: rgba(99, 230, 226, 0.08); }
.match-detail .team-head td { font-weight: 800; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.dmg-bar { height: 5px; width: 80px; background: rgba(255,255,255,0.08); border-radius: 3px; display: inline-block; vertical-align: middle; margin-left: 8px; overflow: hidden; }
.dmg-bar i { display: block; height: 100%; background: var(--violet); }

/* ---- about ---- */
.prose { padding: 24px 28px; max-width: 820px; margin: 0 auto; }
.prose h1 { margin-top: 0; }
.prose h2 { font-size: 18px; margin: 26px 0 8px; }
.prose p, .prose li { color: #c3d0e3; }
.tier-ladder { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tier-ladder { gap: 14px 10px; }
.tier-ladder div { text-align: center; }
.tier-ladder small { display: block; color: var(--muted); margin-top: 4px; }

.footer { border-top: 1px solid var(--line); padding: 18px max(16px, calc((100vw - 1180px) / 2)) 26px; color: var(--muted); font-size: 12px; }
.footer #status-line { font-size: 13px; margin-bottom: 8px; color: #b4c4dc; }
.footer p { margin: 0; max-width: 900px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--win); box-shadow: 0 0 8px var(--win); }
.dot.bad { background: var(--loss); box-shadow: 0 0 8px var(--loss); }

@media (max-width: 900px) {
    .cols { grid-template-columns: 1fr; }
    .match-main { grid-template-columns: 84px 44px minmax(0, 1fr) 96px 40px; }
    .match-main .dmg, .match-main .items { display: none; }
    .hide-sm { display: none; }
}
@media (max-width: 640px) {
    .topbar { flex-wrap: wrap; gap: 10px 14px; }
    .region-picker { margin-left: 0; }
    .podium { grid-template-columns: 1fr; }
    .podium .p2 { order: 0; }
    .profile-head .rating-box { margin-left: 0; text-align: left; }
    .profile-head .actions { align-items: flex-start; }
    td, th { padding: 8px 10px; }
}

/* ---- accent text: an ice-blue to azure fade ----
   Both ends are light so it stays readable on the dark background. The solid colour is the fallback
   wherever gradient text is unsupported or overridden (forced colours, high-contrast modes). */
.brand b, .hero h1 span { color: #5cc4ff; }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .brand b, .hero h1 span {
        background-image: linear-gradient(90deg, #b5efff 0%, #5cc4ff 50%, #5b8fff 100%);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
}
@media (forced-colors: active) {
    .brand b, .hero h1 span { background-image: none; -webkit-text-fill-color: currentColor; }
}
