:root {
  --bg: #0a0a0a;
  --panel: #141414;
  --panel-2: #1d1d1d;
  --line: #303030;
  --text: #e0e0e0;
  --muted: #a0a0a0;
  --hk: #f2a93b;
  --am: #4f8fe0;
  --ban: #d0473b;
  --ok: #69e799;
  --sb: #ffd84a; /* Street Brawl changes */
  --weapon: #e8a33d;
  --vitality: #69e799;
  --spirit: #b98cf2;
  --radius: 6px;
  --display: "Saira Condensed", "Barlow", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* read by screen readers, not shown */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
}

button, input, select { font: inherit; color: inherit; }

button, .button {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}
button:hover:not(:disabled), .button:hover { border-color: var(--muted); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.primary, .button.primary { background: var(--hk); color: #111; border-color: var(--hk); font-weight: 700; }
button.primary:hover:not(:disabled), .button.primary:hover { background: #ffbf5e; border-color: #ffbf5e; }
button.danger:hover:not(:disabled) { border-color: var(--ban); color: var(--ban); }
button.big, .button.big { font-size: 17px; padding: 12px 22px; }

.t-hk { color: var(--hk); }
.t-am { color: var(--am); }
.muted { color: var(--muted); }

/* --- views --- */
.landing, .join, .gone, .board, .topbar .actions, .topbar .status { display: none; }
body[data-view="landing"] .landing,
body[data-view="join"] .join,
body[data-view="gone"] .gone { display: block; }
body[data-view="board"] .board { display: grid; }
body[data-view="board"] .topbar .actions { display: flex; }
body[data-view="board"] .topbar .status { display: block; }
.host-only { display: none !important; }
body.is-host .host-only { display: contents !important; }
body.is-host label.host-only { display: flex !important; }
body.is-host .not-host { display: none; }

/* --- top bar --- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  min-height: 56px;
}
.topbar h1 { margin: 0; font: 700 22px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; }
.topbar h1 a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.topbar h1 .logo { height: 28px; width: auto; display: block; }
.topbar h1 span { color: var(--hk); }
.status { flex: 1; text-align: center; font-size: 16px; }
body.my-turn .status { font-weight: 600; }
.actions { gap: 8px; flex-wrap: wrap; }

/* --- cards (landing / join / gone) --- */
.card {
  max-width: 460px;
  margin: 10vh auto 0;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card h2 { margin: 0 0 12px; font: 700 28px/1.1 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.card p { color: var(--muted); margin: 0 0 20px; }
.card code { color: var(--text); background: var(--panel-2); padding: 2px 8px; border-radius: 4px; }
.modes { margin: 0 0 20px; padding-left: 18px; color: var(--muted); font-size: 14px; display: grid; gap: 6px; }
.modes b { color: var(--text); }
.landing .create { display: block; width: 100%; margin-bottom: 10px; }
.join #join-mode { margin: -6px 0 16px; }
.error { color: var(--ban) !important; min-height: 1.4em; margin: 12px 0 0 !important; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field span { font-size: 13px; color: var(--muted); }
.field input, .field select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 16px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--muted); }

.join-code { display: flex; align-items: flex-end; gap: 8px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.join-code .field { flex: 1; margin: 0; }
.join-code input { font-family: ui-monospace, monospace; letter-spacing: .1em; }

.lobby-code { display: inline-flex; align-items: stretch; vertical-align: middle; }
.lobby-code .code-text {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px 6px 12px;
  background: var(--panel-2); border: 1px solid var(--line); border-right: 0; border-radius: 4px 0 0 4px;
  user-select: text; cursor: text;
}
.lobby-code button { display: inline-flex; align-items: center; padding: 6px 9px; color: var(--muted); border-radius: 0; }
.lobby-code .code-copy { border-radius: 0 4px 4px 0; border-left: 0; }
.lobby-code button:hover { color: var(--text); }
.lobby-code svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lobby-code .eye-hide, .lobby-code [aria-pressed="true"] .eye-show { display: none; }
.lobby-code [aria-pressed="true"] .eye-hide { display: inline; }
.lobby-code small { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.lobby-code code { font: 600 15px/1 ui-monospace, monospace; letter-spacing: .1em; }

#join { max-width: 560px; }
.join-extra { display: grid; grid-template-columns: 120px 1fr; gap: 20px; align-items: center; margin-bottom: 16px; }
.join-extra .field { margin-bottom: 14px; }
.rank-preview { width: 120px; height: 120px; object-fit: contain; filter: drop-shadow(0 4px 12px rgba(0,0,0,.4)); }
.rank-field { position: relative; }
.rank-select {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 4px; font-size: 16px; text-align: left;
}
.rank-select img, .rank-menu img { width: 28px; height: 28px; object-fit: contain; }
.rank-select .caret { margin-left: auto; color: var(--muted); }
.rank-menu {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 20; margin: 4px 0 0; padding: 4px; list-style: none;
  max-height: 280px; overflow-y: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.rank-menu[hidden] { display: none; }
.rank-menu li { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 4px; cursor: pointer; }
.rank-menu li:hover { background: color-mix(in srgb, var(--muted) 20%, transparent); }
.sub-field[hidden] { display: none; }
.sub-field b { color: inherit; margin-left: 4px; }
/* fixed-size thumb so the tick labels can sit exactly under its centre at each step */
.sub-field { --thumb: 18px; }
.sub-field input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: var(--thumb); padding: 0; margin: 0; background: transparent; }
.sub-field input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--line); }
.sub-field input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
.sub-field input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: var(--thumb); height: var(--thumb); margin-top: calc((4px - var(--thumb)) / 2); border-radius: 50%; background: var(--text); border: 0; }
.sub-field input[type="range"]::-moz-range-thumb { width: var(--thumb); height: var(--thumb); border-radius: 50%; background: var(--text); border: 0; box-sizing: border-box; }
.sub-field .ticks { position: relative; height: 16px; font-size: 11px; }
.sub-field .ticks i { position: absolute; top: 0; left: calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--i) / 5); transform: translateX(-50%); font-style: normal; }
@media (max-width: 480px) {
  .join-extra { grid-template-columns: 1fr; justify-items: center; }
  .join-extra-fields { width: 100%; }
  .rank-preview { width: 88px; height: 88px; }
}
.join-roles { display: grid; gap: 8px; }
.role-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  font-weight: 600;
  text-align: left;
}
.role-btn small { font-weight: 400; color: var(--muted); }
.role-btn.t-hk { border-color: color-mix(in srgb, var(--hk) 50%, var(--line)); }
.role-btn.t-am { border-color: color-mix(in srgb, var(--am) 50%, var(--line)); }
.role-btn.t-hk:hover:not(:disabled) { border-color: var(--hk); background: color-mix(in srgb, var(--hk) 12%, var(--panel-2)); }
.role-btn.t-am:hover:not(:disabled) { border-color: var(--am); background: color-mix(in srgb, var(--am) 12%, var(--panel-2)); }

