:root {
  color-scheme: light dark;
  --page-bg: radial-gradient(
    circle at top,
    #141b27 0%,
    #05070a 45%,
    #000 100%
  );
  --card-bg: #141b27;
  --table-header: #1e2735;
  --accent: #5ef2b5;
  --accent-muted: rgba(94, 242, 181, 0.2);
  --text: #eef2f8;
  --text-muted: #8a96a8;
  --danger: #ff6b6b;
  --pending-bg: rgba(255, 209, 102, 0.2);
  --pending-text: #ffd166;
  font-family: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

body[data-theme="light"] {
  --page-bg: radial-gradient(circle at top, #ffffff 0%, #f5f6fb 60%, #edf1f9 100%);
  --card-bg: #ffffff;
  --table-header: #f3f5fb;
  --accent: #2563eb;
  --accent-muted: rgba(37, 99, 235, 0.12);
  --text: #0c111d;
  --text-muted: #5f6b7b;
  --danger: #d53030;
  --pending-bg: rgba(255, 183, 77, 0.25);
  --pending-text: #b45309;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text);
  padding: 1.5rem clamp(0.75rem, 2vw, 2rem) 3rem;
  font-size: 0.9rem;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
}

.theme-toggle {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: var(--text);
  font-size: 1.1rem;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border 0.2s ease;
  align-self: flex-start;
}

body[data-theme="light"] .theme-toggle {
  border-color: rgba(12, 17, 29, 0.15);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

body[data-theme="light"] .theme-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

h1 {
  margin: 0;
  font-size: clamp(1.6rem, 2.4vw, 2.5rem);
}

.meta {
  display: flex;
  gap: 1rem;
  text-align: right;
}

.meta-label {
  margin: 0;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.meta-value {
  margin: 0.15rem 0 0;
  font-size: 1rem;
  font-weight: 600;
}

main {
  margin-top: 1.25rem;
  display: grid;
  gap: 1rem;
}

.standings-card {
  background: var(--card-bg);
  border-radius: 1.5rem;
  padding: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
}

.standings-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.standings-head h2 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.standings-pill-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.filter-panel {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-label {
  margin: 0;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.filter-checkboxes {
  display: block;
}

.filter-tree {
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.filter-tree:not(.filter-tree-root) {
  margin: 0.1rem 0 0 0.75rem;
  padding-left: 0.75rem;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
}

body[data-theme="light"] .filter-tree:not(.filter-tree-root) {
  border-color: rgba(12, 17, 29, 0.15);
}

.filter-tree-item {
  margin: 0.15rem 0;
}

.filter-tree-item > .filter-tree {
  margin-top: 0.15rem;
}

.filter-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text);
}

.filter-checkbox input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.filter-toggle {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

body[data-theme="light"] .filter-toggle {
  border-color: rgba(12, 17, 29, 0.2);
}

.filter-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

body[data-theme="light"] .filter-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}

.filter-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.filter-panel.collapsed .filter-body {
  display: none;
}

.filter-placeholder {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.status-pill {
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.status-pill.online {
  background: var(--accent-muted);
  color: var(--accent);
}

.status-pill.error {
  background: rgba(255, 107, 107, 0.15);
  color: var(--danger);
}

.table-wrapper {
  overflow: auto;
  margin-top: 1.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

thead tr {
  background: var(--table-header);
}

th,
td {
  padding: 0.6rem 0.7rem;
  text-align: left;
  font-size: 0.85rem;
}

th {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  color: var(--text-muted);
}

tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.placeholder {
  text-align: center;
  color: var(--text-muted);
  padding: 1.2rem;
}

.team-name {
  margin: 0;
  font-weight: 600;
  font-size: 0.95em;
}

.team-school {
  margin: 0.1rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.team-info {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.team-flag {
  width: 1.5rem;
  height: 1rem;
  border-radius: 0.2rem;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}

body[data-theme="light"] .team-flag {
  box-shadow: 0 0 0 1px rgba(12, 17, 29, 0.15);
}

.problem-cell {
  text-align: center;
  font-weight: 600;
  border-radius: 0.5rem;
  min-width: 2.4rem;
  font-size: 0.8rem;
}

.problem-cell.pending {
  background: var(--pending-bg);
  color: var(--pending-text);
}

.problem-cell.idle {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

.problem-cell.solved {
  background: var(--accent-muted);
  color: var(--accent);
}

.problem-cell.failed {
  background: rgba(255, 107, 107, 0.15);
  color: var(--danger);
}

.problem-cell span {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  body {
    padding: 1.25rem 0.75rem 2rem;
  }

  .meta {
    width: 100%;
    justify-content: space-between;
    text-align: left;
  }

  th,
  td {
    padding: 0.6rem 0.5rem;
  }
}
