:root {
  color-scheme: dark;
  --bg: #060b14;
  --bg-soft: #0a1220;
  --panel: rgba(13, 24, 40, .88);
  --panel-2: rgba(19, 35, 57, .82);
  --panel-3: #162942;
  --panel-grad: linear-gradient(180deg, rgba(17, 31, 51, .92), rgba(10, 19, 33, .94));
  --line: rgba(141, 177, 226, .14);
  --line-soft: rgba(141, 177, 226, .08);
  --line-strong: rgba(141, 177, 226, .28);
  --text: #eef4ff;
  --muted: #93a4bd;
  --muted-2: #6f819c;

  --accent: #35e0a4;
  --accent-rgb: 53, 224, 164;
  --accent-soft: rgba(53, 224, 164, .12);
  --accent-line: rgba(53, 224, 164, .36);
  --accent-fill: #35e0a4;
  --accent-fill-2: #23b981;
  --accent-on: #04271c;
  --accent-ink: #c9ffe9;
  --accent-ink-soft: #bff6e2;
  --accent-ink-strong: #d9fff1;
  --blue: #66a9ff;
  --link: #8fc1ff;
  --link-hover: #cbe3ff;
  --link-soft: rgba(143, 193, 255, .08);
  --gold: #ffc857;
  --gold-ink: #2a1c00;
  --danger: #ff7a8a;

  --warn-line: rgba(255, 176, 87, .38);
  --warn-line-soft: rgba(255, 200, 87, .32);
  --warn-bg: rgba(255, 176, 87, .1);
  --warn-chip-bg: rgba(255, 200, 87, .18);
  --warn-text: #ffd9a3;
  --warn-text-strong: #ffe9b8;
  --warn-text-hover: #fff3d6;
  --danger-line: rgba(255, 122, 138, .4);
  --danger-line-soft: rgba(255, 122, 138, .24);
  --danger-bg: rgba(255, 122, 138, .09);
  --danger-text: #ff9daa;
  --danger-text-soft: #ffc3cb;
  --danger-text-strong: #ffd6db;

  --tint-1: rgba(255, 255, 255, .025);
  --tint-2: rgba(255, 255, 255, .04);
  --tint-3: rgba(255, 255, 255, .055);
  --tint-4: rgba(255, 255, 255, .08);
  --tint-5: rgba(255, 255, 255, .13);
  --tint-6: rgba(255, 255, 255, .18);
  --tint-border: rgba(255, 255, 255, .075);
  --tint-hover: rgba(255, 255, 255, .06);

  --control-bg: rgba(9, 18, 32, .68);
  --control-bg-2: rgba(8, 17, 30, .72);
  --field-bg: rgba(7, 15, 27, .74);
  --control-grad: linear-gradient(180deg, rgba(23, 42, 67, .82), rgba(10, 20, 35, .86));
  --menu-bg: #0e1c30;
  --toast-bg: rgba(10, 21, 37, .96);
  --sheet-grad: linear-gradient(180deg, #14263f, #0b1626 34%, #08111d);
  --header-bg: rgba(6, 11, 20, .86);
  --tabbar-bg: rgba(8, 16, 29, .96);
  --tabbar-solid: #08101d;
  --mobile-bg: radial-gradient(120% 55% at 50% -8%, #0b1a2d 0%, var(--bg) 55%);
  --backdrop: rgba(2, 7, 14, .62);
  --scroll-thumb: rgba(141, 177, 226, .2);
  --scroll-thumb-strong: rgba(141, 177, 226, .24);
  --logo-bg: radial-gradient(circle at 30% 25%, rgba(53, 224, 164, .2), rgba(8, 19, 33, .9) 70%);
  --orb-a: rgba(40, 112, 210, .36);
  --orb-b: rgba(23, 190, 132, .2);
  --court-ring: rgba(120, 160, 220, .08);
  --court-grid-x: rgba(120, 160, 220, .05);
  --court-grid-y: rgba(120, 160, 220, .035);
  --selection-bg: rgba(53, 224, 164, .32);
  --avatar-bg: linear-gradient(145deg, #22385a, #152740);
  --avatar-border: rgba(255, 255, 255, .1);
  --avatar-fallback-fg: #d9e6ff;

  --shadow: 0 24px 70px rgba(0, 0, 0, .36);
  --shadow-xs: 0 2px 10px rgba(0, 0, 0, .32);
  --shadow-lg: 0 22px 50px rgba(0, 0, 0, .55);
  --shadow-avatar: 0 12px 34px rgba(0, 0, 0, .42);
  --shadow-avatar-xl: 0 14px 38px rgba(0, 0, 0, .46);
  --shadow-toast: 0 18px 50px rgba(0, 0, 0, .5);
  --shadow-sheet: 0 -24px 60px rgba(0, 0, 0, .55);
  --shadow-sheet-desktop: 0 30px 90px rgba(0, 0, 0, .6);
  --shadow-mobile-panel: 0 14px 34px rgba(0, 0, 0, .22);

  --radius: 20px;
  --font: Inter, "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3fa;
  --bg-soft: #e6edf7;
  --panel: rgba(255, 255, 255, .9);
  --panel-2: rgba(247, 250, 255, .9);
  --panel-3: #e2ebf6;
  --panel-grad: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(246, 250, 255, .98));
  --line: rgba(23, 60, 102, .13);
  --line-soft: rgba(23, 60, 102, .07);
  --line-strong: rgba(23, 60, 102, .24);
  --text: #0d1c2e;
  --muted: #596e8b;
  --muted-2: #5f748d;

  --accent: #077353;
  --accent-rgb: 7, 115, 83;
  --accent-soft: rgba(7, 115, 83, .1);
  --accent-line: rgba(7, 115, 83, .36);
  --accent-fill: #12b981;
  --accent-fill-2: #0a9a70;
  --accent-on: #04231a;
  --accent-ink: #056b4f;
  --accent-ink-soft: #077858;
  --accent-ink-strong: #03553d;
  --blue: #2f6fd0;
  --link: #1f64c4;
  --link-hover: #144a96;
  --link-soft: rgba(31, 100, 196, .09);
  --gold: #d99a13;
  --gold-ink: #2a1c00;
  --danger: #d6455b;

  --warn-line: rgba(186, 118, 18, .42);
  --warn-line-soft: rgba(186, 118, 18, .34);
  --warn-bg: rgba(240, 173, 60, .16);
  --warn-chip-bg: rgba(240, 173, 60, .22);
  --warn-text: #875a10;
  --warn-text-strong: #6d4707;
  --warn-text-hover: #573805;
  --danger-line: rgba(214, 69, 91, .42);
  --danger-line-soft: rgba(214, 69, 91, .28);
  --danger-bg: rgba(214, 69, 91, .08);
  --danger-text: #b3243c;
  --danger-text-soft: #a91f38;
  --danger-text-strong: #941a31;

  --tint-1: rgba(16, 48, 84, .028);
  --tint-2: rgba(16, 48, 84, .05);
  --tint-3: rgba(16, 48, 84, .07);
  --tint-4: rgba(16, 48, 84, .1);
  --tint-5: rgba(16, 48, 84, .15);
  --tint-6: rgba(16, 48, 84, .2);
  --tint-border: rgba(16, 48, 84, .1);
  --tint-hover: rgba(16, 48, 84, .065);

  --control-bg: rgba(255, 255, 255, .78);
  --control-bg-2: rgba(246, 250, 255, .92);
  --field-bg: #f5f9fd;
  --control-grad: linear-gradient(180deg, #ffffff, #f1f6fc);
  --menu-bg: #ffffff;
  --toast-bg: rgba(255, 255, 255, .98);
  --sheet-grad: linear-gradient(180deg, #ffffff, #f6faff 34%, #eef5fc);
  --header-bg: rgba(248, 251, 255, .9);
  --tabbar-bg: rgba(251, 253, 255, .96);
  --tabbar-solid: #fbfdff;
  --mobile-bg: radial-gradient(120% 55% at 50% -8%, #e4eefa 0%, var(--bg) 55%);
  --backdrop: rgba(11, 31, 54, .34);
  --scroll-thumb: rgba(23, 60, 102, .18);
  --scroll-thumb-strong: rgba(23, 60, 102, .22);
  --logo-bg: radial-gradient(circle at 30% 25%, rgba(10, 140, 102, .18), rgba(255, 255, 255, .95) 70%);
  --orb-a: rgba(64, 132, 235, .16);
  --orb-b: rgba(23, 190, 132, .14);
  --court-ring: rgba(45, 95, 160, .1);
  --court-grid-x: rgba(45, 95, 160, .06);
  --court-grid-y: rgba(45, 95, 160, .04);
  --selection-bg: rgba(10, 140, 102, .2);
  --avatar-bg: linear-gradient(145deg, #e3edf8, #c9d9ea);
  --avatar-border: rgba(16, 48, 84, .1);
  --avatar-fallback-fg: #ffffff;

  --shadow: 0 20px 50px rgba(15, 45, 80, .1);
  --shadow-xs: 0 2px 8px rgba(15, 45, 80, .08);
  --shadow-lg: 0 20px 50px rgba(15, 45, 80, .16);
  --shadow-avatar: 0 10px 26px rgba(15, 45, 80, .16);
  --shadow-avatar-xl: 0 12px 30px rgba(15, 45, 80, .18);
  --shadow-toast: 0 16px 44px rgba(15, 45, 80, .18);
  --shadow-sheet: 0 -18px 50px rgba(15, 45, 80, .16);
  --shadow-sheet-desktop: 0 24px 70px rgba(15, 45, 80, .2);
  --shadow-mobile-panel: 0 12px 30px rgba(15, 45, 80, .08);
}

/* Neon glows read as haze on a light surface, so tone them down. */
[data-theme="light"] .brand { text-shadow: none; }
[data-theme="light"] .conn[data-state="on"] .conn-dot { box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .16); }


* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }

::selection { background: var(--selection-bg); }

body.sheet-open { overflow: hidden; }

/* ---------- atmosphere ---------- */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
}
.orb-a {
  width: 620px; height: 620px;
  top: -280px; right: -140px;
  background: radial-gradient(circle, var(--orb-a), transparent 68%);
}
.orb-b {
  width: 520px; height: 520px;
  bottom: -260px; left: -180px;
  background: radial-gradient(circle, var(--orb-b), transparent 68%);
}
.court-lines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 50% 118%, transparent 0 208px, var(--court-ring) 209px 210px, transparent 211px),
    linear-gradient(90deg, var(--court-grid-x) 1px, transparent 1px) 0 0 / 84px 84px,
    linear-gradient(var(--court-grid-y) 1px, transparent 1px) 0 0 / 84px 84px;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.5), transparent 72%);
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.5), transparent 72%);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 2.4vw, 34px) 54px;
}