/* --- board layout --- */
.board {
  grid-template-columns: 300px 1fr 300px;
  gap: 16px;
  padding: 16px 20px;
  align-items: start;
}

/* --- draft banner: both teams' bans and picks --- */
.draft {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px 20px;
  align-items: stretch;
  padding: 16px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--hk) 10%, transparent), transparent 40%, transparent 60%, color-mix(in srgb, var(--am) 10%, transparent)),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.side {
  --c: var(--hk);
  display: grid;
  grid-template-columns: 64px minmax(0, 520px);
  grid-template-areas: "name name" "ban picks";
  align-content: start;
  gap: 10px 14px;
  min-width: 0;
}
.side[data-team="am"] {
  --c: var(--am);
  grid-template-columns: minmax(0, 520px) 64px;
  grid-template-areas: "name name" "picks ban";
  justify-content: end;
  text-align: right;
}
/* 6 picks a side need more room; 3 bans stack in a slimmer column */
body[data-mode="normal"] .side { grid-template-columns: 56px minmax(0, 700px); }
body[data-mode="normal"] .side[data-team="am"] { grid-template-columns: minmax(0, 700px) 56px; }
.side .team-name { grid-area: name; }
.side .dc {
  grid-area: name;
  justify-self: end;
  align-self: center;
  padding: 3px 8px;
  border: 1px solid var(--ban);
  border-radius: 4px;
  color: var(--ban);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  animation: blink 1.4s steps(2) infinite;
}
.side[data-team="am"] .dc { justify-self: start; }
.side .bans { grid-area: ban; align-self: end; }
.bans { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.side .picks { grid-area: picks; }
.team-name {
  margin: 0;
  font: 700 24px/1 var(--display);
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--c);
}
.side.mine .team-name::after { content: "Your team"; margin: 0 8px; font: 500 12px/1 "Barlow", sans-serif; letter-spacing: .08em; color: var(--muted); vertical-align: middle; }
.side.active .team-name { text-shadow: 0 0 18px var(--c); }

