:root {
  --bg: #070a10;
  --bg-2: #0a0f18;
  --panel: #0d141f;
  --panel-2: #111b29;
  --panel-3: #162233;
  --line: #243247;
  --line-soft: #1a2535;
  --text: #e9f0fa;
  --muted: #8b9bb2;
  --dim: #7b8aa0;
  --blue: #46a7ff;
  --blue-soft: rgba(70, 167, 255, .14);
  --red: #ff5570;
  --red-soft: rgba(255, 85, 112, .14);
  --accent: #ff3d81;
  --accent-2: #ffbf5b;
  --gold: #ffbf5b;
  --green: #48d7a0;
  --shadow: 0 18px 60px rgba(0, 0, 0, .35);
  --radius: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); scrollbar-color: #2b3e55 var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Segoe UI", "Microsoft JhengHei UI", "Microsoft JhengHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(70, 167, 255, .14), transparent 65%),
    radial-gradient(800px 500px at 92% 0%, rgba(255, 61, 129, .10), transparent 60%),
    var(--bg);
}

button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2 { text-wrap: pretty; }
.lede { text-wrap: pretty; }
::selection { background: rgba(70, 167, 255, .34); color: #fff; }

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .9), transparent 78%);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1500px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 34px;
}

/* --------------------------------------------------------------- header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  width: min(1500px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(7, 10, 16, .9);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .16);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #ff7c4d);
  color: #12040a;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -.04em;
  box-shadow: 0 6px 22px rgba(255, 61, 129, .28);
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.05; }
.brand-copy strong { font-size: 17px; letter-spacing: .14em; }
.brand-copy small { color: var(--muted); font-size: 10px; letter-spacing: .16em; margin-top: 4px; }

.top-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.status-dot {
  width: 7px; height: 7px; border-radius: 99px;
  background: var(--dim);
  box-shadow: 0 0 0 4px rgba(139, 155, 178, .08);
}
.status-dot.ok { background: var(--green); box-shadow: 0 0 0 4px rgba(72, 215, 160, .10); }
.status-dot.bad { background: var(--red); box-shadow: 0 0 0 4px rgba(255, 85, 112, .12); }
.data-badge {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(13, 20, 31, .7);
  color: #c7d4e7;
}
.version { color: var(--dim); font-variant-numeric: tabular-nums; }
.intro-status { display: flex; align-items: center; gap: 10px; margin: 16px 0 0; }
.intro-status .data-badge { font-size: 12px; }
.top-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}
.top-link:hover { color: var(--text); border-color: #36506d; background: var(--panel-2); }
.top-link:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.top-link.is-active { color: var(--text); border-color: rgba(255, 61, 129, .45); background: rgba(255, 61, 129, .1); }
.top-link[aria-current="page"] { color: var(--text); border-color: rgba(255, 61, 129, .45); background: rgba(255, 61, 129, .1); }

/* ----------------------------------------------------------------- intro */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, .6fr);
  gap: 32px;
  align-items: end;
  padding: 34px 2px 24px;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .2em;
}
.intro h1 {
  margin: 0;
  font-size: clamp(28px, 3.4vw, 46px);
  line-height: 1.12;
  letter-spacing: -.045em;
  font-weight: 800;
}
.intro h1 span {
  display: inline-block;
  background: linear-gradient(100deg, var(--accent), #ff9a55 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede {
  max-width: 730px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.guide-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 7px 12px 7px 8px;
  border: 1px solid rgba(255, 61, 129, .28);
  border-radius: 10px;
  background: linear-gradient(100deg, rgba(255, 61, 129, .09), rgba(70, 167, 255, .05));
  color: var(--text);
  font-size: 12px;
  text-decoration: none;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.guide-cta:hover {
  border-color: rgba(255, 61, 129, .55);
  background: linear-gradient(100deg, rgba(255, 61, 129, .16), rgba(70, 167, 255, .09));
  transform: translateY(-1px);
}
.guide-cta:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.guide-cta-tag {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--accent);
  color: #12050b;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
}
.guide-cta-copy { display: inline-flex; align-items: baseline; gap: 8px; }
.guide-cta-copy strong { color: var(--text); font-size: 12px; }
.guide-cta-copy span { color: var(--muted); font-size: 11px; }
.guide-cta-arrow { color: var(--accent); transition: transform .18s ease; }
.guide-cta:hover .guide-cta-arrow { transform: translateX(3px); }
.intro-note {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255, 61, 129, .07), transparent);
  color: var(--muted);
  font-size: 12px;
}
.intro-note p { margin: 4px 0 0; }
.note-kicker { color: var(--text); font-size: 11px; font-weight: 700; letter-spacing: .1em; }