/* ---------- header ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.headline {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  font-size: clamp(17px, 1.85vw, 27px);
  line-height: 1.15;
  letter-spacing: -.015em;
}
.brand {
  flex: none;
  color: var(--accent);
  font-size: .66em;
  font-weight: 850;
  letter-spacing: .18em;
  text-transform: uppercase;
  text-shadow: 0 0 26px rgba(var(--accent-rgb), .34);
}
.app-logo {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  border: 1px solid var(--accent-line);
  background: var(--logo-bg);
  box-shadow: 0 0 22px rgba(var(--accent-rgb), .16);
}
.app-logo svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sep { flex: none; color: var(--muted-2); font-weight: 400; }
.headline-main { flex: none; font-weight: 800; }
.tagline {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: .66em;
  font-weight: 450;
  letter-spacing: 0;
}

.top-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.conn {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--control-bg);
}
.conn-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted-2);
  transition: background .2s, box-shadow .2s;
}
.conn[data-state="connecting"] .conn-dot { background: var(--gold); animation: pulse 1.2s infinite; }
.conn[data-state="on"] .conn-dot { background: var(--accent); box-shadow: 0 0 14px var(--accent); animation: pulse 2s infinite; }
.conn[data-state="error"] .conn-dot { background: var(--danger); animation: pulse 1s infinite; }
.conn[data-state="on"] { color: var(--accent-ink-soft); border-color: var(--accent-line); }

.lang {
  flex: none;
  display: flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--control-bg);
}
.lang button {
  flex: none;
  white-space: nowrap;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  transition: background .18s, color .18s;
}
.lang button:hover { color: var(--text); }
.lang button.active { background: var(--panel-3); color: var(--text); box-shadow: var(--shadow-xs); }

/* Theme switch: auto (half sun) / light (sun) / dark (moon). */
.theme-btn {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--control-bg);
  color: var(--muted);
  transition: color .18s, border-color .18s, background .18s, transform .18s;
}
.theme-btn:hover { color: var(--text); border-color: var(--line-strong); }
.theme-btn:active { transform: scale(.94); }
.theme-btn:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.theme-btn svg { display: block; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .theme-icon { display: none; }
html[data-theme-mode="auto"] .theme-btn .theme-icon-auto,
html[data-theme-mode="light"] .theme-btn .theme-icon-light,
html[data-theme-mode="dark"] .theme-btn .theme-icon-dark { display: block; }
@media (max-width: 980px) {
  .theme-btn { width: 30px; height: 30px; }
  .theme-btn svg { width: 15px; height: 15px; }
}

/* ---------- layout ---------- */
.source-alert {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--warn-line);
  border-radius: 12px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 12.5px;
  line-height: 1.5;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 424px;
  gap: 20px;
  align-items: start;
}
.rail {
  display: grid;
  /* Without a zero minimum the implicit track grows to the longest masked
     webhook, making the whole column overflow to the right and forcing a
     horizontal scroll. Keep the column at its layout width; the saved-channel
     rows truncate their addresses instead. */
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb-strong) transparent;
  overscroll-behavior: contain;
}
.rail::-webkit-scrollbar { width: 8px; }
.rail::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }

