/* Sport4Africa Fan — Starlink-clean chrome. Light default + dark via data-theme. */

:root,
html[data-theme="light"] {
  --bg: #f5f5f4;
  --bg-elev: #ffffff;
  --ink: #171717;
  --muted: #6b6b6b;
  --line: #e5e5e3;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --brand: #e61e4d;
  --brand-hover: #c81a42;
  --brand-soft: #fff0f3;
  --navy: #1b2a4a;
  --ok: #0f7b3a;
  --ok-bg: #e8f6ee;
  --danger: #b42318;
  --warn: #9a6700;
  --info-bg: #eef1f6;
  --own-bg: #1b2a4a;
  --own-ink: #fff;
  --other-bg: #ecece9;
  --radius: 14px;
  --radius-sm: 10px;
  --header-h: 64px;
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --max: 1120px;
}

html[data-theme="dark"] {
  --bg: #0c0c0d;
  --bg-elev: #161618;
  --ink: #f4f4f2;
  --muted: #a3a3a0;
  --line: #2a2a2e;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --brand: #ff5a6a;
  --brand-hover: #ff7a86;
  --brand-soft: #3a1520;
  --navy: #9db4e0;
  --ok: #4ade80;
  --ok-bg: #14301f;
  --danger: #ff8a70;
  --warn: #fbbf24;
  --info-bg: #1c2436;
  --own-bg: #2a3d66;
  --own-ink: #fff;
  --other-bg: #222226;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: clamp(15px, 0.3vw + 14px, 16.5px);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

.fan-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
}

.fan-header-row {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 clamp(16px, 3vw, 36px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #1b2a4a;
}
.brand-text strong {
  display: block;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
  color: var(--brand);
  line-height: 1.1;
}
.brand-text span {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
}

.sport-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 4px 0;
}
.sport-strip-links {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}
.sport-strip a {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid transparent;
}
.sport-strip a:hover,
.sport-strip a.is-active {
  background: var(--bg);
  border-color: var(--line);
  text-decoration: none;
}
.sport-picker {
  flex: 0 0 auto;
  min-width: 132px;
  max-width: 200px;
}
.sport-picker select {
  width: 100%;
  padding: 6px 10px;
  font-size: 0.82rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.search-form {
  display: flex;
  align-items: center;
}
.search-form input {
  width: min(220px, 28vw);
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
}
.search-form input:focus {
  outline: 2px solid var(--brand);
  border-color: transparent;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.icon-btn:hover { box-shadow: var(--shadow-sm); }

.account-menu { position: relative; }
.account-menu summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.82rem;
  font-weight: 600;
}
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu .menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 200px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 50;
}
.account-menu .menu a,
.account-menu .menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  font: inherit;
  color: inherit;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}
.account-menu .menu a:hover,
.account-menu .menu button:hover { background: var(--bg); }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  object-fit: cover;
}
img.avatar {
  padding: 0;
  background: var(--line);
}
.avatar.lg {
  width: 64px;
  height: 64px;
  font-size: 1.2rem;
}

.logged-nav {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 4px clamp(16px, 3vw, 36px) 14px;
  overflow-x: auto;
}
.logged-nav a {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.98rem;
  font-weight: 650;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.logged-nav a:hover,
.logged-nav a.is-active {
  background: var(--bg);
  text-decoration: none;
}

.nav-toggle { display: none; }

.fan-main {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
  min-height: calc(100vh - var(--header-h) - 88px);
}

.page-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.add-menu {
  position: relative;
}
.add-menu > summary {
  list-style: none;
  cursor: pointer;
}
.add-menu > summary::-webkit-details-marker { display: none; }
.add-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  width: min(360px, 86vw);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
}
.add-menu-panel details { margin-bottom: 8px; }
.add-menu-panel > details > summary {
  cursor: pointer;
  font-weight: 650;
  padding: 6px 0;
}

.cascade-suggest { position: relative; }
.cascade-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 8px);
  z-index: 25;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow: auto;
}
.cascade-menu li {
  padding: 8px 12px;
  cursor: pointer;
}
.cascade-menu li:hover { background: var(--bg); }

.page-head { margin-bottom: 22px; }
.page-head h1 {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.15rem);
  letter-spacing: -0.04em;
  font-weight: 700;
}
.page-head p { margin: 0; color: var(--muted); }

