:root {
  --bg: #0b0d10;
  --bg-elevated: #12161c;
  --bg-panel: #161b22;
  --border: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(255, 70, 86, 0.35);
  --text: #ece8e1;
  --text-muted: #8d9199;
  --text-dim: #5c6270;
  --accent: #ff4655;
  --accent-soft: rgba(255, 70, 86, 0.14);
  --win: #3dd68c;
  --loss: #ff6b7a;
  --gold: #ffd166;
  --sidebar-w: 280px;
  --header-h: 56px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family:
    ui-sans-serif,
    system-ui,
    Segoe UI,
    Roboto,
    sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.sidebar-brand-link:hover {
  text-decoration: none;
}

.sidebar-brand-link:hover h1 {
  color: #ff6b76;
}

.sidebar-brand-icon {
  flex-shrink: 0;
  display: block;
}

.sidebar-brand h1 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.sidebar-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.current-rank-line {
  margin-bottom: 14px;
  font-size: 15px;
  color: var(--text);
}

.hidden-mmr {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-dim);
}

.hidden-mmr.verdict-above {
  border-left-color: var(--win);
}

.hidden-mmr.verdict-below {
  border-left-color: var(--loss);
}

.hidden-mmr.verdict-converged {
  border-left-color: var(--gold);
}

.hidden-mmr-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.hidden-mmr-conf {
  font-size: 11px;
  color: var(--text-dim);
}

.hidden-mmr-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 6px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.hidden-mmr-verdict {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.hidden-mmr-band {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-dim);
}

.hidden-mmr-signals {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

.modal {
  width: min(420px, calc(100vw - 40px));
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-title {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--text);
}

.modal-body {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.act-list {
  display: grid;
  gap: 8px;
}

.act-history-summary {
  margin-bottom: 12px;
}

.act-scale-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
}

.act-scale {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-width: min(100%, 520px);
  padding: 8px 4px 4px;
}

.act-scale-point {
  flex: 1 1 0;
  min-width: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  text-align: center;
}

.act-scale-point.current .act-scale-badge {
  transform: scale(1.06);
  filter: drop-shadow(0 2px 6px rgba(255, 70, 86, 0.25));
}

.act-scale-point.current .act-scale-act {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 2px;
}

.act-scale-badge {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
  margin-top: 2px;
}

.act-scale-avg-badge {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
  opacity: 0.9;
}

.act-scale-labels {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  max-width: 52px;
  margin-bottom: 2px;
}

.act-scale-act {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: 0.03em;
}

.act-scale-act.v-era {
  font-size: 12px;
}

.act-scale-season {
  font-size: 9px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.act-scale-season.v-era {
  font-size: 8px;
  opacity: 0.85;
}

.act-label-primary {
  font-weight: 600;
}

.act-summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.act-summary-stats strong {
  color: var(--text);
}

.act-history details > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.act-history details > summary::-webkit-details-marker {
  display: none;
}

.act-history details > summary::before {
  content: "▸ ";
  color: var(--text-dim);
}

.act-history details[open] > summary::before {
  content: "▾ ";
}

.act-history details .act-list {
  margin-top: 12px;
}

.act-history-details > summary {
  cursor: pointer;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  user-select: none;
}

.alt-accounts-page h2 {
  margin: 0 0 6px;
}

.alt-accounts-meta {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.alt-table-wrap {
  overflow-x: auto;
}

.alt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.alt-table th,
.alt-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.alt-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.alt-table tr:hover td {
  background: var(--bg-elevated);
}

.alt-rank {
  font-weight: 600;
}

.alt-error {
  color: var(--loss);
  font-size: 12px;
}

.alt-rr {
  color: var(--text-dim);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.alt-renamed {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 400;
}

.alt-add {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  flex-wrap: wrap;
}

.alt-add-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  padding: 7px 10px;
  min-width: 220px;
}

.alt-add-input:focus {
  outline: none;
  border-color: var(--accent);
}

.alt-add-msg {
  font-size: 12px;
  color: var(--text-muted);
}

.alt-add-error {
  color: var(--loss);
}

.alt-perf {
  font-variant-numeric: tabular-nums;
}

.alt-perf-pending {
  color: var(--text-dim);
}

.alt-perf-note {
  margin: -8px 0 12px;
}

.alt-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.auth-persist-note {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.auth-details {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.auth-details textarea {
  width: 100%;
  margin-top: 0.25rem;
  font-size: 0.7rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
}

.auth-details .btn-sm {
  margin-top: 0.35rem;
}

.act-row {
  display: grid;
  grid-template-columns: 150px 170px 1fr;
  grid-template-areas: "label peak meta";
  align-items: center;
  gap: 10px 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.act-row.current {
  border-color: var(--border-accent);
}

.act-label {
  grid-area: label;
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}

.act-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  border: 1px solid var(--border-accent);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
}

.act-peak {
  grid-area: peak;
  font-size: 13px;
  font-weight: 600;
}

.act-meta {
  grid-area: meta;
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

.wbt-bar {
  grid-column: 1 / -1;
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--bg);
}

.wbt-seg {
  height: 100%;
}

@media (max-width: 720px) {
  .act-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "label peak"
      "meta meta";
  }
  .act-meta {
    text-align: left;
  }
}

.sidebar-search label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.sidebar-search input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #2f3540;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.sidebar-search input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 70, 86, 0.25);
}

.sidebar-controls {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.sidebar-controls {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.sidebar-controls .btn {
  flex: 1;
}

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--border);
}

.sidebar-tools {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 10px 8px;
}

.sidebar-tools-header {
  padding: 0 6px 6px;
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-tools a {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid transparent;
}

.sidebar-tools a:hover {
  color: var(--text);
  background: var(--accent-soft);
  text-decoration: none;
}

.sidebar-tools a.active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: rgba(255, 70, 86, 0.18);
}

.sidebar-status {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
}

.sidebar-status-loading,
.sidebar-status-error {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--text-dim);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.status-ready {
  background: var(--win);
  box-shadow: 0 0 6px rgba(61, 214, 140, 0.45);
}

.status-dot.status-partial,
.status-dot.status-stored {
  background: var(--gold);
}

.status-dot.status-off {
  background: var(--text-dim);
}

.status-dot.status-error {
  background: var(--loss);
}

.status-label {
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 72px;
}

.status-text {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-page {
  max-width: 720px;
}

.settings-page h2 {
  margin: 0 0 20px;
  font-size: 22px;
}

.settings-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
  border-bottom: none;
}

.settings-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.settings-desc {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

.settings-panel .rso-msg {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

.settings-panel .rso-msg.linked {
  color: var(--win);
}

.settings-panel .rso-msg.error {
  color: #ff9aa3;
}

.settings-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.settings-field input[type="number"] {
  width: 96px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #2f3540;
  background: var(--bg);
  color: var(--text);
}

.settings-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

.settings-panel .auth-details textarea {
  max-width: 100%;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  background: linear-gradient(180deg, #ff5e6f 0%, #d93a49 100%);
  color: #fff;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--border-accent);
  color: var(--text);
}

.friend-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-dim);
}

.friend-status-dot.online {
  background: var(--win);
}

.friend-status-dot.mobile {
  background: #60a5fa;
}

.friend-status-dot.away,
.friend-status-dot.dnd {
  background: var(--gold);
}

.friend-status-dot.in_queue {
  background: var(--gold);
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.25);
}

.friend-status-dot.in_game,
.friend-status-dot.pregame {
  background: var(--accent);
}

.monitor-page {
  max-width: 1100px;
}

.monitor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.monitor-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.monitor-polled {
  color: var(--text-dim);
}

.monitor-toggle-offline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

.monitor-watch-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--gold);
}

.monitor-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .monitor-grid {
    grid-template-columns: 1fr;
  }
}