.panel {
  min-width: 0;
  background: var(--panel-grad);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.teams-panel { padding: 20px 20px 12px; min-height: 360px; }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.panel-head h2 {
  font-size: 18px;
  font-weight: 780;
  letter-spacing: -.01em;
}
.sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

.icon-btn {
  flex: none;
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--control-bg);
  color: var(--muted);
  transition: color .18s, border-color .18s, transform .18s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
.icon-btn:active { transform: rotate(40deg); }
/* Touch devices can keep :active after a tap; a scale avoids a tilted icon. */
@media (hover: none) {
  .icon-btn:active { transform: scale(.94); }
}
.icon-btn svg { display: block; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* The refresh arrowhead carries more weight on the right; nudge the glyph
   back to its optical centre inside the square button. */
#reload svg { transform: translateX(-.5px); }

/* ---------- search + tabs ---------- */
.teams-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 16px 0 8px;
}
.search {
  flex: 1 1 250px;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 0 12px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--control-bg-2);
  transition: border-color .18s, box-shadow .18s;
}
.search:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .1);
}
.search svg { width: 17px; height: 17px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13.5px;
}
.search input::placeholder { color: var(--muted-2); }
.search input::-webkit-search-cancel-button { display: none; }
.clear {
  flex: none;
  border: 0;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  background: var(--tint-4);
  color: var(--muted);
  width: 20px; height: 20px;
  border-radius: 50%;
  line-height: 1;
  display: grid;
  place-items: center;
}
.clear svg {
  display: block;
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}
.clear:hover { color: var(--text); background: var(--tint-5); }

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--control-bg-2);
}
.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 650;
  transition: background .18s, color .18s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--panel-3); color: var(--text); box-shadow: var(--shadow-xs); }

/* ---------- team list ---------- */
.team-list {
  max-height: calc(100vh - 245px);
  overflow-y: auto;
  margin: 4px -8px 0;
  padding: 4px 8px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb-strong) transparent;
  overscroll-behavior: contain;
}
.team-list::-webkit-scrollbar { width: 8px; }
.team-list::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }

.team {
  border-bottom: 1px solid var(--line);
}
.team:last-child { border-bottom: 0; }

.team-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 8px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  text-align: left;
  transition: background .16s;
}
.team-row:hover { background: var(--tint-1); }
.team-row:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 1px; }
.team.open .team-row { background: rgba(var(--accent-rgb), .045); }

.team-logo {
  width: 38px; height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--tint-2);
  border: 1px solid var(--tint-border);
}
.team-logo img { width: 30px; height: 30px; object-fit: contain; }
.team-logo .logo-fallback { font-size: 11px; font-weight: 800; color: var(--muted); }

.team-names { flex: 1; min-width: 0; }
.team-names b {
  display: block;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-names small {
  display: block;
  color: var(--muted-2);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.team-count {
  flex: none;
  min-width: 27px;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--tint-3);
}
.chev {
  flex: none;
  width: 17px; height: 17px;
  fill: none;
  stroke: var(--muted-2);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .2s, stroke .2s;
}
.team.open .chev { transform: rotate(180deg); stroke: var(--accent); }

.roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(184px, 1fr));
  gap: 7px;
  padding: 4px 8px 15px 59px;
  animation: rosterIn .2s ease both;
}
.roster[hidden] { display: none; }

.player-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 7px 9px 7px 7px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--tint-1);
  text-align: left;
  transition: background .15s, border-color .15s, transform .15s;
}
.player-chip:hover { background: var(--tint-hover); border-color: var(--line); transform: translateY(-1px); }
.player-chip:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 1px; }
.player-chip.selected {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .12);
}