.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  margin-bottom: 8px;
}
.messages li.success { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.messages li.error { color: var(--danger); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 650;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--brand-hover); text-decoration: none; color: #fff; }
.btn-secondary {
  background: var(--bg-elev);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-secondary:hover { background: var(--bg); color: var(--ink); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.small { padding: 6px 12px; font-size: 0.8rem; }

.card {
  background: var(--bg-elev);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(16px, 2vw, 22px);
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 1.05rem; letter-spacing: -0.02em; }

.muted { color: var(--muted); }
.note { font-size: 0.8rem; color: var(--muted); margin-top: 12px; }
.warn { color: var(--danger); font-size: 0.85rem; }
.ok { color: var(--ok); font-size: 0.85rem; }

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--info-bg);
  color: var(--navy);
}
.badge.live { color: var(--brand); background: var(--brand-soft); }
.badge.ok { color: var(--ok); background: var(--ok-bg); }

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.form-control, select, textarea,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], input[type="file"],
input[type="datetime-local"] {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: var(--bg-elev);
  color: var(--ink);
}
.form-control:focus, select:focus, textarea:focus, input:focus {
  outline: 2px solid var(--brand);
  border-color: transparent;
}
.help { font-size: 0.8rem; color: var(--muted); margin-top: 6px; }
.errorlist { color: var(--danger); font-size: 0.85rem; padding-left: 18px; margin: 6px 0 0; }

.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.live-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 22px;
}
.live-chip {
  flex: 0 0 auto;
  min-width: 200px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.live-chip:hover { text-decoration: none; box-shadow: var(--shadow-sm); }
.live-chip strong { display: block; }

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 14px;
}
.news-card {
  background: var(--bg-elev);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}
.news-card h3 { margin: 6px 0 8px; font-size: 1.02rem; letter-spacing: -0.02em; }
.news-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.9fr);
  gap: 22px;
  align-items: start;
}

.date-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 18px 0 8px;
}
.fixture-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.fixture-row:hover { text-decoration: none; }
.fixture-row:last-child { border-bottom: 0; }

.chat-list a.chat-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 4px 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.chat-list a.chat-row:hover { text-decoration: none; }
.chat-block { padding: 4px 0 8px; border-bottom: 1px solid var(--line); }
.chat-block:last-child { border-bottom: 0; }
.chat-list > .date-label:first-child { margin-top: 0; }
.chat-divider { border: 0; border-top: 2px solid var(--line); margin: 6px 0 0; }
.chat-row-group,
.follow-row-group { padding-left: 18px; }
.chat-row .preview { color: var(--muted); font-size: 0.88rem; grid-column: 1; }
.chat-row .when { color: var(--muted); font-size: 0.78rem; }
.unread-dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #25d366;
  align-self: center;
}
.start-group-inline { margin: 4px 0 8px; font-size: 0.88rem; }
.start-group-inline summary { cursor: pointer; font-weight: 650; color: var(--navy); }
.follow-block { padding: 4px 0 8px; border-bottom: 1px solid var(--line); }
.follow-block:last-child { border-bottom: 0; }
.follow-block .fixture-row:last-of-type { border-bottom: 1px solid var(--line); }
.follow-row { flex-wrap: wrap; }
.follow-row-meta { text-align: right; }
.follow-row-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.follow-row-actions form { margin: 0; display: inline; }

.also-groups {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 12px 0 16px;
}
.also-groups legend {
  font-weight: 650;
  padding: 0 6px;
}
.group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 10px;
}
.group-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
}
.group-chip input { width: auto; margin: 0; }
.group-chip:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.extra-suffixes { display: grid; gap: 8px; margin-bottom: 8px; }

