:root {
  --bg: #f7f8fa;
  --card-bg: #ffffff;
  --text: #1b1e24;
  --muted: #5b6472;
  --accent: #1f7ae0;
  --border: #e2e5ea;
  --radius: 14px;
  --gold: #b5680b;
  --subtle: #f1f2f4;
  --faint: #9aa2ae;
  --shadow: rgba(0, 0, 0, 0.04);
  --green: #1e8a4c; --green-bg: #eafbf0; --green-border: #bfe9cf;
  --red: #c73e35; --red-bg: #fdeceb; --red-border: #f5c9c5; --red-strong: #c0392b;
  --amber-bg: #fff4e5;
  --gold-text: #8a5a00; --gold-bg: #fdf3dc; --gold-border: #efd391;
  --hint-bg: #fff8e8; --hint-border: #f1dcae;
  --blue-text: #1d5fb8; --blue-bg: #eaf4ff; --blue-border: #b9d3f5;
  --indigo: #3a4a9e; --indigo-bg: #eef2fd;
  --purple: #5b3fb8; --purple-bg: #f1eefc;
  --olive: #5b7a12; --olive-bg: #f4f9e6; --olive-border: #dbe9b5;
  --on-accent: #ffffff;
  color-scheme: light;
}
/* Dark theme: follows the system setting unless the visitor picked one
   with the theme button (theme.js sets data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #0f1217;
  --card-bg: #171b22;
  --text: #e4e7ec;
  --muted: #9aa3b1;
  --accent: #5ea3f2;
  --border: #2b313b;
  --gold: #e3a24f;
  --subtle: #212731;
  --faint: #6c7480;
  --shadow: rgba(0, 0, 0, 0.35);
  --green: #6fd39b; --green-bg: rgba(46, 160, 90, 0.16); --green-border: rgba(111, 211, 155, 0.35);
  --red: #f08a82; --red-bg: rgba(220, 70, 60, 0.16); --red-border: rgba(240, 138, 130, 0.35); --red-strong: #e5675c;
  --amber-bg: rgba(227, 162, 79, 0.15);
  --gold-text: #f0c062; --gold-bg: rgba(240, 192, 98, 0.15); --gold-border: rgba(240, 192, 98, 0.4);
  --hint-bg: rgba(240, 192, 98, 0.1); --hint-border: rgba(240, 192, 98, 0.3);
  --blue-text: #8cbcf5; --blue-bg: rgba(94, 163, 242, 0.15); --blue-border: rgba(94, 163, 242, 0.35);
  --indigo: #a3b0f0; --indigo-bg: rgba(130, 145, 230, 0.16);
  --purple: #bba6f5; --purple-bg: rgba(160, 130, 240, 0.16);
  --olive: #b8d36a; --olive-bg: rgba(160, 200, 70, 0.14); --olive-border: rgba(184, 211, 106, 0.35);
  --on-accent: #0f1217;
  color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1217;
  --card-bg: #171b22;
  --text: #e4e7ec;
  --muted: #9aa3b1;
  --accent: #5ea3f2;
  --border: #2b313b;
  --gold: #e3a24f;
  --subtle: #212731;
  --faint: #6c7480;
  --shadow: rgba(0, 0, 0, 0.35);
  --green: #6fd39b; --green-bg: rgba(46, 160, 90, 0.16); --green-border: rgba(111, 211, 155, 0.35);
  --red: #f08a82; --red-bg: rgba(220, 70, 60, 0.16); --red-border: rgba(240, 138, 130, 0.35); --red-strong: #e5675c;
  --amber-bg: rgba(227, 162, 79, 0.15);
  --gold-text: #f0c062; --gold-bg: rgba(240, 192, 98, 0.15); --gold-border: rgba(240, 192, 98, 0.4);
  --hint-bg: rgba(240, 192, 98, 0.1); --hint-border: rgba(240, 192, 98, 0.3);
  --blue-text: #8cbcf5; --blue-bg: rgba(94, 163, 242, 0.15); --blue-border: rgba(94, 163, 242, 0.35);
  --indigo: #a3b0f0; --indigo-bg: rgba(130, 145, 230, 0.16);
  --purple: #bba6f5; --purple-bg: rgba(160, 130, 240, 0.16);
  --olive: #b8d36a; --olive-bg: rgba(160, 200, 70, 0.14); --olive-border: rgba(184, 211, 106, 0.35);
  --on-accent: #0f1217;
  color-scheme: dark;
}

/* Dark-theme tweaks that are rules, not colours: plain links take the
   accent instead of the browser's default (purple when visited), and
   the generic grey icon (a data: SVG, so it can't use the variables)
   is dimmed instead of glowing. :where() keeps these weak so every
   class that styles its own links still wins. */
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) a { color: var(--accent); }
  :where(:root:not([data-theme="light"])) img[src^="data:image/svg+xml"] { filter: invert(0.85) hue-rotate(180deg); }
}
:where(:root[data-theme="dark"]) a { color: var(--accent); }
:where(:root[data-theme="dark"]) img[src^="data:image/svg+xml"] { filter: invert(0.85) hue-rotate(180deg); }


* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header {
  max-width: 1000px;
  margin: 0 auto;
  padding: 3rem 1.5rem 1.5rem;
  text-align: center;
}

h1 { margin: 0 0 0.5rem; font-size: 2rem; }

.subtitle {
  color: var(--muted);
  max-width: 720px;
  text-wrap: balance;
  margin: 0 auto 1.5rem;
  font-size: 0.95rem;
}

.subtitle a { color: var(--accent); }

.stats-line {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  margin: -0.5rem 0 1.25rem;
}

.queue-line {
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 600;
  margin: -1rem 0 1.25rem;
}

.legend {
  max-width: 640px;
  margin: 0 auto 0.4rem;
  text-align: left;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.1rem;
}

/* Index: the three info panels as one box instead of four loose ones */
.info-group {
  max-width: 640px;
  margin: 0 auto 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.info-group .legend {
  max-width: none;
  margin: 0;
  background: none;
  border: none;
  border-radius: 0;
}
.info-group .legend + .legend { border-top: 1px solid var(--border); }
.info-group .legend-prose ul { padding-left: 1.2rem; }

.legend summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
}

.legend dl {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
}

.legend dt { margin-top: 0.6rem; }

.legend dd {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.legend-prose {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.6;
}

.legend-prose p { margin: 0 0 0.85rem; }

.legend-prose .detail-subhead {
  font-size: 0.92rem;
  margin: 1.1rem 0 0.5rem;
  padding-bottom: 0.3rem;
}

.legend-prose .guide-intro {
  color: var(--muted);
}

.legend-prose .guide-list {
  margin: 0 0 0.85rem;
  padding-left: 1.2rem;
}

.legend-prose .guide-list li { margin-bottom: 0.4rem; }

.legend-prose .guide-note {
  background: var(--amber-bg);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  color: var(--text);
}

.legend-prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: var(--subtle);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

.chart-block {
  margin: 0.5rem 0 1.25rem;
}

.chart-block h4 {
  font-size: 0.85rem;
  margin: 1.1rem 0 0.6rem;
  color: var(--text);
}

.chart-row {
  display: grid;
  grid-template-columns: 130px 1fr 34px;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
  font-size: 0.78rem;
}

.chart-label {
  color: var(--text);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-track-bg {
  background: var(--subtle);
  border-radius: 6px;
  height: 16px;
}

.chart-track {
  display: flex;
  height: 16px;
  border-radius: 6px;
  overflow: hidden;
}

.chart-fill {
  height: 100%;
}

.chart-value {
  color: var(--muted);
}

.chart-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.chart-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.stat-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.6rem;
  margin: 0.5rem 0 1.25rem;
}

.stat-summary-cell {
  background: var(--subtle);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  text-align: center;
}

.stat-summary-number {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.stat-summary-label {
  font-size: 0.72rem;
  color: var(--muted);
}

.chart-caveat {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}

.description {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
  min-height: 2.7em;
}

#search {
  width: 100%;
  max-width: 420px;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 1rem;
  margin: 1.1rem 0 0.75rem;
}

#search:focus { outline: 2px solid var(--accent); }

.filters {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  flex-wrap: wrap;
}

.filters select {
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.78rem;
}

.archived-toggle {
  display: block;
  text-align: center;
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
}

.archived-toggle input {
  margin-right: 0.3rem;
  vertical-align: middle;
}

.new-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 1rem;
}