.avatar {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--avatar-bg);
  border: 1px solid var(--avatar-border);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.avatar-fallback {
  display: none;
  position: absolute;
  inset: 0;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--avatar-fallback-fg);
  background: linear-gradient(145deg, var(--team, #2a466d), #152740);
}
.avatar.fallback .avatar-fallback { display: grid; }
.avatar.sm { width: 38px; height: 38px; }
.avatar.md { width: 44px; height: 44px; }
.avatar.lg { width: 104px; height: 104px; border-width: 2px; }
.avatar.lg .avatar-fallback { font-size: 30px; }

.p-copy { flex: 1 1 auto; min-width: 0; }
.player-chip.subscribed { border-color: rgba(var(--accent-rgb), .16); }
.p-sub {
  flex: none;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}
.p-sub svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.p-name {
  display: block;
  font-size: 12.8px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p-meta {
  display: block;
  color: var(--muted-2);
  font-size: 10.8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.loading, .empty, .no-results {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 38px 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.no-results { flex-direction: column; gap: 6px; }
.no-results b { color: var(--text); font-size: 14px; }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--tint-5);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ---------- player panel (desktop) / player sheet ---------- */
.profile-panel { padding: 20px; min-height: 228px; }
.profile-panel.flash { animation: formFlash 1.2s ease; }
.profile-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 188px;
  text-align: center;
  color: var(--muted);
  padding: 10px;
}
.profile-empty .halo {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px dashed var(--line-strong);
  background: var(--tint-1);
  color: var(--muted-2);
}
.profile-empty .halo svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.profile-empty h2 { color: var(--text); font-size: 16px; font-weight: 750; }
.profile-empty p { font-size: 12.5px; max-width: 290px; line-height: 1.6; }

.sheet-hero { display: flex; gap: 17px; align-items: center; }
.avatar.lg { box-shadow: var(--shadow-avatar); border-color: color-mix(in srgb, var(--team, var(--accent)) 55%, transparent); }
.avatar.xl { width: 86px; height: 86px; border-width: 2px; box-shadow: var(--shadow-avatar-xl); border-color: color-mix(in srgb, var(--team, var(--accent)) 55%, transparent); }
.avatar.xl .avatar-fallback { font-size: 25px; }
.profile-id { min-width: 0; flex: 1; }
.eyebrow {
  display: block;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.profile-id h2,
.sheet-body h2 {
  font-size: clamp(20px, 2.2vw, 25px);
  line-height: 1.1;
  font-weight: 820;
  letter-spacing: -.025em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.alt-name {
  color: var(--muted-2);
  font-size: 12px;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meta-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.meta-chip {
  font-size: 11px;
  color: var(--muted);
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--tint-2);
  white-space: nowrap;
}
.meta-chip.team-chip { color: var(--text); border-color: color-mix(in srgb, var(--team, var(--accent)) 38%, transparent); }

.channel-status {
  margin-top: 18px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--tint-1);
}
.channel-status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.status-label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .03em;
}
.mini-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--link);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 6px;
  margin: -4px -6px -4px 0;
  border-radius: 8px;
  transition: color .16s, background .16s;
}
.mini-link:hover { color: var(--link-hover); background: var(--link-soft); }
.mini-link svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.channel-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px 4px 4px;
  border: 1px solid color-mix(in srgb, var(--ch) 34%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--ch) 12%, transparent);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.channel-badge .ch-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 9.5px;
  box-shadow: none;
}
.channel-badge .ch-count {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.channel-empty { color: var(--muted-2); font-size: 12px; line-height: 1.5; }

/* Green dot next to players who are on the floor right now. */
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
  animation: live-pulse 1.8s infinite;
}
.player-chip.on-court .p-name { color: var(--accent-ink-strong); }
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), .45); }
  70% { box-shadow: 0 0 0 6px rgba(var(--accent-rgb), 0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0); }
}

/* Remembered destinations: the player card lists every saved channel so one
   can be picked for that player, and the form lets one be reused on save. */
.channel-list {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 232px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.channel-status-actions { display: inline-flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 2px; flex: none; }
.channel-status-actions .mini-link { margin: 0; }

/* Saved destinations are compact multi-select tags: one submission can push
   to several channels without asking for a webhook again. */
.channel-tags {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
  max-height: 176px;
}
.channel-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 3px 8px 3px 4px;
  border: 1px dashed color-mix(in srgb, var(--ch, var(--link)) 42%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--ch, var(--link)) 8%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .16s, background .16s, transform .15s;
}
.channel-tag .ch-icon { width: 18px; height: 18px; border-radius: 50%; font-size: 8.5px; box-shadow: none; }
.channel-tag:hover {
  border-color: color-mix(in srgb, var(--ch, var(--link)) 66%, transparent);
  background: color-mix(in srgb, var(--ch, var(--link)) 14%, transparent);
}
.channel-tag:active { transform: translateY(1px); }
.channel-tag:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 1px; }
.channel-tag:disabled { cursor: default; }
.channel-tag.is-selected {
  border-style: solid;
  border-color: var(--ch, var(--link));
  background: color-mix(in srgb, var(--ch, var(--link)) 18%, transparent);
}
.channel-tag.is-used {
  cursor: default;
  border-style: solid;
  border-color: color-mix(in srgb, var(--ch, var(--link)) 40%, transparent);
  background: color-mix(in srgb, var(--ch, var(--link)) 10%, transparent);
  color: var(--muted);
}
.channel-tag.is-used:hover { background: color-mix(in srgb, var(--ch, var(--link)) 10%, transparent); }
.channel-tag.is-used:active { transform: none; }
.channel-tag .tag-target {
  max-width: 74px;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 600;
  text-overflow: ellipsis;
}
.channel-tag .tag-mark { color: var(--link); font-size: 10px; font-weight: 800; }
.channel-tag.is-selected .tag-mark,
.channel-tag.is-used .tag-mark { color: var(--accent-ink); }