.room {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-h) - 120px);
}
.match-header {
  position: sticky;
  top: var(--header-h);
  z-index: 15;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.match-header .score-line {
  font-size: 1.6rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  margin: 4px 0;
}
.match-header details.group-meta { margin-top: 8px; font-size: 0.88rem; }
.match-header details.group-meta > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  color: var(--muted);
}
.match-header details.group-meta > summary::-webkit-details-marker { display: none; }
.header-avatars {
  display: inline-flex;
  align-items: center;
  flex-direction: row;
}
.header-avatars .avatar {
  width: 24px;
  height: 24px;
  font-size: 0.58rem;
  border: 2px solid var(--bg-elev);
  margin-left: -8px;
  box-sizing: content-box;
}
.header-avatars .avatar:first-child { margin-left: 0; }
.chat-name-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.chat-name-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-self: start;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  width: max-content;
}
.chat-name-row h1,
.chat-name-block h1 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-name-row .score-bug {
  justify-self: end;
}
.chat-bug-side {
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 0;
}
.chat-event-line {
  max-width: 100%;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.clock-start-form {
  margin: 0;
  display: inline-flex;
}
.clock-start-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 2px 9px;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: var(--bg-elev, var(--bg));
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.clock-start-btn:hover {
  border-color: var(--muted);
  color: var(--ink);
}
.score-enter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 4px 11px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 550;
  line-height: 1.2;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: none;
  cursor: pointer;
  white-space: nowrap;
  width: auto;
}
.score-enter-btn:hover {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--muted);
  text-decoration: none;
}
.score-enter-dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px 16px;
  background: var(--bg-elev);
  color: var(--ink);
  min-width: min(92vw, 320px);
  box-shadow: var(--shadow);
}
.score-enter-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}
.score-enter-dialog form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0;
}
.score-enter-fields {
  display: flex;
  justify-content: center;
  gap: 22px;
}
.score-enter-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-weight: 650;
}
.score-enter-dialog input.score-digits {
  min-width: 3ch;
  width: 4.5em;
  padding: 10px 0;
  font-size: 2rem;
  line-height: 1.2;
  min-height: 52px;
  box-sizing: border-box;
  font-variant-numeric: tabular-nums;
  appearance: textfield;
  -moz-appearance: textfield;
  -webkit-appearance: textfield;
  border-radius: 8px;
  text-align: center;
}
.score-enter-dialog input[type="number"]::-webkit-outer-spin-button,
.score-enter-dialog input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
  margin: 0;
}
.score-enter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.score-compact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.7rem;
  color: var(--muted);
  min-width: 0;
}
.score-compact form {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0;
}
.score-compact-label {
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.score-compact-side {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 650;
  color: var(--ink);
}
.score-compact input[type="number"],
.score-compact input.score-digits {
  min-width: 3ch;
  width: 4.5em;
  padding: 6px 0;
  font-size: 1.1rem;
  line-height: 1.2;
  min-height: 36px;
  box-sizing: border-box;
  font-variant-numeric: tabular-nums;
  appearance: textfield;
  -moz-appearance: textfield;
  -webkit-appearance: textfield;
  border-radius: 6px;
  text-align: center;
}
.score-compact input[type="number"]::-webkit-outer-spin-button,
.score-compact input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
  margin: 0;
}
.score-compact .btn {
  padding: 3px 8px;
  font-size: 0.7rem;
  line-height: 1.2;
}
.commentary-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-top: 10px;
}
.commentary-form textarea {
  flex: 1;
  min-height: 44px;
  resize: none;
}
.score-bug {
  display: inline-flex;
  align-items: stretch;
  flex-shrink: 0;
  background: #141416;
  color: #f4f4f2;
  border-radius: 6px;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  line-height: 1.2;
}
.score-bug span {
  padding: 5px 8px;
  border-right: 1px solid #2c2c30;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.score-bug span:last-child { border-right: 0; }
.score-bug .bug-score {
  background: #1c1c20;
  min-width: 1.5em;
  justify-content: center;
}
.score-bug .bug-clock {
  font-weight: 600;
  color: #c8c8c4;
  white-space: nowrap;
}
.score-bug .bug-live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff5a6a;
  display: inline-block;
}
.score-bug .bug-official {
  font-weight: 650;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  color: #d8d0b8;
  white-space: nowrap;
}
html[data-theme="dark"] .score-bug { background: #0a0a0b; }

.stream {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0 16px;
  flex: 1;
}
.bubble {
  max-width: min(78%, 420px);
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 0.94rem;
}
.bubble .meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 2px;
}
.bubble.own {
  align-self: flex-end;
  background: var(--own-bg);
  color: var(--own-ink);
  border-bottom-right-radius: 4px;
}
.bubble.own .meta { color: rgba(255,255,255,0.7); }
.bubble.other {
  align-self: flex-start;
  background: var(--other-bg);
  border-bottom-left-radius: 4px;
}
.bubble.system {
  align-self: center;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
  max-width: 90%;
}
.bubble.commentary {
  align-self: center;
  max-width: 92%;
  background: var(--info-bg);
  border-left: 3px solid var(--navy);
  border-radius: 10px;
  font-size: 0.88rem;
}
.bubble.commentary .meta {
  color: var(--navy);
  font-weight: 650;
}
.bubble.score-line {
  align-self: center;
  max-width: 90%;
  padding: 6px 12px;
  background: transparent;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  border-radius: 8px;
}
.bubble.score-line .meta {
  text-align: center;
  font-weight: 550;
}

