/* Site styles for the gallery (index.html), viewer (view.html) and docs
   (documentation.html). Scoreboard pages don't load this file.

   Styled to match the scorer app (solidconnect-scorer): Inter, a fixed
   black-to-grey gradient, white panels with black text, small bold uppercase
   headings, translucent black buttons, green for "go" actions and red for
   errors. Colours are Tailwind's, as the scorer uses them. */

:root {
  --black-90: rgba(0, 0, 0, 0.9);
  --black-80: rgba(0, 0, 0, 0.8);
  --black-70: rgba(0, 0, 0, 0.7);
  --black-60: rgba(0, 0, 0, 0.6);
  --black-50: rgba(0, 0, 0, 0.5);
  --black-40: rgba(0, 0, 0, 0.4);
  --black-10: rgba(0, 0, 0, 0.1);
  --black-5: rgba(0, 0, 0, 0.05);
  --white-95: rgba(255, 255, 255, 0.95);
  --white-70: rgba(255, 255, 255, 0.7);
  --white-50: rgba(255, 255, 255, 0.5);
  --white-10: rgba(255, 255, 255, 0.1);
  --gray-700: #374151;
  --gray-900: #111827;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-50: #f0fdf4;
  --green-800: #166534;
  --red-600: #dc2626;
  --orange-50: #fff7ed;
  --orange-800: #9a3412;
  --amber-300: #fcd34d;
  --radius: 4px;      /* rounded */
  --radius-md: 6px;   /* rounded-md */
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.25), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
  --shadow-field: 0 0 20px rgba(0, 0, 0, 0.1);
  --gap: 0.75rem;     /* p-3, the scorer's page padding */
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

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

[hidden] { display: none !important; }