.monitor-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  min-height: 320px;
}

.monitor-panel h2 {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.monitor-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--text-dim);
}

.monitor-friend-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.monitor-friend-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
}

.monitor-friend-card.in-queue {
  border-color: rgba(255, 209, 102, 0.35);
  background: rgba(255, 209, 102, 0.05);
}

.monitor-friend-card.watched {
  border-color: rgba(255, 209, 102, 0.45);
}

.monitor-friend-main {
  display: flex;
  align-items: stretch;
}

.monitor-watch-btn {
  flex-shrink: 0;
  width: 40px;
  border: none;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
}

.monitor-watch-btn:hover,
.monitor-watch-btn.active {
  color: var(--gold);
  background: rgba(255, 209, 102, 0.08);
}

.monitor-friend-body {
  flex: 1;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  cursor: pointer;
}

.monitor-friend-body:hover {
  background: rgba(255, 255, 255, 0.03);
}

.monitor-friend-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.monitor-friend-name {
  font-size: 14px;
  font-weight: 600;
}

.monitor-friend-status {
  margin-top: 4px;
  margin-left: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.monitor-friend-party {
  margin-top: 2px;
  margin-left: 16px;
  font-size: 11px;
  color: var(--text-dim);
}

.monitor-event-list {
  max-height: 520px;
  overflow: auto;
}

.monitor-event-row {
  padding: 5px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.monitor-event-row.alert {
  color: var(--gold);
}

.monitor-event-time {
  display: inline;
  font-size: 10px;
  color: var(--text-dim);
  margin-right: 8px;
  font-family: ui-monospace, monospace;
}

.monitor-empty {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}

.sidebar-recent {
  min-height: 0;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 10px 16px;
}

.sidebar-section:not(.collapsed) {
  flex: 1;
  overflow: hidden;
}

.sidebar-section.collapsed {
  flex: 0 0 auto;
}

.sidebar-section-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px 8px;
  min-height: 24px;
}

.sidebar-section-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  text-align: left;
}

.sidebar-section-toggle:hover {
  color: var(--text);
}

.sidebar-section-chevron {
  flex-shrink: 0;
  font-size: 10px;
  line-height: 1;
  transition: transform 0.15s ease;
}

.sidebar-section.collapsed .sidebar-section-chevron {
  transform: rotate(-90deg);
}

.sidebar-section-title {
  flex-shrink: 0;
}

.sidebar-section-meta {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: normal;
}

.sidebar-section-clear {
  flex-shrink: 0;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.4;
  cursor: pointer;
}

.sidebar-section-clear:hover {
  color: var(--loss);
  border-color: rgba(255, 107, 122, 0.25);
  background: rgba(255, 107, 122, 0.08);
}