.composer {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 8px 0 0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.composer textarea {
  resize: none;
  min-height: 44px;
  flex: 1;
  min-width: 0;
}
.composer .btn { flex: 0 0 auto; }
.attach-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--bg-elev);
  color: var(--ink);
}
.attach-btn input { display: none; }
.attach-btn:hover { border-color: var(--navy); }
.predict-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 0;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.predict-compact-label {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--muted);
}
.predict-compact-sep {
  font-weight: 700;
  color: var(--muted);
}
.predict-digits {
  width: 4.8ch;
  min-width: 3ch;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding: 6px 4px;
}
.commentary-panel {
  border-top: 1px solid var(--line);
  padding: 8px 0 0;
  max-height: 28vh;
  overflow-y: auto;
}
.commentary-panel .bubble.commentary {
  align-self: stretch;
  max-width: 100%;
}
.bubble-media {
  display: block;
  max-width: 100%;
  border-radius: 10px;
  margin: 4px 0;
}

.score-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.vote-btns { display: flex; gap: 6px; align-items: center; }
.vote-btns button { min-width: 42px; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 16px;
}

.fan-footer {
  border-top: 1px solid var(--line);
  padding: 22px clamp(16px, 3vw, 36px);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  color: var(--muted);
  font-size: 0.85rem;
}
.fan-footer a { color: var(--muted); }
.fan-footer .credit {
  opacity: 0.7;
  font-size: 0.78rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.member-list { list-style: none; margin: 8px 0; padding: 0; }
.member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.invite-form, .membership-form {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}
.invite-form select, .invite-form input, .membership-form input[type="text"] {
  width: 100%;
}
.invite-actions { display: flex; gap: 8px; align-items: center; }
.color-palette {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.color-palette legend {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
  width: 100%;
}
.color-palette label { display: inline-flex; align-items: center; cursor: pointer; }
.color-palette input { position: absolute; opacity: 0; pointer-events: none; }
.swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: inline-block;
}
.color-palette input:checked + .swatch { border-color: var(--brand); }
.component-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}

.narrow { width: min(480px, 100%); margin: 0 auto; }

@media (max-width: 860px) {
  .home-grid { grid-template-columns: 1fr; }
  .search-form input { width: 140px; }
  .sport-strip-links { display: none; }
  .nav-toggle { display: inline-flex; }
  .logged-nav.mobile-hide:not(.is-open) { display: none; }
  .logged-nav.is-open {
    display: flex;
    flex-direction: column;
    padding-bottom: 12px;
  }
}

@media (max-width: 640px) {
  .fan-main { width: calc(100% - 24px); padding-top: 18px; }
  .brand-text span { display: none; }
  .search-form { display: none; }
  .btn.full-mobile { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

.member-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
  align-items: center;
}
.member-actions form { margin: 0; }
.admin-check-form { margin: 0; }
.admin-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.admin-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--brand);
  flex-shrink: 0;
}
.member-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--danger);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
.member-remove:hover {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
}
.pending-line { margin: 8px 0 0; }

.commentator-desk .fixture-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.commentator-desk .fixture-picker label {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--muted);
}
.commentator-desk .fixture-picker select {
  flex: 1;
  min-width: 12rem;
}
.commentator-clock-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 0 18px;
  text-align: center;
}
.commentator-clock-wrap .clock-start-form {
  align-self: flex-end;
}
.commentator-clock {
  font-size: clamp(2.8rem, 12vw, 5.4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.commentary-stream {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  min-height: 4rem;
}
.commentary-stream .bubble.commentary {
  align-self: stretch;
  max-width: 100%;
}


/* Sport accent: --sport / --sport-icon come from {% sport_css %} (fan_extras.SPORT_STYLES). */
.sport-stripe { border-left: 4px solid var(--sport); padding-left: 10px; }
.chat-list a.chat-row-group.sport-stripe { padding-left: 22px; }
.chat-block.sport-stripe .chat-row > strong::before,
.chat-row.sport-stripe > strong::before,
.fixture-row.sport-stripe > div > strong:first-child::before,
.fixture-row.sport-stripe > a > strong:first-child::before,
.match-header.sport-stripe h1::before { content: var(--sport-icon); margin-right: 6px; }

/* News (RSS / sitemap headlines) */
.news-item { padding: 10px 0 10px 10px; border-bottom: 1px solid var(--line); }
.news-item:last-of-type { border-bottom: 0; }
.news-item h3 { margin: 0 0 4px; font-size: 0.98rem; letter-spacing: -0.01em; line-height: 1.3; }
.news-item h3 a { color: var(--ink); }
.news-item.sport-stripe h3::before { content: var(--sport-icon); margin-right: 6px; }
.news-item p { margin: 0 0 4px; color: var(--muted); font-size: 0.88rem; }
.news-meta { font-size: 0.78rem; }
.news-credit { font-weight: 600; }
.news-more { margin: 10px 0 0; font-size: 0.88rem; }
.news-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.news-filter .chip {
  padding: 6px 12px; border-radius: 999px; font-size: 0.82rem; font-weight: 600;
  color: var(--ink); text-decoration: none; border: 1px solid var(--line); background: var(--bg-elev);
}
.news-filter .chip.sport-stripe { border-left: 1px solid var(--line); padding-left: 12px; }
.news-filter .chip.sport-stripe::before { content: var(--sport-icon); margin-right: 4px; }
.news-filter .chip.is-active { border-color: var(--sport, var(--ink)); box-shadow: inset 0 0 0 1px var(--sport, var(--ink)); }

/* Curated social posts (embeds load lazily; link card when no embed) */
.social-post { padding: 10px 0; border-bottom: 1px solid var(--line); }
.social-post:last-of-type { border-bottom: 0; }
.social-embed blockquote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--sport, var(--line)); font-size: 0.9rem; overflow-wrap: anywhere; }
.social-embed blockquote p { margin: 0 0 6px; }
.social-embed iframe { max-width: 100%; }
.social-link-card { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 0.9rem; }
.social-link-who { font-weight: 600; }
.social-tags { font-size: 0.78rem; margin-top: 4px; }

