/* Colours live here only, so a light theme is a second set of values. */
:root {
  color-scheme: dark;
  --page: #0d1319;
  --panel: #151d27;
  --panel-hi: #1b2531;
  --seam: #243040;
  --text: #e6ebf1;
  --muted: #8593a5;
  --win: #46c2a8;
  --loss: #e5687d;
  --flag: #e8b04a;
  --flag-bg: #2b2412;
  --focus: #7db4ff;

  --tier-iron: #8a7f78;
  --tier-bronze: #b27a49;
  --tier-silver: #a3b0bd;
  --tier-gold: #d9ae3f;
  --tier-platinum: #4fb8ad;
  --tier-emerald: #3fbf7f;
  --tier-diamond: #6f93f2;
  --tier-master: #b673e6;
  --tier-grandmaster: #e4636d;
  --tier-challenger: #72d5f2;

  --sans: "Barlow", system-ui, sans-serif;
  --display: "Barlow Condensed", "Barlow", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 400 15px/1.4 var(--sans);
  font-variant-numeric: tabular-nums;
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Page chrome */
.top {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--seam);
}
.brand {
  font: 700 22px/1 var(--display);
  letter-spacing: 0.02em;
  text-decoration: none;
}
.again { display: flex; flex: 1; gap: 8px; max-width: 720px; }
.again input { flex: 1; min-width: 0; }

input[type="text"], textarea {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--seam);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}
button {
  background: var(--text);
  color: var(--page);
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  font: 600 15px var(--sans);
  cursor: pointer;
}
button:hover { background: #fff; }

main { padding: 20px; }

.intro { max-width: 560px; margin: 8vh auto 0; }
.intro h1 { font: 700 40px/1.05 var(--display); margin: 0 0 20px; }
.intro form { display: grid; gap: 8px; }
.intro label { font-weight: 500; }
.intro textarea { resize: vertical; width: 100%; }
.intro button { justify-self: start; }
.intro .clash { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--seam); }
.intro .clash h2 { margin: 0 0 12px; font: 700 24px/1.1 var(--display); }
.intro .clash .row { display: flex; gap: 8px; }
.intro .clash .row input { flex: 1; min-width: 0; }
.hint { color: var(--muted); margin: 0 0 8px; max-width: 60ch; }

.problems {
  list-style: none;
  margin: 0 0 16px;
  padding: 10px 14px;
  background: var(--flag-bg);
  border-left: 3px solid var(--flag);
  border-radius: 4px;
}
.empty { color: var(--muted); }

/* Suggested bans */
.bans { margin-bottom: 12px; padding: 12px; min-height: 92px; background: var(--panel); border: 1px solid var(--seam); border-radius: 8px; }
.bans h2 { margin: 0 0 8px; font: 700 18px/1 var(--display); }
.bans-status { margin: 0; color: var(--muted); font-size: 14px; }
.bans-status:not([hidden]) + .ban-list { margin-top: 10px; }
.ban-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px 16px; }
.ban { display: grid; grid-template-columns: 40px 1fr; column-gap: 10px; align-items: start; }
.ban-icon { width: 40px; height: 40px; border-radius: 6px; }
.ban-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
.ban-name { font: 600 18px/1.1 var(--display); text-decoration: none; }
.ban-sources { flex-basis: 100%; color: var(--muted); font-size: 13px; }

/* The comparison grid: every card shares the same rows, so a row reads across the team. */
.team {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(6, auto);
  column-gap: 12px;
  align-items: start;
}
.card {
  grid-row: span 6;
  display: grid;
  grid-template-rows: subgrid;
  row-gap: 0;
  background: var(--panel);
  border: 1px solid var(--seam);
  border-radius: 8px;
  min-width: 0;
}
.card > * { padding: 10px 12px; min-width: 0; }
.card > * + * { border-top: 1px solid var(--seam); }
.card > .flags:empty { padding-block: 0; border-top: 0; }

