:root {
  --bg: #090f1c;
  --bg-glow: #10203d;
  --panel: #0f1829;
  --panel-2: #152038;
  --panel-3: #1b2844;
  --line: #22304d;
  --line-soft: #1a2640;
  --text: #e8edf7;
  --muted: #8a98b5;
  --faint: #5d6b88;
  --accent: #5aa9ff;
  --accent-soft: rgba(90, 169, 255, .14);
  --gold: #f4c55a;
  --silver: #cdd6e6;
  --bronze: #df9a62;
  --win: #34d399;
  --win-soft: rgba(52, 211, 153, .12);
  --loss: #f87171;
  --loss-soft: rgba(248, 113, 113, .10);
  --draw: #e3c55b;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 500px at 50% -200px, var(--bg-glow), transparent 70%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* Inter's contextual alternates restyle '*' next to other '*' (Neuron masked names like *******100) and space out hyphens */
  font-feature-settings: 'calt' 0;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: #8cc4ff; }
.wrap { max-width: 1150px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.loading { padding: 40px 0; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(9, 15, 28, .8);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: -.2px; }
.brand:hover { color: var(--text); }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--gold), #e08a3c); color: #1a1205; font-size: 16px; font-weight: 800;
}
.brand-accent { color: var(--gold); margin-left: -4px; }
nav { display: flex; gap: 2px; background: var(--panel); border: 1px solid var(--line-soft); padding: 3px; border-radius: 11px; }
nav a { color: var(--muted); padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 14px; transition: color .15s, background .15s; }
nav a:hover { color: var(--text); }
nav a.active { color: var(--text); background: var(--panel-3); }

/* ---------- headings ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; margin: 28px 0 16px; }
.page-head h1 { margin: 0; }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -.5px; margin: 28px 0 4px; }
h2 { font-size: 16px; font-weight: 700; margin: 32px 0 12px; letter-spacing: -.1px; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.footnote { margin: 8px 2px 0; font-size: 12.5px; color: var(--faint); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: baseline; gap: 5px; font-size: 13px; color: var(--muted); background: var(--panel); border: 1px solid var(--line-soft); border-radius: 99px; padding: 4px 11px; }
.chip b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- controls ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 0 0 14px; }
.search { position: relative; flex: 0 1 280px; min-width: 200px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search input {
  width: 100%; background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px 9px 34px; font: inherit; font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--panel-2); }
.search input::-webkit-search-cancel-button { filter: invert(.6); cursor: pointer; }

.seg-wrap { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); background: none; border: 0;
  padding: 5px 11px; border-radius: 7px; cursor: pointer; transition: color .15s, background .15s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent); color: #06111f; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); background: var(--panel); }
th.sortable { cursor: pointer; user-select: none; transition: color .15s; }
th.sortable:hover, th.sorted { color: var(--text); }
th .arrow { color: var(--accent); margin-left: 3px; }
th.num, td.num { text-align: right; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: rgba(90, 169, 255, .05); }
td.rank { color: var(--faint); width: 1%; }
td a { font-weight: 500; }

.place { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 6px; border-radius: 6px; font-weight: 700; font-size: 13px; background: var(--panel-3); color: var(--muted); }
.place.p1 { background: rgba(244, 197, 90, .16); color: var(--gold); }
.place.p2 { background: rgba(205, 214, 230, .12); color: var(--silver); }
.place.p3 { background: rgba(223, 154, 98, .14); color: var(--bronze); }
.of { color: var(--faint); font-size: 12px; margin-left: 4px; }
.W { color: var(--win); font-weight: 600; }
.L { color: var(--loss); font-weight: 600; }
.D { color: var(--draw); font-weight: 600; }
.sep { color: var(--faint); margin: 0 1px; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--panel-3); color: var(--muted); }
.pill.open { background: var(--win-soft); color: var(--win); }
.pill.open::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--win); }

.bar { display: inline-block; height: 6px; border-radius: 3px; background: var(--accent); vertical-align: middle; margin-left: 8px; opacity: .85; }

/* ---------- summary panels (player / deck) ---------- */
.summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 8px; }
.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.panel-title { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); margin-bottom: 8px; }
.hero { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.hero .big { font-size: 32px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; line-height: 1; }
.hero .lbl { color: var(--muted); font-size: 14px; }
.kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.kv > div { display: flex; flex-direction: column; gap: 1px; }
.kv b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kv span { font-size: 12px; color: var(--muted); }
.kv b.gold { color: var(--gold); }
.wl-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--panel-3); margin-bottom: 10px; }
.wl-bar i { display: block; height: 100%; }
.wl-bar .w { background: var(--win); }
.wl-bar .l { background: var(--loss); }
.wl-bar .d { background: var(--draw); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }
.legend b { font-weight: 700; margin-right: 3px; }
.legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

