:root {
  color-scheme: dark;
  --page: #141414;
  --panel: #181818;
  --surface: #1c1c1c;
  --surface-2: #242424;
  --ink: #e6e6ea;
  --ink-2: #b4b4bf;
  --muted: #8b8b98;
  --grid: #2b2c33;
  --axis: #3a3b44;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #7fa8e8;
  --c1: #7fa8e8;
  --c2: #eea47a;
  --c3: #5ec9b0;
  --c4: #a99ce8;
  --c5: #d9be6c;
  --c6: #e08fb4;
  --c7: #9fcf80;
  --c8: #ec8585;
  --neutral: #6d6e7a;
  --gold: #785a28;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "title tabs home";
  align-items: end;
  column-gap: 24px;
  padding: 14px 20px 0;
  border-bottom: 1px solid var(--border);
}

h1 { grid-area: title; align-self: baseline; font-size: 17px; font-weight: 600; margin: 0 0 14px; }

.tabs { grid-area: tabs; display: flex; gap: 4px; margin-bottom: -1px; }
.tabs button {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  padding: 7px 14px 8px;
  font: inherit;
  cursor: pointer;
}
.mouse .tabs button:hover { background: var(--surface-2); }
.tabs button[aria-selected="true"] {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--border);
}

main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  container-type: size;
  background: var(--panel);
  padding: 16px 20px 32px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(max(520px, calc((100% - 16px) / 2)), 1fr));
  gap: 16px;
}

.card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: 0px;
  padding: 14px 16px 10px;
  min-width: 0;
}
.card h2 { font-size: 14px; font-weight: 600; margin: 0; }
.explanation { max-width: 78ch; margin: 0 auto; padding: 18px 24px 8px; }
.explanation h2 { font-size: 15px; margin-top: 20px; }
.explanation h2:first-child { margin-top: 0; }
.explanation p { color: var(--ink-2); margin: 6px 0 12px; }
.card figcaption p { color: var(--muted); font-size: 12px; margin: 2px 0 0; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 8px 0 2px;
  font-size: 12px;
  color: var(--ink-2);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.legend.picking span:not(.picked) { opacity: 0.4; }
.legend.picking span.picked { color: var(--ink); }
.legend.focusing span:not(.focus) { opacity: 0.4; }
.legend span.focus { color: var(--ink); }
.legend i { display: inline-block; width: 16px; height: 0; border-top: 2px solid; }
.legend i.band { height: 8px; border: 0; border-radius: 2px; }

.plot { position: relative; height: 290px; }
.plot .layer { position: absolute; inset: 0; }
.xcaption { text-align: center; color: var(--muted); font-size: 11px; margin-top: -2px; }

.crosshair {
  position: absolute;
  top: 0;
  width: 1px;
  background: var(--axis);
  pointer-events: none;
}
.tooltip {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.tooltip b { display: block; color: var(--ink); margin-bottom: 2px; }
.tooltip div { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tooltip div i { width: 8px; height: 8px; border-radius: 50%; }
.tooltip div.focus { color: var(--ink); font-weight: 600; }
.focusing .ct-series:not(.focus) { opacity: 0.25; }
.ct-series { transition: opacity 120ms; }
.tooltip div em { font-style: normal; color: var(--ink); margin-left: auto; padding-left: 12px; }

.ct-label { color: var(--muted); fill: var(--muted); font-size: 11px; }
.ct-label.ct-vertical.ct-end { justify-content: flex-end; text-align: right; }
.ct-grid { stroke: var(--grid); stroke-dasharray: none; }

.champion-layout:not([hidden]) {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.sidebar {
  position: sticky;
  top: 16px;
  max-height: 100cqh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: 0px;
  padding: 10px;
}
.icon-filter { display: flex; justify-content: space-between; gap: 4px; }
.icon-filter button {
  flex: 1;
  display: flex;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 0;
  cursor: pointer;
}
.mouse .icon-filter button:hover { background: var(--surface-2); }
.icon-filter button[aria-pressed="true"] { background: var(--surface-2); border-color: var(--axis); }
.icon-filter img { width: 28px; height: 28px; filter: grayscale(1); opacity: 0.55; }
.icon-filter button[aria-pressed="true"] img { filter: none; opacity: 1; }
.mouse .icon-filter button:hover img { filter: none; opacity: 1; }
.icon-filter .text { color: var(--ink-2); font-size: 12px; }
.champ-list { list-style: none; margin: 0; padding: 0; --row: 34px; }
#selected-list { min-height: calc(8 * var(--row)); }
#champion-list { overflow-y: auto; flex: 1; min-height: 0; scrollbar-gutter: stable; }
.selected {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.selected-head { display: flex; align-items: center; justify-content: space-between; }
.selected-head h2 { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 0 0 6px; }
.selected .clear {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--axis);
  border-radius: 999px;
  padding: 1px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.mouse .selected .clear:hover { color: var(--ink); background: var(--surface-2); }
.champ-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--row);
  padding: 3px 6px;
  border-left: 3px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
}
.champ-list li[hidden] { display: none; }
.mouse .champ-list li:hover { background: var(--surface-2); }
.champ-list li[aria-selected="true"] { background: var(--surface-2); color: var(--ink); }
.champ-list img { width: 28px; height: 28px; border-radius: 4px; flex: none; }
.champ-list .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.champ-list .tags { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: none; }
.champ-list .tags img { width: 18px; height: 18px; border-radius: 0; opacity: 0.75; }
.champ-list .tags .text { color: var(--muted); font-size: 11px; }
input {
  background: var(--page);
  color: var(--ink);
  border: 1px solid var(--axis);
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.smooth { color: var(--ink-2); }
.smooth input { width: 56px; margin: 0 4px; }
.smooth input[type="checkbox"] { width: auto; margin: 0 4px 0 0; }
.chart-option { display: block; margin-top: 8px; font-size: 13px; }
.note { color: var(--muted); font-size: 12px; margin: 0; }
.kit-source { border: 0; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column;
  gap: 6px; }
.kit-source[hidden] { display: none; }
.kit-source legend { color: var(--ink-2); font-size: 13px; padding: 0; margin-bottom: 6px; }
.segmented { display: inline-flex; border: 1px solid var(--axis); border-radius: 999px;
  overflow: hidden; align-self: flex-start; }
.segmented label { position: relative; padding: 3px 12px; font-size: 13px; color: var(--muted); cursor: pointer; }
.segmented label + label { border-left: 1px solid var(--axis); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { background: var(--surface-2); color: var(--ink); }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }

@media (max-width: 600px), (max-height: 500px) {
  main, header { padding-left: 16px; padding-right: 16px; }
  .grid { grid-template-columns: 1fr; }
  .champion-layout:not([hidden]) { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  #selected-list { min-height: 0; }
  #champion-list { flex: none; max-height: calc(6 * var(--row)); }
  .sidebar:not(.filtering) #champion-list { display: none; }
  .plot { height: 240px; }
}

.joker {
  position: fixed;
  right: 12px;
  bottom: 12px;
  pointer-events: none;
  z-index: 3;
}

a { color: var(--accent); }
@media (hover: hover) { a:hover { color: var(--ink); } }
.home-link { grid-area: home; align-self: baseline; margin: 0 0 14px; color: var(--ink-2);
  text-decoration: none; }

@media (max-width: 720px) {
  header { grid-template-columns: 1fr auto; grid-template-areas: "title home" "tabs tabs"; }
}
.links { margin: 0; padding-left: 20px; }
.links li + li { margin-top: 6px; }
