:root {
  color-scheme: light;
  --bg: #f8f9fb;
  --surface: #ffffff;
  --surface-soft: #eef1f7;
  --border: #d8dde7;
  --text: #161b26;
  --muted: #6b7280;
  --accent: #334155;
  --accent-strong: #1f2937;
  --focus: rgba(30, 64, 175, 0.2);
  --radius-sm: 6px;
  --radius-md: 10px;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg);
  color: var(--text);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f172a;
  --surface: #101828;
  --surface-soft: #1e293b;
  --border: #1f2937;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #d1d5db;
  --accent-strong: #f8fafc;
  --focus: rgba(148, 163, 184, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.75rem 2rem;
}

.title-block {
  flex: 1 1 320px;
}

.title-block h1 {
  margin: 0;
  font-size: clamp(1.8rem, 2.4vw + 1rem, 2.4rem);
  font-weight: 600;
  color: var(--accent-strong);
}

.title-block p {
  margin: 0.75rem 0 0;
  max-width: 40rem;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.meta-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 90px;
}

.meta-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.meta-value {
  font-weight: 600;
  font-size: 1.1rem;
}

.divider {
  width: 1px;
  height: 42px;
  background: var(--border);
}

.language-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.language-button {
  background: transparent;
  border: none;
  padding: 0.45rem 0.85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.language-button:hover,
.language-button.is-active {
  color: var(--accent-strong);
  background: var(--surface-soft);
}

.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.45rem;
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, border 0.2s ease;
}

.theme-toggle:hover {
  color: var(--accent-strong);
  border-color: var(--accent-strong);
}

.theme-toggle .icon svg {
  width: 20px;
  height: 20px;
}

html[data-theme="dark"] .theme-toggle .sun {
  opacity: 0.4;
}

html[data-theme="light"] .theme-toggle .moon {
  opacity: 0.4;
}

.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.table-scroll {
  overflow: auto;
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  color: var(--text);
}

thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 0.75rem 0.95rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

thead th[data-sort] {
  cursor: pointer;
}

th .sort-indicator::before {
  content: '\2195';
  font-size: 0.7rem;
  margin-left: 0.3rem;
  opacity: 0.3;
}

th.sorted-asc .sort-indicator::before {
  content: '\2191';
  opacity: 0.8;
}

th.sorted-desc .sort-indicator::before {
  content: '\2193';
  opacity: 0.8;
}

tbody td {
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--surface-soft);
}

.filter-trigger {
  margin-left: 0.45rem;
  background: transparent;
  border: none;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.filter-trigger:hover,
.filter-trigger.is-active {
  color: var(--accent-strong);
  background: var(--surface-soft);
}

.filter-trigger svg {
  width: 16px;
  height: 16px;
}

.filter-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem;
  min-width: 180px;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
  display: none;
  z-index: 10;
}

html[data-theme="dark"] .filter-popover {
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.5);
}

.filter-popover input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  padding: 0.5rem 0.65rem;
  font-size: 0.9rem;
  color: var(--text);
}

.filter-popover input:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--focus);
}

th.filter-open .filter-popover {
  display: block;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.contribute {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.75rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contribute h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.contribute p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.code-pill {
  font-family: 'Fira Code', 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
  padding: 0.05rem 0.45rem;
}

@media (max-width: 768px) {
  .page {
    padding: 2.25rem 1.2rem 3rem;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.05rem 1.1rem;
    gap: 0.75rem;
  }

  .title-block {
    flex: none !important;
    width: 100%;
  }

  .topbar-controls {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
  }

  .divider {
    display: none;
  }

  .title-block h1 {
    font-size: 1.55rem;
  }

  .meta-group {
    flex-direction: row;
    align-items: baseline;
    gap: 0.4rem;
  }

  .meta-label {
    letter-spacing: 0.08em;
    font-size: 0.72rem;
  }

  .meta-value {
    font-size: 1rem;
  }

  thead th,
  tbody td {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .filter-popover {
    min-width: 150px;
  }
}

@media (max-width: 560px) {
  .page {
    padding-top: 1.8rem;
  }

  .topbar {
    padding: 0.95rem 0.95rem;
  }

  .title-block h1 {
    font-size: 1.4rem;
  }

  .title-block p {
    margin-top: 0.35rem;
    font-size: 0.9rem;
    line-height: 1.4;
  }

  .title-block p[data-i18n="subtitle"] {
    display: none;
  }

  .topbar-controls {
    gap: 0.5rem;
    align-items: center;
  }

  .meta-group {
    font-size: 0.85rem;
  }

  .language-switch {
    border-radius: 5px;
  }

  .language-button {
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
  }

  .theme-toggle {
    padding: 0.25rem 0.35rem;
  }

  table {
    font-size: 0.9rem;
  }
}