.new-section .group-title {
  color: var(--gold);
}

.new-subsection {
  margin-bottom: 2rem;
}

.new-subtitle {
  font-size: 1rem;
  color: var(--gold);
  margin: 0 0 0.75rem;
}

.new-count {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.8rem;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
}

.group {
  margin-bottom: 2.5rem;
}

.group-title {
  font-size: 1.1rem;
  margin: 0 0 0.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.group-subtitle {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 1rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: 0 1px 3px var(--shadow);
  position: relative;
}

.card.tier-3 { border-style: dashed; }

.card-link {
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.card-link:hover .card-head h2 { color: var(--accent); }

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.card-head img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--subtle);
}

.card-head-text { flex: 1; min-width: 0; }

.card-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.byline {
  color: var(--muted);
  font-size: 0.8rem;
}

.byline a { color: var(--muted); }

.stats {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.1rem;
}

.lang-flags {
  margin-top: 0.25rem;
  font-size: 0.9rem;
  letter-spacing: 0.1rem;
}

.lang-flag { margin-right: 0.15rem; }

.lang-flag-current {
  filter: drop-shadow(0 0 0 transparent);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: 3px;
}

.untranslated-note {
  margin-top: 0.25rem;
  font-size: 0.72rem;
  font-style: italic;
  color: var(--muted);
}

.site-lang-switcher {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.5rem 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.site-lang-switcher select {
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.78rem;
}

.detail-header .site-lang-switcher {
  margin: 0;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge svg { width: 12px; height: 12px; }

.badge-store { background: var(--blue-bg); color: var(--accent); }
.badge-offline { background: var(--green-bg); color: var(--green); }
.badge-hybrid { background: var(--amber-bg); color: var(--gold); }
.badge-lan { background: var(--indigo-bg); color: var(--indigo); }
.badge-online { background: var(--red-bg); color: var(--red); }
.badge-key { background: var(--purple-bg); color: var(--purple); }
.badge-verified { background: var(--green-bg); color: var(--green); }
.badge-partial { background: var(--amber-bg); color: var(--gold); }
.badge-unverified { background: var(--subtle); color: var(--muted); }
.badge-warn { background: var(--red-bg); color: var(--red); }
.badge-type { background: var(--indigo-bg); color: var(--indigo); }

.examples {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: var(--text);
}

.examples li { margin-bottom: 0.15rem; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
}

.tag {
  background: var(--subtle);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.75rem;
}

.links {
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
  margin-top: 0.4rem;
}

.links a { color: var(--accent); text-decoration: none; }
.links a:hover { text-decoration: underline; }
.translate-link { margin-left: auto; }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 2rem 1rem 3rem;
}

footer a { color: var(--accent); }

#empty-state {
  text-align: center;
  color: var(--muted);
  padding: 3rem 0;
}

/* Detail page */

.detail-header {
  max-width: 700px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover { text-decoration: underline; }

.detail-root {
  max-width: 700px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}

.loading {
  text-align: center;
  color: var(--muted);
  padding: 3rem 0;
}

.loading a { color: var(--accent); }

.detail-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

.detail-top {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1rem;
}

.detail-icon {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--subtle);
  flex-shrink: 0;
}

.detail-top h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.license-warning {
  background: var(--red-bg);
  color: var(--red);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  font-size: 0.88rem;
  margin: 1rem 0;
  line-height: 1.5;
}

