:root {
  --clay: #c25a3a;
  --clay-deep: #9c4429;
  --clay-soft: #f6eae2;
  --bg: #f4ece4;
  --ball: #d6e64f;
  --ball-deep: #c2d23c;
  --ink: #2c2722;
  --muted: #8a7d70;
  --line: #ece1d6;
  --card: #ffffff;
  --ok: #2f8f57;
  --warn: #cf9320;
  --bad: #c0392b;

  --radius: 18px;
  --radius-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(156, 68, 41, .06);
  --shadow: 0 4px 18px rgba(156, 68, 41, .09), 0 1px 3px rgba(156, 68, 41, .05);
  --shadow-lg: 0 18px 44px rgba(156, 68, 41, .18), 0 3px 10px rgba(156, 68, 41, .08);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

/* ───────────────── animations ───────────────── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pop    { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes shake  { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); }
                    30%, 50%, 70% { transform: translateX(-5px); } 40%, 60% { transform: translateX(5px); } }
@keyframes pulse  { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ───────────────── tennis ball ───────────────── */
.ball { width: 30px; height: 30px; flex: none; display: inline-flex; filter: drop-shadow(0 2px 3px rgba(0,0,0,.18)); }
.ball svg { width: 100%; height: 100%; display: block; }
.ball-lg { width: 78px; height: 78px; animation: bounce 2.4s ease-in-out infinite; }

/* ───────────────── login gate ───────────────── */
.login {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--clay); overflow: hidden;
}
/* minimalist court drawn with solid lines only — no gradients */
.login-court { position: absolute; inset: 7%; border: 2px solid rgba(255,255,255,.16); border-radius: 6px; }
.login-court::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: rgba(255,255,255,.16); }
.login-court::after  { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 2px; margin-top: -1px; background: rgba(255,255,255,.12); }

.login-card {
  position: relative; z-index: 1; width: 100%; max-width: 360px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 34px 30px 28px; text-align: center;
  animation: pop .42s cubic-bezier(.2, .8, .25, 1) both;
}
.login-card.shake { animation: shake .5s ease; }
.login-card h1 { margin: 16px 0 4px; font-size: 22px; letter-spacing: .2px; }
.login-sub { margin: 0 0 22px; font-size: 13px; color: var(--muted); }

.field { position: relative; margin-bottom: 14px; }
.field input {
  width: 100%; font-size: 15px; font-family: inherit; color: var(--ink);
  padding: 13px 64px 13px 15px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: #fdfaf6; transition: border-color .18s ease, box-shadow .18s ease;
}
.field input:focus { outline: 0; border-color: var(--clay); box-shadow: 0 0 0 4px rgba(194,90,58,.14); }
.pw-toggle {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; cursor: pointer; color: var(--muted);
  font: 600 12px/1 var(--font); padding: 7px 9px; border-radius: 8px; transition: color .15s, background .15s;
}
.pw-toggle:hover { color: var(--clay-deep); background: var(--clay-soft); }
.login-error { margin: 14px 0 0; font-size: 13px; font-weight: 600; color: var(--bad); }

/* ───────────────── app shell entrance ───────────────── */
#app { display: block; }