/* Player header */
.who { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.who-name { grid-column: 2; grid-row: 1; min-width: 0; overflow-wrap: anywhere; }
.who-meta { grid-column: 2; grid-row: 2; color: var(--muted); font-size: 13px; }
.profile-icon { grid-column: 1; grid-row: 1 / span 2; width: 44px; height: 44px; border-radius: 6px; }
.game-name { font: 700 22px/1.1 var(--display); }
.tag { color: var(--muted); margin-left: 2px; }
.who a { color: var(--muted); }
.who a:hover { color: var(--text); }

.flags { display: flex; flex-wrap: wrap; gap: 6px; }
.flag {
  background: var(--flag-bg);
  color: var(--flag);
  border-radius: 4px;
  padding: 1px 8px;
  font-size: 13px;
  font-weight: 500;
}
.flag.quiet { background: var(--panel-hi); color: var(--muted); }

/* Ranks */
.ranks { display: grid; gap: 6px; }
.rank { display: grid; grid-template-columns: 38px 1fr auto; align-items: baseline; gap: 6px; }
.rank-queue { color: var(--muted); font-size: 13px; }
.rank-tier { font: 600 17px/1.1 var(--display); }
.rank-lp { color: var(--muted); font-size: 13px; margin-left: 4px; }
.rank-wr { font-size: 13px; color: var(--muted); }
.rank.none .rank-tier { color: var(--muted); font-weight: 500; }
[data-tier="IRON"] { color: var(--tier-iron); }
[data-tier="BRONZE"] { color: var(--tier-bronze); }
[data-tier="SILVER"] { color: var(--tier-silver); }
[data-tier="GOLD"] { color: var(--tier-gold); }
[data-tier="PLATINUM"] { color: var(--tier-platinum); }
[data-tier="EMERALD"] { color: var(--tier-emerald); }
[data-tier="DIAMOND"] { color: var(--tier-diamond); }
[data-tier="MASTER"] { color: var(--tier-master); }
[data-tier="GRANDMASTER"] { color: var(--tier-grandmaster); }
[data-tier="CHALLENGER"] { color: var(--tier-challenger); }

/* Roles */
.roles { display: flex; flex-wrap: wrap; gap: 4px 10px; align-content: start; }
.role { font-size: 14px; color: var(--muted); }
.role b { font-weight: 600; color: var(--text); }
.role.main { color: var(--text); }
.role.main::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--text); vertical-align: 2px; }

/* Champion rows */
.champs, .mastery { align-content: start; }
.list { display: grid; gap: 6px; }
.card h2 { margin: 0 0 8px; font: 500 13px/1 var(--sans); color: var(--muted); }
.champ { display: grid; grid-template-columns: 30px 1fr auto; column-gap: 8px; align-items: center; }
.champ img { width: 30px; height: 30px; border-radius: 4px; grid-row: 1 / span 2; }
.champ-name { font-weight: 500; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.champ-stat { font-size: 13px; color: var(--muted); text-align: right; }
.champ-bar { grid-column: 2 / span 2; height: 4px; background: var(--panel-hi); border-radius: 2px; overflow: hidden; }
.champ-bar span { display: block; height: 100%; background: var(--muted); }
.champ-bar .good { background: var(--win); }
.champ-bar .bad { background: var(--loss); }
.champ .wr-good { color: var(--win); }
.champ .wr-bad { color: var(--loss); }

.mastery .champ { grid-template-columns: 24px 1fr auto; }

/* Champion name that opens a menu of links to other sites */
.champ-menu { position: relative; min-width: 0; }
.champ-menu > summary { list-style: none; cursor: pointer; }
.champ-menu > summary::-webkit-details-marker { display: none; }
.champ-menu > summary:hover { text-decoration: underline; }
.champ-menu[open] { z-index: 10; }
.menu { position: absolute; top: calc(100% + 4px); left: 0; display: grid; min-width: 190px; padding: 8px 10px; gap: 2px; background: var(--panel-hi); border: 1px solid var(--seam); border-radius: 6px; }
.menu-site { margin-top: 6px; color: var(--muted); font-size: 13px; }
.menu-site:first-child { margin-top: 0; }
.menu-link { padding: 2px 0; font-size: 14px; font-weight: 400; text-decoration: none; white-space: nowrap; }
.menu-link:hover { text-decoration: underline; }
.mastery .champ img { width: 24px; height: 24px; grid-row: auto; }

.none-yet { color: var(--muted); font-size: 14px; }

/* Loading and error states */
.card.is-loading .who-meta { color: var(--muted); }
.card.is-loading .ranks,
.card.is-loading .roles,
.card.is-loading .champs,
.card.is-loading .mastery { min-height: 56px; background: linear-gradient(90deg, transparent, var(--panel-hi), transparent); background-size: 200% 100%; animation: sweep 1.4s linear infinite; }
@keyframes sweep { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.problem { display: grid; gap: 8px; justify-items: start; align-content: start; }
.problem p { margin: 0; }
.problem button { background: var(--panel-hi); color: var(--text); border: 1px solid var(--seam); }
.problem button:hover { background: var(--seam); }

@media (prefers-reduced-motion: reduce) {
  .card.is-loading .ranks,
  .card.is-loading .roles,
  .card.is-loading .champs,
  .card.is-loading .mastery { animation: none; background: var(--panel-hi); }
}

/* Narrow screens: stack the cards, each with its own rows. */
@media (max-width: 1100px) {
  .team { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; row-gap: 12px; }
  .card { grid-row: auto; grid-template-rows: none; }
}
@media (min-width: 700px) and (max-width: 1100px) {
  .team { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