.archived-notice {
  background: var(--subtle);
  color: var(--text);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  font-size: 0.88rem;
  margin: 1rem 0;
  line-height: 1.5;
}

.assessment-text {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0.5rem 0 0.9rem;
}

.assessment-text code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: var(--subtle);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

.facts-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.fact-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text);
}

.fact-detail {
  color: var(--muted);
}

.detail-description {
  font-size: 1rem;
  color: var(--text);
  margin: 1.25rem 0;
  line-height: 1.6;
}

.install-box {
  background: var(--subtle);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin: 1.25rem 0;
}

.install-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.install-command {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  color: var(--text);
  overflow-x: auto;
  white-space: pre;
}

.setup-note {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0 0 0.75rem;
}

.setup-section {
  background: var(--subtle);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.75rem;
}

.setup-heading {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.setup-content {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  max-height: 260px;
  overflow-y: auto;
}

.detail-subhead {
  font-size: 1rem;
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem 1.5rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.88rem;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 0.35rem;
}

.stat-label { color: var(--muted); flex: 0 0 auto; max-width: 45%; }
.stat-value { font-weight: 600; flex: 1 1 auto; min-width: 0; text-align: right; overflow-wrap: anywhere; }

.maintainer-guide { max-width: 760px; }

.guide-intro {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 0.75rem 0 1.5rem;
}

.guide-list {
  margin: 0.5rem 0 1rem;
  padding-left: 1.3rem;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text);
}

.guide-list li { margin-bottom: 0.4rem; }

.guide-list code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: var(--subtle);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

.guide-note {
  background: var(--blue-bg);
  color: var(--blue-text);
  border-radius: 10px;
  padding: 0.85rem 1.05rem;
  font-size: 0.88rem;
  line-height: 1.55;
  margin: 0.75rem 0 1.25rem;
}

.guide-note code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

.detail-links {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.detail-link-btn {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.detail-link-btn:hover { opacity: 0.9; }
.detail-link-btn:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(1); }
.detail-link-btn:disabled:hover { opacity: 0.45; }

.detail-link-translate {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  margin-left: auto;
}

.detail-meta-links {
  display: flex;
  gap: 1.25rem;
  margin-top: 1rem;
  font-size: 0.8rem;
}

.detail-meta-links a {
  color: var(--muted);
  text-decoration: none;
}

.detail-meta-links a:hover { text-decoration: underline; }

.flag-link { color: var(--red); }

/* Detail page sections (from "what is it" down to "for the maintainer"). */
.detail-section { margin-top: 1.75rem; }

.detail-fold {
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
}
.detail-fold > summary {
  cursor: pointer;
  color: var(--muted);
  list-style-position: outside;
}
.detail-fold > summary:hover { color: var(--text); }
.detail-fold-body { margin-top: 0.6rem; }

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 2rem;
  align-items: start;
}
@media (max-width: 640px) {
  .about-grid { grid-template-columns: 1fr; }
}
.stat-grid-compact { grid-template-columns: 1fr; gap: 0.35rem; }
.about-tags { margin-top: 0.9rem; }

.maintainer-section .detail-meta-links { flex-wrap: wrap; row-gap: 0.5rem; }

/* Channel test results (issue #6): card labels + "Works with OVOS". */
.compat-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.compat-label {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 0.1rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.quality-label { border-width: 1.5px; }
.quality-routes { background: var(--blue-bg); color: var(--blue-text); border-color: var(--blue-border); }
.quality-klondike { background: var(--gold-bg); color: var(--gold-text); border-color: var(--gold-border); }
.compat-pass { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.compat-warn { background: var(--olive-bg); color: var(--olive); border-color: var(--olive-border); }
.compat-fail { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.compat-untested,
.compat-unsupported { background: var(--subtle); color: var(--muted); border-color: var(--border); }

.compat-row {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}
.compat-row:first-of-type { padding-top: 0.2rem; }

.compat-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.6rem;
}
.compat-row-head strong { min-width: 3.5rem; }

.compat-meta { color: var(--muted); font-size: 0.8rem; }

.compat-issue {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--gold-text);
  overflow-wrap: anywhere;
}
.compat-issue-fail { color: var(--red); }
.compat-issue code,
.compat-facts code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8em;
  background: var(--subtle);
  border-radius: 4px;
  padding: 0.05em 0.3em;
}