.saved-channel {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 1px dashed color-mix(in srgb, var(--ch, var(--link)) 34%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--ch, var(--link)) 7%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 11.5px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s, background .16s, transform .15s;
}
.saved-channel .ch-icon { width: 22px; height: 22px; border-radius: 7px; font-size: 10px; }
.saved-channel:hover {
  border-color: color-mix(in srgb, var(--ch, var(--link)) 62%, transparent);
  background: color-mix(in srgb, var(--ch, var(--link)) 14%, transparent);
}
.saved-channel:active { transform: translateY(1px); }
.saved-channel:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 1px; }
.saved-channel[aria-busy="true"] { opacity: .6; cursor: progress; }
.saved-channel.is-used {
  cursor: default;
  border-style: solid;
  border-color: color-mix(in srgb, var(--ch, var(--link)) 40%, transparent);
  background: color-mix(in srgb, var(--ch, var(--link)) 10%, transparent);
}
.saved-channel.is-used:active { transform: none; }
.pick-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pick-copy b { color: var(--text); font-size: 11.8px; font-weight: 720; }
.pick-copy small {
  color: var(--muted-2);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pick-state { flex: none; font-size: 10px; font-weight: 700; color: var(--muted-2); }
.saved-channel:not(.is-used) .pick-state { color: var(--link); }
.saved-channel.is-used .pick-state { color: var(--accent-ink); }

.preset-row {
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--tint-1);
}
.preset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.preset-count { color: var(--muted-2); font-size: 10.5px; font-weight: 700; }
.preset-list {
  min-width: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 164px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}
.preset-tag { display: inline-flex; align-items: center; gap: 0; min-width: 0; }
.preset-tag .preset-forget { width: 18px; height: 18px; margin-left: -4px; }
.preset-item { display: flex; align-items: center; gap: 2px; min-width: 0; }
.preset-pick {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s, background .16s;
}
.preset-pick .ch-icon { width: 20px; height: 20px; border-radius: 6px; font-size: 9.5px; box-shadow: none; }
.preset-pick:hover { background: var(--tint-3); }
.preset-pick:focus-visible { outline: 2px solid var(--accent-line); outline-offset: -1px; }
.preset-item.is-selected .preset-pick {
  border-color: color-mix(in srgb, var(--ch) 56%, transparent);
  background: color-mix(in srgb, var(--ch) 12%, transparent);
}
.preset-item.is-selected .pick-state { color: var(--text); }
.preset-forget {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
}
.preset-forget svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.preset-forget:hover { color: var(--danger); background: var(--danger-bg); }
.preset-forget:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 1px; }
.preset-hint { margin-top: 6px; color: var(--muted-2); }

.push-status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 17px;
  padding: 11px 13px;
  border: 1px solid rgba(var(--accent-rgb), .32);
  border-radius: 12px;
  background: rgba(var(--accent-rgb), .08);
}
.push-status .live-dot { flex: none; margin: 0; }
.push-status .push-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.push-status b { color: var(--accent-ink); font-size: 13px; font-weight: 750; }
.push-status small { color: var(--muted); font-size: 11.5px; line-height: 1.45; }

.watch-btn {
  width: 100%;
  margin-top: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--accent-line);
  background: linear-gradient(180deg, rgba(var(--accent-rgb), .18), rgba(var(--accent-rgb), .08));
  color: var(--accent-ink);
  font-size: 13.5px;
  font-weight: 750;
  transition: background .18s, transform .15s, border-color .18s;
}
.watch-btn:hover { background: linear-gradient(180deg, rgba(var(--accent-rgb), .26), rgba(var(--accent-rgb), .12)); }
.watch-btn:active { transform: translateY(1px); }
.watch-btn.on {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent-fill), var(--accent-fill-2));
  color: var(--accent-on);
}
.watch-btn:disabled {
  cursor: not-allowed;
  color: var(--muted);
  border-color: var(--line);
  background: var(--tint-2);
  opacity: 1;
}
.watch-btn:disabled:hover { background: var(--tint-2); }
.watch-btn:disabled:active { transform: none; }
.watch-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.watch-btn .wave, .watch-btn .lock { display: none; }
.watch-btn.on .wave { display: inline; }
.watch-btn.on .play { display: none; }
.watch-btn.locked .play { display: none; }
.watch-btn.locked .lock { display: inline; }
.watch-hint {
  margin-top: 9px;
  text-align: center;
  color: var(--warn-text);
  font-size: 11.5px;
  line-height: 1.55;
}
.watch-hint b { color: var(--warn-text-strong); font-weight: 750; }
.watch-hint.preset { color: var(--muted); }

/* ---------- subscription form ---------- */
.form-panel, .subs-panel { padding: 19px 20px 20px; }

/* ---------- email identity ---------- */
.identity-panel { padding: 16px 20px 15px; }
.identity-head { align-items: flex-start; }
.identity-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  margin-top: 12px;
}
.identity-form input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--field-bg);
  color: var(--text);
  outline: 0;
  font-size: 13px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.identity-form input:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .09);
}
.identity-form input::placeholder { color: var(--muted-2); }
.identity-form .primary, .identity-form .ghost { height: 42px; padding: 0 14px; }
.identity-leave { color: var(--muted); }
.identity-panel.is-bound .identity-form input {
  border-color: var(--accent-line);
  background: rgba(var(--accent-rgb), .05);
}
.identity-hint { margin-top: 9px; }
/* Keep the open channel menu above the following "My subscriptions" panel. */
.form-panel.dropdown-open {
  position: relative;
  z-index: 60;
}
.form-head { align-items: center; }
.panel-head h2 + .player-pill { margin-top: 2px; }
.player-pill {
  flex: none;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-ink-soft);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  padding: 4px 10px;
  border-radius: 999px;
  transition: background .16s, border-color .16s;
}
.player-pill:hover { background: rgba(var(--accent-rgb), .18); }
.player-pill[data-empty="true"] {
  color: var(--muted);
  background: var(--tint-2);
  border-color: var(--line);
}
.form-need {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}
.form-need[hidden] { display: none; }
.form-need-cta {
  flex: none;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink-soft);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  transition: background .16s;
}
.form-need-cta:hover { background: rgba(var(--accent-rgb), .2); }
.form-panel.flash { animation: formFlash 1.2s ease; }
@keyframes formFlash {
  0%, 100% { border-color: var(--line); box-shadow: var(--shadow); }
  30% { border-color: var(--accent-line); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .14), var(--shadow); }
}

