:root {
  --bg: #0e0904;
  --panel: rgba(13, 13, 13, 0.94);
  --line: #8f8f8f;
  --text: #fff;
  --dim: #c9c9c9;
  --faint: #8c8c8c;
  --accent: #87d704;
  --gold: #ffcf3f;
  --silver: #d5dde6;
  --bronze: #d9925a;
  --font: "Segoe UI", Inter, Arial, Helvetica, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  background: var(--bg);
}
.bg-art {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(135, 215, 4, 0.16), transparent 60%),
    radial-gradient(700px 500px at 80% 110%, rgba(90, 50, 10, 0.45), transparent 55%),
    linear-gradient(180deg, #14100c, #0e0904 40%, #090704);
}
.shell { width: min(920px, calc(100% - 28px)); margin: 0 auto; }
.vh {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.site-head { padding: 18px 0 8px; }
.head-inner { display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.brand img { border-radius: 8px; }
.brand-name { font-size: 15px; letter-spacing: 0.01em; color: #ece7df; white-space: nowrap; }
.brand-name b { color: var(--accent); font-weight: 700; }
.search { margin-left: auto; flex: 0 1 240px; }
.search-input {
  width: 100%;
  border: 1px solid #3a3a3a;
  background: #161616;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
}
.search-input:focus { outline: 2px solid rgba(135, 215, 4, 0.55); border-color: transparent; }
.play-link, .mark-btn, .save-btn {
  border: 1px solid #3c3c3c;
  background: #171717;
  color: var(--text);
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.play-link:hover, .mark-btn:hover, .save-btn:hover { border-color: var(--accent); color: var(--accent); }
.marks { position: relative; }
.mark-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 260px;
  background: #121212;
  border: 1px solid #3a3a3a;
  border-radius: 10px;
  padding: 10px 12px;
  z-index: 5;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.mark-panel ul { list-style: none; margin: 0; padding: 0; }
.mark-panel a { color: var(--text); text-decoration: none; display: block; padding: 6px 0; }
.mark-panel a:hover { color: var(--accent); }
.mark-empty { margin: 0; color: var(--dim); font-size: 13px; }
.mark-panel.has-items .mark-empty { display: none; }

.lb-controls {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0 12px;
}
.seg {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
}
.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--dim);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 14px;
}
.seg-btn.is-active { background: var(--accent); color: #142000; font-weight: 700; }
.seg-btn:hover:not(.is-active) { color: white; }

.ico { width: 14px; height: 14px; display: inline-block; background: currentColor; }
.i-xp { clip-path: polygon(50% 0, 62% 38%, 100% 38%, 70% 58%, 82% 100%, 50% 74%, 18% 100%, 30% 58%, 0 38%, 38% 38%); }
.i-crystal { clip-path: polygon(50% 0, 100% 38%, 50% 100%, 0 38%); }
.i-gold { clip-path: polygon(8% 18%, 92% 18%, 100% 40%, 50% 100%, 0 40%); }

.board, .profile, .champs {
  background: var(--panel);
  border: 1px solid #6a6a6a;
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.board-head, .profile-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 8px;
}
.board-head h2, .page-title, .champs h2 { margin: 0; font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; }
.caption, .note, .kicker, .rank-name { color: var(--dim); margin: 0; }
.board-head .caption { margin-left: auto; font-size: 13px; text-align: right; }
.board-rows { list-style: none; margin: 0; padding: 0 0 8px; }
.row {
  display: grid;
  grid-template-columns: 46px 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.row.top-1 { background: linear-gradient(90deg, rgba(255, 207, 63, 0.16), transparent 70%); }
.row.top-2 { background: linear-gradient(90deg, rgba(207, 214, 221, 0.12), transparent 70%); }
.row.top-3 { background: linear-gradient(90deg, rgba(217, 146, 90, 0.14), transparent 70%); }
.pos { color: var(--faint); text-align: center; }
.medal {
  display: inline-grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  font-weight: 700;
  color: #1a1204;
}
.top-1 .medal { background: var(--gold); }
.top-2 .medal { background: var(--silver); }
.top-3 .medal { background: var(--bronze); }
.top-1 .val { color: var(--gold); }
.top-2 .val { color: var(--silver); }
.top-3 .val { color: var(--bronze); }
.rank { width: 30px; height: 30px; object-fit: contain; }
.rank.is-premium { filter: drop-shadow(0 0 4px rgba(135, 215, 4, 0.85)); }
.nick { color: var(--text); text-decoration: none; font-weight: 650; }
.nick:hover { color: var(--accent); }
.val { font-weight: 700; }
.empty { padding: 28px 16px 32px; color: var(--dim); }

.champs { margin: 16px 0 28px; padding: 12px 16px 6px; }
.champs ol { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 12px; padding: 0; }
.champ { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; background: rgba(255, 255, 255, 0.03); border-radius: 6px; }
.champ-cat { color: var(--faint); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.champ a { color: var(--text); text-decoration: none; font-weight: 700; }
.champ a:hover { color: var(--accent); }
.champ b { color: var(--accent); }

.profile { margin: 22px 0 28px; padding-bottom: 16px; }
.profile-head { align-items: flex-start; padding-top: 18px; }
.profile-head h1 { margin: 0; font-size: 32px; }
.profile .rank { width: 78px; height: 78px; }
.ident { display: flex; gap: 14px; align-items: center; padding: 0 16px 6px; }
.ident h1 { margin: 0; font-size: 30px; }
.profile-head { justify-content: space-between; }
.profile-head .kicker { letter-spacing: 0.16em; text-transform: uppercase; font-size: 12px; }
.viewer-well {
  position: relative;
  height: 360px;
  margin: 6px 16px 10px;
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 72%, rgba(255, 255, 255, 0.08), transparent 42%),
    linear-gradient(180deg, #1a1a1a, #0c0c0c 72%);
  border: 1px solid #2c2c2c;
}
.viewer-well canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.viewer-note {
  position: absolute;
  left: 12px;
  bottom: 10px;
  margin: 0;
  color: #9a9a9a;
  font-size: 12px;
  pointer-events: none;
}
.garage { margin: 8px 16px 18px; }
.garage h2, .tray h3 {
  margin: 14px 0 8px;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.hscroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.g-card {
  flex: 0 0 158px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #3a3a3a;
  background: #121212;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.g-card img, .g-fallback { width: 100%; height: 92px; object-fit: contain; background: #1b1b1b; border-radius: 4px; }
.g-fallback { display: block; }
.g-card.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.g-name { font-weight: 700; }
.g-mod { margin-left: 6px; color: var(--accent); }
.g-eq { color: var(--faint); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.save-btn { margin-left: auto; }
.save-btn.is-on { background: var(--accent); color: #142000; border-color: var(--accent); }
.pill {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(135, 215, 4, 0.16);
  color: var(--accent);
  font-size: 12px;
}
.xp, .stats { margin: 8px 16px; }
.xp-top { display: flex; justify-content: space-between; gap: 12px; }
.xp-bar { height: 8px; border-radius: 99px; background: #222; overflow: hidden; margin-top: 8px; }
.xp-bar span { display: block; height: 100%; background: linear-gradient(90deg, #43a06b, #87d704); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { background: rgba(255, 255, 255, 0.03); border: 1px solid #333; border-radius: 6px; padding: 10px 12px; }
.stats span, .stats small { display: block; color: var(--faint); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.stats b { font-size: 22px; }
.note, .back { margin: 12px 16px; }
.back a { color: var(--accent); }
.page-title { margin: 22px 0 12px; }
.site-foot {
  width: min(920px, calc(100% - 28px));
  margin: 10px auto 28px;
  color: var(--faint);
  font-size: 13px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.site-foot a { color: var(--dim); }

@media (max-width: 720px) {
  .head-inner { flex-wrap: wrap; }
  .search { order: 5; flex-basis: 100%; margin-left: 0; }
  .lb-controls { flex-direction: column; }
  .seg { overflow-x: auto; }
  .board-head { flex-wrap: wrap; }
  .board-head .caption { margin-left: 0; text-align: left; }
  .champs ol, .stats { grid-template-columns: 1fr; }
  .row { grid-template-columns: 36px 28px 1fr auto; padding-inline: 10px; }
}