.vs { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-width: 70px; }
.vs-mark { font: 700 34px/1 var(--display); color: var(--muted); letter-spacing: .04em; }
.vs-phase { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); white-space: nowrap; }
body[data-turn="hk"] .vs-phase { color: var(--hk); }
body[data-turn="am"] .vs-phase { color: var(--am); }
.vs-clock { font: 700 30px/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.vs-clock:empty, .vs-bank:empty { display: none; }
.vs-clock.overtime { color: var(--ban); }
.vs-clock.overtime::before { content: "OT "; font-size: 16px; letter-spacing: .08em; }
.vs-clock.low { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .45; } }
.vs-bank { display: flex; gap: 6px; align-items: baseline; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); white-space: nowrap; }
.lock {
  margin-top: 6px;
  min-width: 160px;
  max-width: 220px;
  padding: 14px 20px;
  font: 700 20px/1.1 var(--display);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.lock:not(:disabled) { box-shadow: 0 0 22px -4px var(--hk); }
.vs-bank b { font-variant-numeric: tabular-nums; }

/* portrait slots, shared by picks and bans */
.picks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--size, 4), 1fr); gap: 10px; min-width: 0; }
.side[data-team="am"] .picks { direction: rtl; }
.picks li, .ban-slot {
  position: relative;
  aspect-ratio: 280 / 380;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 1px dashed var(--line);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  direction: ltr;
}
.picks img, .ban-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.picks .label, .ban-slot .label {
  position: relative;
  width: 100%;
  padding: 22px 6px 7px;
  text-align: center;
  font: 600 16px/1.1 var(--display);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.picks li.filled .label, .ban-slot.filled .label { background: linear-gradient(transparent, rgb(0 0 0 / .9)); }
.label.empty { align-self: center; padding: 0 6px; font-size: 14px; color: var(--muted); background: none; }
.picks li.filled { border: 1px solid var(--c); border-bottom-width: 3px; }

/* who's playing an already-picked hero: a plain label, or (for the captain/host) a chip
   that opens a player picker on hover — see .assign-menu below */
.assigned-tag {
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  z-index: 1;
  display: block;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgb(0 0 0 / .7);
  color: var(--text);
  font: 600 11px/1.2 "Barlow", sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
.assigned-tag.empty { color: var(--muted); }
.assigned-tag.assignable {
  cursor: pointer;
  border: 1px solid transparent;
}
.assigned-tag.assignable:hover, .assigned-tag.assignable:focus-visible {
  border-color: var(--c, var(--muted));
  color: var(--text);
}

/* the player picker that pops up next to an assignable tag, like the hero preview */
.assign-menu {
  position: fixed;
  z-index: 20;
  min-width: 160px;
  max-width: 220px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--c, var(--line));
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(0 0 0 / .5);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.assign-menu-title {
  font: 700 11px/1.2 "Barlow", sans-serif;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 0 4px 2px;
}
.assign-opt {
  text-align: left;
  padding: 5px 8px;
  font-size: 13px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.assign-opt.picked { border-color: var(--c, var(--text)); color: var(--c, var(--text)); font-weight: 700; }

/* the hero someone's assigned to play, shown next to their name in the roster */
.playing-tag { flex: none; display: flex; align-items: center; gap: 6px; }
.playing-tag img { width: 28px; height: 38px; object-fit: cover; border-radius: 3px; border: 1px solid var(--c, var(--line)); }
.playing-tag small { font-size: 11px; color: var(--muted); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ban-slot small { display: block; font: 700 10px/1.2 "Barlow", sans-serif; text-transform: uppercase; letter-spacing: .1em; color: var(--ban); }
.ban-slot .label { font-size: 12px; padding: 14px 3px 5px; }
.ban-slot.filled { border: 1px solid var(--ban); }
.ban-slot.filled img { filter: grayscale(1) brightness(.6); }
.ban-slot.filled::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top right, transparent calc(50% - 1.5px), var(--ban) calc(50% - 1.5px), var(--ban) calc(50% + 1.5px), transparent calc(50% + 1.5px));
  opacity: .8;
  pointer-events: none;
}

.picks li.selecting img, .ban-slot.selecting img { opacity: .55; }
.picks li.selecting .label, .ban-slot.selecting .label { background: linear-gradient(transparent, rgb(0 0 0 / .9)); }
.picks li.next, .ban-slot.next { border-color: var(--c); border-style: solid; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { background: color-mix(in srgb, var(--c) 18%, var(--panel-2)); } }

/* --- team rosters (player cards) --- */
.team {
  --c: var(--hk);
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--c);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 16px;
  transition: box-shadow .2s;
}
.team[data-team="am"] { --c: var(--am); }
.team.active { box-shadow: 0 0 0 1px var(--c), 0 0 24px -6px var(--c); }
.team-label {
  margin: 0;
  padding: 0 2px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font: 700 18px/1 var(--display);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c);
}
.team-label .count { font: 500 13px/1 "Barlow", sans-serif; color: var(--muted); letter-spacing: 0; }