.compat-facts { display: grid; gap: 0.3rem; }
.compat-facts .stat-row { font-size: 0.82rem; gap: 1rem; }
.compat-facts .stat-value { font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.compat-facts code.compat-lang-missing { background: var(--red-bg); color: var(--red); }

.compat-log {
  margin: 0.6rem 0 0;
  max-height: 20rem;
  overflow: auto;
  background: var(--subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem;
  font-size: 0.72rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.compat-footnote { margin-top: 0.7rem; }

.compat-snippet {
  display: grid;
  gap: 0.35rem;
  margin: 0.5rem 0;
}
.compat-snippet img { height: 20px; }
.compat-snippet code {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

/* Level 3 routing details on the detail page */
.compat-subhead { margin: 0.9rem 0 0.3rem; font-size: 0.95rem; }
.compat-misses { margin: 0.3rem 0 0.6rem 1.2rem; padding: 0; font-size: 0.85rem; }
.compat-misses li { margin: 0.15rem 0; }

/* Test reports from people (#6 maintainer, #9 community) */
.compat-maintainer { background: var(--blue-bg); color: var(--blue-text); border-color: var(--blue-border); }
.people-row { margin: 0.45rem 0 0.1rem; font-size: 0.88rem; }
.people-stale, .people-invalid { color: var(--muted); }
.people-why, .people-setup { font-size: 0.82rem; color: var(--muted); margin-top: 0.15rem; }
.people-matrix { border-collapse: collapse; margin: 0.4rem 0; font-size: 0.84rem; }
.people-matrix th, .people-matrix td { padding: 0.2rem 0.6rem; text-align: left; border-bottom: 1px solid var(--border); }
.people-matrix th:not(:first-child), .people-matrix td:not(:first-child) { text-align: center; }
.people-matrix .people-detail td { border-bottom: none; padding-top: 0; }
.people-list { margin: 0.2rem 0 0.4rem 1rem; padding: 0; }
.people-outcome { font-weight: 600; margin-right: 0.3rem; }
.people-works { color: var(--green); }
.people-partly { color: var(--olive); }
.people-doesnt_work { color: var(--red); }
.report-input { width: 100%; font-family: ui-monospace, monospace; font-size: 0.8rem; border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem; }
.report-actions { display: flex; gap: 0.5rem; margin: 0.5rem 0; }
.report-result { font-size: 0.88rem; }
.report-result p { margin: 0.2rem 0; }
.report-invalid { color: var(--red); }
.report-stale { color: var(--gold); }
.report-ok { color: var(--green); }
.report-pending { color: var(--muted); }
.report-hint { background: var(--hint-bg); border: 1px solid var(--hint-border); border-radius: 8px; padding: 0.6rem 0.8rem; margin: 0.5rem 0 0.8rem; font-size: 0.88rem; }

/* Labels and badges legend (index "What do the labels and badges mean?",
   for-maintainers "The labels at a glance"); rows drawn by legend.js */
.legend-subhead { margin: 1rem 0 0.4rem; font-size: 1rem; }
.legend-table { border-collapse: collapse; width: 100%; font-size: 0.86rem; margin: 0.3rem 0 0.6rem; }
.legend-table th, .legend-table td { text-align: left; vertical-align: top; padding: 0.35rem 0.6rem 0.35rem 0; border-bottom: 1px solid var(--border); }
.legend-table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
/* The label column never wraps; the explanation always does. Only the
   three-column label table (card | detail page | meaning) has a middle
   column to keep on one line and to drop on narrow screens. */
.legend-table td:first-child { white-space: nowrap; }
.legend-table td:last-child { white-space: normal; overflow-wrap: anywhere; }
.legend-table-3 td:nth-child(2) { white-space: nowrap; }
.legend-shield { vertical-align: middle; height: 20px; }
@media (max-width: 640px) {
  .legend-table-3 td:nth-child(2), .legend-table-3 th:nth-child(2) { display: none; }
  .legend-table td:first-child { white-space: normal; }
}
.legend a { color: var(--accent); }
.maintainer-guide code, .legend-prose code, .profile-howto code { overflow-wrap: anywhere; }
.legend > .setup-note { margin: 0.6rem 0 0; }

/* ---- Index toolbar and Filters panel (filters.js) ---- */
.toolbar {
  max-width: 720px;
  margin: 1.1rem auto 0.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}
.toolbar #search { margin: 0; }
.toolbar-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}
.toolbar-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.toolbar-button[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.filters-count {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 999px;
  padding: 0 0.45rem;
  font-size: 0.7rem;
  line-height: 1.3rem;
}
.toolbar-select {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.toolbar-select select {
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.78rem;
}
.toolbar .site-lang-switcher { margin: 0; }
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  align-items: center;
  max-width: 900px;
  margin: 0.4rem auto 0;
}
.filters-panel {
  max-width: 900px;
  margin: 0.6rem auto 0;
  text-align: left;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem 0.7rem;
}
.filters-help, .facet-help { color: var(--muted); font-size: 0.75rem; margin: 0; }
.filters-help { margin-bottom: 0.8rem; }
.facet { margin-bottom: 0.9rem; }
.facet-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.facet-head h3 { margin: 0; font-size: 0.85rem; }
.facet-search {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.75rem;
  width: 12rem;
  max-width: 100%;
}
.facet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}
.chip {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  font-size: 0.76rem;
  line-height: 1.35;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip:focus-visible, .toolbar-button:focus-visible, .link-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chip-on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip-count { opacity: 0.6; font-size: 0.7rem; margin-left: 0.15rem; }
.chip-on .chip-count { opacity: 0.85; }
.chip-facet { opacity: 0.85; }
.link-button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.76rem;
  padding: 0.2rem 0.3rem;
  text-decoration: underline;
}
.filters-panel-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 0.7rem;
}
.filters-panel-footer .archived-toggle { display: inline; margin: 0; }
.filters-panel-footer #filters-done { margin-left: auto; }
.filters-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}
.filters-panel-head .filters-help { margin: 0.25rem 0 0; }
.clear-button {
  flex-shrink: 0;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--red-strong);
  background: transparent;
  color: var(--red-strong);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}