.sidebar-section-body {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.sidebar-section.collapsed .sidebar-section-body {
  display: none;
}

.sidebar-recent-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 6px 8px;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.recent-player-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
  margin-bottom: 4px;
}

.recent-player-row.active .recent-player {
  background: var(--accent-soft);
  border-color: rgba(255, 70, 86, 0.18);
}

.recent-player {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 8px;
  align-items: center;
  text-align: left;
  padding: 10px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.recent-remove {
  flex-shrink: 0;
  width: 32px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.recent-remove:hover {
  color: var(--loss);
  border-color: rgba(255, 107, 122, 0.25);
  background: rgba(255, 107, 122, 0.08);
}

.recent-player:hover {
  background: var(--accent-soft);
  border-color: rgba(255, 70, 86, 0.18);
}

.recent-player .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.recent-player .meta {
  font-size: 10px;
  color: var(--text-dim);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: var(--header-h);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 8px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(18, 22, 28, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

.breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumbs .bc-sep {
  color: var(--text-dim);
  user-select: none;
}

.breadcrumbs .bc-current {
  color: var(--text);
}

.topbar-title {
  font-size: 13px;
  color: var(--text-muted);
}

.content {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
}

.empty-state {
  margin-top: 48px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 22px;
}

.loading-block {
  padding: 48px 0;
  text-align: center;
  color: var(--text-muted);
}
.live-loading-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 0;
  color: var(--text-muted);
}
.live-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent, #7fd4a6);
  border-radius: 50%;
  animation: live-spin 0.7s linear infinite;
}
.live-spinner-sm {
  width: 12px;
  height: 12px;
  flex: none;
}
@keyframes live-spin {
  to { transform: rotate(360deg); }
}

.error-block {
  padding: 16px 18px;
  border-radius: 10px;
  background: rgba(255, 70, 86, 0.1);
  border: 1px solid rgba(255, 70, 86, 0.25);
  color: #ff9aa3;
}

.player-header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.player-identity h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.player-identity .sub {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
}

.player-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.refresh-countdown {
  font-size: 12px;
  color: var(--text-dim);
  min-width: 130px;
}

.cache-note {
  color: var(--gold);
}

.btn-danger:hover {
  border-color: rgba(255, 107, 122, 0.35);
  color: var(--loss);
}

.rr-up {
  color: var(--win);
}

.rr-down {
  color: var(--loss);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}

.stat-card .label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card .value {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 700;
}

.placement-card {
  background: linear-gradient(135deg, rgba(255, 70, 86, 0.12), rgba(18, 22, 28, 0.9));
  border: 1px solid var(--border-accent);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 24px;
}

.placement-card h3 {
  margin: 0 0 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.placement-main {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  align-items: center;
}

.placement-rank {
  font-size: 24px;
  font-weight: 700;
  color: var(--gold);
}

.placement-meta {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.rank-delta {
  display: inline-block;
  margin-left: 8px;
  font-size: 12px;
  font-weight: 600;
}

.rank-delta.up {
  color: var(--win);
}

.rank-delta.down {
  color: var(--loss);
}

.rank-cell {
  white-space: nowrap;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 5px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.rank-badge.promoted {
  color: var(--win);
  background: rgba(61, 214, 140, 0.12);
  border: 1px solid rgba(61, 214, 140, 0.45);
}

.rank-badge.demoted {
  color: var(--loss);
  background: rgba(255, 107, 122, 0.12);
  border: 1px solid rgba(255, 107, 122, 0.4);
}

.section {
  margin-bottom: 28px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-head h3 {
  margin: 0;
  font-size: 15px;
}

.section-head span {
  font-size: 12px;
  color: var(--text-dim);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-panel);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

table.data-table th,
table.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

table.data-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.15);
}

table.data-table tr:last-child td {
  border-bottom: none;
}

table.data-table tbody tr {
  cursor: pointer;
}

table.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

table.data-table tbody tr.highlight {
  background: rgba(255, 70, 86, 0.08);
}

table.data-table tbody tr.player-link-row {
  cursor: pointer;
}

table.data-table tbody tr.player-link-row:hover {
  background: rgba(255, 70, 86, 0.08);
}

table.data-table .player-link {
  color: inherit;
}

table.data-table tbody tr.player-link-row:hover .player-link {
  color: var(--accent);
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.pill.win {
  background: rgba(61, 214, 140, 0.15);
  color: var(--win);
}

.pill.loss {
  background: rgba(255, 107, 122, 0.15);
  color: var(--loss);
}

.result-cell {
  white-space: nowrap;
}

.result-score {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.pill.queue-comp {
  background: rgba(255, 209, 102, 0.12);
  color: var(--gold);
}

.pill.queue-other {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.teammate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.teammate-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.teammate-card.teammate-link {
  appearance: none;
  display: block;
  width: 100%;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition:
    border-color 0.08s,
    background 0.08s;
}

.teammate-card.teammate-link:hover {
  border-color: var(--border-accent);
  background: var(--accent-soft);
}

.teammate-subhead {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.teammate-subhead:not(:first-child) {
  margin-top: 16px;
}

.teammate-card .subtitle {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.teammate-card .name {
  font-weight: 600;
  margin-bottom: 4px;
}

.teammate-card .count {
  font-size: 12px;
  color: var(--text-muted);
}

.warnings {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  white-space: pre-wrap;
}

.match-view .match-header {
  margin-bottom: 20px;
}

.match-view .match-header h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.match-view .match-meta {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.team-block {
  margin-bottom: 20px;
}

.team-block h4 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.team-block h4 .won {
  color: var(--win);
}

.team-block h4 .lost {
  color: var(--loss);
}

table.data-table tbody tr.party-row td:first-child {
  box-shadow: inset 3px 0 0 var(--party-color);
}

.party-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--party-color, var(--text-muted));
  background: color-mix(in srgb, var(--party-color, #888) 18%, transparent);
  vertical-align: middle;
}

.mvp-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

.mvp-badge.match-mvp {
  color: #1a1408;
  background: linear-gradient(135deg, #ffd166, #f4a623);
}

.mvp-badge.team-mvp {
  color: var(--text);
  background: rgba(255, 209, 102, 0.18);
  border: 1px solid rgba(255, 209, 102, 0.35);
}

table.data-table td.score-mvp-match {
  color: var(--gold);
  font-weight: 700;
}

table.data-table td.score-mvp-team {
  color: #e8c56a;
  font-weight: 600;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    min-height: auto;
  }

  .content {
    padding: 16px;
  }
}

/* --- Live game (agent select / in-game roster + auto-lock) --- */
.live-page { display: flex; flex-direction: column; gap: 16px; }
#live-roster-wrap { display: flex; flex-direction: column; gap: 10px; }
.live-toolbar {
  display: flex; align-items: center; justify-content: space-between;
}
.live-phase-label { font-size: 14px; color: var(--text-dim); }
.live-phase-label span { color: var(--text); font-weight: 600; }
.live-warn {
  margin: 8px 0; padding: 8px 12px; border-radius: 8px; font-size: 13px;
  background: rgba(255, 209, 102, 0.10);
  border: 1px solid rgba(255, 209, 102, 0.30);
  color: #e8c56a;
}
.live-warn.danger {
  background: rgba(255, 99, 110, 0.10);
  border-color: rgba(255, 99, 110, 0.35);
  color: #ff9aa3;
}
.live-lobby-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.lobby-chip {
  display: flex; flex-direction: column; gap: 1px;
  min-width: 88px; padding: 4px 10px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}
.lobby-chip span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.lobby-chip b { font-size: 14px; color: var(--text); font-weight: 700; }
.lobby-chip.ally { background: rgba(127, 212, 166, 0.10); }
.lobby-chip.enemy { background: rgba(255, 154, 163, 0.10); }
.live-team-avg {
  margin-left: 8px; font-weight: 600; font-size: 12px; color: var(--text-dim);
}
.live-alerts {
  display: flex; flex-direction: column; gap: 6px;
}
.live-alerts-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-direction: row;
}
.live-alert-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  line-height: 1.2;
  flex: 0 0 auto;
  width: auto;
}
.live-alert-pill:hover { border-color: rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.08); }
.live-alert-pill.sev-danger {
  color: #ff9aa3;
  background: rgba(255, 99, 110, 0.12);
  border-color: rgba(255, 99, 110, 0.32);
}
.live-alert-pill.sev-warn {
  color: #e8c56a;
  background: rgba(255, 209, 102, 0.12);
  border-color: rgba(255, 209, 102, 0.28);
}
.live-alert-pill.sev-info {
  color: #7fd4a6;
  background: rgba(127, 212, 166, 0.10);
  border-color: rgba(127, 212, 166, 0.26);
}
.live-alert {
  display: grid; grid-template-columns: 22px 1fr; grid-template-rows: auto auto;
  column-gap: 8px; row-gap: 2px; text-align: left;
  padding: 8px 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03); color: inherit;
  font: inherit;
}
.live-alert:hover { border-color: rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.05); }
.live-alert-mark {
  grid-row: 1 / span 2; width: 22px; height: 22px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
}
.live-alert-title { font-size: 13px; font-weight: 700; color: var(--text); }
.live-alert-sum { font-size: 12px; color: var(--text-dim); grid-column: 2; }
.live-alert.sev-danger { border-color: rgba(255, 99, 110, 0.35); background: rgba(255, 99, 110, 0.08); }
.live-alert.sev-danger .live-alert-mark { background: rgba(255, 99, 110, 0.25); color: #ff9aa3; }
.live-alert.sev-warn { border-color: rgba(255, 209, 102, 0.30); background: rgba(255, 209, 102, 0.07); }
.live-alert.sev-warn .live-alert-mark { background: rgba(255, 209, 102, 0.22); color: #e8c56a; }
.live-alert.sev-info { border-color: rgba(79, 182, 224, 0.28); background: rgba(79, 182, 224, 0.07); }
.live-alert.sev-info .live-alert-mark { background: rgba(79, 182, 224, 0.22); color: #4fb6e0; }
.alert-modal { max-width: 560px; }
.alert-lead { font-size: 14px; color: var(--text); margin: 8px 0 10px; }
.alert-body { font-size: 13px; color: var(--text-dim); line-height: 1.45; white-space: pre-wrap; }
.alert-stack {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px;
  padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.04);
  font-size: 12px; color: var(--text-dim);
}
.alert-stack b { color: var(--text); }
.live-metric.delta-low { color: #ff9aa3; background: rgba(255, 99, 110, 0.12); }
.live-metric.delta-high { color: #7fd4a6; background: rgba(127, 212, 166, 0.12); }
.live-metric.delta-mid { color: var(--text-dim); }
.live-tag.tag-outside_band { background: rgba(255, 99, 110, 0.16); color: #ff9aa3; }
.live-tag.tag-passenger { background: rgba(240, 138, 63, 0.18); color: #f08a3f; }
.party-out-band { color: #ff9aa3; font-weight: 700; }
.live-team { margin-top: 12px; }
.live-team h3 { margin: 0 0 8px; font-size: 14px; }
.live-team.enemy h3 { color: #ff9aa3; }
.live-team.ally h3 { color: #7fd4a6; }
.live-roster {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-x: auto;
  --live-v3-cols: 44px minmax(120px, 1.2fr) 32px 68px 72px 84px 42px 40px 38px 40px 56px 32px minmax(44px, 0.8fr);
}
.live-row {
  background: var(--panel, #161922);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px; padding: 8px 12px;
  display: flex; align-items: center; gap: 12px;
}
.live-row.self { border-color: rgba(127, 212, 166, 0.5); }
.live-rank-badge { width: 38px; height: 38px; object-fit: contain; flex: none; }
.live-id { width: 190px; flex: none; min-width: 0; }
.live-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1; }
.live-stat {
  font-size: 12px; color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04); border-radius: 5px; padding: 2px 7px;
}
.live-stat.live-current-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.live-stat.live-current-stat.is-live { color: var(--text); }
.live-stat b { color: var(--text); font-weight: 700; }
.live-stat.acs b { color: #ffd166; }
.live-form { display: inline-flex; gap: 2px; margin-left: 2px; }
.live-form .fd { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.live-form .fd.w { background: #7fd4a6; }
.live-form .fd.l { background: #ff6e73; }
.live-loading { font-size: 11px; color: var(--text-dim); font-style: italic; }
.live-loading.dim { opacity: 0.55; }
.live-games { font-size: 11px; color: var(--text-dim); opacity: 0.7; }
.live-agent-slot {
  flex: none;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.live-agent-icon {
  width: 40px; height: 40px; border-radius: 8px; object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
}
.live-agent-icon.hovering {
  opacity: 0.45;
  border: 1px dashed rgba(255, 255, 255, 0.35);
}
.live-sel {
  font-size: 9px; font-weight: 700; line-height: 1;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.live-sel.locked { color: #7fd4a6; }
.live-sel.hovering { color: #e8c56a; }
.live-agent-q {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: var(--text-dim);
  border: 1px dashed rgba(255, 255, 255, 0.20); background: rgba(255, 255, 255, 0.03);
}
.live-name {
  font-weight: 600; font-size: 14px;
  display: flex; align-items: center; gap: 5px; min-width: 0;
}
.live-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-peak-act { color: var(--text); font-weight: 600; }
.live-peak-ago { opacity: 0.7; }
.live-rank { font-size: 12px; font-weight: 600; }
.live-streak { font-size: 11px; font-weight: 700; margin-left: 4px; }
.live-metric {
  font-size: 11px; color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04); border-radius: 5px; padding: 1px 6px;
}
.live-metric.live-main {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px; padding: 2px 8px 2px 4px;
}
.live-metric.live-main b { color: var(--text); font-weight: 700; }
.live-main-icon {
  width: 18px; height: 18px; border-radius: 4px; object-fit: cover; flex: none;
}
.live-main-role {
  font-size: 10px; font-weight: 700; letter-spacing: 0.02em;
  text-transform: uppercase; opacity: 0.85;
}
.live-main-role.role-duelist { color: #ff6e73; }
.live-main-role.role-controller { color: #c34fe0; }
.live-main-role.role-initiator { color: #4fb6e0; }
.live-main-role.role-sentinel { color: #f2d64b; }
.live-agent-icon.main-pred {
  opacity: 0.4;
  filter: grayscale(0.35);
  border: 1px dashed rgba(255, 255, 255, 0.25);
}
.live-sel.main-pred { color: var(--text-dim); font-weight: 600; }
.live-rank-trail {
  display: inline-flex; align-items: center; gap: 3px; margin-left: 6px;
  vertical-align: middle;
}
.live-rank-dot {
  width: 7px; height: 7px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  flex: none;
}
.live-rank-dot.current {
  width: 8px; height: 8px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.autolock-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.autolock-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-dim); }
.autolock-field select, .autolock-field input {
  background: var(--input-bg, #0f1218); color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.10); border-radius: 6px; padding: 6px 8px;
}
.autolock-actions { display: flex; gap: 8px; margin-top: 10px; }
.autolock-log { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.autolock-log-row { font-size: 11px; color: var(--text-dim); font-family: ui-monospace, monospace; }
.autolock-log-row.dim { opacity: 0.6; }

/* Live: clickable rows, preview modal, drill-in */
.live-row { cursor: pointer; transition: border-color 0.12s ease, background 0.12s ease; }
.live-row:hover { border-color: rgba(255, 255, 255, 0.18); background: #1b1f29; }
.live-row:focus-visible { outline: 2px solid var(--accent, #7fd4a6); outline-offset: 1px; }
.lp-modal { max-width: 440px; }
.lp-modal .modal-actions { flex-wrap: wrap; }
.lp-body { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 4px; }
.lp-row { font-size: 13px; color: var(--text-dim); }
.lp-row b { color: var(--text); font-weight: 600; margin-right: 6px; }
.live-player-page { display: flex; flex-direction: column; gap: 14px; }

/* Competitive filter + recent-players sidebar */
.comp-filter {
  font-size: 12px; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
}
.comp-filter input { accent-color: var(--accent); }
.sidebar-empty { padding: 8px; color: var(--text-dim); font-size: 12px; margin: 0; }
.sidebar-live-recent { border-top: 1px solid var(--border); }

/* Live: premade party outlines + badges */
.live-row.party { border-left-width: 3px; border-left-style: solid; padding-left: 9px; }
.live-row.party-0 { border-left-color: #f2d64b; }
.live-row.party-1 { border-left-color: #4fb6e0; }
.live-row.party-2 { border-left-color: #c34fe0; }
.live-row.party-3 { border-left-color: #36c98a; }
.live-row.party-4 { border-left-color: #f08a3f; }
.live-row.party-5 { border-left-color: #ff6e9c; }
.live-party {
  flex: none; font-size: 9px; font-weight: 800; letter-spacing: 0.03em;
  padding: 1px 5px; border-radius: 4px; color: #11141a;
}
.live-row.party-0 .live-party { background: #f2d64b; }
.live-row.party-1 .live-party { background: #4fb6e0; }
.live-row.party-2 .live-party { background: #c34fe0; }
.live-row.party-3 .live-party { background: #36c98a; }
.live-row.party-4 .live-party { background: #f08a3f; }
.live-row.party-5 .live-party { background: #ff6e9c; }

/* Smurf risk pill + expandable reasons */
.live-row { flex-wrap: wrap; }
.smurf-pill {
  flex: none; cursor: pointer; font-size: 9px; font-weight: 800;
  letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 7px;
  border-radius: 5px; border: none; transition: transform 0.12s ease;
}
.smurf-pill::before { content: "\26A0  "; }
.smurf-pill:hover { transform: translateX(-3px); }
.smurf-low { background: rgba(242, 214, 75, 0.18); color: #f2d64b; }
.smurf-medium { background: rgba(240, 138, 63, 0.20); color: #f08a3f; }
.smurf-high { background: rgba(255, 99, 110, 0.22); color: #ff6e73; }
.smurf-reasons {
  flex: 0 0 100%; display: none; gap: 6px; margin-top: 6px;
  padding-top: 6px; border-top: 1px solid var(--border); flex-wrap: wrap;
}
.live-row.smurf-open .smurf-reasons { display: flex; }
.smurf-reason {
  font-size: 11px; color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04); border-radius: 5px; padding: 2px 7px;
}
.smurf-reason b { color: var(--text); }
.smurf-reason.ctx { opacity: 0.75; }
.live-games.thin { color: #f08a3f; font-style: normal; font-weight: 600; }

/* Auto-lock collapsible */
.autolock-details > summary {
  cursor: pointer; user-select: none; font-size: 14px; font-weight: 600;
  color: var(--text); margin-bottom: 8px;
}
.autolock-details > summary::-webkit-details-marker { color: var(--text-dim); }
/* Public UI without the autolock feature: the panel acts on the host's own pregame. */
html[data-sova-autolock="0"] .autolock-details { display: none; }
.live-party.inferred { opacity: 0.85; border: 1px dashed currentColor; background: transparent !important; color: inherit; }

/* Store page */
.store-page { display: flex; flex-direction: column; gap: 14px; }
.store-head { display: flex; align-items: baseline; justify-content: space-between; }
.store-timer { font-size: 13px; color: var(--text-muted); }
.store-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.store-card {
  background: var(--bg-panel, #161922); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.store-skin { width: 100%; max-width: 200px; height: 80px; object-fit: contain; }
.store-name { font-weight: 600; font-size: 14px; text-align: center; }
.store-cost { font-size: 13px; color: var(--gold); font-weight: 700; }

/* Neutral player tags (not smurf evidence) */
.live-tag {
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px;
  color: var(--text-dim); background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}
.live-tag.tag-hardstuck { color: #8fb3ff; border-color: rgba(143, 179, 255, 0.3); }
.live-tag.tag-returning { color: #c9a0ff; border-color: rgba(201, 160, 255, 0.3); }
.live-tag.tag-encounter { color: #e8c56a; border-color: rgba(232, 197, 106, 0.35); }
.live-tag.tag-unmasked { color: #7ee0c3; border-color: rgba(126, 224, 195, 0.35); }

/* Tracked players: navbar widget + dropdown */
.topbar-tracked { position: absolute; top: 10px; right: 24px; }
.tracked-toggle {
  background: var(--bg-panel); border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 12px; font-weight: 600;
}
.tracked-toggle:hover { color: var(--text); border-color: var(--text-dim); }
.tracked-count {
  background: var(--accent); color: #fff; border-radius: 10px; padding: 0 6px;
  font-size: 11px; font-weight: 700; margin-left: 5px;
}
.tracked-dropdown {
  position: absolute; right: 0; top: 34px; width: 290px; background: var(--bg-panel);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px; z-index: 50;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); max-height: 380px; overflow-y: auto;
}
.tracked-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-dim); padding: 4px 8px 6px;
}
.tracked-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 6px; cursor: pointer;
}
.tracked-row:hover { background: var(--bg-elevated); }
.tracked-name {
  font-weight: 600; font-size: 13px; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tracked-status { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.tracked-untrack {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 2px;
}
.tracked-untrack:hover { color: var(--loss); }

/* Site-wide alerts (public/js/alerts.js). The stack is a manual popover so it sits above modal dialogs. */
.toast-stack {
  position: fixed; bottom: 20px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(360px, calc(100vw - 32px));
}
.toast-stack:empty { display: none; }
.toast-stack:popover-open {
  inset: auto 20px 20px auto; margin: 0; padding: 0; border: 0; background: transparent;
  overflow: visible; width: auto; height: auto; color: inherit;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 10px 10px 14px;
  min-width: 220px; max-width: 360px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.25s ease;
}
.toast.out { opacity: 0; transform: translateX(20px); transition: opacity 0.3s ease, transform 0.3s ease; }
.toast-content { flex: 1; min-width: 0; }
.toast-content.is-clickable { cursor: pointer; }
.toast-content.is-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.toast-success { border-left-color: var(--win); }
.toast-success .toast-title { color: var(--win); }
.toast-error { border-left-color: var(--loss); }
.toast-error .toast-title { color: var(--loss); }
.toast-title { font-weight: 700; font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.toast-body { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.45; overflow-wrap: anywhere; }
.toast-dismiss {
  flex-shrink: 0; width: 28px; height: 28px; margin: -4px -4px -4px 0; padding: 0;
  border: 0; border-radius: 6px; background: transparent; color: var(--text-muted);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.toast-dismiss:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.toast-dismiss:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .toast.out { transition: none; }
}

/* Live row: more breathing room + current-game line */
.live-row { gap: 16px; padding: 10px 14px; }
.live-id { width: 210px; }
.live-stats { gap: 8px; }
.live-current { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-top: 3px; }
.live-current-acs { color: #ffd166; font-weight: 700; margin-left: 5px; }

/* Your own party (exact, from parties endpoint) */
.live-row.party-mine { border-left-color: #7fd4a6; }
.live-row.party-mine .live-party.mine { background: #7fd4a6; color: #11141a; }

/* Live in-game (Overwolf GEP) indicator */
.live-current.is-live { color: var(--text); font-weight: 700; }
.live-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #3dd68c; margin-right: 5px; box-shadow: 0 0 6px #3dd68c;
  animation: live-pulse 1.4s ease-in-out infinite; vertical-align: middle;
}
@keyframes live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.live-current-money { color: var(--gold); opacity: 0.85; margin-left: 6px; font-weight: 600; }

/* Friends: presence line, activity drill-in, tracked filter */
.monitor-friend-presence { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
.monitor-activity-btn {
  flex: none; align-self: stretch; width: 40px; border: none;
  border-left: 1px solid var(--border); background: transparent;
  color: var(--text-dim); font-size: 15px; cursor: pointer;
}
.monitor-activity-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.monitor-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.monitor-panel-head h2 { margin: 0; }
.monitor-tracked-toggle {
  font-size: 12px; color: var(--text-muted); display: inline-flex; align-items: center;
  gap: 5px; cursor: pointer;
}
.monitor-tracked-toggle input { accent-color: var(--accent); }
.fa-modal { width: min(460px, calc(100vw - 40px)); }
.fa-presence {
  display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text-dim);
  padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px solid var(--border);
}
.fa-presence b { color: var(--text); font-weight: 600; margin-right: 6px; }
.fa-timeline { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; }
.fa-event { font-size: 12px; color: var(--text-muted); }
.fa-time { color: var(--text-dim); font-family: ui-monospace, monospace; margin-right: 8px; }

/* --- Comeback advisor (docs/team-performance-analysis.md) --- */
.comeback-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.comeback-card:empty { display: none; }
.comeback-head {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.comeback-score { font-size: 30px; font-weight: 700; letter-spacing: 1px; line-height: 1; }
.comeback-score .dim { font-size: 13px; font-weight: 400; color: var(--text-dim); }
.comeback-rr { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.comeback-rr-cell { display: flex; flex-direction: column; line-height: 1.15; }
.comeback-rr-cell .value { font-size: 22px; font-weight: 700; }
.comeback-rr-cell .label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-dim);
}
.comeback-rr-cell.win .value { color: var(--win); }
.comeback-rr-cell.loss .value { color: var(--loss); }
.comeback-verdict {
  margin-left: auto; font-size: 13px; font-weight: 600; text-transform: uppercase;
}
.comeback-verdict.good { color: var(--win); }
.comeback-verdict.mid { color: var(--gold); }
.comeback-verdict.bad { color: var(--loss); }
.comeback-bar {
  margin: 12px 0 8px; height: 6px; border-radius: 3px;
  background: rgba(255, 255, 255, 0.07); overflow: hidden;
}
.comeback-bar span { display: block; height: 100%; border-radius: 3px; }
.comeback-bar.good span { background: var(--win); }
.comeback-bar.mid span { background: var(--gold); }
.comeback-bar.bad span { background: var(--loss); }
.comeback-prob { font-size: 13px; }
.comeback-finals { font-size: 13px; margin-top: 6px; }
.comeback-finals .label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-dim); margin-right: 8px;
}
.comeback-drivers {
  margin-top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px;
}
.comeback-drivers .label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-dim);
}
.comeback-drivers .driver {
  padding: 1px 7px; border-radius: 999px; cursor: help;
  border: 1px solid transparent; font-variant-numeric: tabular-nums;
}
.comeback-drivers .driver b { font-weight: 700; }
.comeback-drivers .driver.up {
  color: var(--win); background: rgba(61, 214, 140, 0.10); border-color: rgba(61, 214, 140, 0.24);
}
.comeback-drivers .driver.down {
  color: var(--loss); background: rgba(255, 107, 122, 0.10); border-color: rgba(255, 107, 122, 0.26);
}

/* --- Live page V1/V2/V3 switch + V2 row extras --- */
.live-toolbar-right { display: flex; align-items: center; gap: 10px; }
.live-glance {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-panel, #161922);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}
.live-glance-top {
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-dim);
}
.live-glance-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.live-glance-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  padding: 0;
  min-width: 0;
}
.live-glance-stat b {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
}
.live-glance-stat span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.live-glance-stat.good b { color: var(--win, #7fd4a6); }
.live-glance-stat.mid b { color: var(--gold, #e8c56a); }
.live-glance-stat.bad b { color: var(--loss, #ff6e73); }
button.live-glance-stat { cursor: pointer; }
button.live-glance-stat:hover b { text-decoration: underline; }
@media (max-width: 860px) {
  .live-glance-stats { grid-template-columns: 1fr 1fr; }
}
.live-readout {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.live-readout-row {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 13px;
}
.live-readout-k {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 700;
  padding-top: 2px;
}
.live-readout-v {
  color: var(--text);
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.live-row-v3 {
  display: grid;
  grid-template-columns: var(--live-v3-cols);
  gap: 8px;
  align-items: center;
  min-width: 980px;
  flex-wrap: nowrap;
}
.live-row-v3 .live-id {
  width: auto;
  min-width: 0;
}
.live-row-v3 .live-rank {
  font-size: 12px;
  line-height: 1.2;
}
.live-row-v3 .live-rank-badge {
  width: 32px;
  height: 32px;
}
.live-row-v3.party {
  padding-left: 14px;
}
.live-v3-head {
  display: grid;
  grid-template-columns: var(--live-v3-cols);
  gap: 8px;
  padding: 0 14px 4px;
  min-width: 980px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.live-v3-cell {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.live-v3-acs {
  color: #ffd166;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}
.live-v3-rr {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dim);
}
.live-v3-peak {
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: var(--text);
}
.live-v3-peak-sub,
.live-v3-last-act {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.live-v3-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  max-width: 100%;
}
.live-v3-main-top {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.live-v3-main .live-main-icon {
  width: 14px;
  height: 14px;
}
.live-v3-main b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-v3-main .live-main-role {
  font-size: 9px;
  line-height: 1;
}
.live-v3-form .live-form { margin-left: 0; }
.live-v3-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.live-v3-peak-metric b { font-weight: 700; }
.live-igl {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.live-igl .dim { font-weight: 500; color: var(--text-dim); }
.live-glance .live-alerts-pills { margin-top: 10px; }
.live-alert-compact .live-alert-sum { display: none; }
.live-alert-compact {
  grid-template-rows: auto;
  padding: 6px 10px;
}
.live-alert-compact .live-alert-mark { grid-row: 1; }
.live-rr { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.live-rr .dim { font-size: 10px; text-transform: uppercase; }
.live-offrole {
  font-size: 10px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  padding: 1px 5px; border-radius: 4px; cursor: help;
  background: rgba(255, 209, 102, 0.14); color: var(--gold);
}
.comeback-accuracy {
  margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
}
.comeback-accuracy a { color: var(--text-muted); text-decoration: underline; }
.comeback-accuracy a:hover { color: var(--text); }
.accuracy-table-wrap { overflow-x: auto; margin-top: 16px; }
.accuracy-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.accuracy-table th {
  text-align: left; font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-dim); font-weight: 600; padding: 0 12px 8px 0; white-space: nowrap;
}
.accuracy-table td {
  padding: 7px 12px 7px 0; border-top: 1px solid var(--border);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.accuracy-table .dim { color: var(--text-dim); }
.badge-thin {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px;
  background: rgba(255, 255, 255, 0.06); color: var(--text-dim);
  padding: 1px 5px; border-radius: 4px;
}
.acc-row { cursor: pointer; }
.acc-row:hover td { background: rgba(255, 255, 255, 0.03); }
.acc-row.open td { background: rgba(255, 70, 86, 0.06); }
.acc-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.acc-caret { color: var(--text-dim); font-size: 10px; margin-right: 2px; }
.acc-detail td { padding: 0 0 14px; border-top: none; }
.acc-trail {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; overflow-x: auto;
}
.acc-trail-head { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.acc-trail-head b { color: var(--text); }
.acc-trail .accuracy-table { font-size: 12.5px; }
.stat-card .sub {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}