.roster { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.roster .muted { padding: 10px 4px; font-size: 14px; }
.member {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  min-height: 120px;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--c, var(--line));
}
.member-rank { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.member-rank img { width: 52px; height: 52px; object-fit: contain; flex: none; }
.member-rank span { display: flex; flex-direction: column; line-height: 1.15; }
.member-rank b { font-size: 14px; text-transform: uppercase; letter-spacing: .05em; }
.member-rank small { font-size: 12px; color: var(--muted); }
.member.you { background: color-mix(in srgb, var(--c, var(--text)) 9%, var(--panel-2)); }
.avatar {
  position: relative;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--c, var(--muted)) 22%, var(--bg));
  color: var(--c, var(--text));
  font: 700 22px/1 var(--display);
}
.avatar .dot { position: absolute; right: -3px; bottom: -3px; width: 11px; height: 11px; border-radius: 50%; background: var(--ok); border: 2px solid var(--panel-2); }
.member.offline { color: var(--muted); }
.member.offline .avatar { opacity: .5; }
.member.offline .dot { background: var(--line); }
.member-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.member-name { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-meta { display: flex; gap: 4px; flex-wrap: wrap; }
.badge { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 1px 5px; border-radius: 3px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.badge.captain { color: var(--c, var(--text)); border-color: var(--c, var(--line)); }
.badge.you { color: var(--text); }
.shadow-pick { flex: none; display: flex; }
.shadow-pick img { width: 34px; height: 46px; object-fit: cover; object-position: top; border-radius: 4px; border: 1px dashed var(--c, var(--muted)); }
.member .rename { padding: 2px 6px; font-size: 13px; border-color: transparent; background: transparent; color: var(--muted); }
.member-tools { position: absolute; top: 4px; right: 4px; display: flex; gap: 4px; padding: 2px; border-radius: 4px; background: var(--panel); opacity: 0; pointer-events: none; transition: opacity .1s; }
.member:hover .member-tools, .member:focus-within .member-tools { opacity: 1; pointer-events: auto; }
.member-tools button { min-width: 30px; padding: 4px 8px; font-size: 13px; border-color: transparent; background: transparent; color: var(--muted); }
.member-tools button:hover:not(:disabled) { border-color: var(--line); background: var(--panel-2); color: var(--text); }
.member.draggable { cursor: grab; }
.member.dragging { opacity: .4; }
body.drag-active .team[data-team], body.drag-active .spectators { outline: 2px dashed var(--line); outline-offset: 4px; border-radius: var(--radius); }
body.drag-active .drop-target { outline-color: var(--c, var(--text)); background: color-mix(in srgb, var(--c, var(--text)) 6%, transparent); }
.seat { font-size: 13px; padding: 8px 10px; border-style: dashed; }
.seat:hover:not(:disabled) { border-color: var(--c, var(--muted)); color: var(--c, var(--text)); }

/* --- pool --- */
.pool { min-width: 0; }
.pool-tools { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; align-items: center; }
#search {
  flex: 1;
  min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 9px 12px;
}
#search:focus { outline: none; border-color: var(--muted); }
.first { align-items: center; gap: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.first select { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 6px; }
.mode-label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }

/* draft order tracker, under the banner */
.order {
  grid-column: 1 / -1;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(var(--steps, 12), 1fr);
  gap: 4px;
}
.order li {
  --c: var(--hk);
  height: 28px;
  border-radius: 4px;
  border-bottom: 3px solid var(--c);
  background: var(--panel-2);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.order li.t-am { --c: var(--am); }
.order li.ban { border-bottom-color: var(--ban); }
.order li.ban::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); }
.order li.now { background: color-mix(in srgb, var(--c) 30%, var(--panel)); color: var(--text); font-weight: 700; }
.order li.done img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; opacity: .55; }
.order li.done span { position: relative; color: var(--text); text-shadow: 0 1px 2px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 3px; }
.order li.ban.done img { filter: grayscale(1); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.hero {
  position: relative;
  padding: 0;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 280 / 380;
  background: var(--panel-2);
  transition: transform .1s, border-color .1s;
}
.hero:disabled { opacity: 1; cursor: default; }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero .name {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 16px 6px 6px;
  background: linear-gradient(transparent, rgb(0 0 0 / .85));
  font: 600 14px/1.1 var(--display);
  text-transform: uppercase;
  letter-spacing: .03em;
  text-align: center;
}
.hero .sb {
  position: absolute;
  top: 5px; right: 5px;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgb(0 0 0 / .7);
  color: var(--muted);
}
.hero .tag {
  position: absolute;
  top: 40%; left: 0; right: 0;
  text-align: center;
  font: 700 15px/1 var(--display);
  text-transform: uppercase;
  letter-spacing: .1em;
}
.hero .wants {
  position: absolute;
  top: 5px; left: 5px; right: 28px;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgb(0 0 0 / .75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: fit-content;
  max-width: calc(100% - 33px);
}
.hero.shadowed:not(.taken) { border: 1px dashed var(--muted); }
.hero.my-shadow:not(.taken) { border: 2px solid var(--text); }
.hero.taken img { filter: grayscale(1) brightness(.35); }
.hero.banned .tag { color: var(--ban); }
body.started:not(.my-turn) .hero:not(.taken) img { filter: brightness(.8); }
body[data-phase="done"] .hero:not(.taken) { opacity: .5; }
body.paused .hero:not(.taken) { opacity: .5; }
body.paused .picks li.next, body.paused .ban-slot.next { animation: none; }

body.my-turn[data-turn="hk"] .hero:not(:disabled):hover { border-color: var(--hk); transform: translateY(-2px); }
body.my-turn[data-turn="am"] .hero:not(:disabled):hover { border-color: var(--am); transform: translateY(-2px); }
body.my-turn[data-phase="ban"] .hero:not(:disabled):hover { border-color: var(--ban); }
body.can-shadow .hero:not(:disabled):hover { border-style: dashed; border-color: var(--text); transform: translateY(-2px); }

.spectators {
  margin-top: 18px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.spectators h3 { margin: 0; font: 700 15px/1 var(--display); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.spectators .roster { flex-direction: row; flex-wrap: wrap; gap: 6px; }
.spectators .member { min-height: 0; padding: 4px 8px; gap: 8px; }
.spectators .member-rank { margin: 0; gap: 4px; }
.spectators .member-rank img { width: 22px; height: 22px; }
.spectators .member-rank small { display: none; }
.spectators .member-rank b { font-size: 11px; font-weight: 600; color: var(--muted); }
.spectators .member-rank img { opacity: .75; }
.spectators .member.you .member-rank b { color: var(--text); }
.spectators .avatar { width: 26px; height: 26px; font-size: 15px; }
.spectators .member-name { font-size: 14px; }
.spectators .seat { align-self: flex-start; }

.credit { color: var(--muted); font-size: 12px; margin-top: 16px; text-align: center; }
.credit a { color: inherit; }

/* --- final draft summary --- */
.final {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(0 0 0 / .75);
  overflow-y: auto;
}
.final-card {
  width: min(960px, 100%);
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
}
.final-card h2 { margin: 0 0 18px; font: 700 30px/1 var(--display); text-transform: uppercase; letter-spacing: .04em; }
.final-card > p { margin: 18px 0 14px; }
.final-teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; text-align: left; }
.final-team { --c: var(--hk); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.final-team[data-team="am"] { --c: var(--am); text-align: right; }
.final-players { margin: 0; color: var(--muted); font-size: 14px; }
.final-picks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--size, 4), 1fr); gap: 8px; }
.final-picks li {
  position: relative;
  aspect-ratio: 280 / 380;
  border: 1px solid var(--c);
  border-bottom-width: 3px;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.final-picks img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.final-picks .label {
  position: relative;
  width: 100%;
  padding: 18px 4px 6px;
  text-align: center;
  font: 600 14px/1.1 var(--display);
  text-transform: uppercase;
  background: linear-gradient(transparent, rgb(0 0 0 / .9));
}
.final-bans { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.final-team[data-team="am"] .final-bans { justify-content: flex-end; }
.final-bans small { font: 700 11px/1 "Barlow", sans-serif; text-transform: uppercase; letter-spacing: .1em; color: var(--ban); }
.final-ban { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border: 1px solid var(--ban); border-radius: 4px; }
.final-ban img { width: 24px; height: 32px; object-fit: cover; border-radius: 2px; filter: grayscale(1) brightness(.7); }
.final-ban.none { padding: 3px 8px; color: var(--muted); border-style: dashed; }
.final-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* --- hero info: the guide page's detail and the draft's hover preview --- */
.hero-info { font-size: 13px; line-height: 1.4; }
.hero-info h4 { margin: 0 0 6px; font: 700 15px/1.1 var(--display); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.hero-info h4 small { margin-left: 6px; font: 500 12px/1 "Barlow", sans-serif; text-transform: none; letter-spacing: 0; color: var(--text); }
.hero-info section + section { margin-top: 14px; }
.hero-info a { color: inherit; }
.ins-head { display: flex; gap: 12px; align-items: center; }
.ins-head img { width: 54px; aspect-ratio: 280 / 380; object-fit: cover; border-radius: 4px; }
.ins-head h3 { margin: 0; font: 700 26px/1 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.ins-head p { margin: 4px 0 0; color: var(--muted); }
.sb-tag { color: var(--sb); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.ins-note { margin: 10px 0 0; padding: 6px 10px; border-left: 3px solid var(--sb); background: color-mix(in srgb, var(--sb) 8%, var(--panel-2)); }
.ins-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 18px; margin-top: 14px; }
.ins-stats { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
.ins-stats div { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; border-bottom: 1px solid var(--panel-2); }
.ins-stats dt { color: var(--muted); }
.ins-stats dd { margin: 0; text-align: right; font-weight: 600; }
.ins-stats .changed dt { color: var(--sb); }
/* per-boon gain: the wiki's mint boon badge */
.boon { display: inline-flex; align-items: center; gap: 1px; margin-left: 6px; padding: 1px 4px 1px 2px; border-radius: 5px; background: rgba(33, 33, 29, .6); color: #99ffd6; font-weight: 700; font-size: .85em; text-shadow: 1px 1px rgba(0, 0, 0, .6); vertical-align: 1px; }
.boon img { width: 11px; height: 13px; opacity: .85; }
.ins-small { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.ins-small b { color: var(--text); }
.ins-foot { margin: 14px 0 0; color: var(--muted); font-size: 12px; }

/* a value Street Brawl changes, with the normal one struck through */
.sbv { color: var(--sb); font-weight: 700; white-space: nowrap; }
.sbv del { margin-left: 4px; color: var(--muted); font-weight: 400; font-size: .9em; }
.scale { color: var(--spirit); font-weight: 500; font-size: .92em; white-space: nowrap; }

.ins-draft { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.odds { width: 11px; height: 13px; }
.odds.down { transform: rotate(180deg); filter: hue-rotate(210deg) saturate(2.5); }
.ins-tier { display: flex; gap: 8px; align-items: stretch; margin-top: 10px; }
.ins-tier-n { flex: none; width: 24px; padding-top: 4px; font: 700 15px/1 var(--display); color: var(--muted); }
/* a tier's "more often" and "less often" columns, tinted like the wiki's */
.ins-odds { --chance: #4f8f36; flex: 1 1 auto; min-width: 0; border-radius: 6px; overflow: hidden; background: color-mix(in srgb, var(--chance) 12%, transparent); }
.ins-odds.low { --chance: #9c3f37; flex: 0 1 auto; }
.ins-odds-head { display: flex; align-items: center; gap: 5px; padding: 3px 8px; background: var(--chance); color: #fff; font-size: 12px; font-weight: 700; white-space: nowrap; }
.ins-odds-head .odds { filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, .5)); }
.ins-odds-head .odds.down { filter: hue-rotate(210deg) saturate(2.5) drop-shadow(-1px -1px 0 rgba(0, 0, 0, .5)); }
.ins-odds > div { display: flex; flex-wrap: wrap; gap: 8px 6px; padding: 8px; }
/* item tiles: the game's icon on its slot colour */
.ins-item { --c: var(--line); width: 64px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.ins-item.weapon { --c: var(--weapon); }
.ins-item.vitality { --c: var(--vitality); }
.ins-item.spirit { --c: var(--spirit); }
.ins-item-icon {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--c) 55%, #1a1a1a);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 80%, #fff 0%);
}
.ins-item-icon img { position: absolute; inset: 5px; width: 34px; height: 34px; object-fit: contain; }
.ins-item-name { font-size: 10.5px; line-height: 1.15; text-align: center; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.ins-ab { padding: 8px 10px; background: var(--panel-2); border-radius: var(--radius); border-left: 3px solid var(--line); }
.ins-ab + .ins-ab { margin-top: 8px; }
.ins-ab.changed { border-left-color: var(--sb); }
.ins-ab header { display: flex; align-items: center; gap: 8px; }
.ins-ab header img { width: 26px; height: 26px; border-radius: 4px; background: var(--bg); }
.ins-ab header b { font: 700 16px/1 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.ins-ab header .sb-tag { margin-left: auto; font-size: 10px; }
.ins-desc { margin: 6px 0 0; color: var(--text); }
/* description highlights, coloured like deadlock.wiki: plain ones bold white,
   keywords in their stat's colour with the game's icon */
.hero-info b { font-weight: 700; color: #fff; }
.hero-info b.spirit { color: #bc8ee8; }
.hero-info b.weapon { color: #ec981a; }
.hero-info b.heal { color: #13f278; }
.hero-info b.effect { color: #ffefd7; }
.hero-info i.dim { color: #c0c0c0; }
.kw { white-space: nowrap; }
.kw-icon { width: 15px; height: 15px; margin-right: 3px; vertical-align: -2px; object-fit: contain; }
.kw-icon.tint-green { filter: brightness(0) saturate(100%) invert(66%) sepia(32%) saturate(1046%) hue-rotate(95deg) brightness(103%) contrast(102%); }
.kw-icon.tint-brown { filter: brightness(0) saturate(100%) invert(80%) sepia(42%) saturate(6295%) hue-rotate(355deg) brightness(104%) contrast(85%); }
.kw-icon.tint-white { filter: brightness(0) invert(90%) sepia(20%) saturate(565%) hue-rotate(318deg) brightness(106%) contrast(104%); }
.kw-icon.tint-purple { filter: brightness(0) saturate(100%) invert(78%) sepia(43%) saturate(4738%) hue-rotate(215deg) brightness(100%) contrast(102%); }
.hero-info kbd { padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; background: var(--panel); font: 600 11px/1.4 "Barlow", sans-serif; white-space: nowrap; }
.ins-heads { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0; color: var(--muted); font-size: 12px; }
.ins-heads b { color: var(--text); }
.ins-heads .changed { color: var(--sb); }
.ins-ab .ins-stats { font-size: 12px; }
.ins-ab .ins-stats div { border-bottom-color: var(--panel); }
.ins-ups { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.ins-ups li { padding: 4px 6px; border-radius: 4px; background: var(--panel); font-size: 12px; }
.ins-ups li.changed { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sb) 60%, transparent); }
.ins-ups li > span { display: block; font: 700 11px/1 var(--display); color: var(--muted); margin-bottom: 2px; }

/* hover preview in the draft: the short version */
.inspect {
  position: fixed;
  z-index: 15;
  width: min(360px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgb(0 0 0 / .6);
}
.inspect .ins-head img { width: 40px; }
.inspect .ins-head h3 { font-size: 22px; }
.ins-quick { display: flex; flex-wrap: wrap; gap: 2px 12px; margin: 10px 0 0; color: var(--muted); }
.ins-quick b { color: var(--text); }
.ins-abs { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ins-abs li { display: flex; gap: 8px; align-items: flex-start; padding: 4px 6px; border-radius: 4px; border-left: 3px solid transparent; background: var(--panel-2); }
.ins-abs li.changed { border-left-color: var(--sb); }
.ins-abs img, .ins-abs li > span { flex: none; width: 24px; height: 24px; border-radius: 4px; }
.ins-abs b { font: 700 14px/24px var(--display); text-transform: uppercase; letter-spacing: .03em; }
.ins-abs small { display: block; font-size: 12px; color: var(--muted); }
.inspect .ins-foot { margin-top: 10px; }
.inspect .ins-foot a { color: var(--hk); font-weight: 600; text-decoration: none; }

/* --- hero guide page --- */
body[data-view="guide"] .topbar { position: sticky; top: 0; z-index: 2; }
.guide-title { font: 700 18px/1 var(--display); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.guide { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; padding: 16px 20px; max-width: 1240px; margin: 0 auto; align-items: start; }
/* wide screens: use the width, with the item draft in its own column beside the abilities */
@media (min-width: 1440px) {
  .guide { max-width: 2000px; padding: 16px 12px; }
  .guide-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 30%); column-gap: 20px; align-items: start; }
  .guide-detail > :not(.ins-body, .ins-draft) { grid-column: 1 / -1; }
  .guide-detail .ins-draft { margin-top: 14px; padding: 0 0 0 20px; border-top: 0; border-left: 1px solid var(--line); }
  .guide-detail .ins-tier { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 6px 8px; }
  .guide-detail .ins-odds { grid-column: 2; }
}
.guide-list {
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 88px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.guide-list select { width: 100%; padding: 7px 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; }
.guide-list input[type="search"] { width: 100%; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; }
.guide-filter { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.guide-list ul { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; scrollbar-color: var(--line) transparent; }
.guide-list a { position: relative; display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 4px; color: inherit; text-decoration: none; }
/* each hero in its identity colours (--hc main, --hd dark, --ha accent, --ht title) */
.guide-list a {
  --hc: var(--panel-2); --hd: var(--panel-2); --ha: var(--line); --ht: var(--text);
  background: linear-gradient(90deg, color-mix(in srgb, var(--hc) 45%, transparent), transparent 90%);
  box-shadow: inset 3px 0 0 var(--ha);
}
.guide-list a:hover { background: linear-gradient(90deg, color-mix(in srgb, var(--hc) 75%, transparent), color-mix(in srgb, var(--hd) 20%, transparent)); }
.guide-list a[aria-current] {
  background: linear-gradient(90deg, var(--hc), var(--hd));
  box-shadow: inset 4px 0 0 var(--ha), 0 0 0 1px var(--ha);
  color: var(--ht);
  font-weight: 600;
}
.guide-list img { width: 28px; aspect-ratio: 280 / 380; object-fit: cover; border-radius: 3px; }
.guide-list .sb { margin-left: auto; font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 3px; background: var(--bg); color: var(--sb); }
.guide-detail { scroll-margin-top: 68px; min-height: 60vh; padding: 18px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; }
.guide-detail .ins-head img { width: 72px; }
/* hero header in the hero's colours, like the wiki's infobox */
.hero-info[style*="--hc"] > .ins-head {
  margin: -4px -6px 0;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--hc), var(--hd) 55%, transparent);
  border-left: 4px solid var(--ha);
}
.hero-info[style*="--hc"] > .ins-head h3 { color: var(--ht); }
.hero-info[style*="--hc"] > .ins-head p { color: color-mix(in srgb, var(--ht) 75%, transparent); }
.guide-detail .ins-head h3 { font-size: 34px; }
@media (max-width: 760px) {
  .guide { grid-template-columns: minmax(0, 1fr); padding: 12px 16px; }
  .guide-list { position: static; max-height: none; min-width: 0; }
  .guide-list ul { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
  .guide-list a { flex: none; background: linear-gradient(180deg, color-mix(in srgb, var(--hc) 45%, transparent), transparent); box-shadow: inset 0 3px 0 var(--ha); flex-direction: column; gap: 2px; width: 64px; font-size: 11px; text-align: center; }
  .guide-list img { width: 44px; }
  .guide-list .sb { position: absolute; top: 2px; right: 2px; }
  .guide-detail { padding: 14px; }
  .guide-title { display: none; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 4px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* --- responsive --- */
@media (max-width: 1200px) {
  .board { grid-template-columns: 250px 1fr 250px; }
}
@media (max-width: 900px) {
  .ins-body { grid-template-columns: 1fr; }
  .board { grid-template-columns: 1fr 1fr; padding: 12px 16px; }
  /* teams stack, so the team tints run top and bottom */
  .draft {
    grid-template-columns: 1fr;
    padding: 12px;
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--hk) 10%, transparent), transparent 40%, transparent 60%, color-mix(in srgb, var(--am) 10%, transparent)),
      var(--panel);
  }
  body[data-mode] .side, body[data-mode] .side[data-team="am"] {
    grid-template-columns: 64px minmax(0, 1fr);
    grid-template-areas: "name name" "ban picks";
    justify-content: stretch;
    text-align: left;
  }
  .side[data-team="am"] .picks { direction: ltr; }
  .vs { flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .lock { flex-basis: 100%; max-width: none; }
  .vs-mark { font-size: 22px; }
  .pool { grid-column: 1 / -1; order: 2; }
  .team { position: static; }
  .status { order: 3; flex-basis: 100%; }
  .member-tools { position: static; opacity: 1; pointer-events: auto; background: none; }
}
@media (max-width: 520px) {
  .ins-tier { flex-wrap: wrap; }
  .ins-odds, .ins-odds.low { flex: 1 1 100%; }
  .ins-tier-n { width: 100%; padding-top: 0; }
  .ins-ups { grid-template-columns: 1fr; }
  .ins-stats { grid-template-columns: 1fr; }
  .topbar { padding: 10px 16px; }
  .board { grid-template-columns: 1fr; gap: 10px; }
  body[data-mode] .side, body[data-mode] .side[data-team="am"] { grid-template-columns: 48px minmax(0, 1fr); gap: 8px; }
  .bans { gap: 4px; }
  .team-name { font-size: 18px; }
  .picks { gap: 6px; }
  .picks .label { font-size: 12px; padding: 16px 3px 5px; }
  .ban-slot .label { font-size: 10px; padding: 10px 2px 4px; }
  .final-teams { grid-template-columns: 1fr; }
  .final-teams .vs-mark { justify-self: center; }
  .final-team[data-team="am"] { text-align: left; }
  .final-team[data-team="am"] .final-bans { justify-content: flex-start; }
  .team { padding: 8px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
  .order li span { display: none; }
  .card { margin: 24px 16px 0; padding: 20px; }
}

.join-extra .field[hidden] { display: none; }
.badge.rank { display: inline-flex; align-items: center; gap: 4px; }
.badge.rank img { width: 18px; height: 18px; object-fit: contain; }
