:root {
  --bg: #090c13;
  --panel: #0d111a;
  --card: #0b0e16;
  --line: #1b2130;
  --text: #f1f3f8;
  --muted: #8592ab;
  --dim: #56617a;
  --gold: #f0c65a;
  --green: #3ddc84;
  --red: #ff6b6b;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; color: var(--text); font-family: "Inter", system-ui, sans-serif; font-size: 15px;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px) 0 0 / 40px 40px,
    radial-gradient(1000px 500px at 20% -10%, rgba(80,110,190,.12), transparent 70%),
    var(--bg);
  min-height: 100vh;
}
.page { max-width: 1120px; margin: 0 auto; padding: 22px 22px 40px; }

h1, h2, .rankname, .pos, .lead strong, .name {
  font-family: "Barlow Condensed", sans-serif; text-transform: uppercase; margin: 0;
}
h1 { font-size: clamp(52px, 9vw, 92px); font-weight: 800; line-height: .95; letter-spacing: .005em; }
h2 { font-size: 34px; font-weight: 700; line-height: 1; letter-spacing: .01em; }
.eyebrow { margin: 0 0 8px; font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.label { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.tagline { margin: 10px 0 0; color: var(--muted); font-size: 15px; }

.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; }
.lastupdate { border: 1px solid var(--line); background: rgba(13,17,26,.7); padding: 12px 18px 14px; min-width: 190px; text-align: right; }
.lastupdate strong { display: block; margin-top: 6px; font-size: 15px; font-weight: 600; }

.error { border: 1px solid var(--red); background: rgba(255,107,107,.08); color: var(--red); padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }

.panel { border: 1px solid var(--line); background: var(--panel); padding: 26px 28px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 26px; }
.tag { border: 1px solid rgba(61,220,132,.5); color: var(--green); font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 5px 9px; background: rgba(61,220,132,.06); }

.lead { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.lead strong { font-size: 30px; font-weight: 700; color: var(--text); line-height: 1; }
.lead.has strong { color: var(--gold); }
.dash { display: inline-block; width: 22px; height: 4px; background: var(--gold); border-radius: 2px; vertical-align: middle; }

/* Player cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.card { position: relative; border: 1px solid var(--line); background: var(--card); padding: 20px 20px 18px; min-height: 168px; }
.card.first { border-color: rgba(240,198,90,.55); box-shadow: inset 0 0 0 1px rgba(240,198,90,.08); }
.card.done { border-color: var(--green); }
.card-top { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 52px; height: 52px; flex: none; border-radius: 50%; background: #151b29 center/cover;
  border: 2px solid var(--line); display: grid; place-items: center; font-weight: 700; color: var(--muted);
}
.first .avatar { border-color: var(--gold); }
.who { min-width: 0; flex: 1; }
.name { font-size: 26px; font-weight: 700; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.riotid { display: block; margin-top: 4px; font-size: 12px; color: var(--dim); }
.pos { font-size: 40px; font-weight: 800; color: var(--dim); line-height: 1; }
.first .pos { color: var(--gold); }

.rankline { display: flex; align-items: baseline; justify-content: space-between; margin: 20px 0 14px; gap: 10px; }
.rankname { font-size: 30px; font-weight: 700; line-height: 1; }
.rankname[data-tier="IRON"] { color: #8b8f98; } .rankname[data-tier="BRONZE"] { color: #c1875a; }
.rankname[data-tier="SILVER"] { color: #b7c3d0; } .rankname[data-tier="GOLD"] { color: #f0c65a; }
.rankname[data-tier="PLATINUM"] { color: #4fc3bb; } .rankname[data-tier="EMERALD"] { color: var(--green); }
.rankname[data-tier="DIAMOND"] { color: #6fa8ff; } .rankname[data-tier="MASTER"],
.rankname[data-tier="GRANDMASTER"], .rankname[data-tier="CHALLENGER"] { color: #c084fc; }
.lp { font-size: 15px; font-weight: 600; color: var(--text); }
.lp small { color: var(--muted); font-weight: 500; }

.stats { display: flex; gap: 18px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.stats b { display: block; margin-top: 3px; font-size: 14px; color: var(--text); font-weight: 600; }
.up { color: var(--green) !important; } .down { color: var(--red) !important; }

/* Race progress */
.progress { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.progress-head { display: flex; justify-content: space-between; margin-bottom: 18px; }
.progress-row { display: flex; align-items: center; gap: 22px; }
.rail { position: relative; flex: 1; height: 2px; background: var(--line); margin: 0 14px; }
.rail-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), rgba(240,198,90,.15)); transition: width 1.2s cubic-bezier(.2,.8,.2,1); }
.marker {
  position: absolute; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #10131b; background: #e6e9f0;
  border: 2px solid var(--bg); transition: left 1.2s cubic-bezier(.2,.8,.2,1);
}
.marker.m1 { background: var(--gold); z-index: 3; }
.goal { border: 1px dashed var(--dim); color: var(--dim); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding: 14px 16px; }
.goal.reached { border-color: var(--green); color: var(--green); }

/* Bottom panels */
.bottom { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; margin-top: 16px; }
.bottom h2 { font-size: 34px; }
.history { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow: auto; }
.history li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.history li:last-child { border-bottom: 0; }
.history .when { display: block; margin-top: 2px; color: var(--dim); font-size: 12px; }
.history .delta { font-weight: 700; white-space: nowrap; }
.history .empty { display: block; text-align: center; color: var(--dim); font-size: 13px; padding: 70px 0; border: 0; }
.rules { margin: 22px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 14px; line-height: 2; }
.rules li::before { content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 12px 2px 4px; border-radius: 50%; background: var(--dim); }

footer { margin-top: 26px; color: var(--dim); font-size: 10.5px; line-height: 1.6; max-width: 760px; }

@media (max-width: 760px) {
  .bottom { grid-template-columns: 1fr; }
  .top { flex-direction: column; }
  .lastupdate { text-align: left; }
  .panel { padding: 22px 18px; }
  h2 { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) { .rail-fill, .marker { transition: none; } }
