:root {
  --bg: #0a0a12;
  --panel: rgba(22, 21, 34, .72);
  --panel-solid: #161522;
  --panel-2: #1d1b2c;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --text: #f1effa;
  --muted: #9893b0;
  --accent: #c084fc;
  --accent-2: #f0abfc;
  --accent-3: #8b5cf6;
  --blurple: #5865f2;
  /* MCTiers tier colours */
  --HT1: #e8ba3a; --LT1: #d5b355;
  --HT2: #c4d3e7; --LT2: #a0a7b2;
  --HT3: #f89f5a; --LT3: #c67842;
  --HT4: #b1749a; --LT4: #8a7aa8;
  --HT5: #8f82a8; --LT5: #6f6590;
  --T1: #e8ba3a; --T2: #c4d3e7; --T3: #f89f5a; --T4: #b1749a; --T5: #8f82a8;
  --NA: #f87171; --EU: #4ade80; --ASAU: #60a5fa;
  --radius: 18px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); font: 15px/1.55 Inter, system-ui, sans-serif; }
main { flex: 1; width: 100%; max-width: 1220px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3, .logo, .rank { font-family: 'Space Grotesk', Inter, sans-serif; letter-spacing: -.02em; }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--muted); }


/* header */
.top { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px;
  padding: 12px max(16px, calc((100vw - 1220px) / 2 + 16px));
  background: rgba(10, 10, 18, .7); backdrop-filter: blur(14px) saturate(140%); border-bottom: 1px solid var(--line); }
.top-right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.logo { display: flex; align-items: center; gap: 9px; font-size: 22px; font-weight: 700; color: var(--text); text-decoration: none; }
.logo b { font-weight: 700; }
.logo-px { width: 28px; height: 28px; image-rendering: pixelated; border-radius: 4px; filter: drop-shadow(0 0 8px rgba(210, 111, 224, .55)); }
.logo span { color: var(--accent-2); }
.logo span b { color: var(--text); }
@keyframes float { 50% { transform: translateY(-3px) rotate(4deg); } }
.nav { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); }
.nav a { display: flex; align-items: center; gap: 8px; padding: 7px 15px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; transition: color .18s, background .18s; }
.nav a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s cubic-bezier(.34, 1.56, .64, 1); }
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.nav a:hover svg { transform: translateY(-1px) rotate(-8deg) scale(1.1); }
.nav a[aria-current="page"] { color: var(--text); background: rgba(192, 132, 252, .16); }
.nav a[aria-current="page"] svg { color: var(--accent-2); }
/* Discord button next to the search */
.discord-btn { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 12px; overflow: hidden; flex: none;
  color: #fff; font-weight: 700; font-size: 14px; text-decoration: none; background: var(--blurple);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12) inset, 0 6px 18px -8px rgba(88, 101, 242, .9);
  transition: transform .2s cubic-bezier(.2, .8, .2, 1.4), box-shadow .25s, filter .2s; }
.discord-btn svg { width: 19px; height: 19px; transition: transform .3s; }
.discord-btn::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%); transform: translateX(-120%); }
.discord-btn:hover, .discord-btn:focus-visible { transform: translateY(-2px) scale(1.04); filter: brightness(1.1); outline: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .2) inset, 0 0 0 4px rgba(88, 101, 242, .25), 0 12px 28px -8px rgba(88, 101, 242, 1); }
.discord-btn:hover svg, .discord-btn:focus-visible svg { animation: wiggle .5s ease; }
.discord-btn:hover::after, .discord-btn:focus-visible::after { transform: translateX(120%); transition: transform .6s ease; }
.discord-btn:active { transform: translateY(0) scale(.98); }
.discord-btn[aria-current="page"] { box-shadow: 0 0 0 2px rgba(255, 255, 255, .35) inset, 0 8px 22px -8px rgba(88, 101, 242, 1); }
@keyframes wiggle { 25% { transform: rotate(-14deg) scale(1.15); } 50% { transform: rotate(10deg) scale(1.15); } 75% { transform: rotate(-6deg); } }
.search { display: flex; align-items: center; gap: 8px; width: clamp(150px, 20vw, 280px); padding: 8px 12px;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 12px; transition: border-color .2s, box-shadow .2s; }
.search:focus-within { border-color: rgba(192, 132, 252, .6); box-shadow: 0 0 0 4px rgba(192, 132, 252, .12); }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; flex: none; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: inherit; }
kbd { font: 11px Inter, sans-serif; color: var(--muted); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; }

