/* Draft Predictor.
 *
 * Colour has three jobs and no others: blue and red are the two teams, gold is how likely the
 * model thinks something is. Everything else is neutral. Regions sit on the page background and
 * are separated by space and hairlines; only things that float (popovers, the hover card) get a
 * surface of their own.
 */
/* Sofia Sans and Sofia Sans Condensed (SIL Open Font License, see fonts/OFL.txt), served from this site:
 * variable-weight files, the extended-Latin ones are only fetched when a name needs them. */
@font-face {
  font-family: "Sofia Sans"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("/static/fonts/sofia-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Sofia Sans"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("/static/fonts/sofia-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Sofia Sans Condensed"; font-style: normal; font-weight: 500 600; font-display: swap;
  src: url("/static/fonts/sofia-sans-condensed-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Sofia Sans Condensed"; font-style: normal; font-weight: 500 600; font-display: swap;
  src: url("/static/fonts/sofia-sans-condensed-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #0c0d0f;
  --raise: #16181b;        /* popovers, hovered rows, empty art */
  --raise-2: #202327;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.18);
  --text: #edebe6;
  --soft: #c6c4bd;         /* secondary text that still has to read easily */
  --muted: #9a9891;
  --faint: #7a7872;        /* de-emphasised: factors that count against, placeholders */
  --blue: #5a96ff;
  --red: #f25a5f;
  --gold: 200, 170, 110;   /* likelihood, used as rgb() components */
  --error: #ff8085;
  --display: "Sofia Sans Condensed", "Avenir Next Condensed", "DIN Condensed", "Bahnschrift", "Roboto Condensed", "Arial Narrow", sans-serif;
  --body: "Sofia Sans", "Avenir Next", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --team-w: 236px;
  --side-w: 344px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 var(--body);
  font-variant-numeric: tabular-nums;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.blue-text { color: var(--blue); }
.red-text { color: var(--red); }
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.16) transparent; }

/* ---------- buttons, tabs, fields ---------- */
.btn {
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  padding: 4px 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.btn:hover:not(:disabled) { border-color: var(--muted); background: var(--raise); }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn.quiet { border-color: transparent; color: var(--muted); }
.btn.quiet:hover:not(:disabled) { color: var(--text); background: var(--raise); border-color: transparent; }
.btn.toggle { color: var(--muted); border-color: transparent; padding: 4px 8px; }
.btn.toggle.on { color: var(--text); border-color: var(--line-2); }
.btn.small { padding: 2px 8px; font-size: 12px; }
.btn:focus-visible, .seg button:focus-visible, .tile:focus-visible, .pred:focus-visible, .setup-btn:focus-visible {
  outline: 2px solid var(--text); outline-offset: 2px;
}

/* a row of choices: plain words, the chosen one underlined */
.seg { display: inline-flex; gap: 2px; }
.seg button {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 4px 8px 3px;
  cursor: pointer;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.seg button:hover { color: var(--text); }
.seg button.on { color: var(--text); border-bottom-color: var(--text); }
.seg.fp button { max-width: 150px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.seg.fp button.fp-blue.on { color: var(--blue); border-bottom-color: var(--blue); }
.seg.fp button.fp-red.on { color: var(--red); border-bottom-color: var(--red); }

input[type=text], input[type=search], select {
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 4px 7px;
  min-width: 0;
}
input:focus, select:focus { outline: none; border-color: var(--muted); }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 9px 20px;
  border-bottom: 1px solid var(--line);
}
.brand {
  font: 600 19px/1 var(--display); font-stretch: condensed; text-transform: uppercase; letter-spacing: 0.09em; white-space: nowrap;
}
.field { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.field select { color: var(--text); }
.spacer { flex: 1; }

.setup-wrap { position: relative; }
/* Anything that opens a list of choices looks the same: its current value, a chevron, and a rule
   under both that brightens when pointed at. */
.chevron {
  flex: none; display: inline-block; width: 7px; height: 7px; margin: -4px 2px 0 0;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); transition: transform 0.15s var(--ease), margin 0.15s var(--ease); color: var(--muted);
}
.setup-btn {
  display: inline-flex; align-items: center; gap: 9px;
  background: transparent; border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0; padding: 4px 4px 4px 2px; cursor: pointer;
  color: var(--muted); white-space: nowrap; transition: border-color 0.15s, color 0.15s;
}
.setup-btn b { color: var(--text); font-weight: 600; }
.setup-btn:hover, .setup-btn[aria-expanded=true] { border-bottom-color: var(--text); color: var(--text); }
.setup-btn:hover .chevron, .setup-btn[aria-expanded=true] .chevron, .combo:hover .chevron, .combo:focus-within .chevron { color: var(--text); }
.setup-btn[aria-expanded=true] .chevron, .combo:has(.team-input[aria-expanded=true]) .chevron { transform: rotate(225deg); margin-top: 4px; }
.setup-pop {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 40; display: grid; gap: 10px; padding: 14px 16px;
  background: var(--raise); border: 1px solid var(--line-2); border-radius: 4px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}
.setup-pop .field { justify-content: space-between; gap: 16px; }

.data-through { white-space: nowrap; }
.about-wrap { position: relative; }
.about-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: 400px; max-width: calc(100vw - 24px);
  padding: 14px 16px; background: var(--raise); border: 1px solid var(--line-2); border-radius: 4px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6); font-size: 13px; line-height: 1.45;
}
.about-pop p { margin: 0 0 9px; }
.about-pop p:last-child { margin-bottom: 0; }
.about-pop p.muted { font-size: 12px; }
.series { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.series-game { font: 600 17px/1 var(--display); font-stretch: condensed; text-transform: uppercase; letter-spacing: 0.06em; }
.series-score { font-weight: 600; }
.game-chip {
  font-size: 12px; padding: 0 0 1px; border-bottom: 2px solid var(--line-2); color: var(--soft);
  max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: help;
}
.game-chip.side-blue { border-bottom-color: var(--blue); }
.game-chip.side-red { border-bottom-color: var(--red); }
.notices { display: inline-flex; gap: 6px; align-items: center; }
.notices:empty { display: none; }
.pill { font-size: 12px; padding: 2px 9px; border-radius: 3px; border: 1px solid var(--line-2); background: transparent; color: var(--soft); cursor: pointer; }
.pill.warn:hover { border-color: var(--muted); color: var(--text); }
.pill.error { color: var(--error); border-color: var(--error); cursor: help; }
.warn-wrap { position: relative; }
.warn-list {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 360px; max-width: 86vw; max-height: 300px; overflow: auto;
  margin: 0; padding: 10px 12px 10px 26px; background: var(--raise); border: 1px solid var(--line-2); border-radius: 4px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6); font-size: 13px;
}
.warn-list li { margin: 3px 0; }

/* ---------- main layout ---------- */
.main {
  display: grid;
  grid-template-columns: 46px var(--team-w) minmax(0, 1fr) var(--team-w) var(--side-w);
  gap: 22px;
  padding: 18px 20px 16px;
  min-height: 0;
}
.main > * { min-height: 0; }

/* ---------- evaluation bar ---------- */
.rail { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 0; }
.rail-end { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 46px; }
.rail-end b { font: 600 19px/1 var(--display); font-stretch: condensed; }
.rail-name { font-size: 11px; line-height: 1.2; font-weight: 600; max-width: 46px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-red { color: var(--red); }
.rail-blue { color: var(--blue); }
.evalbar {
  --pb: 50; --base: 50;
  position: relative;
  flex: 1;
  width: 14px;
  border-radius: 2px;
  background: var(--red);
  cursor: help;
}
.eval-blue {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--pb) * 1%);
  background: var(--blue); border-radius: 0 0 2px 2px;
  box-shadow: 0 -2px 0 var(--bg);
  transition: height 0.6s var(--ease);
}
.eval-mid { position: absolute; left: -5px; right: -5px; top: 50%; border-top: 1px solid var(--line-2); }
.eval-base {
  position: absolute; left: -6px; right: -6px; height: 2px; bottom: calc(var(--base) * 1%); margin-bottom: -1px;
  background: var(--text); transition: bottom 0.6s var(--ease); z-index: 1; cursor: help;
}
.info-dot {
  display: inline-grid; place-items: center; width: 13px; height: 13px; border-radius: 50%;
  border: 1px solid currentColor; font: italic 700 9px Georgia, serif;
}

/* ---------- team columns ---------- */
.team { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; overflow-x: hidden; }
.team-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.team-rule { display: block; width: 34px; height: 3px; margin-bottom: 6px; }
.team-blue .team-rule { background: var(--blue); }
.team-red .team-rule { background: var(--red); justify-self: end; }
.team-head { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.team-red .team-head { flex-direction: row-reverse; }
.fp-tag { font-size: 12px; color: var(--muted); white-space: nowrap; flex: none; margin-left: auto; }
.team-red .fp-tag { margin-left: 0; margin-right: auto; }
.team-score { font-size: 12px; color: var(--muted); }
.team-red .team-score { text-align: right; }
.team-score:empty { display: none; }

/* team and player names read as text; the field shows itself on hover and focus */
.team input[type=text] { background: transparent; border-color: transparent; padding-left: 0; padding-right: 0; }
.team input[type=text]:hover { border-bottom-color: var(--line-2); }
.team input[type=text]:focus { border-color: transparent; border-bottom-color: var(--muted); }
.team-red input[type=text] { text-align: right; }

.combo {
  position: relative; flex: 0 1 auto; min-width: 0; max-width: 100%;
  display: inline-flex; align-items: center; gap: 9px; padding-bottom: 3px;
  border-bottom: 1px solid var(--line-2); cursor: pointer; transition: border-color 0.15s;
}
.combo:hover { border-bottom-color: var(--muted); }
.combo:focus-within { border-bottom-color: var(--text); }
.team-input {
  flex: 0 1 auto; min-width: 0; padding-top: 0; padding-bottom: 0; text-overflow: ellipsis; cursor: pointer;
  font: 600 30px/1.05 var(--display) !important; font-stretch: condensed; text-transform: uppercase; letter-spacing: 0.02em;
}
.team input.team-input, .team input.team-input:hover, .team input.team-input:focus { border: 0; text-align: left; }
.team-input:focus { cursor: text; }
.team-input::placeholder { color: var(--faint); }
.team-mirror { position: absolute; left: 0; top: 0; visibility: hidden; pointer-events: none; white-space: pre; }
/* placed on the viewport by the script (the team column scrolls, so it would clip a list inside it) */
.combo-list {
  position: fixed; z-index: 40; max-height: 420px; overflow: auto; text-align: left;
  background: var(--raise); border: 1px solid var(--line-2); border-radius: 4px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}
.opt-group { position: sticky; top: 0; background: var(--raise-2); color: var(--muted); font-size: 12px; font-weight: 600; padding: 4px 10px; }
.opt { padding: 5px 10px; cursor: pointer; display: flex; flex-direction: column; }
.opt span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt span:first-child { font-weight: 600; }
.opt.active, .opt:hover { background: var(--raise-2); }
.opt.current span:first-child::after { content: " ✓"; color: var(--muted); }
.opt.custom { font-style: italic; border-top: 1px solid var(--line); }
.opt-empty { padding: 6px 10px; }

.players { display: grid; }
.player { display: grid; grid-template-columns: 34px 1fr; align-items: center; }
.team-red .player { grid-template-columns: 1fr 34px; }
.team-red .player .role-tag { order: 2; text-align: right; }
.player input { padding-top: 1px; padding-bottom: 1px; font-size: 13px; color: var(--soft); }
.role-tag { font-size: 12px; color: var(--faint); }

.slot { position: relative; overflow: hidden; }

.bans { display: flex; gap: 5px; align-items: center; }
.team-red .bans { flex-direction: row-reverse; }
.bans-label { font-size: 12px; color: var(--faint); width: 34px; flex: none; }
.team-red .bans-label { text-align: right; }
.ban { width: 32px; height: 32px; flex: none; border-radius: 2px; background: var(--raise); }
.ban.empty { background: rgba(255, 255, 255, 0.035); }
.ban-gap { width: 5px; flex: none; }
.ban .slot-icon { width: 100%; height: 100%; display: block; filter: grayscale(1) brightness(0.62); }
.ban.filled::after {
  content: ""; position: absolute; left: 50%; top: -6px; bottom: -6px; width: 1.5px; margin-left: -0.75px;
  background: rgba(237, 235, 230, 0.75); transform: rotate(45deg);
}
.ban.missed::after { display: none; }
.slot-missed { display: grid; place-items: center; height: 100%; font-size: 10px; color: var(--faint); }
.ban .slot-next { display: none; }
.team-blue .ban.next { box-shadow: inset 0 0 0 2px var(--blue); animation: breathe 1.6s ease-in-out infinite; }
.team-red .ban.next { box-shadow: inset 0 0 0 2px var(--red); animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.45; } }

/* picks: splash art, the way a broadcast shows a draft */
.picks { flex: 1 1 auto; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.pick {
  flex: 1 1 0; min-height: 50px; max-height: 118px;
  display: flex; align-items: flex-end; border-radius: 2px; background: var(--raise);
}
.pick.empty { background: rgba(255, 255, 255, 0.025); }
.pick .slot-art {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%;
  transform: scale(1.18); transform-origin: 50% 18%;
}
.pick.filled::before { content: ""; position: absolute; top: 0; bottom: 0; width: 3px; z-index: 2; }
.team-blue .pick.filled::before { left: 0; background: var(--blue); }
.team-red .pick.filled::before { right: 0; background: var(--red); }
.pick.filled::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.team-blue .pick.filled::after { background: linear-gradient(90deg, rgba(8, 9, 10, 0.9) 0%, rgba(8, 9, 10, 0.55) 38%, rgba(8, 9, 10, 0) 72%); }
.team-red .pick.filled::after { background: linear-gradient(270deg, rgba(8, 9, 10, 0.9) 0%, rgba(8, 9, 10, 0.55) 38%, rgba(8, 9, 10, 0) 72%); }
.slot-text { position: relative; z-index: 2; width: 100%; min-width: 0; padding: 7px 12px 8px; }
.team-red .slot-text { text-align: right; }
.slot-name {
  font: 600 21px/1.05 var(--display); font-stretch: condensed; text-transform: uppercase; letter-spacing: 0.03em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}
.slot-meta { font-size: 12px; color: var(--soft); white-space: nowrap; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8); }
.slot-meta.surprise { color: var(--text); font-weight: 600; }
.pick.next { align-items: center; background: transparent; }
.team-blue .pick.next { box-shadow: inset 0 0 0 1px var(--blue), inset 3px 0 0 var(--blue); }
.team-red .pick.next { box-shadow: inset 0 0 0 1px var(--red), inset -3px 0 0 var(--red); }
.slot-next {
  width: 100%; padding: 0 14px;
  font: 500 15px/1 var(--display); font-stretch: condensed; text-transform: uppercase; letter-spacing: 0.1em;
  animation: breathe 1.6s ease-in-out infinite;
}
.team-red .slot-next { text-align: right; }
.team-blue .slot-next { color: var(--blue); }
.team-red .slot-next { color: var(--red); }

/* a champion locking in */
.pick.just .slot-art { animation: artIn 0.55s var(--ease) both; }
.pick.just .slot-text { animation: textIn 0.4s 0.1s var(--ease) both; }
.ban.just .slot-icon { animation: banIn 0.35s var(--ease) both; }
@keyframes artIn { from { opacity: 0; transform: scale(1.36); } to { opacity: 1; transform: scale(1.18); } }
@keyframes textIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes banIn { from { opacity: 0; transform: scale(1.25); } to { opacity: 1; transform: none; } }

.burned { padding-top: 2px; font-size: 12px; color: var(--faint); }
.team-red .burned { text-align: right; }
.burned-icons { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
.team-red .burned-icons { justify-content: flex-end; }
.bicon { width: 22px; height: 22px; border-radius: 2px; filter: grayscale(1) brightness(0.55); }

/* ---------- centre ---------- */
.center { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; }
.statusbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
/* whose turn it is never gets cut short: if the buttons do not fit beside it they move to the next line */
.status-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; min-height: 32px; }
.status { flex: 1 0 auto; max-width: 100%; display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow: hidden; }
.status-main {
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font: 600 30px/1.05 var(--display); font-stretch: condensed; text-transform: uppercase; letter-spacing: 0.02em;
}
.status-main b { font-weight: 600; }
.status-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-actions { display: flex; gap: 6px; flex: none; }
body.loading .status-main::after { content: " ·"; color: var(--muted); animation: blink 0.6s infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* draft timeline: one mark per action, short = ban, tall = pick */
.timeline { display: flex; align-items: flex-end; gap: 3px; height: 10px; }
.tl-step { flex: 1; height: 3px; background: var(--raise-2); }
.tl-pick { height: 10px; }
.tl-blue { background: var(--blue); }
.tl-red { background: var(--red); }
.tl-todo { opacity: 0.2; }
.tl-now { animation: breathe 1.2s ease-in-out infinite; }
.tl-gap { flex: none; width: 8px; }

.winner-ask {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-weight: 600;
}
.winner-ask .btn { font-weight: 600; padding: 6px 14px; }
.btn.win-blue { border-color: var(--blue); color: var(--blue); }
.btn.win-red { border-color: var(--red); color: var(--red); }
.btn.win-blue:hover { background: var(--blue) !important; color: var(--bg); }
.btn.win-red:hover { background: var(--red) !important; color: var(--bg); }

.toolbar { display: flex; gap: 10px; align-items: center; }
.toolbar input[type=search] {
  flex: 1; min-width: 90px; padding: 6px 2px; background: transparent; border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0;
}
.toolbar input[type=search]:focus { border-bottom-color: var(--text); }

.grid { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 12px 2px; }
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin: 18px 0 10px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--soft);
}
.sec-head:first-child, .recap .sec-head { margin-top: 2px; padding-top: 0; border-top: 0; }
.sec-note { font-weight: 400; font-size: 12px; color: var(--muted); }
.tiles { display: grid; grid-auto-rows: max-content; align-content: start; }
.tiles.big { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 14px 4px; padding-top: 3px; }
.tiles.small { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px 2px; }
.grid.flat .tiles.big { margin-top: 4px; }
.grid-empty { padding: 18px 4px; }

.tile {
  --heat: 0;
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  min-width: 0;
}
.tile-icon {
  width: 60px; height: 60px; border-radius: 2px; display: block;
  box-shadow: 0 0 0 2px rgba(var(--gold), calc(var(--heat) * var(--heat)));
  transition: transform 0.12s var(--ease), filter 0.15s;
}
.tile:hover:not(.off) .tile-icon { transform: translateY(-2px); filter: brightness(1.2); }
.tile:active:not(.off) .tile-icon { transform: scale(0.94); }
.pred:active { transform: scale(0.99); }
/* things that open: a short fade from where they hang */
.setup-pop:not([hidden]), .combo-list:not([hidden]), .warn-list:not([hidden]), .caveat-pop:not([hidden]), .about-pop:not([hidden]) { animation: popIn 0.14s var(--ease) both; }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.winner-ask:not([hidden]) { animation: textIn 0.35s var(--ease) both; }
.tile-name { margin-top: 6px; font-size: 12px; line-height: 1.15; width: 100%; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-prob {
  font: 600 17px/1.1 var(--display); font-stretch: condensed; min-height: 19px;
  color: rgba(var(--gold), calc(0.55 + var(--heat) * 0.45));
}
.tile-bar { display: none; }
.tile-reason {
  position: absolute; top: 21px; left: 50%; transform: translateX(-50%);
  font-size: 11px; font-weight: 600; padding: 0 5px 1px; border-radius: 2px;
  background: rgba(8, 9, 10, 0.82); color: var(--text); white-space: nowrap;
}
.tile-reason:empty { display: none; }
.tile.off { cursor: not-allowed; }
.tile.off .tile-icon { filter: grayscale(1) brightness(0.45); box-shadow: none; }
.tile.off .tile-name { color: var(--faint); }
.tile.burn-other::after {
  content: ""; position: absolute; top: -3px; right: calc(50% - 33px); width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted); box-shadow: 0 0 0 2px var(--bg);
}

/* the long tail and the unavailable champions: smaller and quieter, the number is in the tooltip */
.tiles.small .tile-icon { width: 42px; height: 42px; box-shadow: none; }
.tiles.small .tile-name { font-size: 11px; margin-top: 3px; color: var(--muted); }
.tiles.small .tile-prob { display: none; }
.tiles.small .tile-reason { top: 13px; font-size: 10px; padding: 0 3px 1px; }
.tiles.small .tile.burn-other::after { right: calc(50% - 24px); }
.tiles.small .tile.off .tile-name { color: var(--faint); }

/* ---------- recap of a completed draft ---------- */
.recap { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 12px 2px; }
.recap-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(186px, 1fr)); gap: 4px 24px; align-items: start; }
.recap-phase { font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
.recap-col > .recap-phase:first-child { margin-top: 0; }
.recap-row {
  display: grid; grid-template-columns: 18px 28px minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 2px 4px 2px 0; box-shadow: inset 2px 0 0 var(--line-2);
}
.recap-row.rc-blue { box-shadow: inset 2px 0 0 var(--blue); }
.recap-row.rc-red { box-shadow: inset 2px 0 0 var(--red); }
.recap-n { font-size: 11px; color: var(--faint); text-align: right; }
.recap-icon { width: 28px; height: 28px; border-radius: 2px; display: block; background: var(--raise); }
.rc-ban .recap-icon { filter: grayscale(1) brightness(0.65); }
.recap-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-ban .recap-name { font-weight: 400; color: var(--muted); }
.recap-p { font-size: 12px; color: var(--muted); white-space: nowrap; }
.recap-p.surprise { color: var(--text); font-weight: 600; }

/* ---------- right column ---------- */
.side { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding-left: 22px; border-left: 1px solid var(--line); }
.card { position: relative; }
.card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; white-space: nowrap;
  font: 600 19px/1.1 var(--display); font-stretch: condensed; text-transform: uppercase; letter-spacing: 0.04em;
}
.card-head b { font-weight: 600; }
.card-head > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.card-head > .small { flex: none; }
.card-head .small { font: 400 12px/1.2 var(--body); text-transform: none; letter-spacing: 0; }
.preds { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pred-error { color: var(--error); font-size: 13px; padding: 2px 0 8px; }
.pred-list { list-style: none; margin: 0 -8px 0 -8px; padding: 0; overflow-y: auto; min-height: 0; flex: 1; transition: opacity 0.2s; }
.pred-list.stale { opacity: 0.5; }
.pred {
  position: relative;
  display: grid; grid-template-columns: 16px 34px minmax(0, 1fr); gap: 9px; align-items: center;
  padding: 3px 8px; border-radius: 3px; cursor: pointer;
}
.pred:hover, .pred:focus-visible { background: var(--raise); }
.pred-rank { font-size: 12px; color: var(--faint); text-align: right; }
.pred-icon { width: 32px; height: 32px; border-radius: 2px; }
.pred-top { display: flex; align-items: center; gap: 9px; line-height: 17px; }
.pred-top .pred-bar { flex: 1; margin: 0; }
.pred-name { width: 100px; flex: none; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pred-pct { min-width: 46px; text-align: right; font: 600 18px/1 var(--display); font-stretch: condensed; color: rgb(var(--gold)); }
.pred-bar { height: 3px; background: var(--raise-2); overflow: hidden; min-width: 20px; }
.pred-bar i { display: block; height: 100%; background: rgb(var(--gold)); transition: width 0.35s var(--ease); }
.pred-empty { padding: 8px; }
/* the reasons in words, strongest first; a reason is shown whole or not at all */
.pred-why { display: flex; flex-wrap: wrap; height: 16px; overflow: hidden; font-size: 12px; line-height: 16px; color: var(--soft); }
.reason { white-space: nowrap; }
.reason + .reason::before { content: "·"; margin: 0 6px; color: var(--faint); }
.reason.against { color: var(--faint); }
.why b { font-weight: 600; }
b.for { color: var(--text); }
b.against { color: var(--muted); }

/* hover card with the full breakdown */
.why {
  position: fixed; z-index: 60; width: 330px; max-width: calc(100vw - 16px); pointer-events: none;
  background: var(--raise); border: 1px solid var(--line-2); border-radius: 4px; padding: 14px 16px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.65);
}
.why-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.why-icon { width: 42px; height: 42px; border-radius: 2px; }
.why-title { flex: 1; min-width: 0; }
.why-name { font: 600 21px/1.05 var(--display); font-stretch: condensed; text-transform: uppercase; letter-spacing: 0.03em; }
.why-pct { font: 600 26px/1 var(--display); font-stretch: condensed; color: rgb(var(--gold)); }
.why-sub { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.why-row { display: grid; grid-template-columns: 120px 1fr 42px; align-items: center; gap: 8px; margin-top: 8px; }
.why-row b { text-align: right; }
.why-group { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.why-words { margin-top: 2px; font-size: 12px; color: var(--soft); }
.why:not([hidden]) { animation: cardIn 0.16s var(--ease) both; }
@keyframes cardIn { from { opacity: 0; transform: translateX(6px); } to { opacity: 1; transform: none; } }
.why-track { position: relative; height: 6px; }
.why-track::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line-2); }
.why-track i { position: absolute; top: 0; bottom: 0; }
.why-track i.for { left: 50%; background: var(--text); }
.why-track i.against { right: 50%; box-shadow: inset 0 0 0 1px var(--muted); }
.why-feats { margin-top: 3px; }
.why-feat {
  display: flex; justify-content: space-between; gap: 8px; color: var(--faint);
  font: 10.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.why-feat span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.why-foot { margin-top: 12px; padding-top: 9px; border-top: 1px solid var(--line); font-size: 12px; }

.wincard { flex: none; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.caveat {
  display: inline-flex; align-items: center; gap: 4px; background: transparent; border: 0; cursor: pointer;
  font-size: 12px; color: var(--muted); padding: 0; margin-left: 6px; text-decoration: underline dotted; text-underline-offset: 3px;
}
.caveat:hover { color: var(--text); }
.caveat-pop {
  position: absolute; right: 0; bottom: calc(100% - 8px); z-index: 30; width: 300px; max-width: 86vw;
  background: var(--raise); border: 1px solid var(--line-2); border-radius: 4px;
  padding: 10px 12px; font-size: 13px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}
.win-row { display: flex; justify-content: space-between; gap: 8px; }
.win-team { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.win-team.red { flex-direction: row-reverse; }
.win-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-team.blue .win-name { color: var(--blue); }
.win-team.red .win-name { color: var(--red); }
.win-pct { font: 600 32px/1 var(--display); font-stretch: condensed; }
.win-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; margin: 4px 0 10px; font-size: 12px; }
.win-stat { white-space: nowrap; }
.win-stat b { font-weight: 600; }
.wingraph { width: 100%; height: 82px; display: block; }
.g-bg { fill: transparent; }
.g-blue { fill: rgba(90, 150, 255, 0.24); }
.g-red { fill: rgba(242, 90, 95, 0.18); }
.g-line { fill: none; stroke: var(--text); stroke-width: 1.5; stroke-linejoin: round; }
.g-half { stroke: var(--line-2); }
.g-grid { stroke: var(--line); }
.g-phase { stroke: var(--line); }
.g-base { stroke: var(--text); stroke-opacity: 0.55; stroke-dasharray: 1 4; stroke-linecap: round; }
.g-dot { fill: var(--text); }
.g-dot.last { fill: var(--text); stroke: var(--bg); stroke-width: 2; }
.graph-axis { position: relative; height: 16px; margin-top: 3px; font-size: 11px; color: var(--faint); }
.graph-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.graph-axis span:nth-child(1) { left: 15%; }
.graph-axis span:nth-child(2) { left: 45%; }
.graph-axis span:nth-child(3) { left: 70%; }
.graph-axis span:nth-child(4) { left: 90%; }
/* what moves the win probability: bar length = size of the push, colour = the team it favours */
.win-factors { display: grid; gap: 4px; margin-top: 8px; }
.wf-row { display: grid; grid-template-columns: 108px 1fr auto; align-items: center; gap: 8px; font-size: 12px; cursor: help; }
.wf-group { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-track { height: 3px; background: var(--raise-2); overflow: hidden; }
.wf-track i { display: block; height: 100%; }
.wf-track i.blue { background: var(--blue); }
.wf-track i.red { background: var(--red); }
.wf-team { font-weight: 600; white-space: nowrap; max-width: 90px; overflow: hidden; text-overflow: ellipsis; text-align: right; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 50; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: min(640px, 92vw);
  background: var(--raise-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 8px 8px 8px 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6); transition: opacity 0.25s, transform 0.25s;
}
.toast.error { border-color: var(--error); }
.toast.out { opacity: 0; transform: translateY(6px); }
.toast-x { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; padding: 0 4px; }

/* ---------- narrower and shorter screens ---------- */
@media (max-width: 1360px) {
  :root { --team-w: 204px; --side-w: 304px; }
  .main { gap: 18px; padding: 14px 16px; }
  .side { padding-left: 18px; }
  .team-input { font-size: 26px !important; }
  .status-main { font-size: 26px; }
  .status-actions .btn { padding: 4px 8px; }
  .ban { width: 26px; height: 26px; }
  .seg button { padding: 4px 6px 3px; }
  .tiles.big { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
  .tile-icon { width: 54px; height: 54px; }
  .tile.burn-other::after { right: calc(50% - 30px); }
  .pred-name { width: 88px; }
}
@media (max-width: 1180px) {
  :root { --team-w: 180px; --side-w: 272px; }
  .data-through { display: none; }
  .main { gap: 14px; padding: 12px; grid-template-columns: 40px var(--team-w) minmax(0, 1fr) var(--team-w) var(--side-w); }
  .side { padding-left: 14px; }
  .rail-end, .rail-name { width: 40px; max-width: 40px; }
  .ban { width: 24px; height: 24px; }
  .bans { gap: 4px; }
  .bans-label { display: none; }
  .slot-name { font-size: 18px; }
  .toolbar { flex-wrap: wrap; }
  .toolbar input[type=search] { flex: 1 1 100%; }
}
@media (max-height: 820px) {
  .wingraph { height: 64px; }
  .wf-row:nth-child(n+4) { display: none; }
  .players { grid-template-columns: 1fr; }
  .player input { padding-top: 0; padding-bottom: 0; }
}

/* ---------- phones: one scrolling column ----------
 * Order: win bar, the two teams side by side, whose turn it is, the likely choices (tap one to
 * enter it), the win details, then search and every champion. The grid comes last and is not a
 * scroll box of its own: a box that scrolls inside a page that scrolls traps the finger. */
@media (max-width: 860px) {
  html, body { height: auto; }
  body { display: block; min-height: 100vh; overflow: auto; }
  .topbar { position: relative; gap: 4px 12px; padding: 9px 12px; }
  .spacer { display: none; }
  .brand { order: 0; }
  .about-wrap { order: 1; margin-left: auto; position: static; }
  .setup-wrap { order: 2; flex-basis: 100%; }
  .topbar > .field, #swapSides, .series, .notices { order: 3; }
  .about-pop { left: 12px; right: 12px; width: auto; max-width: none; top: calc(100% + 4px); }
  /* fingers need more room than a pointer */
  .btn, .setup-btn { min-height: 40px; }
  .seg button { min-height: 40px; padding: 8px 10px 7px; }
  .setup-btn { padding-left: 0; }

  .main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 10px; padding: 12px; }
  .center, .side { display: contents; }
  .rail, .statusbar, .winner-ask, .recap, .preds, .wincard, .toolbar, .grid { grid-column: 1 / -1; }
  .rail { order: 0; }
  .team-blue { order: 1; }
  .team-red { order: 2; }
  .statusbar { order: 3; }
  .winner-ask { order: 4; }
  .recap { order: 5; }
  .preds { order: 6; }
  .wincard { order: 7; margin-top: 0; }
  .toolbar { order: 8; padding-top: 14px; border-top: 1px solid var(--line); }
  .grid { order: 9; }
  body[data-acting=""] .preds { display: none; }  /* draft complete: the recap says it all */

  .rail { flex-direction: row-reverse; gap: 10px; }
  .rail-end, .rail-name { width: auto; max-width: 34vw; }
  .rail-end { flex-direction: row; align-items: baseline; gap: 6px; }
  .rail-red { flex-direction: row-reverse; }
  .evalbar { height: 12px; width: auto; }
  .eval-blue { top: 0; right: auto; height: auto; width: calc(var(--pb) * 1%); border-radius: 2px 0 0 2px; box-shadow: 2px 0 0 var(--bg); transition: width 0.6s var(--ease); }
  .eval-mid { top: -4px; bottom: -4px; left: 50%; right: auto; border-top: 0; border-left: 1px solid var(--line-2); }
  .eval-base { top: -5px; bottom: -5px; left: calc(var(--base) * 1%); right: auto; width: 2px; height: auto; margin: 0 0 0 -1px; transition: left 0.6s var(--ease); }
  .team { overflow: visible; gap: 8px; }
  .team-input { font-size: 22px !important; }
  .players, .bans-label { display: none; }
  .ban { width: 24px; height: 24px; }
  .bans { gap: 3px; }
  .ban-gap { width: 3px; }
  .picks { flex: none; }
  .pick { flex: none; height: 52px; }
  .slot-name { font-size: 17px; }
  .slot-text { padding: 5px 9px 6px; }
  .status-main { font-size: 24px; }
  .toolbar { flex-wrap: wrap; }
  .toolbar input[type=search] { flex: 1 1 100%; font-size: 16px; min-height: 40px; }
  .grid, .recap { flex: none; max-height: none; overflow: visible; padding: 0 2px; }
  .sec-head:first-child { margin-top: 0; }
  .preds { flex: none; }
  .pred-list { overflow: visible; }
  .pred { padding: 7px 8px; }
  .recap-cols { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
