:root {
  --bg: #121214;
  --surface: #1a1a19;
  --surface-2: #232325;
  --line: #2f2f33;
  --ink: #ececec;
  --ink-2: #b4b4b8;
  --ink-3: #85858c;
  --accent: #3987e5;
  --win: #3987e5;
  --loss: #e66767;
  --mid: #383835;
  --good: #0ca30c;
  --warn: #fab219;
  --page: 150rem;      /* content width, shared by header and main */
  --gutter: 2rem;

  /* WoW class colours */
  --c-Warrior: #c69b6d;
  --c-Paladin: #f48cba;
  --c-Hunter: #aad372;
  --c-Rogue: #fff468;
  --c-Priest: #ffffff;
  --c-Shaman: #2f8fff;
  --c-Mage: #3fc7eb;
  --c-Warlock: #9e8cdf;
  --c-Druid: #ff7c0a;
  color-scheme: dark;
}

/* Every size below is in rem, with 1rem = 10px at up to 1600px wide. Past that the whole UI grows with the
   viewport: ~1.1x at 1920, 1.3x at 2560 (1440p), 1.7x at 3840 (4K at 100% scaling), capped at 1.8x. */
html {
  font-size: 10px;
  font-size: clamp(10px, calc(0.3125vw + 5px), 18px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1.4rem/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.bar, .status { max-width: var(--page); margin: 0 auto; }
.bar { display: flex; align-items: center; gap: 1.8rem; padding: 1rem var(--gutter); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.6rem; color: var(--ink); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand span { color: var(--ink-3); font-weight: 400; }
nav { display: flex; gap: .4rem; flex-wrap: wrap; }
nav a { color: var(--ink-2); padding: .5rem 1rem; border-radius: .6rem; white-space: nowrap; }
nav a:hover { background: var(--surface-2); text-decoration: none; }
nav a.active { background: var(--surface-2); color: var(--ink); }
nav .sep { flex: none; width: 1px; margin: .5rem .6rem; background: var(--line); }
nav a.hot { color: #ffd27a; background: linear-gradient(135deg, #fab2192e, #e667672e); box-shadow: inset 0 0 0 1px #fab21966; font-weight: 600; }
nav a.hot:hover, nav a.hot.active { background: linear-gradient(135deg, #fab21952, #e6676752); color: #ffe3a8; }
#psearch { margin-left: auto; width: 22rem; }
.status { display: flex; gap: 1.2rem; align-items: center; padding: .4rem var(--gutter) .8rem; color: var(--ink-3); font-size: 1.25rem; flex-wrap: wrap; }
.status .prov { color: var(--warn); }

input, select, button {
  font: inherit; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: .6rem; padding: .4rem .8rem;
}
button { cursor: pointer; }
button:hover { border-color: var(--ink-3); }

main { padding: 1.8rem var(--gutter) 6rem; max-width: var(--page); margin: 0 auto; }
h1 { font-size: 2rem; margin: 0 0 .4rem; }
h2 { font-size: 1.6rem; margin: 2.2rem 0 .8rem; }
h3 { font-size: 1.4rem; margin: 0 0 .6rem; }
.sub { color: var(--ink-3); margin: 0 0 1.4rem; }
.muted { color: var(--ink-3); }
.small { font-size: 1.2rem; }
.err { background: #3a1c1c; border: 1px solid #6b2b2b; padding: 1.4rem; border-radius: .8rem; }
.err code { background: #0006; padding: 1px .4rem; border-radius: .4rem; }

.controls { display: flex; gap: 1rem; flex-wrap: wrap; align-items: end; margin-bottom: 1.2rem; }
.controls label { display: flex; flex-direction: column; gap: .2rem; font-size: 1.2rem; color: var(--ink-3); }
.controls label > input, .controls label > select { font-size: 1.4rem; }
.pills { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.pills button { padding: .3rem 1rem; border-radius: 999px; }
.pills button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

table { border-collapse: collapse; width: 100%; }
th, td { padding: .5rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--ink-3); font-weight: 600; font-size: 1.2rem; position: sticky; top: 0; background: var(--bg); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:hover td { background: #ffffff08; }
tr.cut td { border-bottom: 2px solid var(--warn); }
/* tables scroll sideways, so keep each row on one line instead of squeezing cells into several */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll td { white-space: nowrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; padding: 1.4rem 1.6rem; margin-bottom: 1.4rem; }
.grid { display: grid; gap: 1.4rem; grid-template-columns: repeat(auto-fill, minmax(min(46rem, 100%), 1fr)); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem 1.8rem; margin-top: 1rem; }
.kv div span { display: block; color: var(--ink-3); font-size: 1.2rem; }
.kv div b { font-size: 1.5rem; }

.cls { font-weight: 600; }
.cls-Warrior { color: var(--c-Warrior); } .cls-Paladin { color: var(--c-Paladin); } .cls-Hunter { color: var(--c-Hunter); }
.cls-Rogue { color: var(--c-Rogue); } .cls-Priest { color: var(--c-Priest); } .cls-Shaman { color: var(--c-Shaman); }
.cls-Mage { color: var(--c-Mage); } .cls-Warlock { color: var(--c-Warlock); } .cls-Druid { color: var(--c-Druid); }
.dot { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; margin-right: .6rem; vertical-align: .1rem; }
a.pl { color: var(--ink); }
a.pl:hover { color: var(--accent); }

.badge { display: inline-block; padding: .1rem .7rem; border-radius: 999px; font-size: 1.15rem; font-weight: 600; border: 1px solid var(--line); color: var(--ink-2); }
.badge.qualified { color: var(--good); border-color: var(--good); }
.badge.tied { color: var(--warn); border-color: var(--warn); }
.badge.ineligible, .badge.withdrawn, .badge.disqualified { color: var(--ink-3); border-style: dashed; }
.res { display: inline-block; min-width: 2.2rem; text-align: center; border-radius: .4rem; font-weight: 700; font-size: 1.2rem; padding: 0 .4rem; }
.res.W { background: #3987e533; color: #8fbaf0; }
.res.L { background: #e6676733; color: #f0a0a0; }
.res.T, .res.P { background: #ffffff14; color: var(--ink-2); }
.win { font-weight: 700; }
.lose { color: var(--ink-3); }
.trees { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 1.2rem; }
.more { margin: 1.2rem 0; }

/* heatmap */
.heat { border-collapse: separate; border-spacing: 2px; width: auto; }
.heat th, .heat td { border: 0; }
.heat th { position: static; background: none; }
.heat th.col { writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; padding: .4rem .2rem; height: 7.6rem; }
.heat td.cell { width: 6.6rem; height: 4.6rem; text-align: center; border-radius: .4rem; cursor: pointer; padding: .2rem; }
.heat td.cell b { display: block; font-size: 1.4rem; }
.heat td.cell i { font-style: normal; font-size: 1.1rem; color: #ffffffb0; }
.heat td.cell:hover { outline: 2px solid var(--ink); }
.heat td.cell.thin { background-image: repeating-linear-gradient(45deg, #0000 0 .5rem, #00000040 .5rem .7rem); }
.heat td.mirror { background: var(--surface); color: var(--ink-3); text-align: center; cursor: default; border-radius: .4rem; }
.heat td.overall { padding-left: 1.4rem; font-variant-numeric: tabular-nums; }
.legend { display: flex; align-items: center; gap: .8rem; font-size: 1.2rem; color: var(--ink-3); margin: 1rem 0 .4rem; flex-wrap: wrap; }
.legend .ramp { width: 22rem; max-width: 100%; height: 1rem; border-radius: .5rem; background: linear-gradient(90deg, var(--loss), var(--mid), var(--win)); }
.legend .swatch { width: 1.8rem; height: 1.2rem; border-radius: .3rem; background: var(--mid) repeating-linear-gradient(45deg, #0000 0 .5rem, #00000060 .5rem .7rem); }

/* talents */
.share { display: flex; align-items: center; gap: .6rem; min-width: 12rem; }
.share .b { height: .8rem; border-radius: 0 .4rem .4rem 0; }
.share .b.w { background: var(--win); }
.share .b.l { background: var(--loss); }
.share span { font-size: 1.2rem; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 3.8rem; }
.tree { display: flex; align-items: center; gap: .3rem; margin: .4rem 0; flex-wrap: wrap; }
.tree .lbl { width: 9.2rem; color: var(--ink-3); font-size: 1.2rem; }
.tree .t { width: 2rem; height: 2.2rem; display: inline-flex; align-items: center; justify-content: center; border-radius: .3rem; background: var(--surface-2); color: var(--ink-3); font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.tree .t.on { background: #3987e555; color: var(--ink); font-weight: 700; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 1.25rem; }

/* feed */
.run { margin-bottom: 1.6rem; }
.run h3 { color: var(--ink-2); font-weight: 600; border-bottom: 1px solid var(--line); padding-bottom: .4rem; }
.ev { padding: .3rem 0; display: flex; gap: 1rem; align-items: baseline; }
.ev .ty { width: 9.2rem; flex: none; font-size: 1.15rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; }
.ev .where { color: var(--ink-3); font-size: 1.2rem; white-space: nowrap; }

/* finals */
  background: radial-gradient(120% 140% at 0% 0%, #fab21924, transparent 55%), radial-gradient(120% 140% at 100% 100%, #3987e526, transparent 55%), var(--surface); }
.watch { display: inline-flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.watch a { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .8rem; border-radius: 999px; font-size: 1.2rem; font-weight: 600; white-space: nowrap; background: #3987e526; color: #9cc3f5; }
.watch.l { justify-content: flex-start; }
td .watch { flex-wrap: nowrap; }
.watch a.ch { background: #9146ff24; color: #c4a8ff; }
.watch a:hover { text-decoration: none; filter: brightness(1.25); }
.vodgrid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(30rem, 100%), 1fr)); }
.fm { background: var(--surface); border: 1px solid var(--line); border-radius: .8rem; padding: .7rem .9rem .8rem; }
.fm .hd { display: flex; justify-content: space-between; align-items: center; gap: .8rem; font-size: 1.15rem; color: var(--ink-3); margin-bottom: .4rem; min-height: 2.2rem; }
.fm .sd { display: flex; align-items: center; gap: .6rem; padding: .2rem 0; }
.fm .sd .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm .sd .seed { color: var(--ink-3); font-size: 1.1rem; min-width: 1.6rem; font-variant-numeric: tabular-nums; }
.fm .sd .sc { font-variant-numeric: tabular-nums; font-size: 1.25rem; color: var(--ink-2); }
.fm .sd.win .nm, .fm .sd.win .sc { font-weight: 700; color: var(--ink); }
.fm .sd.lose { opacity: .5; }
.pbar { display: flex; height: .4rem; border-radius: .2rem; overflow: hidden; margin-top: .5rem; opacity: .8; }
/* bracket: rounds are columns of one shared row grid (see bracketGrid), so matches line up with their feeders */
.bracket { --bcol: 26rem; display: grid; gap: .8rem 1.4rem; overflow-x: auto; padding-bottom: .8rem; -webkit-overflow-scrolling: touch; }
.bracket > h3 { color: var(--ink-3); font-weight: 600; margin: 0 0 .2rem; white-space: nowrap; }
.bracket .slot { align-self: center; min-width: 0; }
.rvs { white-space: nowrap; }
.po { margin-bottom: .8rem; border: 1px solid var(--line); border-radius: .8rem; padding: .2rem 1.2rem; }
.po > summary { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .8rem 0; cursor: pointer; font-size: 1.5rem; font-weight: 600; }
.po > summary .muted { font-size: 1.3rem; font-weight: 400; }
.po > summary .qodds { margin: 0; font-weight: 400; }
.po[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.qodds { display: flex; flex-wrap: wrap; gap: .4rem .6rem; margin-bottom: 1rem; }
.qodds .q { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .8rem; border-radius: .6rem; background: var(--surface-2); font-size: 1.3rem; white-space: nowrap; }
.qodds .q b { font-variant-numeric: tabular-nums; }
.qodds .q.in { box-shadow: inset 0 0 0 1px var(--good); }
.qodds .q.in b { color: var(--good); }
.qodds .q.out { opacity: .4; }
.rv { display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; margin-right: .2rem; border-radius: .4rem; font-size: 1.2rem; font-weight: 700; }
a.rv:hover { text-decoration: none; outline: 1px solid currentColor; }
.rv.W { background: #3987e533; color: #8fbaf0; }
.rv.L { background: #e6676733; color: #f0a0a0; }
.rv.T, .rv.B, .rv.P { background: #ffffff14; color: var(--ink-2); }
.rv.none { opacity: .35; }

/* phones: brand + search on one row, nav as one sideways-scrolling row, filters in an even two-column grid */
@media (max-width: 700px) {
  :root { --gutter: 1.2rem; }
  header { position: static; }
  .bar { gap: .8rem 1rem; padding-top: .8rem; padding-bottom: .6rem; }
  #psearch { flex: 1; min-width: 0; width: auto; margin-left: 0; }
  nav {
    order: 3; flex: 0 0 calc(100% + 2 * var(--gutter)); flex-wrap: nowrap; overflow-x: auto;
    margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); scrollbar-width: none;
  }
  nav::-webkit-scrollbar { display: none; }
  nav a { padding: .6rem 1.1rem; }
  .status { gap: .4rem 1rem; padding-bottom: .6rem; font-size: 1.2rem; }
  main { padding: 1.4rem var(--gutter) 5rem; }
  h1 { font-size: 1.9rem; }
  .sub { font-size: 1.3rem; }
  .controls { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
  .controls label > input, .controls label > select { width: 100%; min-width: 0; }
  /* 16px stops iOS from zooming the page when a field gets focus */
  input, select { font-size: 16px; }
  .controls label > input, .controls label > select { font-size: 16px; }
  .pills { gap: .5rem; }
  .pills button { padding: .4rem 1.1rem; }
  .scroll { margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
  th, td { padding: .5rem .6rem; }
  .grid { grid-template-columns: 1fr; }
  .card { padding: 1.2rem; }
  .bracket { --bcol: 24rem; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) .8rem; }
  .ev { display: block; padding: .4rem 0; }
  .ev .ty { display: inline; width: auto; margin-right: .6rem; }
}