/* pages */
.page { animation: in .25s cubic-bezier(.22, 1, .36, 1) both; }

/* fast entrance: rows rise in with a tiny stagger; rows further down animate as they scroll into view */
.reveal { opacity: 0; transform: translateY(10px); }
.reveal.in { animation: rise .32s cubic-bezier(.22, 1, .36, 1) both; animation-delay: calc(var(--i, 0) * 14ms); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
/* search hit: the row glows once before its profile opens */
.flash { animation: flash .7s ease !important; opacity: 1 !important; transform: none !important; }
@keyframes flash { 0%, 100% { box-shadow: none; } 30% { box-shadow: inset 0 0 0 2px var(--accent), 0 0 24px rgba(192, 132, 252, .55); background: rgba(192, 132, 252, .22); } }
@keyframes in { from { opacity: 0; transform: translateY(8px); } }
.hero { text-align: center; padding: 48px 0 28px; }
.hero h1 { margin: 0; font-size: clamp(34px, 6vw, 56px); line-height: 1.05; }
.hero p { margin: 10px 0 0; color: var(--muted); }
.accent { color: var(--accent); }
#page-tiers { padding-top: 32px; }

/* leaderboard */

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.head { width: 24px; height: 24px; border-radius: 5px; image-rendering: pixelated; background: var(--panel-2); flex: none; }
.name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peak { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }

/* MCTiers-style row: slanted banner (rank + skin bust), then name / region / tier */
.row { --b: #26233a; display: grid; grid-template-columns: 210px minmax(0, 1fr) auto auto; grid-template-rows: 100%; align-items: center; gap: 16px; height: 68px; padding-right: 16px;
  border-radius: 14px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); cursor: pointer; transition: border-color .15s, transform .15s, background .15s; }
.row:hover, .row:focus-visible { border-color: rgba(192, 132, 252, .45); background: var(--panel-2); transform: translateX(3px); outline: none; }
.banner { position: relative; align-self: stretch; overflow: hidden; background: var(--b); clip-path: polygon(0 0, 100% 0, 90% 100%, 0 100%); }
.banner .rank { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); z-index: 1;
  font: italic 700 30px 'Space Grotesk', sans-serif; color: rgba(255, 255, 255, .85); text-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.bust { position: absolute; left: 96px; bottom: 0; height: 66px; image-rendering: pixelated; filter: drop-shadow(-3px 0 6px rgba(0, 0, 0, .35)); transition: transform .3s cubic-bezier(.22, 1, .36, 1); }