.clear-button:hover:not(:disabled) { background: var(--red-strong); color: var(--on-accent); }
.clear-button:disabled { border-color: var(--border); color: var(--muted); cursor: default; opacity: 0.6; }
.clear-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Icons the crawler found in a README or the repo (shared.js iconExtras) */
.card-head img.icon-found, .detail-icon.icon-found { object-fit: contain; padding: 3px; background: #fff; border: 1px solid var(--border); }
.card-head img.icon-tile, .detail-icon.icon-tile { object-fit: contain; padding: 9px; filter: none; }
.card-head img.icon-tile { padding: 9px; }
.detail-icon.icon-tile { padding: 13px; }

/* Flags are bundled SVGs (shared.js languageFlag), not emoji (issue #14) */
img.flag {
  display: inline-block;
  width: 1.25em;
  height: auto;
  aspect-ratio: 4 / 3;
  vertical-align: -0.15em;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  object-fit: cover;
}
.chip img.flag { margin-right: 0.15rem; }

/* Test overview by install profile (profiles.html) */
.profiles-header, .profiles-root { max-width: 960px; }
.profile-tabs { display: flex; gap: 0.4rem; margin: 1rem 0 0.4rem; flex-wrap: wrap; }
.profile-tab {
  border: 1px solid var(--border); background: var(--card-bg); color: var(--text);
  border-radius: 999px; padding: 0.3rem 0.9rem; font: inherit; font-size: 0.9rem; cursor: pointer;
}
.profile-tab.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.profile-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem; margin: 0.8rem 0 1rem;
}
.profile-box {
  display: flex; flex-direction: column; gap: 0.2rem; padding: 0.9rem 1rem;
  border: 1px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none;
}
.profile-box:hover { border-color: var(--accent); }
.profile-box-title { font-weight: 600; }
.profile-box-big { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.profile-box-big small { font-size: 1rem; color: var(--muted); font-weight: 500; }
.profile-box-sub { font-size: 0.8rem; color: var(--muted); }
.profile-filter { display: flex; gap: 0.4rem; align-items: center; font-size: 0.88rem; color: var(--muted); }
.profile-head-count { font-size: 0.85rem; font-weight: 500; color: var(--muted); margin-left: 0.4rem; }
.profile-table-wrap { overflow-x: auto; margin-bottom: 1rem; }
.profile-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.profile-table th {
  text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--muted); font-weight: 600; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border);
}
.profile-table td { padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.profile-table td a { color: var(--accent); text-decoration: none; }
.profile-table td a:hover { text-decoration: underline; }
.profile-sub { font-size: 0.75rem; color: var(--muted); margin-top: 0.1rem; overflow-wrap: anywhere; }
.profile-out td { opacity: 0.6; }
.profile-kind {
  font-size: 0.72rem; border-radius: 6px; padding: 0.05rem 0.4rem;
  background: var(--subtle); color: var(--muted); white-space: nowrap;
}
.profile-kind-pipeline { background: var(--purple-bg); color: var(--purple); }
.profile-dim { color: var(--muted); }
.compat-fail-text { color: var(--red); font-weight: 600; }
.profile-new { color: var(--faint); }
.profile-pipe-warn { color: var(--gold-text); font-weight: 600; }
.profile-pipe-warn code { font-weight: 500; }
.profile-ok { color: var(--green); font-weight: 600; }
.profile-near { color: var(--olive); font-weight: 600; }
.profile-bad { color: var(--red); font-weight: 600; }
.profile-foot { margin-top: 1.2rem; }
.profile-howto { margin: 0.8rem 0 0.2rem; font-size: 0.88rem; }
.profile-howto summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.profile-howto .legend-table { margin-top: 0.6rem; }
.profile-howto td:first-child { white-space: nowrap; padding-right: 0.8rem; }
@media (max-width: 640px) {
  .profile-howto td:first-child { white-space: normal; max-width: 40vw; }
}
.profile-compare-sum { margin-bottom: 0.4rem; }
.profile-compare-sum td, .profile-compare-sum th { text-align: left; }
.profile-fixed { table-layout: fixed; }
.profile-fixed td:first-child { overflow-wrap: anywhere; }
.profile-fixed .compat-label { white-space: normal; }
@media (max-width: 600px) {
  /* narrow screens: keep the fixed layout (columns still line up), but
     squeeze the type column to nothing and drop the runtime id line */
  .profile-fixed { font-size: 0.8rem; }
  .profile-table th { letter-spacing: 0; text-transform: none; }
  .profile-table td, .profile-table th { padding: 0.4rem 0.3rem; }
  .profile-col-type { width: 0 !important; }
  .profile-fixed:not(.profile-compare-sum) td:nth-child(2),
  .profile-fixed:not(.profile-compare-sum) th:nth-child(2) { padding: 0; overflow: hidden; font-size: 0; }
  .profile-table .profile-sub code { display: none; }
  .profile-fixed .compat-label { font-size: 0.68rem; padding: 0.1rem 0.3rem; }
}

/* Theme button (theme.js) */
.theme-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--shadow);
}
.theme-toggle:hover { border-color: var(--accent); }