.sub-form { margin-top: 15px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; }
.field > label, .field-head > label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .03em;
}
.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.doc-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--link);
  font-size: 11.5px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  transition: color .16s;
}
.doc-link:hover { color: var(--link-hover); text-decoration: underline; }
.doc-link svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.field input:not([type="hidden"]) {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--field-bg);
  outline: 0;
  font-size: 13px;
  transition: border-color .18s, box-shadow .18s;
}
.field input:not([type="hidden"]):focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .09);
}
.field input::placeholder { color: var(--muted-2); }
.field-hint { color: var(--muted-2); font-size: 11px; line-height: 1.5; }
.field-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0;
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
}
.field-divider::before,
.field-divider::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.field-divider[hidden] { display: none; }
.field-hint.is-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--warn-line);
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 11.5px;
  line-height: 1.6;
}
.field-hint.is-alert .hint-badge {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--gold-ink);
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}
.field-hint.is-alert code {
  padding: 0 4px;
  border: 1px solid var(--warn-line-soft);
  border-radius: 5px;
  background: var(--warn-chip-bg);
  color: var(--warn-text-strong);
  font: inherit;
  font-weight: 700;
}
.field-hint.is-alert b { color: var(--warn-text-strong); font-weight: 800; }
.field-hint.is-alert .hint-kw {
  padding: 1px 5px;
  border: 1px solid var(--warn-line-soft);
  border-radius: 5px;
  background: var(--warn-chip-bg);
  color: var(--warn-text-strong);
  font-weight: 800;
  font-style: normal;
  letter-spacing: .02em;
}
.field-hint.is-alert .hint-link {
  color: var(--warn-text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.field-hint.is-alert .hint-link:hover { color: var(--warn-text-hover); }

/* custom channel picker */
.channel-picker { position: relative; }
.channel-trigger {
  width: 100%;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--control-grad);
  text-align: left;
  transition: border-color .18s, box-shadow .18s;
}
.channel-trigger:hover { border-color: var(--line-strong); }
.channel-trigger[aria-expanded="true"] {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .09);
}
.channel-trigger .chev { margin-left: auto; }
.channel-trigger[aria-expanded="true"] .chev { transform: rotate(180deg); stroke: var(--accent); }

.ch-icon {
  flex: none;
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  background: linear-gradient(145deg, color-mix(in srgb, var(--ch) 82%, #fff 8%), color-mix(in srgb, var(--ch) 66%, #000 20%));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--ch) 28%, transparent);
  letter-spacing: 0;
}
.ch-copy { flex: 1 1 auto; min-width: 0; display: grid; gap: 1px; }
.ch-copy b { font-size: 13px; font-weight: 720; }
.ch-copy small {
  color: var(--muted-2);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-menu {
  position: absolute;
  z-index: 40;
  left: 0; right: 0;
  top: calc(100% + 7px);
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--menu-bg);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 2px;
  animation: menuIn .16s ease both;
  max-height: 360px;
  overflow-y: auto;
}
.channel-menu[hidden] { display: none; }
.channel-menu.up { top: auto; bottom: calc(100% + 7px); animation-name: menuInUp; }
.channel-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  transition: background .14s, border-color .14s;
}
.channel-option:hover { background: var(--tint-3); }
.channel-option[aria-selected="true"] { background: rgba(var(--accent-rgb), .08); border-color: rgba(var(--accent-rgb), .22); }
.channel-option .ch-icon { width: 30px; height: 30px; }
.channel-option .ch-copy b { font-size: 12.5px; }
.channel-option .ch-copy small { font-size: 10px; }
.ch-check {
  margin-left: auto;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  opacity: 0;
}
.channel-option[aria-selected="true"] .ch-check { opacity: 1; }

.form-actions { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.primary, .ghost {
  height: 42px;
  padding: 0 16px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 750;
  transition: filter .18s, transform .14s, background .18s, border-color .18s;
}
.primary {
  border: 1px solid var(--accent);
  background: linear-gradient(180deg, var(--accent-fill), var(--accent-fill-2));
  color: var(--accent-on);
}
.primary:hover { filter: brightness(1.06); }
.primary:active, .ghost:active { transform: translateY(1px); }
.primary:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.ghost {
  border: 1px solid var(--line);
  background: var(--tint-2);
  color: var(--text);
}
.ghost:hover { background: var(--tint-hover); border-color: var(--line-strong); }
.hint { color: var(--muted-2); font-size: 11px; line-height: 1.55; }
.test-result {
  margin-top: -2px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--tint-2);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.test-result[hidden] { display: none; }
.test-result[data-kind="pending"] { border-color: var(--warn-line-soft); color: var(--warn-text-strong); }
.test-result[data-kind="ok"] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-ink-soft); }
.test-result[data-kind="error"] { border-color: var(--danger-line); background: var(--danger-bg); color: var(--danger-text-soft); }

/* ---------- subscriptions ---------- */
.count-badge {
  min-width: 24px;
  padding: 2px 8px;
  text-align: center;
  border-radius: 999px;
  background: var(--tint-3);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}