.row:hover .bust { transform: translateY(-2px) scale(1.06); }
.row.lead { height: 84px; }
.row.lead .banner .rank { font-size: 40px; color: #fff; }
.row.lead .bust { left: 110px; height: 82px; }
.lead1 { --b: #e3ad2d; }
.lead2 { --b: #9eabbd; }
.lead3 { --b: #c2703a; }
.row .name { font-size: 17px; }

/* tiers page: all five tiers side by side, spreadsheet style */
.sheet-wrap { overflow-x: auto; border: 1px solid var(--line-2); border-radius: 14px; background: var(--panel-solid); }
.tier-sheet { display: grid; grid-template-columns: repeat(5, minmax(170px, 1fr)); }
.tcol { border-right: 1px solid var(--line); min-width: 0; }
.tcol:last-of-type { border-right: 0; }
.th { position: sticky; top: 0; display: flex; align-items: center; justify-content: center; gap: 9px; height: 62px; padding: 0 14px;
  font: 700 22px "Space Grotesk", sans-serif; color: var(--c); background: color-mix(in srgb, var(--c) 24%, var(--panel-2)); border-bottom: 1px solid var(--line-2); }
.th svg { width: 24px; height: 24px; fill: currentColor; filter: drop-shadow(0 0 8px color-mix(in srgb, var(--c) 60%, transparent)); }
.th .count { margin-left: 2px; }
.count { font: 700 11px Inter, sans-serif; padding: 1px 7px; border-radius: 6px; background: rgba(255, 255, 255, .08); color: var(--muted); }

/* player row: region-coloured left edge, HT lighter than LT, chevrons; hovering slides the region tag in */
.td { --rc: var(--muted); display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 10px 0 0; cursor: pointer; font-size: 14px;
  background: rgba(255, 255, 255, .025); border-left: 3px solid var(--rc); border-bottom: 1px solid var(--line); transition: background .3s ease; }
.td.ht { background: rgba(255, 255, 255, .085); }
.td.NA { --rc: var(--NA); } .td.EU { --rc: var(--EU); } .td.ASAU { --rc: var(--ASAU); }
/* region tag: the box widens with an ease-out curve, the label fades and glides in just behind it */
.td .rg { flex: none; align-self: stretch; display: grid; place-items: center; width: 0; overflow: hidden;
  background: color-mix(in srgb, var(--rc) 28%, #12111c); transition: width .4s cubic-bezier(.65, 0, .35, 1); will-change: width; }
.td .rg span { font: 900 13px Poppins, sans-serif; letter-spacing: .02em; white-space: nowrap; color: var(--rc);
  opacity: 0; transform: translateX(-10px) scale(.9); transition: opacity .25s ease, transform .4s cubic-bezier(.65, 0, .35, 1); }
.td[data-ign]:hover, .td[data-ign]:focus-visible { background: rgba(192, 132, 252, .14); outline: none; }
.td[data-ign]:hover .rg, .td[data-ign]:focus-visible .rg { width: 46px; }
.td.ASAU[data-ign]:hover .rg, .td.ASAU[data-ign]:focus-visible .rg { width: 58px; }
.td[data-ign]:hover .rg span, .td[data-ign]:focus-visible .rg span { opacity: 1; transform: none; transition: opacity .3s ease .12s, transform .4s cubic-bezier(.65, 0, .35, 1); }
/* small angled 3D skin, cropped to head + upper body */
.td .ava { flex: none; width: 28px; height: 28px; margin-left: 6px; }
.td .ava img { display: block; width: 28px; height: 28px; image-rendering: pixelated; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5));
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); transition: transform .45s cubic-bezier(.22, 1, .36, 1); }
.td[data-ign]:hover .ava img { transform: translateY(-1px) scale(1.12); }
.td .name { flex: 1; min-width: 0; }
.td .chev { flex: none; width: 18px; height: 18px; color: rgba(255, 255, 255, .35); }
.td.ht .chev { color: rgba(255, 255, 255, .55); }
.td.empty { display: block; padding-left: 12px; color: var(--muted); cursor: default; line-height: 40px; border-left-color: transparent; }
.sheet-empty { grid-column: 1 / -1; margin: 0; padding: 30px 14px; text-align: center; color: var(--muted); border-top: 1px solid var(--line); }
.sheet-empty a { color: var(--accent); font-weight: 600; }
.tier { --c: var(--muted); display: inline-block; min-width: 48px; padding: 3px 9px; border-radius: 8px; text-align: center; font: 700 13px 'Space Grotesk', sans-serif;
  color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); }
.tier.none { font-weight: 500; }
.region { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; color: var(--rc, var(--muted)); background: color-mix(in srgb, var(--rc, var(--muted)) 15%, transparent); }
.region.NA { --rc: var(--NA); } .region.EU { --rc: var(--EU); } .region.ASAU { --rc: var(--ASAU); }
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); background: var(--panel); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty-state a { color: var(--accent); font-weight: 600; }

/* discord page */
.discord-card { position: relative; max-width: 560px; margin: 48px auto 24px; padding: 44px 28px 30px; text-align: center; border-radius: 26px; overflow: hidden;
  background: var(--panel-solid); border: 1px solid rgba(88, 101, 242, .35);
  box-shadow: 0 30px 80px -30px rgba(88, 101, 242, .55); }
.orbit { position: absolute; left: 50%; top: 92px; width: 0; height: 0; }
.orbit span { position: absolute; left: 50%; top: 50%; border: 1px solid rgba(88, 101, 242, .35); border-radius: 50%; transform: translate(-50%, -50%); animation: ring 3.6s ease-out infinite; }
.orbit span:nth-child(2) { animation-delay: 1.2s; } .orbit span:nth-child(3) { animation-delay: 2.4s; }
@keyframes ring { from { width: 90px; height: 90px; opacity: .9; } to { width: 360px; height: 360px; opacity: 0; } }
.server-icon { position: relative; display: block; width: 104px; height: 104px; margin: 0 auto; border-radius: 30px; object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 14px 40px -8px rgba(88, 101, 242, .8); animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-3deg); } }
.discord-card h1 { margin: 22px 0 6px; font-size: 30px; }
.d-stats { display: flex; justify-content: center; gap: 18px; margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.d-stats b { color: var(--text); }
.dot { display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; background: #80848e; }
.dot.on { background: #23a55a; box-shadow: 0 0 0 0 rgba(35, 165, 90, .6); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(35, 165, 90, 0); } }
.join { position: relative; display: inline-flex; align-items: center; gap: 10px; padding: 14px 30px; border-radius: 14px; overflow: hidden;
  background: var(--blurple); color: #fff; font-weight: 700; font-size: 16px; text-decoration: none; transition: transform .2s, box-shadow .2s; }
.join svg { width: 22px; height: 22px; }
.join:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 16px 34px -10px rgba(88, 101, 242, .9); }

/* profile */
dialog { width: min(560px, calc(100vw - 32px)); padding: 26px; border: 1px solid var(--line-2); border-radius: 22px; background: var(--panel-solid); color: var(--text); }
dialog[open] { animation: pop .25s ease both; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
dialog::backdrop { background: rgba(5, 5, 10, .7); backdrop-filter: blur(4px); }
.close { position: absolute; top: 10px; right: 14px; border: 0; background: none; font-size: 26px; color: var(--muted); }
.p-body { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 22px; align-items: center; }
#p-skin { width: 130px; image-rendering: pixelated; filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .55)); }
#p-name { font-size: 28px; margin: 0 0 8px; }
.p-badges { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.p-badges .tier { font-size: 16px; padding: 5px 12px; }
.p-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0 0; }
.p-stats div { background: var(--panel-2); border-radius: 12px; padding: 9px 11px; }
.p-stats dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.p-stats dd { margin: 2px 0 0; font-weight: 700; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 10px 16px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--line-2); transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.foot { margin-top: 48px; padding: 22px 16px 30px; text-align: center; border-top: 1px solid var(--line); font-size: 13px; }
.foot p { margin: 2px 0; }

@media (max-width: 920px) {
  .top { grid-template-columns: auto 1fr; gap: 10px; }
  .nav { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .nav a { flex: 1; justify-content: center; }
  .search { width: auto; flex: 1; }
  .top-right { min-width: 0; }
  kbd { display: none; }
  .hero { padding: 32px 0 20px; }
  .discord-btn { padding: 9px 11px; }
  .discord-btn span { display: none; }
}
@media (max-width: 520px) {
  .row { grid-template-columns: 128px minmax(0, 1fr) auto; gap: 10px; height: 58px; padding-right: 10px; }
  .row .region { display: none; }
  .row .name { font-size: 15px; }
  .banner .rank { left: 10px; font-size: 22px; }
  .bust { left: 56px; height: 56px; }
  .row.lead { height: 70px; }
  .row.lead .banner .rank { font-size: 30px; }
  .row.lead .bust { left: 62px; height: 68px; }
  .p-body { grid-template-columns: 1fr; text-align: center; }
  .p-badges { justify-content: center; }
  #p-skin { width: 100px; margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .reveal { opacity: 1; transform: none; } }