/* --------------------------------------------------------------- toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(17, 27, 41, .92), rgba(10, 15, 24, .92));
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.controls { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.controls label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .04em;
}
select, input[type="search"] {
  min-height: 34px;
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: var(--bg-2);
  color: var(--text);
  outline: none;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 13px) calc(50% - 2px), calc(100% - 8px) calc(50% - 2px); background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
select:hover, input[type="search"]:hover { border-color: #36506d; }
select:focus-visible, input:focus-visible, button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

button {
  min-height: 34px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
button:hover { border-color: #3b5677; background: var(--panel-3); }
button:active { transform: translateY(1px); }
button.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--blue), #2d7cff);
  color: #03101f;
  font-weight: 800;
  box-shadow: 0 6px 20px rgba(70, 167, 255, .22);
}
button.primary:hover { background: linear-gradient(135deg, #62b5ff, #4392ff); }
button.primary:disabled { opacity: .55; cursor: progress; }
button.ghost { color: var(--muted); background: transparent; }
button.ghost:hover { color: var(--text); }
.btn-spark { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 99px; background: #03101f; vertical-align: 1px; }

.known-wrap { display: flex; align-items: center; gap: 10px; }
.server-pill {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
}
select.server-pill {
  min-height: 26px;
  padding: 3px 24px 3px 8px;
  background-color: var(--bg-2);
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  cursor: pointer;
}
.known-label { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.known-label.incomplete { color: var(--accent-2); }

.role-picker-wrap { display: flex; align-items: center; gap: 7px; min-width: 0; }
.role-picker-title { color: var(--muted); font-size: 11px; letter-spacing: .04em; white-space: nowrap; }
.role-picker {
  display: flex;
  align-items: stretch;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(7, 12, 20, .55);
}
.role-option {
  --role-icon: none;
  --role-icon-hover: none;
  --role-icon-active: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 50px;
  min-height: 40px;
  padding: 3px 6px 2px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  line-height: 1;
}
.role-option:hover { color: var(--text); border-color: rgba(255, 191, 91, .22); background: rgba(255, 191, 91, .06); }
.role-option[aria-checked="true"] {
  border-color: rgba(70, 167, 255, .5);
  background: linear-gradient(180deg, rgba(70, 167, 255, .16), rgba(70, 167, 255, .05));
  color: var(--text);
}
.role-icon {
  width: 24px;
  height: 24px;
  background-image: var(--role-icon);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: .78;
  transition: opacity .16s ease;
}
.role-option:hover .role-icon,
.role-option[aria-checked="true"] .role-icon { opacity: 1; }
.role-option:not([aria-checked="true"]):hover .role-icon { background-image: var(--role-icon-hover); }
.role-option[aria-checked="true"] .role-icon { background-image: var(--role-icon-active); }
.role-name { font-size: 10px; letter-spacing: .03em; white-space: nowrap; }
.role-option[data-role="TOP"] {
  --role-icon: url("/static/role-icons/icon-position-top.png");
  --role-icon-hover: url("/static/role-icons/icon-position-top-hover.png");
  --role-icon-active: url("/static/role-icons/icon-position-top-blue.png");
}
.role-option[data-role="JUNGLE"] {
  --role-icon: url("/static/role-icons/icon-position-jungle.png");
  --role-icon-hover: url("/static/role-icons/icon-position-jungle-hover.png");
  --role-icon-active: url("/static/role-icons/icon-position-jungle-blue.png");
}
.role-option[data-role="MIDDLE"] {
  --role-icon: url("/static/role-icons/icon-position-middle.png");
  --role-icon-hover: url("/static/role-icons/icon-position-middle-hover.png");
  --role-icon-active: url("/static/role-icons/icon-position-middle-blue.png");
}
.role-option[data-role="BOTTOM"] {
  --role-icon: url("/static/role-icons/icon-position-bottom.png");
  --role-icon-hover: url("/static/role-icons/icon-position-bottom-hover.png");
  --role-icon-active: url("/static/role-icons/icon-position-bottom-blue.png");
}
.role-option[data-role="UTILITY"] {
  --role-icon: url("/static/role-icons/icon-position-utility.png");
  --role-icon-hover: url("/static/role-icons/icon-position-utility-hover.png");
  --role-icon-active: url("/static/role-icons/icon-position-utility-blue.png");
}

/* ----------------------------------------------------------------- board */
.board {
  display: grid;
  grid-template-columns: minmax(220px, 272px) minmax(0, 1fr) minmax(220px, 272px);
  gap: 12px;
  margin-top: 12px;
  align-items: stretch;
}
.team, .pool-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(17, 27, 41, .9), rgba(10, 15, 24, .94));
  box-shadow: var(--shadow);
  min-height: 0;
}
.team { padding: 12px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.team::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0; height: 2px;
  background: var(--blue);
}
.team-red::before { background: var(--red); }
.team-red { border-color: rgba(255, 85, 112, .25); }
.team-blue { border-color: rgba(70, 167, 255, .25); }

.team-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 0 1px 10px; }
.team-name { display: block; font-size: 17px; font-weight: 800; letter-spacing: .02em; }
.team-blue .team-name { color: var(--blue); }
.team-red .team-name { color: var(--red); }
.team-side { display: block; color: var(--dim); font-size: 10px; letter-spacing: .14em; margin-top: 2px; }
.team-right { text-align: right; }
.ban-caption { color: var(--dim); font-size: 10px; font-weight: 700; letter-spacing: .14em; margin-top: 3px; }

.ban-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.ban-row .slot { justify-self: center; }
.team-red .ban-row { direction: rtl; }