/* ───────────────── topbar ───────────────── */
.topbar {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 24px; background: var(--clay); color: #fff; box-shadow: var(--shadow);
  animation: fadeUp .4s ease both;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand h1 { margin: 0; font-size: 19px; letter-spacing: .2px; }
.brand .sub { margin: 2px 0 0; font-size: 12px; color: rgba(255,255,255,.82); }
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* ───────────────── buttons ───────────────── */
.btn {
  appearance: none; border: 0; cursor: pointer;
  background: var(--ball); color: #2c3a08; font-weight: 700; font-size: 13px;
  padding: 9px 16px; border-radius: 999px; box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .18s ease, background .18s ease, filter .18s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(156,68,41,.18); background: var(--ball-deep); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn:disabled { opacity: .6; cursor: default; transform: none; box-shadow: var(--shadow-sm); }
.btn-block { width: 100%; padding: 13px; font-size: 15px; margin-top: 4px; }
.btn-ghost { background: rgba(255,255,255,.16); color: #fff; box-shadow: none; }
.btn-ghost:hover { background: rgba(255,255,255,.28); }
.btn-icon { background: rgba(255,255,255,.12); color: #fff; box-shadow: none; padding: 9px 13px; }
.btn-icon:hover { background: rgba(255,255,255,.24); }

/* ───────────────── pills ───────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; letter-spacing: .3px;
  padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.16); color: #fff;
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill-ok   { color: #ecffd8; } .pill-ok::before   { animation: pulse 2s ease-out infinite; }
.pill-warn { color: #ffe6b0; }
.pill-bad  { color: #ffd2cb; } .pill-bad::before  { animation: pulse 1.3s ease-out infinite; }
.pill-muted{ color: rgba(255,255,255,.85); }

/* ───────────────── layout ───────────────── */
.wrap { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 26px 20px 40px; }

.stats { display: grid; gap: 14px; margin-bottom: 18px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); animation: fadeUp .5s .04s ease both; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); transition: transform .16s ease, box-shadow .2s ease;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat .label { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); }
.stat .value { font-size: 26px; font-weight: 800; margin-top: 6px; line-height: 1.1; }
.stat .meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat .value small { font-size: 14px; font-weight: 600; color: var(--muted); }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); min-width: 0;
  transition: transform .16s ease, box-shadow .2s ease;
  animation: fadeUp .5s ease both;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.grid > .card:nth-child(1) { animation-delay: .06s; }
.grid > .card:nth-child(2) { animation-delay: .12s; }
.grid > .card:nth-child(3) { animation-delay: .18s; }
.grid > .card:nth-child(4) { animation-delay: .24s; }
.grid > .card:nth-child(5) { animation-delay: .30s; }
.span-2 { grid-column: 1 / -1; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.card-head h2 { margin: 0; font-size: 15px; }
.hint { font-size: 12px; color: var(--muted); }

/* ───────────────── runs table ───────────────── */
.table-scroll { overflow-x: auto; }
table.runs { width: 100%; border-collapse: collapse; font-size: 13px; }
table.runs th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap;
}
table.runs td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.runs tbody tr { transition: background .15s ease; }
table.runs tbody tr:hover { background: var(--clay-soft); }
table.runs tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .3px; padding: 2px 9px; border-radius: 999px; }
.tag-success   { background: #e4f4ea; color: var(--ok); }
.tag-nochanges { background: #eef0f2; color: #5a6470; }
.tag-failed    { background: #fbe4e0; color: var(--bad); }
.tag-running   { background: #fff2d9; color: var(--warn); }
.tag-trigger   { background: var(--clay-soft); color: var(--clay-deep); }

/* ───────────────── key/values ───────────────── */
.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; font-size: 13px; font-weight: 600; text-align: right; }

.players { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 999px;
  background: var(--clay-soft); color: var(--clay-deep); border: 1px solid var(--line);
  transition: transform .14s ease;
}
.chip:hover { transform: translateY(-2px); }

/* ───────────────── health checks ───────────────── */
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checks li { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.checks .name { font-weight: 600; }
.checks .desc { color: var(--muted); margin-left: auto; text-align: right; font-size: 12px; }
.led { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.led-ok   { background: var(--ok);   color: rgba(47,143,87,.5);  animation: pulse 2.4s ease-out infinite; }
.led-warn { background: var(--warn); color: rgba(207,147,32,.5); }
.led-bad  { background: var(--bad);  color: rgba(192,57,43,.5);  animation: pulse 1.4s ease-out infinite; }

/* ───────────────── next match ───────────────── */
.next-match .nm-title { font-size: 16px; font-weight: 800; }
.next-match .nm-row { font-size: 13px; color: var(--ink); margin-top: 6px; }
.next-match .nm-row span { color: var(--muted); }
.next-match.empty { color: var(--muted); font-size: 13px; }

/* ───────────────── notifications ───────────────── */
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.notes li {
  display: flex; align-items: center; gap: 10px; font-size: 13px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fdfaf6;
  transition: transform .14s ease, box-shadow .18s ease;
}
.notes li:hover { transform: translateX(3px); box-shadow: var(--shadow-sm); }
.notes .who { color: var(--muted); }
.notes .ago { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.notes .fail { color: var(--bad); font-weight: 700; }

.foot { margin-top: 22px; text-align: center; color: var(--muted); font-size: 12px; }
.foot .dot { margin: 0 8px; }
.empty-row td { color: var(--muted); text-align: center; padding: 18px; }

/* ───────────────── tab nav ───────────────── */
.tabnav { display: flex; gap: 6px; }
.tab {
  appearance: none; border: 0; cursor: pointer;
  background: rgba(255,255,255,.14); color: #fff; font-weight: 700; font-size: 13px;
  padding: 8px 16px; border-radius: 999px; transition: background .15s ease, transform .12s ease;
}
.tab:hover { background: rgba(255,255,255,.26); transform: translateY(-1px); }
.tab.is-active { background: var(--ball); color: #2c3a08; }

/* ───────────────── stats toolbar ───────────────── */
.stats-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  margin-bottom: 18px; animation: fadeUp .4s ease both;
}
.seg { display: inline-flex; background: var(--clay-soft); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg-btn {
  border: 0; cursor: pointer; background: transparent; color: var(--clay-deep);
  font-weight: 700; font-size: 13px; padding: 7px 16px; border-radius: 999px; transition: all .15s ease;
}
.seg-btn.is-active { background: var(--clay); color: #fff; box-shadow: var(--shadow-sm); }
.lvl-pick { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.lvl-pick select {
  font: inherit; font-size: 13px; color: var(--ink); padding: 8px 12px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fdfaf6; cursor: pointer;
}
.lvl-pick select:focus { outline: 0; border-color: var(--clay); box-shadow: 0 0 0 3px rgba(194,90,58,.14); }
.stats-toolbar .btn-recompute { margin-left: auto; background: var(--clay-soft); color: var(--clay-deep); box-shadow: var(--shadow-sm); }
.stats-toolbar .btn-recompute:hover { background: #efe0d4; }

/* ───────────────── watched players ───────────────── */
.watched-card { margin-bottom: 16px; animation: fadeUp .5s ease both; }
.watched-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(264px, 1fr)); }
.wcard {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; background: #fdfaf6;
  transition: transform .14s ease, box-shadow .18s ease;
}
.wcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.wcard.is-empty { color: var(--muted); }
.wname { font-size: 15px; font-weight: 800; margin-bottom: 11px; }
.wdiscs { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.wdisc { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; }
.wdh { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--clay-deep); margin-bottom: 8px; }
.wstat { display: grid; grid-template-columns: 1fr auto auto; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.wlab { font-size: 11px; color: var(--muted); }
.wstat b { font-size: 15px; font-variant-numeric: tabular-nums; }
.wtt { font-size: 11px; color: var(--muted); }
.wform { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 9px; }
.fb { width: 17px; height: 17px; border-radius: 5px; font-size: 10px; font-weight: 800; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; }
.fb-w { background: var(--ok); } .fb-l { background: var(--bad); }

/* ───────────────── leaderboards ───────────────── */
.boards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(296px, 1fr)); margin-bottom: 16px; }
.board { animation: fadeUp .5s ease both; }
.blist { list-style: none; margin: 0; padding: 0; }
.brow { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 8px; }
.brow + .brow { border-top: 1px solid var(--line); }
.brow.is-watched { background: linear-gradient(90deg, rgba(214,230,79,.30), rgba(214,230,79,.05)); }
.brank { font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; }
.bmain { min-width: 0; }
.bname { font-size: 13px; font-weight: 600; display: flex; flex-direction: column; }
.bname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brow.is-watched .bname { color: var(--clay-deep); }
.bctx { font-size: 11px; font-weight: 500; color: var(--muted); }
.btrack { height: 4px; background: var(--clay-soft); border-radius: 999px; margin-top: 5px; overflow: hidden; }
.bfill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--clay), var(--clay-deep)); }
.bnum { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bempty { color: var(--muted); font-size: 13px; padding: 10px 0; list-style: none; }

/* ───────────────── charts ───────────────── */
.charts-card { animation: fadeUp .5s ease both; }
.charts-grid { display: grid; gap: 20px 24px; grid-template-columns: repeat(auto-fit, minmax(236px, 1fr)); }
.chart h3 { font-size: 13px; margin: 0 0 12px; }
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: 78px 1fr 34px; align-items: center; gap: 9px; font-size: 12px; }
.hbl { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbt { height: 9px; background: var(--clay-soft); border-radius: 999px; overflow: hidden; }
.hbf { display: block; height: 100%; border-radius: 999px; }
.hbf-clay { background: linear-gradient(90deg, var(--clay), var(--clay-deep)); }
.hbf-ball { background: linear-gradient(90deg, var(--ball), var(--ball-deep)); }
.hbv { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.donut { width: 116px; height: 116px; border-radius: 50%; position: relative; flex: none; }
.donut::before { content: ""; position: absolute; inset: 21px; background: var(--card); border-radius: 50%; }
.donut span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 19px; }
.donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 13px; }
.donut-legend li { display: flex; align-items: center; gap: 7px; }
.dot-sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }

/* ───────────────── projected knockout ───────────────── */
.ko-list { display: grid; gap: 16px; }
.ko-card { animation: fadeUp .5s ease both; }
.ko-outlook { list-style: none; margin: 0 0 14px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, rgba(214,230,79,.32), rgba(214,230,79,.08)); font-size: 14px; }
.ko-outlook li + li { margin-top: 4px; }
.ko-options { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 14px; }
.ko-option { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.ko-caption { font-size: 12px; font-weight: 700; color: var(--clay-deep); margin-bottom: 6px; }
.ko-pairs { margin: 0; padding-left: 20px; font-size: 13px; }
.ko-pairs li { padding: 3px 0; }
.ko-vs { color: var(--muted); font-size: 11px; margin: 0 8px; }
.ko-slot b { color: var(--clay-deep); }
.ko-slot.is-watched { background: rgba(214,230,79,.45); border-radius: 6px; padding: 1px 5px; }
.ko-slot.is-bye { color: var(--muted); font-style: italic; }
.ko-groups { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.ko-group { background: var(--bg); border-radius: var(--radius-sm); padding: 8px 10px; }
.ko-ghead { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.ko-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ko-table td { padding: 3px 4px; }
.ko-table td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.ko-table tr.is-watched td { background: rgba(214,230,79,.35); }
.ko-table tr.is-watched .ko-name { font-weight: 700; color: var(--clay-deep); }
.ko-lbl { font-weight: 700; color: var(--muted); width: 26px; }
.ko-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
.ko-q { background: #e4f4ea; color: var(--ok); }
.ko-b { background: #fff2d9; color: var(--warn); }
.ko-r { background: #f4efe9; color: var(--muted); }
.ko-o { background: #eef0f2; color: #8a939d; }
.ko-notes { margin: 12px 0 0; padding-left: 18px; font-size: 12px; color: var(--muted); }
.ko-rounds { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-bottom: 14px; }
.ko-round { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.ko-rhead { font-size: 12px; font-weight: 700; color: var(--clay-deep); margin-bottom: 6px; display: flex; justify-content: space-between; }
.ko-pool { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.ko-pool .ko-slot { background: var(--bg); border-radius: 6px; padding: 2px 7px; }
.ko-pool .ko-slot.is-watched { background: rgba(214,230,79,.45); }
.ko-seed { white-space: nowrap; }
.ko-seed small { color: var(--muted); margin-left: 3px; }
.ko-wgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.ko-wcard { display: grid; grid-template-columns: 1fr 72px; gap: 12px; align-items: center; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(214,230,79,.22), rgba(214,230,79,.03)); }
.ko-wcomp { font-size: 12px; color: var(--muted); margin: 2px 0 8px; }
.ko-wline { font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ko-wpath { font-size: 14px; font-weight: 600; margin: 8px 0 6px; color: var(--ink); }
.ko-factors { display: flex; flex-wrap: wrap; gap: 6px; }
.ko-factor { font-size: 11px; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.ko-factor b { color: var(--ink); }
.ko-caveat { font-size: 12px; color: var(--warn); margin-top: 8px; }
.ko-ring { width: 72px; height: 72px; }
.ko-ring circle { fill: none; stroke-width: 6; }
.ko-ring-bg { stroke: var(--line); }
.ko-ring-fg { stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dasharray .6s ease; }
.ko-ring-ok .ko-ring-fg { stroke: var(--ok); } .ko-ring-warn .ko-ring-fg { stroke: var(--warn); } .ko-ring-bad .ko-ring-fg { stroke: var(--bad); }
.ko-ring text { font-size: 15px; font-weight: 700; fill: var(--ink); }
/* projected draw (bracket) */
.ko-draw { margin-bottom: 14px; }
.bracket-scroll { overflow-x: auto; padding: 6px 2px 10px; }
.bracket { display: flex; gap: 22px; align-items: flex-start; min-width: max-content; }
.round { display: grid; grid-auto-rows: 1fr; width: 172px; position: relative; padding-top: 22px; box-sizing: content-box; }
.rname { position: absolute; top: 0; left: 0; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.bm { align-self: center; position: relative; width: 100%; background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: var(--shadow-sm); font-size: 12px; overflow: visible; }
.bm.is-drawn { border-style: dashed; background: rgba(255,255,255,.6); }
.bm .bs { padding: 4px 8px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm .bs + .bs { border-top: 1px solid var(--line); }
.bm .bs b { color: var(--clay-deep); margin-right: 2px; }
.bm .bs.is-bye, .bm .bs.is-feeder, .bm .bs.is-check { color: var(--muted); font-style: italic; }
.bm .bs.is-check { color: var(--ok); font-style: normal; font-size: 11px; }
.bm .bs.is-watched { background: rgba(214,230,79,.45); font-weight: 700; }
.bm-tag { position: absolute; right: 6px; top: -8px; font-size: 9px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase;
  color: var(--muted); background: var(--bg); border: 1px dashed var(--line); border-radius: 999px; padding: 0 5px; }
/* connectors: odd cards drop to the midpoint, even cards rise to it; the next round's card sits on the midpoint */
.round:not(:last-child) .bm:nth-child(odd of .bm)::after { content: ""; position: absolute; left: 100%; top: 50%; width: 11px;
  height: calc(var(--rh) / 2); border-top: 2px solid var(--line); border-right: 2px solid var(--line); border-radius: 0 6px 0 0; }
.round:not(:last-child) .bm:nth-child(even of .bm)::after { content: ""; position: absolute; left: 100%; bottom: 50%; width: 11px;
  height: calc(var(--rh) / 2); border-bottom: 2px solid var(--line); border-right: 2px solid var(--line); border-radius: 0 0 6px 0; }
.round + .round .bm::before { content: ""; position: absolute; right: 100%; top: 50%; width: 11px; border-top: 2px solid var(--line); }

/* ───────────────── matches ───────────────── */
.mt-section { margin-bottom: 24px; animation: fadeUp .45s ease both; }
.mt-section-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; margin: 0 2px 12px; }
.mt-section-head h2 { margin: 0; font-size: 16px; }
.mt-count { display: inline-block; min-width: 22px; margin-left: 4px; padding: 1px 7px; border-radius: 999px;
  background: var(--clay-soft); color: var(--clay-deep); font-size: 12px; text-align: center; }
.mt-empty { margin: 0 2px; }
.mt-section + .mt-section { padding-top: 18px; border-top: 2px solid var(--line); }
.mt-sub { margin: 0 2px 10px; font-size: 12px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.mt-sub .hint { font-weight: 400; letter-spacing: 0; text-transform: none; }
.mt-grid + .mt-sub { margin-top: 18px; }
.mt-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); align-items: start; }
.mt-card { border-top: 4px solid var(--line); }
.mt-card:hover { transform: none; }
.mt-card.is-scheduled { border-top-color: var(--ok); }
.mt-card.is-pending { border-top-color: var(--warn); }
.mt-card.is-final { border-top-color: #c8962b; }
.mt-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.mt-meta { flex: 1 1 120px; min-width: 0; font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag.is-set   { background: #e4f4ea; color: var(--ok); }
.tag.is-open  { background: #fff2d9; color: var(--warn); }
.tag.is-final { background: #fbf1d8; color: #a8781a; }
.mt-h2h { margin-left: auto; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800;
  white-space: nowrap; background: #eef0f2; color: #5a6470; }
.mt-h2h.is-up    { background: #e4f4ea; color: var(--ok); }
.mt-h2h.is-down  { background: #fbe4e0; color: var(--bad); }
.mt-h2h.is-first { background: var(--clay-soft); color: var(--clay-deep); }
.mt-title { margin: 10px 0 8px; font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.mt-title .vs { margin: 0 4px; color: var(--clay); font-size: 13px; }
.mt-row { margin: 5px 0; font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; }
.mt-card a { color: var(--clay-deep); font-weight: 600; }
.mt-tbd { color: var(--muted); font-style: italic; }
.mt-cap { margin: 12px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--clay); }
.mt-org { padding: 8px 11px; border-left: 3px solid var(--clay); border-radius: 8px; background: var(--clay-soft);
  font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.mt-notes { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.mt-note { padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fdfaf6; }
.mt-note.is-opponent { border-color: rgba(194,90,58,.45); background: #fff6f1; }
.mt-note.is-you, .mt-note.is-partner { border-color: rgba(194,210,60,.7); background: #fbfde9; }
.mt-note-who { margin-bottom: 3px; font-size: 12px; color: var(--muted); }
.mt-note-text { font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; }
.mt-side-opponent { background: var(--clay); color: #fff; }
.mt-side-you, .mt-side-partner { background: var(--ball); color: #2c3a08; }
.mt-side-other { background: #eef0f2; color: #5a6470; }
.mt-more { margin-top: 12px; padding-top: 9px; border-top: 1px dashed var(--line); }
.mt-more summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--clay-deep); }
.mt-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mt-chip { padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); font-size: 12px; }
.mt-cmp { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.mt-cmp th, .mt-cmp td { padding: 4px 6px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.mt-cmp thead th { font-size: 12px; text-align: left; }
.mt-cmp tbody th { width: 34%; font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.mt-cmp .you { text-align: right; font-weight: 700; }
.mt-meets { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.mt-meets li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }

@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .kv dd { text-align: left; }
  .topbar { flex-wrap: wrap; }
  .tabnav { order: 3; width: 100%; justify-content: center; flex-wrap: wrap; }
  .tab { padding: 7px 12px; }
  .topbar-right { flex-wrap: wrap; }
  .wdiscs { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