/* ---------- event rounds ---------- */
.rounds { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.round { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 6px 12px 4px; box-shadow: var(--shadow); min-width: 0; }
.round h3 { margin: 8px 2px 6px; font-size: 11.5px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .6px; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr); align-items: center; gap: 6px; padding: 8px 2px; border-top: 1px solid var(--line-soft); }
.side { min-width: 0; padding: 5px 8px; border-radius: 8px; }
.side.win { background: var(--win-soft); }
.side.lose { background: var(--loss-soft); }
.side.r { text-align: right; }
.side .nm { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; }
.side.r .nm { flex-direction: row-reverse; }
.side .nm a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 600; }
.side.lose .nm a { color: #d7dbe4; font-weight: 500; }
.side .nm a:hover { color: var(--accent); }
.side .dk { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.mark { flex: none; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font-size: 10px; font-weight: 800; }
.mark.w { background: var(--win); color: #062016; }
.mark.l { background: rgba(248, 113, 113, .25); color: var(--loss); }
.mark.d { background: rgba(227, 197, 91, .22); color: var(--draw); }
.pair .mid { text-align: center; font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .5px; }
.side.bye { color: var(--faint); font-size: 13px; font-style: italic; }

/* ---------- notices ---------- */
.notice { background: var(--accent-soft); border: 1px solid rgba(90,169,255,.25); border-radius: 10px; padding: 10px 14px; margin: 14px 0; font-size: 14px; color: #cfe4ff; }
.notice.error { background: var(--loss-soft); border-color: rgba(248,113,113,.3); color: #ffd0d0; }
.footer { padding: 40px 16px 48px; font-size: 12.5px; color: var(--faint); }

/* ---------- decklist links ---------- */
th.grow, td.grow { width: 100%; }
.dl-link { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; font-size: 13.5px; }
.dl-link svg { width: 13px; height: 13px; flex: none; opacity: .8; }
td .dl-link { margin-left: 6px; }
td .dl-link:first-child { margin-left: 0; }
.dl { width: 300px; max-width: 300px; }
.cell-view { display: flex; align-items: center; gap: 6px; min-height: 34px; }
.dl-form { display: flex; align-items: center; gap: 4px; }
.dl-form input {
  flex: 1 1 auto; min-width: 0; background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 6px 10px; font: inherit; font-size: 13.5px; outline: none; text-overflow: ellipsis;
  transition: border-color .15s, box-shadow .15s;
}
.dl-form input::placeholder { color: var(--faint); }
.dl-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dl-form.saving { opacity: .55; pointer-events: none; }
.icon-btn {
  flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 1px solid transparent; border-radius: 8px; background: none; color: var(--muted); cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { color: var(--text); background: var(--panel-3); }
.icon-btn.ok { color: var(--win); border-color: var(--line); }
.icon-btn.ok:hover { background: var(--win-soft); }
.dl-form input:placeholder-shown ~ .icon-btn.ok { color: var(--faint); }

/* ---------- Tom Select (deck picker) ---------- */
.deck-cell { min-width: 220px; }
.ts-wrapper.deck-ts { min-width: 210px; max-width: 280px; }
.ts-wrapper.deck-ts .ts-control {
  background: var(--panel-2) !important; border: 1px solid var(--line) !important; color: var(--text);
  border-radius: 9px; padding: 6px 30px 6px 10px; min-height: 0; box-shadow: none; font-size: 14px; cursor: pointer;
}
.ts-wrapper.deck-ts.focus .ts-control { border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-soft); }
.ts-wrapper.deck-ts .ts-control .item { color: var(--text); }
.ts-wrapper.deck-ts.is-empty .ts-control .item, .ts-wrapper.deck-ts .item[data-value=""] { color: var(--faint); }
.ts-wrapper.deck-ts .ts-control input { color: var(--text); }
.ts-wrapper.deck-ts .ts-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a98b5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-position: right 10px center !important; background-size: 14px !important;
}
.ts-wrapper.deck-ts .ts-control::after { display: none !important; }
.ts-wrapper.deck-ts.saving { opacity: .55; pointer-events: none; }
.ts-dropdown.deck-dd {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; margin-top: 4px; box-shadow: 0 16px 40px rgba(0,0,0,.5); overflow: hidden; z-index: 50;
}
.ts-dropdown.deck-dd .dropdown-input-wrap { padding: 6px; border-bottom: 1px solid var(--line); }
.ts-dropdown.deck-dd .dropdown-input {
  background: var(--panel); border: 1px solid var(--line); border-radius: 7px; color: var(--text);
  padding: 7px 10px; font: inherit; font-size: 14px; box-shadow: none; width: 100%;
}
.ts-dropdown.deck-dd .dropdown-input:focus { border-color: var(--accent); outline: none; }
.ts-dropdown.deck-dd .ts-dropdown-content { max-height: 260px; }
.ts-dropdown.deck-dd .option { padding: 7px 12px; font-size: 14px; }
.ts-dropdown.deck-dd .option.active { background: var(--accent-soft); color: var(--text); }
.ts-dropdown.deck-dd .option.selected { color: var(--accent); font-weight: 600; }
.ts-dropdown.deck-dd .option[data-value=""] { color: var(--faint); }
.ts-dropdown.deck-dd .no-results { padding: 8px 12px; color: var(--faint); font-size: 14px; }
.ts-dropdown.deck-dd .highlight { background: rgba(244, 197, 90, .25); color: inherit; border-radius: 2px; }

@media (max-width: 700px) {
  .summary { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  h1 { font-size: 23px; }
  .brand { font-size: 16px; gap: 8px; }
  .brand-mark { width: 26px; height: 26px; font-size: 14px; }
  nav a { padding: 5px 8px; font-size: 13px; }
  .rounds { grid-template-columns: 1fr; }
  .hero .big { font-size: 28px; }
  .kv b { font-size: 16px; }
  .search { flex: 1 1 100%; }
}
@media (max-width: 440px) {
  .brand-accent { display: none; }
  nav a { padding: 5px 7px; }
}

/* ---------- event standings: a bit more room on desktop ---------- */
td.c-player { min-width: 150px; }
.dkc { min-width: 220px; }
a.plain { color: inherit; font-weight: inherit; }
a.plain:hover { color: var(--accent); }
td.wrapok { white-space: normal; }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  table { font-size: 13.5px; }
  th, td { padding: 9px 8px; }
  th:first-child, td:first-child { padding-left: 12px; }
  th:last-child, td:last-child { padding-right: 12px; }
  th { font-size: 10.5px; letter-spacing: .4px; }
  td.wrapok { min-width: 0; }
  .bar { display: none; }
  h2 { margin-top: 26px; }

  /* event standings: one compact line per player; ✎ expands the row with the editors */
  #tbl-e-st thead { display: none; }
  #tbl-e-st table, #tbl-e-st tbody { display: block; }
  #tbl-e-st tr {
    display: grid; grid-template-columns: 30px minmax(0, 1.15fr) minmax(0, 1fr) auto auto;
    align-items: center; column-gap: 8px; row-gap: 8px; padding: 8px 6px 8px 12px; border-bottom: 1px solid var(--line-soft);
  }
  #tbl-e-st tr:last-child { border-bottom: 0; }
  #tbl-e-st td { display: block; padding: 0; border: 0; width: auto; min-width: 0; text-align: left; white-space: nowrap; }
  #tbl-e-st td.c-place  { grid-row: 1; grid-column: 1; }
  #tbl-e-st td.c-player { grid-row: 1; grid-column: 2; overflow: hidden; text-overflow: ellipsis; }
  #tbl-e-st td.c-m      { grid-row: 1; grid-column: 3; display: flex; align-items: center; gap: 4px; }
  #tbl-e-st td.c-rec    { grid-row: 1; grid-column: 4; text-align: right; font-size: 13px; }
  #tbl-e-st td.c-edit   { grid-row: 1; grid-column: 5; }
  #tbl-e-st td.c-deck, #tbl-e-st td.c-dl { display: none; }
  #tbl-e-st .tag { display: none; }
  .m-deck { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
  .m-deck a { color: var(--muted); font-weight: 500; }
  .m-list { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; color: var(--accent); }
  .m-list svg { width: 15px; height: 15px; }
  #tbl-e-st .row-edit { width: 32px; height: 32px; }
  #tbl-e-st .row-edit.on { color: var(--win); border-color: var(--line); background: var(--win-soft); }

  /* expanded row */
  #tbl-e-st tr.editing { background: var(--panel-2); padding-bottom: 12px; }
  #tbl-e-st tr.editing td.c-m { visibility: hidden; }
  #tbl-e-st tr.editing td.c-deck, #tbl-e-st tr.editing td.c-dl {
    grid-column: 1 / -1; display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 8px; padding-right: 6px;
  }
  #tbl-e-st tr.editing td.c-deck { grid-row: 2; }
  #tbl-e-st tr.editing td.c-dl { grid-row: 3; }
  #tbl-e-st td.c-deck::before, #tbl-e-st td.c-dl::before {
    content: "Deck"; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--faint);
  }
  #tbl-e-st td.c-dl::before { content: "List"; }
  #tbl-e-st .dkc, #tbl-e-st .dl { width: 100%; max-width: none; min-width: 0; }
  #tbl-e-st .ts-wrapper.deck-ts { min-width: 0; max-width: none; width: 100%; }
}
@media (max-width: 640px) {
  .lf { display: none; }
  .ls { display: inline !important; }
  td.rank { padding-right: 0; }
}

.ls { display: none; }
.nobr { white-space: nowrap; }

/* ---------- horizontally scrollable tables ---------- */
.tbl-outer { position: relative; }
.tbl-outer::after {
  content: ""; position: absolute; top: 1px; right: 1px; bottom: 1px; width: 28px; pointer-events: none;
  border-radius: 0 var(--radius) var(--radius) 0; opacity: 0; transition: opacity .2s;
  background: linear-gradient(to right, transparent, rgba(9, 15, 28, .85));
}
.tbl-outer.more::after { opacity: 1; }
.tbl-wrap { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
@media (max-width: 900px) {
  td.stick, th.stick, td.stick-r, th.stick-r { position: sticky; left: 0; z-index: 2; background: var(--panel); }
  td.stick-r, th.stick-r { width: 30px; min-width: 30px; max-width: 30px; padding-right: 0; }
  .has-rank td.stick, .has-rank th.stick { left: 30px; }
  td.stick { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
  .tbl-wrap.scrolled td.stick, .tbl-wrap.scrolled th.stick { box-shadow: 8px 0 10px -8px rgba(0, 0, 0, .8); }
  tbody tr:hover td.stick, tbody tr:hover td.stick-r { background: #111c30; }
}

/* phone-only standings helpers are hidden on wider screens */
td.c-m, th.c-m, td.c-edit, th.c-edit { display: none; }
.m-only { display: none; }
@media (max-width: 640px) { .m-only { display: inline; } }
.tag { display: inline-block; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: var(--panel-3); border-radius: 5px; padding: 1px 5px; margin-left: 4px; vertical-align: 1px; cursor: help; }

/* ---------- deck breakdown donut ---------- */
:root {
  /* categorical slots, dark steps validated vs the panel surface (#0f1829): all checks pass */
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #0ca30c; --c7: #9085e9;
  --c-other: #66728c; --c-unknown: #2c3854;
}
.breakdown { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 32px; padding: 18px 20px; }
.donut-wrap { position: relative; width: 200px; height: 200px; flex: none; margin: 0 auto; }
.donut { width: 100%; height: 100%; overflow: visible; }
.donut path { stroke: var(--panel); stroke-width: 2px; stroke-linejoin: round; cursor: pointer; transition: opacity .15s; }
.breakdown.hl .donut path:not(.on) { opacity: .3; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut-center b { font-size: 26px; font-weight: 800; letter-spacing: -.5px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.donut-center b span { font-size: 15px; color: var(--muted); font-weight: 600; }
.donut-center > span { font-size: 11.5px; color: var(--muted); }
.donut-tip {
  position: absolute; z-index: 5; transform: translate(-50%, -100%); pointer-events: none; width: max-content; max-width: 220px;
  background: #0b1322; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font-size: 13px;
  box-shadow: 0 10px 28px rgba(0,0,0,.55);
}
.donut-tip .t-name { display: flex; align-items: center; gap: 7px; font-weight: 700; margin-bottom: 2px; }
.donut-tip .t-val { color: var(--muted); }
.donut-tip .t-val b { color: var(--text); }
.donut-tip .t-note { color: var(--faint); font-size: 12px; margin-top: 4px; white-space: normal; }
.sw { flex: none; display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.donut-legend { list-style: none; margin: 0; padding: 0; flex: 1 1 240px; min-width: 0; display: grid; gap: 2px; }
.donut-legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 44px; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 7px; font-size: 14px; transition: background .12s, opacity .12s; }
.donut-legend li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend li .nm a { color: var(--text); font-weight: 500; }
.donut-legend li .nm a:hover { color: var(--accent); }
.donut-legend li .n { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.donut-legend li .p { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; font-size: 13px; }
.breakdown.hl .donut-legend li:not(.on) { opacity: .45; }
.donut-legend li.on { background: var(--panel-3); }

/* ---------- YDKe copy buttons ---------- */
.dl-copy {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); border: 1px solid rgba(90,169,255,.25); border-radius: 8px; padding: 4px 10px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s; white-space: nowrap;
}
.dl-copy svg { width: 14px; height: 14px; flex: none; }
.dl-copy:hover { background: rgba(90,169,255,.22); }
.dl-copy.copied { color: var(--win); background: var(--win-soft); border-color: rgba(52,211,153,.35); }
.dl-copy.copy-failed { color: var(--loss); background: var(--loss-soft); border-color: rgba(248,113,113,.35); }
td .dl-copy { margin-left: 6px; padding: 2px 8px; font-size: 12.5px; }
td .dl-copy:first-child, .cell-view .dl-copy { margin-left: 0; }
.dl-counts { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dl-copy.m-list { padding: 0; width: 26px; height: 26px; justify-content: center; margin: 0; }
.dl-copy.m-list.copied { width: 26px; }

/* ---------- event page: standings + deck breakdown side by side ---------- */
.ev-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 20px; align-items: start; }
.ev-main, .ev-side { min-width: 0; }
.dkc { min-width: 150px; }
.ts-wrapper.deck-ts { min-width: 150px; max-width: 180px; }
.dl { width: 190px; max-width: 190px; }
@media (min-width: 1000px) {
  .ev-top { grid-template-columns: minmax(0, 1fr) 260px; }
  .ev-side { position: static; }
  .ev-side .breakdown { flex-direction: column; align-items: stretch; gap: 16px; padding: 18px 14px 12px; }
  .ev-side .donut-wrap { width: 190px; height: 190px; }
  .ev-side .donut-legend { flex: none; }
  .ev-side .donut-legend li { padding: 5px 6px; gap: 8px; grid-template-columns: 10px minmax(0, 1fr) auto 38px; }
}

.dk-wins .breakdown { max-width: 640px; }

/* player page: Neuron name on the same line as the shown name */
h1.pname { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
h1.pname .alias { font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--muted); }

/* ---------- DB Matches (bonus tool) ---------- */
.pill.bonus { vertical-align: middle; margin-left: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; background: rgba(244,197,90,.14); color: var(--gold); }
.dbm-form { margin: 4px 0 18px; padding: 16px; }
.dbm-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.dbm-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-top: 14px; }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld > span { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); }
.fld > span em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: 4px; }
.fld-grow { flex: 1 1 260px; }
.fld input[type=text], .fld input[type=date] {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 9px;
  padding: 7px 10px; font: inherit; font-size: 14px; outline: none; height: 36px; color-scheme: dark; min-width: 0;
}
.fld input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ts-wrapper.fld-ts { min-width: 0; max-width: none; width: 100%; }
.seg-score button.w.on { background: var(--win); color: #062016; }
.seg-score button.l.on { background: var(--loss); color: #2a0707; }
.seg button { min-height: 28px; }
.btn-primary {
  height: 36px; padding: 0 18px; border: 0; border-radius: 9px; background: var(--accent); color: #06111f;
  font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; transition: filter .15s;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:disabled { opacity: .55; cursor: default; }
#dbm-msg .notice { margin: 12px 0 0; }
.notice.ok { background: var(--win-soft); border-color: rgba(52,211,153,.3); color: #c9f5e2; }
.dbm-fdeck { width: 220px; max-width: 100%; }
.res { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.res.won { background: var(--win-soft); color: var(--win); }
.res.lost { background: var(--loss-soft); color: var(--loss); }
.roll { font-size: 13px; color: var(--muted); }
.roll.won { color: var(--text); }
@media (max-width: 760px) {
  .dbm-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .dbm-row > .btn-primary { width: 100%; }
  .dbm-row > .fld:not(.fld-grow) { flex: 1 1 auto; }
  .dbm-fdeck { flex: 1 1 100%; width: auto; }
}
.ts-wrapper.deck-ts .ts-control .item { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-wrapper.deck-ts .ts-control { flex-wrap: nowrap; }
@media (max-width: 640px) {
  .dbm-row { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 12px; }
  .dbm-row > .fld-grow, .dbm-row > .fld:has(#dbm-date), .dbm-row > .btn-primary { grid-column: 1 / -1; }
  .dbm-row .seg { display: flex; }
  .dbm-row .seg button { flex: 1 1 0; padding: 5px 2px; }
}
.notice.bonus-note { background: rgba(244,197,90,.10); border-color: rgba(244,197,90,.35); color: #f6dfa6; margin: -4px 0 16px; }
.notice.bonus-note b { color: var(--gold); }

/* brand: Swedish flag instead of the letter mark */
.brand-flag { width: 28px; height: 17.5px; flex: none; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
@media (max-width: 600px) { .brand-flag { width: 24px; height: 15px; } }