.source-actions { display: flex; gap: 8px; align-items: center; }
.fixture-delete { display: inline-block; margin: -6px 0 10px 12px; font-size: 0.8rem; }

/* Chat safety menu (moderation) and community signal */
.msg-menu { display: inline-block; position: relative; margin-left: .35rem; }
.msg-menu > summary { list-style: none; cursor: pointer; padding: 0 .35rem; border-radius: 6px; opacity: .7; }
.msg-menu > summary::-webkit-details-marker { display: none; }
.msg-menu[open] > summary { opacity: 1; background: rgba(0,0,0,.06); }
.msg-menu-body { position: absolute; right: 0; z-index: 20; min-width: 12rem; background: #fff; color: #111; border: 1px solid #ddd; border-radius: 10px; padding: .5rem; box-shadow: 0 6px 18px rgba(0,0,0,.12); display: grid; gap: .25rem; }
.msg-menu-body form { margin: 0; }
.msg-menu-body a, .msg-menu-body button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: .3rem .4rem; font: inherit; color: inherit; cursor: pointer; border-radius: 6px; text-decoration: none; }
.msg-menu-body a:hover, .msg-menu-body button:hover { background: #f2f2f2; }
.msg-menu-body .menu-row { display: flex; gap: .25rem; }
.msg-menu-body .is-active { font-weight: 600; }
.menu-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; margin: .2rem .4rem 0; opacity: .7; }
.msg-votes { font-size: .75rem; opacity: .75; margin-left: .35rem; }
.bubble.held { opacity: .65; }
.bubble.tombstone { font-style: italic; opacity: .7; }
.collapsed-msg summary { cursor: pointer; font-size: .85rem; opacity: .75; }
.badge.low-trust { background: #fff4d6; color: #7a5600; }
.notice-banner { background: #fff4d6; padding: .5rem .75rem; border-radius: 8px; }
.composer-readonly { padding: .75rem; }

/* Sport-specific score displays (templates/scores/) */
.score-disp { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.score-disp .sd-side { display: inline-flex; align-items: center; gap: 4px; }
.score-disp .sd-box { min-width: 1.8em; padding: 2px 6px; border-radius: 6px; background: var(--sport, #6b7280); color: #fff; font-weight: 700; text-align: center; }
.score-disp .sd-name { font-weight: 600; }
.score-disp .sd-clock { font-size: .85em; opacity: .8; }
.score-header .sd-box, .score-card .sd-box { font-size: 1.2rem; }
.score-header .sd-box { font-size: 1.5rem; }
.score-cricket { flex-direction: column; align-items: flex-start; gap: 2px; }
.score-cricket.score-row { flex-direction: row; flex-wrap: wrap; gap: 8px; }
.score-cricket .sd-cr-line { display: flex; align-items: center; gap: 6px; }
.score-cricket .sd-wide { min-width: 0; }
.score-cricket .sd-bat { color: var(--sport, #1d4ed8); margin-right: 2px; }
.score-motor.score-card { flex-direction: column; align-items: flex-start; }
.score-motor .sd-order { margin: 4px 0; padding-left: 0; list-style: none; text-align: left; }
.score-motor .sd-order li { padding: 1px 0; }
.score-motor .sd-car { display: inline-flex; gap: 4px; align-items: center; }