.pick-list { display: flex; flex-direction: column; gap: 7px; padding-top: 12px; flex: 1; }
.pick-row { display: flex; align-items: center; gap: 8px; min-height: 58px; }
.pick-role { width: 34px; flex: none; color: var(--dim); font-size: 11px; }
.pick-name { min-width: 0; flex: 1; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-row.has-champion .pick-name { color: var(--text); }
.team-red .pick-row { flex-direction: row-reverse; text-align: right; }
.team-red .pick-role { text-align: right; }
.team-red .pick-name { text-align: right; }

.slot {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0a111b;
  color: var(--dim);
  overflow: hidden;
}
.slot.ban { width: 38px; height: 38px; border-radius: 8px; }
.slot.empty { border-style: dashed; background: rgba(255, 255, 255, .015); cursor: pointer; }
.slot.empty.user-role { border-color: var(--blue); background: var(--blue-soft); box-shadow: inset 0 0 0 1px rgba(70, 167, 255, .18); }
.slot.selected { border-style: solid; border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(255, 191, 91, .22); }
.slot.filled { border-color: #334b67; cursor: grab; }
.slot.filled:hover { border-color: var(--accent); }
.team-red .slot.filled { border-color: #5d3542; }
.team-red .slot.filled:hover { border-color: var(--red); }
.slot img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.drag-ghost {
  position: fixed;
  z-index: 1000;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 2px solid var(--accent-2);
  border-radius: 10px;
  background: #0b121c;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .55);
  overflow: hidden;
  pointer-events: none;
  opacity: .92;
}
.drag-ghost img { width: 100%; height: 100%; object-fit: cover; display: block; }
.drag-ghost.fallback { color: var(--accent-2); font-weight: 800; }
.slot-mark { font-size: 18px; font-weight: 300; line-height: 1; color: var(--dim); }
.slot.ban .slot-mark { font-size: 14px; }
.slot-clear {
  position: absolute;
  top: 2px; right: 2px;
  display: grid;
  place-items: center;
  width: 18px; height: 18px;
  border-radius: 5px;
  background: rgba(4, 8, 13, .78);
  color: #dce8f6;
  font-size: 12px;
  line-height: 1;
  opacity: 0;
  transition: opacity .15s ease;
  pointer-events: none;
}
.slot.filled:hover .slot-clear { opacity: 1; }
.slot.drag-over { border-color: var(--accent-2) !important; box-shadow: 0 0 0 2px rgba(255, 191, 91, .2); }
.slot.dragging { opacity: .45; }

/* ------------------------------------------------------------------ pool */
.pool-panel { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.pool-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 13px 10px; border-bottom: 1px solid var(--line-soft); }
.pool-head h2, .panel-head h2 { margin: 0; font-size: 13px; letter-spacing: .03em; }
.pool-heading { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.my-role-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid rgba(255, 191, 91, .5); border-radius: 999px; background: rgba(255, 191, 91, .1); color: var(--gold); font-size: 11px; font-weight: 900; letter-spacing: .03em; white-space: nowrap; box-shadow: 0 0 14px rgba(255, 191, 91, .1); }
.pick-row.my-role .pick-role { color: var(--gold); font-weight: 800; }
.pick-row.my-role .pick-role::after { content: "•"; margin-left: 4px; color: var(--gold); }
.pool-hint { display: block; margin-top: 2px; color: var(--dim); font-size: 10px; }
.pool-filters { display: flex; align-items: center; gap: 7px; }
.search-wrap { position: relative; }
#searchInput { width: 154px; padding-left: 12px; }
#searchInput::placeholder { color: var(--dim); }
#poolRoleSelect { min-height: 34px; }

/* Fixed height keeps the board stable while the search filters the grid. */
.pool-scroll { position: relative; flex: none; height: 568px; overflow-y: auto; padding: 9px; scrollbar-width: thin; scrollbar-color: #2b3e55 transparent; scrollbar-gutter: stable; }
.pool-scroll::-webkit-scrollbar { width: 8px; }
.pool-scroll::-webkit-scrollbar-thumb { background: #2b3e55; border-radius: 99px; }
.pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 7px; }
.champ-tile {
  position: relative;
  display: block;
  min-width: 0;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: #0b121c;
  text-align: left;
  cursor: pointer;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: manipulation;
  transition: border-color .14s ease, transform .14s ease, opacity .14s ease;
}
.champ-tile:hover { border-color: #3b4e67; transform: translateY(-1px); }
.champ-tile:active { cursor: grabbing; }
.champ-tile img { width: 100%; aspect-ratio: 1 / 1; display: block; object-fit: cover; border-radius: 6px; background: #0a111b; pointer-events: none; }
.champ-tile .tile-name { display: block; padding: 5px 2px 3px; color: #c3d1e3; font-size: 11px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.champ-tile.used { opacity: .28; filter: grayscale(.7); cursor: not-allowed; }
.champ-tile.used:hover { transform: none; border-color: var(--line-soft); }
.champ-tile.used::after { content: "✓"; position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 17px; height: 17px; border-radius: 99px; background: var(--green); color: #04140d; font-size: 10px; font-weight: 900; }
.champ-tile.placeholder-img { display: grid; place-items: center; aspect-ratio: 1 / 1; border-radius: 6px; background: linear-gradient(135deg, #1a2a40, #0c1522); color: var(--muted); font-size: 18px; font-weight: 700; }
.pool-empty { padding: 40px 10px; color: var(--dim); text-align: center; }
.pool-foot { display: flex; justify-content: space-between; gap: 10px; padding: 7px 12px; border-top: 1px solid var(--line-soft); color: var(--dim); font-size: 10px; }

/* ------------------------------------------------------------------ bottom */
.bottom-grid { display: grid; grid-template-columns: minmax(0, 1.28fr) minmax(320px, .72fr); gap: 12px; margin-top: 12px; align-items: stretch; }
.assist-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 12px; padding: 9px 12px 9px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(120deg, rgba(255, 61, 129, .1), rgba(70, 167, 255, .06)), var(--panel); box-shadow: var(--shadow); }
.assist-copy { display: flex; align-items: center; gap: 10px; min-width: 0; }
.assist-kicker { flex: none; padding: 2px 8px; border: 1px solid rgba(255, 191, 91, .5); border-radius: 999px; color: var(--gold); font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.assist-text { min-width: 0; }
.assist-title { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.assist-sub { display: block; margin-top: 1px; color: var(--dim); font-size: 10px; }
.assist-toggle { flex: none; min-height: 30px; padding: 4px 13px; border-radius: 999px; font-size: 11px; }
.assist-toggle[aria-expanded="true"] { border-color: rgba(70, 167, 255, .55); background: var(--blue-soft); }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, rgba(17, 27, 41, .88), rgba(10, 15, 24, .94)); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 14px 10px; border-bottom: 1px solid var(--line-soft); }
.panel-sub { display: block; margin-top: 2px; color: var(--dim); font-size: 10px; }
.recs-hint { color: var(--dim); font-size: 10px; padding-top: 2px; }
.analysis-badge { padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; }
.analysis-badge.partial { color: var(--accent-2); border-color: rgba(255, 191, 91, .25); }

.recs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; padding: 10px; min-height: 196px; transition: opacity .2s ease; }
.recs.is-updating { opacity: .55; }
.recs.just-updated .rec-card { animation: recFlash .9s ease; }
@keyframes recFlash {
  0% { border-color: var(--accent); background: #15263d; }
  100% { border-color: var(--line); background: #0b121d; }
}
.placeholder { display: grid; place-items: center; min-height: 120px; color: var(--dim); font-size: 12px; grid-column: 1 / -1; text-align: center; padding: 20px; }
.rec-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0b121d;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .15s ease, transform .15s ease, background .15s ease;
}
.rec-card:hover { border-color: var(--accent); transform: translateY(-2px); background: #0e1724; }
.recs .rec-card:first-child { border-color: rgba(255, 191, 91, .36); box-shadow: inset 0 2px 0 rgba(255, 191, 91, .9); }
.recs .rec-card:first-child .rec-score strong { color: #ffd48a; }

/* One-trick band: only shown for first-pick mode, below the main shortlist. */
.ot-recs { border-top: 1px dashed rgba(167, 139, 250, .35); background: linear-gradient(180deg, rgba(167, 139, 250, .06), transparent 72%); }
.ot-recs[hidden] { display: none; }
.ot-recs-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 9px 12px 0; }
.ot-recs-title { color: #c4b5fd; font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.ot-recs-hint { color: var(--dim); font-size: 10px; }
.ot-recs-grid { min-height: 0; padding-top: 6px; }
.ot-recs-grid .rec-card:first-child { border-color: var(--line); box-shadow: none; }
.ot-recs-grid .rec-card:first-child .rec-score strong { color: #c4b5fd; }
.rec-card.is-ot { border-style: dashed; }
.rec-card.is-ot .rec-score strong { color: #c4b5fd; }
.rec-ot-badge { margin-left: auto; flex: none; padding: 1px 6px; border: 1px solid rgba(167, 139, 250, .5); border-radius: 999px; color: #c4b5fd; font-size: 9px; font-weight: 800; letter-spacing: .06em; }
.rec-top { display: flex; align-items: center; gap: 9px; padding: 9px 9px 6px; }
.rec-img { width: 46px; height: 46px; flex: none; border-radius: 8px; object-fit: cover; background: #111c2a; }
.rec-name { display: block; font-size: 14px; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-tags { display: block; color: var(--dim); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-score { display: flex; align-items: baseline; gap: 5px; padding: 0 9px; }
.rec-score strong { font-size: 22px; line-height: 1.1; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.rec-score span { color: var(--dim); font-size: 10px; }
.rec-metrics { display: flex; gap: 8px; padding: 3px 9px 0; color: var(--muted); font-size: 10px; }
.rec-metrics .rec-unc { margin-left: 2px; color: var(--dim); font-size: 9px; font-style: normal; }
.confidence { padding: 1px 5px; border-radius: 4px; font-size: 9px; }
.confidence.high { color: #052116; background: var(--green); }
.confidence.mid { color: #101207; background: var(--accent-2); }
.confidence.low { color: var(--muted); background: #1a2637; }
.rec-reasons { margin: 6px 9px 8px; padding: 0; list-style: none; color: var(--dim); font-size: 10px; line-height: 1.45; }
.rec-reasons li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-reasons li::before { content: "·"; margin-right: 4px; color: var(--accent); }
.rec-build { margin: 7px 9px 0; padding: 7px 8px; border: 1px solid var(--line-soft); border-radius: 8px; background: #0a111b; }
.rec-build.is-empty { color: var(--dim); font-size: 10px; line-height: 1.4; }
.rec-build-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin-bottom: 5px; color: var(--muted); font-size: 9.5px; font-weight: 700; letter-spacing: .04em; }
.rec-build-head span:last-child { color: var(--dim); font-size: 9px; font-weight: 400; white-space: nowrap; }
.rec-build-line { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 5px; align-items: start; margin-top: 4px; }
.rec-build-line:first-of-type { margin-top: 0; }
.rec-build-label { color: var(--dim); font-size: 9.5px; line-height: 19px; letter-spacing: .04em; white-space: nowrap; }
.rec-build-chips { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.rec-build-item { display: inline-flex; align-items: center; gap: 3px; min-width: 0; max-width: 100%; padding: 1px 5px 1px 2px; border: 1px solid var(--line-soft); border-radius: 5px; color: #c5d2e3; font-size: 9.5px; line-height: 19px; }
.rec-build-item > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-build-item b { color: var(--accent-2); font-size: 9.5px; font-weight: 700; }
.rec-build-icon { width: 17px; height: 17px; flex: none; border-radius: 3px; object-fit: cover; background: #101b29; }
.rec-build-icon.fallback { display: grid; place-items: center; color: var(--muted); font-size: 7px; }
.rec-foot { margin-top: auto; padding: 6px 9px; border-top: 1px solid var(--line-soft); color: var(--accent); font-size: 10px; letter-spacing: .03em; }
.rec-opgg-line { padding: 4px 9px 0; }
.rec-opgg { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border: 1px solid var(--line-soft); border-radius: 999px; color: var(--dim); font-size: 9px; line-height: 16px; }
.rec-opgg b { color: var(--accent-2); font-size: 9px; }
.opgg-list { display: grid; gap: 3px; }
.opgg-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) 26px 44px; gap: 6px; align-items: center; font-size: 10px; color: var(--muted); }
.opgg-row span:nth-child(2) { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opgg-row .rank { color: var(--dim); font-variant-numeric: tabular-nums; }
.opgg-row span:last-child { text-align: right; color: var(--accent); font-variant-numeric: tabular-nums; }
.opgg-kv { display: grid; gap: 3px; }
.opgg-kv p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.opgg-src { margin: 5px 0 0; color: var(--dim); font-size: 9px; line-height: 1.4; }

@media (prefers-reduced-motion: reduce) {
  .rec-card { transition: none; }
  .rec-card:hover { transform: none; }
  .recs.just-updated .rec-card { animation: none; }
}

.analysis { padding: 10px 14px 14px; max-height: 300px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #2b3e55 transparent; overscroll-behavior: contain; }
.analysis-section { padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.analysis-section:last-child { border-bottom: 0; }
.analysis-section h3 { margin: 0 0 4px; color: var(--dim); font-size: 10px; letter-spacing: .12em; font-weight: 700; text-transform: uppercase; }
.analysis-section p { margin: 0; color: #c5d2e3; font-size: 11.5px; }
.analysis-section .caveat { color: var(--accent-2); }
.analysis-needs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; }
.analysis-needs span { padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; color: #c5d2e3; font-size: 10px; }
.meter { display: flex; align-items: center; gap: 8px; margin: 5px 0 2px; color: var(--muted); font-size: 10px; }
.meter-bar { flex: 1; height: 3px; border-radius: 99px; background: #1a2637; overflow: hidden; }
.meter-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--accent)); }

/* ----------------------------------------------------------------- builds */
.builds-panel { margin-top: 12px; }
.builds-hint { color: var(--dim); font-size: 10px; padding-top: 2px; white-space: nowrap; }
.build-tabs { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px 14px 0; }
.build-tabs:empty { display: none; }
.build-tab { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 4px; border: 1px solid var(--line); border-radius: 999px; background: #0b121d; color: var(--muted); font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; transition: border-color .14s ease, color .14s ease, background .14s ease; }
.build-tab:hover { border-color: #3b4e67; color: var(--text); }
.build-tab.active { border-color: var(--accent); background: rgba(91, 157, 255, .12); color: var(--text); }
.build-tab img, .build-tab .fallback { width: 24px; height: 24px; border-radius: 999px; object-fit: cover; background: #101b29; }
.build-tab .fallback { display: grid; place-items: center; font-size: 9px; }
.build-tab .tab-mine { color: var(--gold); font-size: 9px; letter-spacing: .04em; }
.build-tab .tab-note { color: var(--dim); font-size: 9px; letter-spacing: .04em; }
.builds { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); align-items: stretch; gap: 10px; padding: 10px 14px 14px; }
.build-summary { grid-column: 1 / -1; display: grid; gap: 7px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: linear-gradient(120deg, rgba(255, 191, 91, .07), rgba(70, 167, 255, .05)), #0a111b; }
.build-summary-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.build-summary-head strong { font-size: 15px; }
.build-summary-pill { padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .05em; }
.build-summary-pill.is-mine { border-color: rgba(255, 191, 91, .48); color: var(--gold); }
.build-summary-tags { color: var(--dim); font-size: 10px; }
.build-summary-score { display: flex; align-items: baseline; gap: 5px; margin-left: auto; }
.build-summary-score b { color: var(--accent-2); font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.build-summary-score span { color: var(--dim); font-size: 9px; letter-spacing: .1em; }
.build-guide-link { color: var(--blue-soft); font-size: 10px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.build-guide-link:hover { text-decoration: underline; }
.build-summary-score.is-empty { color: var(--dim); font-size: 10px; }
.build-summary-stats { color: var(--muted); font-size: 10.5px; }
.build-summary-stats b { color: var(--text); font-weight: 700; }
.build-summary-row { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px; align-items: start; }
.build-summary-row > span { padding-top: 1px; color: var(--dim); font-size: 9px; font-weight: 700; letter-spacing: .1em; white-space: nowrap; }
.build-summary-row p { margin: 0; color: #cfd9e8; font-size: 11.5px; line-height: 1.55; }
.build-summary-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.build-summary-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 2px 9px; border: 1px solid var(--line-soft); border-radius: 999px; background: #0c1521; color: var(--dim); font-size: 9.5px; }
.build-summary-chip b { color: var(--text); font-size: 10px; font-weight: 600; }
.build-summary-chip.is-derived { border-style: dashed; border-color: rgba(139, 155, 178, .45); }
.build-summary-chip.is-derived b { color: var(--muted); border-bottom: 1px dotted rgba(139, 155, 178, .6); }
.build-chip-note { font-style: normal; color: var(--dim); font-size: 8.5px; letter-spacing: .04em; }
.build-card { min-width: 0; padding: 12px 14px 14px; border: 1px solid var(--line-soft); border-radius: 12px; background: #0a111b; }
.build-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.build-card-head h3 { margin: 0; color: var(--dim); font-size: 9px; letter-spacing: .13em; font-weight: 700; text-transform: uppercase; }
.build-meta { color: var(--muted); font-size: 10px; text-align: right; font-variant-numeric: tabular-nums; }
.build-flags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--dim); font-size: 10px; }
.build-flags-wide { grid-column: 1 / -1; margin-bottom: -2px; }
.build-flag { padding: 1px 7px; border: 1px solid rgba(255, 191, 91, .28); border-radius: 999px; color: var(--accent-2); font-size: 9px; }
.build-flag.muted { border-color: var(--line); color: var(--muted); }

/* runes: keystone on top, then one block per tree with every rune named */
.rune-card { display: flex; flex-direction: column; gap: 10px; }
.rune-keystone { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border: 1px solid rgba(70, 167, 255, .22); border-radius: 11px; background: linear-gradient(110deg, rgba(70, 167, 255, .1), rgba(13, 22, 34, .2) 60%), #0c1521; }
.keystone-icon { flex: none; width: 44px; height: 44px; object-fit: cover; border: 1px solid #2b3e55; border-radius: 50%; background: #0d1622; }
.keystone-icon.fallback { display: grid; place-items: center; color: var(--muted); font-size: 11px; font-weight: 700; }
.rune-copy { display: grid; gap: 3px; min-width: 0; }
.rune-name { color: var(--text); font-size: 14px; font-weight: 800; line-height: 1.1; }
.rune-sub { color: var(--dim); font-size: 9.5px; letter-spacing: .03em; }
.rune-trees { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; align-items: start; }
.rune-tree { min-width: 0; padding: 9px 10px 10px; border: 1px solid var(--line-soft); border-radius: 10px; background: #0b121d; }
.rune-tree.is-secondary { border-style: dashed; background: #0a101a; }
.rune-tree-head { display: flex; align-items: center; gap: 6px; min-width: 0; padding-bottom: 7px; margin-bottom: 7px; border-bottom: 1px solid var(--line-soft); }
.tree-icon { flex: none; width: 18px; height: 18px; object-fit: contain; }
.tree-icon.fallback { display: grid; place-items: center; border-radius: 4px; background: #111c2a; color: var(--muted); font-size: 8px; }
.rune-tree-label { color: var(--dim); font-size: 8.5px; font-weight: 700; letter-spacing: .1em; white-space: nowrap; }
.rune-tree-head b { min-width: 0; overflow: hidden; color: var(--text); font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.rune-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.rune-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.rune-minor { flex: none; width: 20px; height: 20px; border-radius: 50%; object-fit: cover; background: #111c2a; }
.rune-minor.fallback { display: grid; place-items: center; color: var(--muted); font-size: 8px; }
.rune-row-name { min-width: 0; overflow: hidden; color: #c8d5e6; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.rune-row-games { margin-left: auto; color: var(--dim); font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.shard-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.shard-label { margin-right: 2px; color: var(--dim); font-size: 8.5px; font-weight: 700; letter-spacing: .1em; white-space: nowrap; }
.shard { padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; background: #0b121d; color: var(--muted); font-size: 9.5px; }

/* skill order + summoners: one card under the runes, on the "what you bring"
   side of the layout */
.build-loadout { display: grid; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: 12px; background: #0a111b; }
.build-loadout.is-wide { grid-column: 1 / -1; }
.build-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.build-col > .build-card:last-child, .build-col > .build-loadout:last-child { flex: 1 1 auto; }
.loadout-block { display: grid; gap: 8px; align-content: start; min-width: 0; }
.loadout-block + .loadout-block { padding-top: 11px; border-top: 1px solid var(--line-soft); }
.loadout-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.loadout-head h3 { margin: 0; color: var(--dim); font-size: 9px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.loadout-order { color: var(--text); font-size: 12px; font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.loadout-note { padding: 1px 6px; border: 1px dashed rgba(139, 155, 178, .45); border-radius: 999px; color: var(--muted); font-size: 8.5px; font-style: normal; }
.loadout-vs { display: inline-flex; align-items: baseline; gap: 5px; max-width: 100%; padding: 1px 7px; border: 1px solid var(--line-soft); border-radius: 999px; background: rgba(70, 167, 255, .08); color: var(--muted); font-size: 9px; letter-spacing: .02em; }
.loadout-vs[hidden] { display: none; }
.loadout-vs b { color: #bcd2ea; font-size: 10px; font-weight: 700; }
.loadout-vs span { color: var(--dim); font-size: 9px; }
.skill-plan { display: grid; grid-template-columns: repeat(18, minmax(0, 1fr)); gap: 4px; margin: 0; padding: 0; list-style: none; }
.skill-cell { display: grid; place-items: center; gap: 2px; padding: 4px 0 5px; border: 1px solid var(--line-soft); border-radius: 7px; background: #0b121d; }
.skill-cell small { color: var(--dim); font-size: 8px; line-height: 1; font-variant-numeric: tabular-nums; }
.skill-key { font-size: 11.5px; font-weight: 800; line-height: 1; }
.key-Q { color: #5fb4ff; }
.key-W { color: #48d7a0; }
.key-E { color: #ff6f9c; }
.key-R { color: #ff9a55; }
.spell-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.spell { display: flex; align-items: flex-start; gap: 8px; min-width: 0; padding: 7px 9px; border: 1px solid var(--line-soft); border-radius: 9px; background: #0b121d; }
.spell-icon { flex: none; width: 26px; height: 26px; object-fit: cover; border: 1px solid var(--line); border-radius: 7px; background: #111c2a; }
.spell-icon.fallback { display: grid; place-items: center; color: var(--muted); font-size: 9px; font-weight: 700; }
.spell-copy { display: grid; gap: 2px; min-width: 0; }
.spell-copy b { color: var(--text); font-size: 11.5px; font-weight: 700; line-height: 1.25; }
.spell-copy small { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: var(--dim); font-size: 9.5px; line-height: 1.4; }
.spell-alt { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 5px 9px; border: 1px dashed rgba(139, 155, 178, .34); border-radius: 9px; background: rgba(11, 18, 29, .55); }
.spell-alt[hidden] { display: none; }
.spell-alt-tag { flex: none; padding: 1px 6px; border-radius: 999px; background: rgba(139, 155, 178, .14); color: var(--muted); font-size: 8.5px; font-weight: 700; letter-spacing: .06em; }
.spell-alt-icon { flex: none; width: 18px; height: 18px; object-fit: cover; border-radius: 5px; background: #111c2a; opacity: .92; }
.spell-alt b { color: #c9d6e7; font-size: 11px; font-weight: 700; }
.spell-alt small { min-width: 0; color: var(--dim); font-size: 9.5px; line-height: 1.4; }

/* items: labelled groups, ranked core, one row per counter item */
.item-card { display: flex; flex-direction: column; }
.item-group { margin-top: 10px; }
.item-card > .item-group:first-of-type { margin-top: 0; }
.item-label { display: block; margin-bottom: 5px; color: var(--dim); font-size: 9px; letter-spacing: .07em; }
.item-row { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }
.item { display: flex; flex: 0 1 auto; align-items: center; gap: 7px; min-width: 138px; max-width: 100%; padding: 4px 9px 4px 4px; border: 1px solid var(--line-soft); border-radius: 8px; background: #0b121d; }
.item-icon { flex: none; width: 26px; height: 26px; object-fit: cover; border-radius: 6px; background: #111c2a; }
.item-icon.fallback { display: grid; place-items: center; color: var(--muted); font-size: 8px; }
.item-rank { flex: none; display: grid; place-items: center; width: 14px; height: 14px; border-radius: 999px; background: var(--accent); color: #0b0f16; font-size: 8.5px; font-style: normal; font-weight: 800; }
.item-copy { display: grid; gap: 1px; min-width: 0; }
.item-name { overflow: hidden; color: #cfdaea; font-size: 11px; font-weight: 600; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.item-rate { color: var(--dim); font-size: 9.5px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.situational { margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line-soft); }
.situational .why { display: block; margin-bottom: 5px; color: var(--accent-2); font-size: 9.5px; font-weight: 600; }
.counter-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.counter-row { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 8px 4px 4px; border: 1px solid var(--line-soft); border-radius: 8px; background: #0b121d; }
.counter-name { min-width: 0; overflow: hidden; color: #cfdaea; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.counter-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-left: 2px; }
.counter-tags span { padding: 1px 6px; border: 1px solid rgba(255, 191, 91, .22); border-radius: 999px; color: var(--accent-2); font-size: 8.5px; white-space: nowrap; }
.counter-rate { flex: none; margin-left: auto; padding-left: 10px; color: var(--dim); font-size: 9.5px; font-variant-numeric: tabular-nums; }
.build-empty { grid-column: 1 / -1; display: grid; place-items: center; gap: 5px; min-height: 110px; padding: 18px; color: var(--dim); font-size: 12px; text-align: center; }
.build-empty code { color: var(--muted); font-size: 11px; }
@media (max-width: 960px) {
  .builds { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .skill-plan { grid-template-columns: repeat(9, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .build-card { padding: 10px 11px 12px; }
  .build-loadout { padding: 10px 11px; }
  .skill-plan { gap: 3px; }
  .skill-cell { padding: 3px 0 4px; border-radius: 6px; }
  .skill-key { font-size: 10px; }
  .rune-trees, .spell-list { grid-template-columns: 1fr; }
  .counter-row { flex-wrap: wrap; }
}

.foot { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 16px 2px 0; color: var(--dim); font-size: 11px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  max-width: min(560px, calc(100% - 32px));
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #101a28;
  color: var(--text);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .4);
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  font-size: 12px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255, 85, 112, .45); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

/* --------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .board { grid-template-columns: minmax(200px, 240px) minmax(0, 1fr) minmax(200px, 240px); }
  .bottom-grid { grid-template-columns: 1fr; }
  .recs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .analysis { max-height: none; }
}

@media (max-width: 960px) {
  .shell, .topbar { width: min(100% - 24px, 760px); }
  .intro { grid-template-columns: 1fr; gap: 14px; padding-top: 24px; }
  .board { grid-template-columns: 1fr 1fr; }
  .pool-panel { grid-column: 1 / -1; grid-row: 1; }
  .team { grid-row: 2; }
  .team-blue { order: 1; }
  .team-red { order: 2; }
  .pool-scroll { height: 420px; }
  .recs { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 960px) {
  .data-badge,
  .status-dot,
  .version { display: none; }
  .brand { flex: 0 0 auto; }
  .brand-copy strong { white-space: nowrap; }
  .top-meta { flex-wrap: nowrap; }
  .top-meta .top-link,
  .top-meta .ghost { flex: 0 0 auto; white-space: nowrap; }
}

@media (max-width: 760px) {
  .data-badge,
  .status-dot { display: none; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 9px 0; }
  .brand { flex: 0 0 auto; }
  .brand-copy strong { white-space: nowrap; }
  .top-meta { width: auto; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
  .top-meta .ghost { white-space: nowrap; }
  .top-link { min-height: 34px; padding: 6px 10px; font-size: 11px; }
}

@media (max-width: 560px) {
  .topbar { row-gap: 7px; }
  .top-meta { width: 100%; justify-content: flex-start; }
}

@media (max-width: 640px) {
  .shell, .topbar { width: calc(100% - 20px); }
  .topbar { min-height: 64px; }
  .brand-copy small { display: none; }
  .top-meta .version { display: none; }
  .intro h1 { font-size: 29px; }
  .lede { font-size: 12px; }
  .intro-note { display: none; }
  .toolbar { padding: 9px; gap: 10px; }
  .controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
  .controls label { flex-direction: column; align-items: stretch; gap: 5px; min-width: 0; font-size: 11px; }
  .controls label > span { white-space: nowrap; }
  .controls select { width: 100%; min-width: 0; min-height: 40px; }
  .controls button { width: 100%; min-height: 40px; }
  .role-picker-wrap { grid-column: 1 / -1; flex-direction: column; align-items: stretch; gap: 4px; }
  .role-picker { width: 100%; }
  .role-option { flex: 1 1 0; min-width: 0; min-height: 44px; }
  .role-option .role-icon { width: 26px; height: 26px; }
  .controls #clearBtn { grid-column: 1 / -1; }
  .known-wrap { width: 100%; justify-content: space-between; }
  .board { grid-template-columns: 1fr; }
  .pool-panel { grid-column: auto; }
  .team { grid-row: auto; padding: 10px; }
  .ban-row { padding-bottom: 9px; }
  .pick-list { gap: 6px; padding-top: 9px; }
  .pick-row { min-height: 50px; }
  .slot { width: 50px; height: 50px; }
  .slot.ban { width: 34px; height: 34px; }
  .pool-scroll { height: 360px; }
  .pool-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
  .pool-filters select, #searchInput { min-height: 38px; }
  .bottom-grid { grid-template-columns: 1fr; }
  .recs { grid-template-columns: 1fr; }
  .rec-card { display: grid; grid-template-columns: auto 1fr; }
  .rec-top { grid-column: 1; }
  .rec-score, .rec-metrics, .rec-reasons, .rec-foot { grid-column: 2; }
  .rec-score { padding-top: 8px; }
  .rec-build { grid-column: 1 / -1; margin-top: 2px; }
  .rec-foot { grid-column: 1 / -1; }
}

/* --------------------------------------------------------------- analysis modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 6, 12, .78);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(980px, 100%);
  max-height: min(86vh, 860px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 61, 129, .32);
  border-radius: 18px;
  background: linear-gradient(180deg, #0d1422, #090e18);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .7), 0 0 60px rgba(255, 61, 129, .12);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.modal-head h2 { margin: 3px 0 0; font-size: 24px; letter-spacing: .04em; }

.modal-body { padding: 18px 24px 24px; overflow: auto; }

.analysis-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.analysis-stat {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 12px;
  background: rgba(255, 255, 255, .025);
}

.analysis-stat span { display: block; color: var(--muted); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.analysis-stat strong { display: block; margin-top: 4px; font-size: 21px; color: var(--text); }

.analysis-block { margin-top: 18px; }
.analysis-block h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }

.analysis-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.analysis-table th, .analysis-table td { padding: 6px 8px; border-bottom: 1px solid rgba(255, 255, 255, .07); text-align: right; }
.analysis-table th:first-child, .analysis-table td:first-child { text-align: left; }
.analysis-table th { color: var(--muted); font-weight: 600; font-size: 10px; letter-spacing: .1em; }

.analysis-warning {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  padding: 9px 11px;
  margin-bottom: 7px;
  border: 1px solid rgba(255, 191, 91, .22);
  border-radius: 9px;
  background: rgba(255, 191, 91, .055);
  color: #ffd79a;
  font-size: 12px;
  line-height: 1.55;
}

.analysis-verdict {
  margin-top: 18px;
  padding: 12px 14px;
  border-left: 2px solid var(--blue);
  background: rgba(70, 167, 255, .06);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

@media (max-width: 720px) {
  .analysis-summary { grid-template-columns: 1fr 1fr; }
  .modal { padding: 10px; }
  .modal-head, .modal-body { padding-left: 16px; padding-right: 16px; }
}

.analysis-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.analysis-list code { color: #b9d9ff; }

/* --------------------------------------------------------- ban suggestions */
.bans-panel { margin-top: 12px; }
.bans-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(236px, 1fr));
  gap: 9px;
  padding: 10px;
  min-height: 96px;
}
.ban-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0b121d;
  overflow: hidden;
}
.bans-list .ban-card:first-child {
  border-color: rgba(255, 191, 91, .36);
  box-shadow: inset 0 2px 0 rgba(255, 191, 91, .9);
}
.ban-top { display: flex; align-items: center; gap: 9px; padding: 9px 9px 6px; }
.ban-img { width: 46px; height: 46px; flex: none; border-radius: 8px; object-fit: cover; background: #111c2a; }
.ban-img.fallback { display: grid; place-items: center; color: var(--muted); font-size: 12px; font-weight: 800; }
.ban-title-wrap { flex: 1 1 auto; min-width: 0; }
.ban-name { display: block; font-size: 14px; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ban-tags { display: block; color: var(--dim); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ban-threat { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; padding-left: 4px; }
.ban-threat strong { color: var(--red); font-size: 17px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ban-card.is-weak .ban-threat strong { color: var(--muted); }
.ban-threat span { color: var(--dim); font-size: 9px; letter-spacing: .04em; }
.ban-metrics { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 3px 9px 0; color: var(--muted); font-size: 10px; }
.ban-reasons { margin: 6px 9px 8px; padding: 0; list-style: none; color: var(--dim); font-size: 10px; line-height: 1.45; }
.ban-reasons li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ban-reasons li::before { content: "·"; margin-right: 4px; color: var(--accent); }
.ban-counters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: auto 9px 0;
  padding: 6px 0 8px;
  border-top: 1px solid var(--line-soft);
}
.ban-counters-label { margin-right: 2px; color: var(--dim); font-size: 9.5px; letter-spacing: .04em; }
.ban-counters-chips { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.ban-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  padding: 1px 6px 1px 2px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: #0a111b;
  color: #c5d2e3;
  font-size: 9.5px;
  line-height: 19px;
}
.ban-chip.is-threat { border-color: rgba(255, 85, 112, .38); background: rgba(255, 85, 112, .1); color: #ffc2cd; }
.ban-chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ban-chip-img { width: 17px; height: 17px; flex: none; border-radius: 3px; object-fit: cover; background: #101b29; }
.ban-chip-img.fallback { display: grid; place-items: center; color: var(--muted); font-size: 7px; }

@media (max-width: 640px) {
  /* 手機：只保留 5 個禁角頭像，完整卡片留給桌機 */
  .bans-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    min-height: 0;
    padding: 8px 10px 10px;
  }
  .bans-list .ban-card {
    position: relative;
    flex: 0 0 calc((100% - 24px) / 5);
    max-width: calc((100% - 24px) / 5);
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: none;
    overflow: visible;
  }
  .bans-list .ban-card:first-child {
    padding: 2px;
    border-color: transparent;
    border-radius: 10px;
    background: rgba(255, 191, 91, .85);
    box-shadow: none;
  }
  .bans-list .ban-top { display: block; padding: 0; gap: 0; }
  .bans-list .ban-img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
  }
  .bans-list .ban-card:first-child .ban-img { border-radius: 7px; }
  .bans-list .ban-img.fallback { display: grid; place-items: center; aspect-ratio: 1 / 1; font-size: 14px; }
  .bans-list .ban-title-wrap {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .bans-list .ban-threat,
  .bans-list .ban-metrics,
  .bans-list .ban-reasons,
  .bans-list .ban-counters { display: none; }
  .bans-list .placeholder { flex: 1 1 100%; }
}

/* ------------------------------------------------------ legal pages */
.legal {
  max-width: 880px;
  margin: 26px auto 0;
  padding: 34px 42px 38px;
}

.legal-head { margin-bottom: 6px; }

.legal h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1.25;
  letter-spacing: .01em;
}

.legal-meta {
  margin: 8px 0 0;
  color: var(--dim);
  font-size: 12px;
  letter-spacing: .04em;
}

.legal h2 {
  margin: 30px 0 10px;
  font-size: 16px;
  letter-spacing: .06em;
  color: var(--text);
}

.legal h2 .num {
  color: var(--accent);
  margin-right: 8px;
  font-variant-numeric: tabular-nums;
}

.legal h3 {
  margin: 20px 0 6px;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.legal p,
.legal li {
  margin: 8px 0;
  color: #c7d2e0;
  font-size: 13.5px;
  line-height: 1.8;
}

.legal ul {
  margin: 8px 0 8px 4px;
  padding-left: 18px;
}

.legal li { margin: 5px 0; }

.legal li::marker { color: var(--accent-2); }

.legal strong { color: var(--text); font-weight: 600; }

.legal a {
  color: var(--blue);
  text-decoration: none;
  border-bottom: 1px solid rgba(70, 167, 255, .35);
}

.legal a:hover { color: #fff; border-bottom-color: var(--blue); }

.legal code {
  padding: 1px 6px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12px;
}

.legal-note {
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-2);
  border-radius: 10px;
  background: rgba(255, 191, 91, .05);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.75;
}

.legal-riot {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}

.legal-riot p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.legal-riot .riot-en { margin-top: 10px; color: var(--dim); }

.foot-legal {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.foot-legal a {
  color: var(--dim);
  text-decoration: none;
  border-bottom: 1px dotted rgba(139, 155, 178, .45);
}

.foot-legal a:hover { color: var(--text); border-bottom-color: var(--accent); }

@media (max-width: 760px) {
  .legal { margin-top: 16px; padding: 26px 20px 30px; }
  .legal h1 { font-size: 22px; }
  .legal h2 { margin-top: 24px; font-size: 15px; }
  .legal p, .legal li { font-size: 13px; line-height: 1.75; }
}