html {
  background: #000 linear-gradient(to bottom right, #000, var(--gray-700)) fixed no-repeat;
  background-size: cover;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  color: #fff;
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
a:hover { opacity: 0.75; }

code, kbd, pre, .mono { font-family: var(--mono); }
code { font-size: 0.88em; }

:focus-visible { outline: 2px solid #22c55e; outline-offset: 2px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* White panel, as the scorer's settings sections (bg-white/95 rounded shadow-md text-black) */
.panel,
.card,
.toolbar,
.viewer-bar,
.docs-content section {
  background: var(--white-95);
  color: #000;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

/* ---------- Site header (the scorer's: logo, a black title pill, white/70 links) ---------- */

.site-header {
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: var(--gap) calc(var(--gap) + 0.25rem);
}

.site-brand {
  display: flex;
  align-items: center;
  gap: var(--gap);
  color: #fff;
  text-decoration: none;
  min-width: 0;
}

.site-brand:hover { opacity: 1; }
.site-brand img { height: 36px; width: auto; display: block; }

.site-brand span {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  background: #000;
  color: var(--white-70);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 0.85rem;
  border-radius: 999px;
  color: var(--white-70);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.site-nav a:hover { color: #fff; opacity: 1; }
.site-nav a[aria-current="page"] { background: #000; color: #fff; }

@media (max-width: 640px) {
  .site-brand span { display: none; }
  .site-nav a { padding: 0 0.6rem; }
}

/* ---------- Shared controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 36px;
  padding: 0 0.9rem;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--black-5);
  color: var(--black-80);
  font: 600 0.875rem/1 var(--font);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn:hover { background: var(--black-10); opacity: 1; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; flex: none; }
.btn--icon { width: 36px; padding: 0; }

/* Go actions (the scorer's Login button) */
.btn--primary { background: var(--green-600); color: #fff; }
.btn--primary:hover { background: var(--green-700); }

/* The scorer's list buttons (bg-black/70 text-white) */
.btn--dark { background: var(--black-70); color: #fff; }
.btn--dark:hover { background: var(--black-80); }

/* On the dark background */
.btn--light { background: var(--white-95); color: #000; box-shadow: var(--shadow-md); }
.btn--light:hover { background: #fff; }

.input,
.select {
  height: 36px;
  padding: 0 0.75rem;
  border: 0;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-field);
  color: #000;
  font: 0.875rem var(--font);
  min-width: 0;
}

.select { padding-right: 1.8rem; }
.input::placeholder { color: var(--black-40); }
.input:focus, .select:focus { outline: 2px solid var(--black-70); outline-offset: 0; }

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--radius-md);
  background: var(--black-5);
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--black-60);
  font: 600 0.8125rem/1 var(--font);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.segmented button:hover { color: #000; }
.segmented button[aria-pressed="true"],
.segmented button[aria-selected="true"] { background: var(--black-70); color: #fff; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
  color: var(--black-80);
  cursor: pointer;
  user-select: none;
}

.switch input {
  appearance: none;
  width: 34px;
  height: 20px;
  margin: 0;
  border-radius: 999px;
  background: var(--black-10);
  position: relative;
  cursor: pointer;
  flex: none;
  transition: background-color 0.15s ease;
}

.switch input::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}

.switch input:checked { background: var(--green-600); }
.switch input:checked::before { transform: translateX(14px); }

.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 0.5rem;
  border-radius: 999px;
  background: var(--black-5);
  color: var(--black-60);
  font: 700 0.6875rem/1 var(--font);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge--size { font: 500 0.6875rem/1 var(--mono); text-transform: none; letter-spacing: 0; }
.badge--wip { background: var(--orange-50); color: var(--orange-800); }
.badge--draft { background: var(--green-50); color: var(--green-800); }
.badge--muted { color: var(--black-50); }

/* A scoreboard page rendered at its real size and scaled to fit its box */
.screen {
  position: relative;
  overflow: hidden;
  background: #000;
  flex: none;
}

.screen iframe {
  position: absolute;
  top: 0;
  left: 0;
  border: 0;
  display: block;
  transform-origin: 0 0;
  background: #000;
}

/* ---------- Gallery (index.html) ---------- */

.gallery-page main {
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 calc(var(--gap) + 0.25rem) 4rem;
}

.intro {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 1.5rem 0.25rem 1.5rem;
}

.intro h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.intro p { margin: 0; color: var(--white-70); max-width: 62ch; }
.intro-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.toolbar {
  position: sticky;
  top: var(--gap);
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.75rem;
  box-shadow: var(--shadow-lg);
}

.sport-tabs {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.sport-tabs::-webkit-scrollbar { display: none; }

.sport-tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 0;
  background: transparent;
  color: var(--black-60);
  font: 600 0.875rem/1 var(--font);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sport-tab:hover { color: #000; background: var(--black-5); }
.sport-tab[aria-selected="true"] { color: #fff; background: var(--black-70); }

.sport-tab .count { font: 500 0.75rem/1 var(--mono); color: var(--black-40); }
.sport-tab[aria-selected="true"] .count { color: var(--white-70); }

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.filters .search { position: relative; flex: 0 1 280px; }
.filters .search .input { width: 100%; padding-left: 2.1rem; }

.filters .search svg {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  color: var(--black-40);
  pointer-events: none;
}

.result-count { font-size: 0.8125rem; color: var(--black-50); }

.family {
  padding-top: 2rem;
  scroll-margin-top: 140px;
}

.family-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem 0.6rem;
  margin: 0 0.25rem 0.75rem;
}

.family-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.family-head .count { font: 500 0.8rem var(--mono); color: var(--white-50); }
.family-head p { margin: 0; flex-basis: 100%; color: var(--white-70); font-size: 0.875rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: var(--gap);
}

@media (min-width: 700px) {
  .card--wide { grid-column: span 2; }
  .card--strip { grid-column: span 2; }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.card:has(.card-link:focus-visible) { outline: 2px solid #22c55e; outline-offset: 2px; }

.card-stage {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  margin: 0.5rem 0.5rem 0;
  border-radius: var(--radius);
  background: var(--black-5);
}

.card--strip .card-stage { height: 110px; }
.card-stage .screen { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); border-radius: 2px; }

.card-body {
  display: flex;
  align-items: start;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem 0.85rem;
}

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

.card-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.3;
}

.card-link { color: #000; text-decoration: none; }
.card-link:hover { opacity: 1; }
.card-link:focus-visible { outline: none; }

/* The whole card opens the viewer */
.card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-top: 0.35rem;
}

.card-slug { font: 0.75rem var(--mono); color: var(--black-50); }

.card-note {
  margin: 0.4rem 0 0;
  font-size: 0.8125rem;
  color: var(--black-60);
  line-height: 1.4;
}

.card-open {
  position: relative;
  z-index: 2;
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  color: var(--black-40);
}

.card-open:hover { color: #000; background: var(--black-5); opacity: 1; }
.card-open svg { width: 14px; height: 14px; }

.empty {
  padding: 4rem 1rem;
  text-align: center;
  color: var(--white-70);
}

/* ---------- Viewer (view.html) ---------- */

.viewer-page { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }

.viewer {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: var(--gap);
  padding: 0 var(--gap) var(--gap);
}

.viewer-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.viewer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem;
}

.viewer-bar .group { display: flex; align-items: center; gap: 0.4rem; }
.viewer-bar .divider { width: 1px; height: 24px; background: var(--black-10); margin: 0 0.25rem; }
.viewer-bar .spacer { flex: 1; }
.viewer-bar #theme-select { max-width: 260px; }
.size-inputs { display: flex; align-items: center; gap: 0.3rem; color: var(--black-40); font-size: 0.85rem; }
.size-inputs .input { width: 70px; font-family: var(--mono); font-size: 0.8125rem; padding: 0 0.5rem; }

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 32px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.08) 1px, transparent 0) 0 0 / 16px 16px,
    rgba(0, 0, 0, 0.35);
}

.stage-inner { position: relative; }
.stage .screen { box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }

.resize-handle {
  position: absolute;
  right: -30px;
  bottom: -30px;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-md);
  display: grid;
  place-items: center;
  touch-action: none;
}

.resize-handle::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--black-50);
  border-bottom: 2px solid var(--black-50);
}

.resize-handle:hover::before { border-color: #000; }

.stage-status {
  position: absolute;
  left: 12px;
  bottom: 10px;
  margin: 0;
  font: 0.75rem var(--mono);
  color: var(--white-50);
  pointer-events: none;
}

.viewer-side {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.panel { padding: 1rem; flex: none; }

.panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
}

.theme-title { margin: 0 0 0.5rem; font-size: 1.25rem; font-weight: 800; line-height: 1.2; }
.theme-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.9rem; }
.theme-note { margin: 0 0 0.9rem; color: var(--black-60); font-size: 0.875rem; }

.facts { display: grid; gap: 0.6rem; margin: 0; }
.facts div { display: grid; gap: 0.15rem; }
.facts dt { font-size: 0.75rem; color: var(--black-50); }
.facts dd { margin: 0; display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.facts dd code { overflow-wrap: anywhere; color: #000; font-size: 0.8125rem; }
.facts dd a { font: 0.8125rem var(--mono); overflow-wrap: anywhere; }

.copy-btn {
  flex: none;
  border: 0;
  background: none;
  color: var(--black-40);
  padding: 3px;
  cursor: pointer;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
}

.copy-btn:hover { color: #000; background: var(--black-5); }
.copy-btn svg { width: 14px; height: 14px; }
.copy-btn.is-copied { color: var(--green-600); }

.panel-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }

.checks { display: grid; gap: 0.65rem; }
.hint { margin: 0.6rem 0 0; font-size: 0.75rem; color: var(--black-50); line-height: 1.5; }
.hint code { color: var(--black-70); }

.editor-field { display: grid; gap: 0.25rem; margin-bottom: 0.75rem; }
.editor-field label { font-size: 0.75rem; color: #000; }
.editor-field .input { width: 100%; height: 44px; font-family: var(--mono); font-size: 0.875rem; }

.editor {
  width: 100%;
  min-height: 300px;
  resize: vertical;
  padding: 0.75rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--gray-900);
  color: #e5e7eb;
  font: 0.78rem/1.6 var(--mono);
  tab-size: 2;
  white-space: pre;
}

.editor:focus { outline: 2px solid var(--black-70); outline-offset: 0; }

.dropzone-active .editor { outline: 2px dashed var(--green-600); outline-offset: 0; }

.status { margin: 0.6rem 0 0; font-size: 0.8125rem; color: var(--black-60); min-height: 1.2em; }
.status--error { color: var(--red-600); font-weight: 600; }

.share-row { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.6rem; scroll-margin-bottom: 1rem; }
.share-row .input { flex: 1; font-family: var(--mono); font-size: 0.75rem; }

.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 960px) {
  .viewer-page { height: auto; overflow: visible; display: block; }
  .viewer { display: flex; flex-direction: column; }
  .stage { flex: none; height: 62vh; min-height: 320px; padding: 20px; }
  .viewer-side { overflow: visible; }
  .viewer-bar #theme-select { max-width: none; flex: 1; }
}

/* ---------- Docs (documentation.html) ---------- */

.docs {
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 calc(var(--gap) + 0.25rem) 5rem;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 2rem;
}

.docs-nav {
  position: sticky;
  top: var(--gap);
  align-self: start;
  max-height: calc(100vh - 2 * var(--gap));
  overflow-y: auto;
  padding: 1.5rem 0 2rem;
}

.docs-nav h2 {
  margin: 1.25rem 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--white-50);
}

.docs-nav h2:first-child { margin-top: 0; }
.docs-nav ul { list-style: none; margin: 0; padding: 0; }

.docs-nav a {
  display: block;
  padding: 0.35rem 0.75rem;
  margin-left: -0.75rem;
  border-radius: var(--radius-md);
  color: var(--white-70);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.docs-nav a:hover { color: #fff; opacity: 1; }
.docs-nav a[aria-current="true"] { color: #fff; background: #000; }

.docs-content { padding: 1.5rem 0 0; min-width: 0; }

.docs-content h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.docs-content .lede { font-size: 1.0625rem; color: var(--white-70); margin: 0 0 1.5rem; }

/* Each section is a white panel, like the scorer's settings */
.docs-content section {
  margin-top: var(--gap);
  padding: 1.25rem 1.5rem 0.5rem;
  scroll-margin-top: var(--gap);
}

.docs-content h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  text-transform: uppercase;
}

/* Headings can carry old anchors (e.g. #custom-google-fonts) */
.docs-content h2,
.docs-content h3 {
  scroll-margin-top: var(--gap);
}

.docs-content h3 {
  margin: 1.5rem 0 0.5rem;
  font-size: 0.9375rem;
  font-weight: 700;
}

.docs-content section p,
.docs-content section li { color: var(--black-80); }
.docs-content p { margin: 0 0 1rem; }
.docs-content ul, .docs-content ol { margin: 0 0 1rem; padding-left: 1.3rem; }
.docs-content li { margin-bottom: 0.45rem; }
.docs-content li::marker { color: var(--black-40); }
.docs-content section strong { color: #000; }
.docs-content :not(pre) > code {
  padding: 0.12em 0.35em;
  border-radius: var(--radius);
  background: var(--black-5);
  color: #000;
  overflow-wrap: anywhere;
}

.code {
  position: relative;
  margin: 0 0 1.25rem;
}

.code pre {
  margin: 0;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  background: var(--gray-900);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: #e5e7eb;
}

.code .copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 5px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--white-70);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.code .copy-btn:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }
.code .copy-btn.is-copied { color: #4ade80; }
.code:hover .copy-btn, .code .copy-btn:focus-visible, .code .copy-btn.is-copied { opacity: 1; }

/* Notices, as the scorer's (bg-black/5 info, bg-orange-50 text-orange-800 warning) */
.callout {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: var(--black-5);
}

.callout p:last-child { margin-bottom: 0; }
.callout--warn { background: var(--orange-50); }
.docs-content .callout--warn p,
.docs-content .callout--warn strong,
.docs-content .callout--warn code { color: var(--orange-800); }

.docs-content .rules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
  counter-reset: rule;
}

.rules li {
  margin: 0;
  padding: 1rem;
  background: var(--black-5);
  border-radius: var(--radius);
  font-size: 0.875rem;
  counter-increment: rule;
}

.rules li::before {
  content: counter(rule);
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-bottom: 0.6rem;
  border-radius: 50%;
  background: var(--black-70);
  color: #fff;
  font: 700 0.75rem/1 var(--font);
}

.rules strong { display: block; margin-bottom: 0.2rem; }

.table-wrap { overflow-x: auto; margin: 0 0 1.25rem; }

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.docs-content th, .docs-content td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--black-10);
}

.docs-content th { color: var(--black-50); font-weight: 700; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }
.docs-content td { color: var(--black-80); }

/* Markup reference tree */
.markup-ref {
  border-radius: var(--radius);
  margin: 0 0 1.25rem;
  overflow: hidden;
}

.markup-ref-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem;
  background: #f3f4f6;
  box-shadow: inset 0 -1px 0 var(--black-10);
}
.markup-ref-bar .input { flex: 1 1 180px; font-family: var(--mono); font-size: 0.8rem; }

.markup-tree {
  background: var(--gray-900);
  max-height: 560px;
  overflow: auto;
  padding: 0.6rem 0.4rem 0.8rem;
  font: 0.8rem/1.65 var(--mono);
  color: #e5e7eb;
}

.markup-tree ul { list-style: none; margin: 0; padding-left: 1.1rem; border-left: 1px solid var(--white-10); }
.markup-tree > ul { border-left: 0; padding-left: 0.4rem; }
.markup-tree li { margin: 0; color: inherit; }
.markup-tree summary { cursor: pointer; list-style: none; }
.markup-tree summary::-webkit-details-marker { display: none; }
.markup-tree summary::before { content: "▸"; display: inline-block; width: 1em; color: #6b7280; }
.markup-tree details[open] > summary::before { content: "▾"; }
.markup-tree .leaf::before { content: ""; display: inline-block; width: 1em; }
.markup-tree .tag { color: #6b7280; }
.markup-tree .cls { color: #f9fafb; }
.markup-tree .mod { color: var(--amber-300); }
.markup-tree .txt { color: #9ca3af; }
.markup-tree .times { color: #fdba74; }
.markup-tree mark { background: rgba(252, 211, 77, 0.3); color: inherit; border-radius: 2px; }
.markup-tree .is-hidden { display: none; }
.markup-tree .hint { color: #9ca3af; }

@media (max-width: 860px) {
  .docs { grid-template-columns: 1fr; gap: 0; }
  .docs-nav { position: static; max-height: none; padding-bottom: 0; }
  .docs-nav ul { display: flex; flex-wrap: wrap; gap: 0.15rem 0.6rem; }
  .docs-nav a { margin-left: 0; padding: 0.25rem 0.6rem; }
  .docs-content section { padding: 1rem 1rem 0.25rem; }
}

/* ---------- Phones ---------- */

@media (max-width: 640px) {
  .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .segmented::-webkit-scrollbar { display: none; }
  .filters .search { flex: 1 1 auto; }
  .viewer-bar .group { width: 100%; }
  .viewer-bar .group .select { flex: 1 1 0; min-width: 0; }
  .viewer-bar .divider, .viewer-bar .spacer { display: none; }
}