.subs-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 13px; min-width: 0; }
.subs-note {
  margin: 10px 2px 0;
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.55;
}
.sub-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--tint-1);
  animation: rosterIn .18s ease both;
}
.sub-top { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; }
.sub-player { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1 1 0; overflow: hidden; }
.sub-player .avatar { width: 34px; height: 34px; font-size: 11px; }
.sub-main { min-width: 0; flex: 1 1 0; display: grid; gap: 1px; overflow: hidden; }
.sub-main b { display: block; min-width: 0; font-size: 12.8px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-main small { display: block; min-width: 0; color: var(--muted-2); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-top .sub-channel-count { flex: none; color: var(--muted-2); font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.sub-channels { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.sub-channels .channel-badge { max-width: 100%; padding-right: 5px; font-size: 11px; }
.sub-channel-target {
  max-width: 82px;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 600;
  text-overflow: ellipsis;
}
.channel-remove {
  flex: none;
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  transition: color .16s, background .16s;
}
.channel-remove svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.channel-remove:hover { color: var(--danger); background: var(--danger-bg); }
.channel-remove:focus-visible { outline: 2px solid var(--danger-line); outline-offset: 1px; }
.channel-remove:disabled { opacity: .45; cursor: progress; }
.subs-list .empty {
  padding: 24px 12px;
  border: 1px dashed var(--line);
  border-radius: 13px;
  font-size: 12px;
  line-height: 1.6;
}

/* ------------------------------ SEO footer ------------------------------ */
.site-footer {
  margin-top: 30px;
  padding: 22px 2px 10px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}
.site-footer h2 { margin: 0 0 8px; color: var(--text); font-size: 17px; letter-spacing: -.01em; }
.site-footer h3 { margin: 0 0 4px; color: var(--text); font-size: 12.5px; }
.site-footer p { margin: 0 0 8px; }
.seo-intro { max-width: 820px; }
.seo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0;
}
.seo-grid section {
  padding: 12px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--tint-1);
}
.seo-faq {
  padding-top: 12px;
  border-top: 1px dashed var(--line-soft);
}
.seo-faq summary {
  cursor: pointer;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
}
.seo-faq div { margin-top: 6px; }
.seo-faq h3 { margin-top: 10px; }
.site-footer a { color: var(--link); }
@media (max-width: 860px) {
  .seo-grid { grid-template-columns: 1fr; gap: 10px; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  z-index: 160;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 22px);
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 13px;
  border: 1px solid var(--line-strong);
  background: var(--toast-bg);
  box-shadow: var(--shadow-toast);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  backdrop-filter: blur(12px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-kind="error"] { border-color: var(--danger-line); color: var(--danger-text-strong); }
.toast[data-kind="alert"] { border-color: var(--accent-line); box-shadow: 0 18px 60px rgba(var(--accent-rgb), .18); }

/* ---------- motion ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes rosterIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes menuIn { from { opacity: 0; transform: translateY(-5px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes menuInUp { from { opacity: 0; transform: translateY(5px) scale(.99); } to { opacity: 1; transform: none; } }

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

/* ---------- responsive ---------- */
@media (max-height: 860px) {
  .rail { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr) 386px; }
  .roster { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); padding-left: 52px; }
}
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .rail { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .teams-panel { order: -1; }
  .team-list { max-height: 560px; }
}
@media (max-width: 820px) {
  .shell { padding: 18px 14px 40px; }
  .top { margin-bottom: 16px; }
  .sep-tag, .tagline { display: none; }
  .headline { font-size: clamp(17px, 4vw, 23px); gap: 9px; }
  .top-actions { gap: 8px; margin-left: 0; width: 100%; justify-content: space-between; }
  .rail { grid-template-columns: 1fr; }
  .teams-panel { padding: 16px 14px 10px; }
  .team-list { max-height: 520px; margin-inline: -4px; padding-inline: 4px; }
  .roster { padding-left: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .player-chip { padding: 6px; }
  .avatar.md { width: 38px; height: 38px; }
  .p-name { font-size: 12px; }
  .p-meta { font-size: 10px; }
  .form-panel, .subs-panel { padding: 16px; }
  .avatar.lg { width: 84px; height: 84px; }
  .profile-id h2 { font-size: 21px; }
  .toast { bottom: 16px; }
}
@media (max-width: 480px) {
  .headline .brand { font-size: .6em; letter-spacing: .12em; }
  .conn { padding: 6px 9px; font-size: 11px; }
  .roster { grid-template-columns: 1fr 1fr; }
  .team-names small { font-size: 10.5px; }
  .form-actions { grid-template-columns: 1fr; }
  .identity-panel { padding: 14px 16px 13px; }
  .identity-form { grid-template-columns: minmax(0, 1fr) auto; }
  .identity-form .identity-leave { grid-column: 2; }
  .identity-form .primary, .identity-form .ghost { padding: 0 12px; }
  .avatar.lg { width: 72px; height: 72px; }
  .profile-id h2 { font-size: 19px; }
}
/* ---------- bottom tabs + player sheet ---------- */
.tabbar { display: none; }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 130;
  background: var(--backdrop);
  opacity: 0;
  transition: opacity .22s ease;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.sheet-backdrop.show { opacity: 1; }
.sheet-backdrop[hidden] { display: none; }

.player-sheet {
  position: fixed;
  z-index: 140;
  left: 50%;
  bottom: 0;
  width: min(560px, 100%);
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 18px calc(22px + env(safe-area-inset-bottom));
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: var(--sheet-grad);
  box-shadow: var(--shadow-sheet);
  transform: translate(-50%, 102%);
  transition: transform .3s cubic-bezier(.22,.85,.28,1), opacity .2s;
  opacity: 0;
  scrollbar-width: thin;
}
.player-sheet.show { transform: translate(-50%, 0); opacity: 1; }
.player-sheet[hidden] { display: none; }
.player-sheet::-webkit-scrollbar { width: 6px; }
.player-sheet::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 99px; }
.sheet-grab {
  width: 40px;
  height: 4px;
  margin: -4px auto 14px;
  border-radius: 99px;
  background: var(--tint-6);
}
.sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--tint-3);
  color: var(--muted);
  transition: color .16s, background .16s;
}
.sheet-close:hover { color: var(--text); background: var(--tint-5); }
.sheet-close svg { display: block; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.sheet-body { min-height: 40px; }
.sheet-body .sheet-hero { padding-right: 30px; }

@media (min-width: 981px) {
  .player-sheet {
    bottom: auto;
    top: 50%;
    max-height: min(84vh, 720px);
    border-bottom: 1px solid var(--line-strong);
    border-radius: 22px;
    padding: 22px 22px 20px;
    box-shadow: var(--shadow-sheet-desktop);
    transform: translate(-50%, calc(-50% + 18px)) scale(.97);
  }
  .player-sheet.show { transform: translate(-50%, -50%) scale(1); }
  .sheet-grab { display: none; }
  .sheet-close { top: 16px; right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .player-sheet, .sheet-backdrop { transition-duration: .01ms !important; }
}

/* ---------- mobile app shell ---------- */
@media (max-width: 980px) {
  html, body { height: 100%; }
  body {
    height: 100vh;
    height: 100dvh;
    /* app.js keeps --app-vh in sync with window.innerHeight, which tracks
       the visible viewport; dvh is the fallback before JS runs. */
    height: var(--app-vh, 100dvh);
    /* The base rule sets min-height: 100vh, which on phones resolves to the
       large viewport (browser toolbar hidden). With the toolbar visible
       100vh > 100dvh, so the body grew past the screen and pushed the
       in-flow tabbar below the visible area until the page scrolled. */
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    background: var(--mobile-bg) fixed;
  }
  .orb, .court-lines { display: none; }
  .shell {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
  }
  .top {
    flex: none;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    margin: 0;
    padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    position: relative;
    z-index: 40;
  }
  .headline { flex: 1 1 auto; min-width: 0; font-size: 16px; gap: 8px; }
  .headline-main { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .conn #connText { max-width: 82px; overflow: hidden; text-overflow: ellipsis; }
  .headline .brand, .headline .sep, .headline .sep-tag, .headline .tagline { display: none; }
  .headline-main { font-size: 16px; font-weight: 780; }
  .app-logo { width: 28px; height: 28px; }
  .top-actions { width: auto; margin-left: auto; gap: 7px; }
  .conn { padding: 5px 9px; font-size: 11px; gap: 6px; }
  .conn-dot { width: 6px; height: 6px; }
  .lang { padding: 2px; }
  .lang button { padding: 5px 8px; font-size: 11px; }
  .layout {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0 12px;
  }
  .teams-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 12px 0 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .teams-panel .panel-head { padding: 0 2px; }
  .panel-head h2 { font-size: 16px; }
  .sub { font-size: 11.5px; }
  .teams-tools { flex: none; margin: 10px 0 8px; gap: 8px; }
  .search { flex: 1 1 120px; height: 42px; min-width: 0; }
  .search input { font-size: 16px; }
  /* iOS zooms the whole page when a focused control is smaller than 16px. */
  .identity-form input,
  .field input:not([type="hidden"]) { font-size: 16px; }
  .segmented { flex: none; padding: 2px; }
  .segmented button { padding: 6px 9px; font-size: 12px; }
  .team-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    margin: 0;
    padding: 0 0 18px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .team { border-bottom: 0; }
  .team-row { min-height: 58px; padding: 9px 8px; border-radius: 14px; }
  .team.open { background: var(--tint-1); border-radius: 16px; }
  .team.open .team-row { background: transparent; }
  .roster { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding: 2px 4px 12px; }
  .player-chip { min-height: 58px; padding: 9px 8px; background: var(--tint-2); border-color: var(--tint-border); }
  .player-chip .avatar.md { width: 38px; height: 38px; }
  .p-name { font-size: 12.5px; }
  .p-meta { font-size: 10.5px; }
  .loading, .empty, .no-results { padding: 34px 12px; }
  .rail {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    display: none;
    flex-direction: column;
    padding: 12px 0 20px;
    gap: 12px;
    position: static;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .layout[data-tab="players"] .teams-panel { display: flex; }
  .layout[data-tab="players"] .rail { display: none; }
  .layout[data-tab="subs"] .teams-panel { display: none; }
  .layout[data-tab="subs"] .rail { display: flex; }
  .rail .profile-panel { display: none; }
  .rail .panel { width: 100%; max-width: 680px; margin-inline: auto; border-radius: 16px; box-shadow: var(--shadow-mobile-panel); }
  .form-panel, .subs-panel { padding: 17px 16px 18px; }
  .avatar.lg { width: 74px; height: 74px; }
  .avatar.xl { width: 76px; height: 76px; }
  .sheet-hero { gap: 14px; }
  .profile-id h2, .sheet-body h2 { font-size: 21px; }
  .channel-status { margin-top: 16px; }
  .sub-card { padding: 12px; }
  .sub-channel-target { font-size: 10px; }
  .channel-remove { width: 20px; height: 20px; }
  body.keyboard-open .tabbar {
    padding-bottom: 6px;
  }
  .tabbar {
    flex: none;
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    padding: 6px 16px calc(6px + env(safe-area-inset-bottom));
    background: var(--tabbar-bg);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
    z-index: 50;
  }
  .tab-btn {
    flex: 1 1 0;
    max-width: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 50px;
    padding: 4px 8px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    position: relative;
    transition: color .18s, background .18s;
  }
  .tab-btn:active { background: var(--tint-2); }
  .tab-btn.active { color: var(--accent); }
  .tab-btn.active .tab-icon { background: var(--accent-soft); }
  .tab-icon {
    position: relative;
    width: 32px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 10px;
  }
  .tab-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .tab-count {
    position: absolute;
    top: -3px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 99px;
    background: var(--accent-fill);
    color: var(--accent-on);
    font-size: 9.5px;
    font-weight: 850;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--tabbar-solid);
  }
  .tab-count[hidden] { display: none; }
  .toast { bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 160; }
  .player-sheet { border-radius: 24px 24px 0 0; }
}

/* Touch tablets can use the desktop breakpoint but still auto-zoom on focus. */
@media (pointer: coarse) {
  .search input,
  .identity-form input,
  .field input:not([type="hidden"]) { font-size: 16px; }
}

@media (max-width: 360px) {
  .roster { grid-template-columns: 1fr; }
  .player-chip .p-name { font-size: 13px; }
  .tab-btn { letter-spacing: 0; }
}
