/* =====================================================
   BROLLFINDER — DESIGN SYSTEM
   A script-to-footage tool for video editors.
   Aesthetic: editorial-meets-editing-suite. A warm,
   confident accent (signal orange) borrowed from timeline
   "in/out" markers, set against calm neutral surfaces that
   work identically in light and dark.
   ===================================================== */

/* ---------- Design tokens ---------- */

:root {
  /* Light theme (default) */
  --bg: #faf9f6;
  --bg-raised: #ffffff;
  --bg-sunken: #f0eee8;
  --border: #e3e0d8;
  --border-strong: #d2cec2;
  --text-primary: #1a1814;
  --text-secondary: #5c574c;
  --text-muted: #948e7e;
  --accent: #ff5a1f;
  --accent-strong: #e0480f;
  --accent-text: #ffffff;
  --accent-soft: rgba(255, 90, 31, 0.10);
  --accent-soft-strong: rgba(255, 90, 31, 0.18);
  --success: #1f8a55;
  --success-soft: rgba(31, 138, 85, 0.10);
  --error: #c63d2f;
  --error-soft: rgba(198, 61, 47, 0.08);
  --shadow-color: rgba(26, 24, 20, 0.08);
  --shadow-color-strong: rgba(26, 24, 20, 0.16);
  --overlay-scrim: rgba(20, 18, 14, 0.55);

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, monospace;

  --radius-sm: 5px;
  --radius-md: 9px;
  --radius-lg: 14px;
  --container-width: 1180px;

  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #131210;
  --bg-raised: #1b1916;
  --bg-sunken: #0f0e0c;
  --border: #2c2a25;
  --border-strong: #3d3a32;
  --text-primary: #f3f1ea;
  --text-secondary: #b3ada0;
  --text-muted: #756e60;
  --accent: #ff6a35;
  --accent-strong: #ff8654;
  --accent-text: #18120e;
  --accent-soft: rgba(255, 106, 53, 0.14);
  --accent-soft-strong: rgba(255, 106, 53, 0.22);
  --success: #3fb87f;
  --success-soft: rgba(63, 184, 127, 0.12);
  --error: #e8695a;
  --error-soft: rgba(232, 105, 90, 0.10);
  --shadow-color: rgba(0, 0, 0, 0.35);
  --shadow-color-strong: rgba(0, 0, 0, 0.55);
  --overlay-scrim: rgba(0, 0, 0, 0.65);

  color-scheme: dark;
}

/* Respect system preference until the user explicitly chooses */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #131210;
    --bg-raised: #1b1916;
    --bg-sunken: #0f0e0c;
    --border: #2c2a25;
    --border-strong: #3d3a32;
    --text-primary: #f3f1ea;
    --text-secondary: #b3ada0;
    --text-muted: #756e60;
    --accent: #ff6a35;
    --accent-strong: #ff8654;
    --accent-text: #18120e;
    --accent-soft: rgba(255, 106, 53, 0.14);
    --accent-soft-strong: rgba(255, 106, 53, 0.22);
    --success: #3fb87f;
    --success-soft: rgba(63, 184, 127, 0.12);
    --error: #e8695a;
    --error-soft: rgba(232, 105, 90, 0.10);
    --shadow-color: rgba(0, 0, 0, 0.35);
    --shadow-color-strong: rgba(0, 0, 0, 0.55);
    --overlay-scrim: rgba(0, 0, 0, 0.65);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

body { font-size: 15px; line-height: 1.5; }

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

::selection { background: var(--accent-soft-strong); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

img, video { max-width: 100%; }

button { font-family: inherit; }

/* ---------- Layout shell ---------- */

.shell {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 28px;
}

@media (max-width: 600px) {
  .shell { padding: 0 16px; }
}

.page-body { padding-bottom: 60px; }

/* ---------- Top nav ---------- */

.topnav {
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topnav-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

@media (max-width: 600px) {
  .topnav-inner { padding: 14px 16px; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}

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

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.brand-logo-img {
  height: 32px;
  max-width: 220px;
  width: auto;
  object-fit: contain;
  display: block;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Theme toggle */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-sunken);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

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

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

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .icon-sun { display: block; }
  html:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .icon-moon { display: none; }
}

/* ---------- Ad slots ---------- */

.ad-slot {
  background: var(--bg-sunken);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ad-slot-top {
  width: 100%;
  min-height: 90px;
  margin: 20px 0;
}

.ad-slot-inline {
  width: 100%;
  min-height: 100px;
  margin: 28px 0;
}

.ad-slot-mid-results {
  margin: 0 0 16px;
}

.ad-slot-sidebar {
  width: 100%;
  min-height: 250px;
}

.layout-with-sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: start;
}

/* When both sidebar ad slots are off, the sidebar column is removed
   from the markup entirely (see index.php) - this makes the single
   remaining column take the full width instead of leaving the 280px
   + gap reserved as empty space on the right. */
.layout-with-sidebar.no-sidebar {
  grid-template-columns: 1fr;
}

.main-column {
  min-width: 0;
}

.sidebar-rail {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 84px;
}

@media (max-width: 980px) {
  .layout-with-sidebar { grid-template-columns: 1fr; }
  .sidebar-rail { position: static; flex-direction: row; overflow-x: auto; }
  .sidebar-rail .ad-slot-sidebar { min-width: 280px; flex-shrink: 0; }
}

/* ---------- Hero ---------- */

.hero {
  padding: 56px 0 40px;
}

@media (max-width: 600px) {
  .hero { padding: 36px 0 28px; }
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 18px;
  background: var(--accent-soft);
  padding: 6px 12px;
  border-radius: 999px;
}

.hero-eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.2vw, 50px);
  line-height: 1.08;
  font-weight: 600;
  margin: 0 0 18px;
  max-width: 720px;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.hero h1 em {
  color: var(--accent);
  font-style: normal;
}

.hero p {
  font-size: 16.5px;
  color: var(--text-secondary);
  max-width: 580px;
  line-height: 1.65;
  margin: 0;
}

/* Simplified hero variant: a single centered-left heading, no eyebrow
   or supporting paragraph, less vertical padding. */
.hero-simple {
  padding: 36px 0 24px;
}

.hero-simple h1 {
  margin: 0;
  font-size: clamp(28px, 3.6vw, 42px);
}

@media (max-width: 600px) {
  .hero-simple { padding: 24px 0 16px; }
}

/* ---------- Panels / cards ---------- */

.panel {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 22px;
  box-shadow: 0 1px 2px var(--shadow-color);
}

@media (max-width: 600px) {
  .panel { padding: 20px; border-radius: var(--radius-md); }
}

.panel-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
}

.panel-label .step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 11px;
}

/* ---------- Script input ---------- */

textarea#scriptInput {
  width: 100%;
  min-height: 220px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  padding: 18px;
  resize: vertical;
  transition: border-color 0.15s ease;
}

textarea#scriptInput::placeholder { color: var(--text-muted); }

textarea#scriptInput:focus {
  outline: none;
  border-color: var(--accent);
}

.script-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.script-meta .highlight { color: var(--accent); }

/* ---------- Upload file link + modal ---------- */

.upload-file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease;
}

.upload-file-link svg { width: 15px; height: 15px; flex-shrink: 0; }

.upload-file-link:hover { color: var(--accent); }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-scrim);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--bg-raised);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 460px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
  animation: modal-pop-in 0.18s ease;
}

@keyframes modal-pop-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 0;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.modal-close:hover { background: var(--bg-sunken); color: var(--text-primary); }

.modal-body {
  padding: 18px 22px 24px;
}

.file-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 38px 20px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s ease;
  text-align: center;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

html[data-theme="dark"] .file-drop-zone:hover,
html[data-theme="dark"] .file-drop-zone.drag-over {
  color: var(--accent);
}

.file-drop-zone svg { width: 34px; height: 34px; margin-bottom: 4px; }

.file-drop-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.file-drop-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.file-upload-status {
  margin-top: 14px;
  font-size: 13px;
  text-align: center;
  min-height: 20px;
}

.file-upload-status.is-loading { color: var(--text-secondary); }
.file-upload-status.is-success { color: var(--success); }
.file-upload-status.is-error { color: var(--error); }

/* ---------- Filters ---------- */

.filters-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

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

.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

/* Custom-styled native <select> dropdowns - consistent look across
   browsers, with a custom chevron icon, while still being a real
   <select> for accessibility and mobile-native picker support. */

.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--text-secondary);
  border-bottom: 2px solid var(--text-secondary);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.select-wrap select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 38px 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.select-wrap select:hover { border-color: var(--border-strong); }

.select-wrap select:focus {
  outline: none;
  border-color: var(--accent);
}

.lines-stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-sunken);
  overflow: hidden;
}

.lines-stepper button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  width: 42px;
  height: 42px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lines-stepper button:hover { color: var(--accent); background: var(--bg-raised); }

.lines-stepper input {
  flex: 1;
  text-align: center;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 15px;
  -moz-appearance: textfield;
}

.lines-stepper input::-webkit-outer-spin-button,
.lines-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.field-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.5;
}

/* ---------- Action row ---------- */

.action-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 13px 24px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}

.btn-primary:hover { background: var(--accent-strong); }
.btn-primary:disabled { background: var(--border-strong); color: var(--text-muted); cursor: not-allowed; }

.btn-secondary {
  background: var(--bg-sunken);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover { border-color: var(--border-strong); background: var(--bg-raised); }
.btn-secondary:disabled { color: var(--text-muted); cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  font-size: 13px;
  padding: 8px 4px;
}

.btn-ghost:hover { color: var(--accent); }

/* ---------- Status / progress ---------- */

#statusBar {
  display: none;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 18px;
}

#statusBar.active { display: flex; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.progress-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  max-width: 220px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  width: 0%;
  transition: width 0.25s ease;
}

.error-box {
  background: var(--error-soft);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-top: 16px;
  display: none;
}

.error-box.active { display: block; }

/* ---------- About / How-to-use info panel ---------- */

.info-panel.hidden { display: none; }

.info-block { margin-bottom: 36px; }
.info-block:last-child { margin-bottom: 0; }

.info-block h2 {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text-primary);
}

.info-block > p {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 15px;
  max-width: 700px;
  margin: 0;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 36px;
}

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

.info-card {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
}

.info-icon {
  width: 44px;
  height: 44px;
  color: var(--accent);
  margin-bottom: 14px;
}

.info-icon svg { width: 100%; height: 100%; }

.info-card h3 {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.info-card p {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.steps-list {
  margin: 0;
  padding-left: 22px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.8;
  max-width: 720px;
}

.steps-list li { margin-bottom: 12px; }
.steps-list li:last-child { margin-bottom: 0; }
.steps-list strong { color: var(--text-primary); }

/* ---------- Results ---------- */

#resultsSection { display: none; }
#resultsSection.active { display: block; }

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 14px;
}

.results-header h2 {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.results-stats {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.group-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
  background: var(--bg-raised);
}

.group-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sunken);
}

.group-number {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 4px 9px;
  white-space: nowrap;
  margin-top: 2px;
}

html[data-theme="dark"] .group-number { color: var(--accent); }

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

.group-lines {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0 0 6px;
}

.group-keywords {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.group-keywords span { color: var(--accent); }

.options-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 18px 20px;
}

@media (max-width: 900px) {
  .options-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .options-grid { grid-template-columns: 1fr 1fr; }
}

.option-card {
  position: relative;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-sunken);
  transition: border-color 0.15s ease, transform 0.1s ease;
  aspect-ratio: 4 / 3;
}

.option-card:hover { border-color: var(--border-strong); }
.option-card.selected { border-color: var(--accent); }

.option-card img,
.option-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--bg-sunken);
}

.option-card .thumb-skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, var(--bg-sunken) 30%, var(--border) 50%, var(--bg-sunken) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0% { background-position: 150% 0; }
  100% { background-position: -50% 0; }
}

.option-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--overlay-scrim);
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  z-index: 2;
}

.option-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--overlay-scrim);
  border: 1px solid rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
  transition: all 0.15s ease;
  z-index: 2;
}

.option-card.selected .option-check {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.option-source {
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(255,255,255,0.9);
  background: var(--overlay-scrim);
  padding: 2px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  z-index: 2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  width: fit-content;
  max-width: calc(100% - 12px);
}

.option-source:hover {
  text-decoration: underline;
}

.group-empty {
  padding: 18px 20px;
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font-mono);
}

.group-source-warning {
  padding: 8px 20px 16px;
  color: var(--text-muted);
  font-size: 11.5px;
  font-family: var(--font-mono);
  border-top: 1px solid var(--border);
  margin-top: 2px;
  line-height: 1.5;
}

.group-card.is-pending .group-header { opacity: 0.5; }
.group-card.is-pending .options-grid { min-height: 100px; }

/* ---------- Sticky download bar ---------- */

.download-bar {
  position: sticky;
  bottom: 20px;
  margin-top: 28px;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 12px 32px var(--shadow-color-strong);
}

.download-bar-info {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
}

.download-bar-info strong { color: var(--accent); }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 56px;
  border-top: 1px solid var(--border);
  background: var(--bg-raised);
}

.footer-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 40px 28px 32px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .footer-inner { padding: 32px 16px 24px; }
}

.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 14px;
}

.footer-col a {
  display: block;
  color: var(--text-secondary);
  font-size: 13.5px;
  margin-bottom: 10px;
}

.footer-col a:hover { color: var(--text-primary); text-decoration: none; }

.footer-bottom {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding: 18px 28px;
  max-width: var(--container-width);
  margin: 0 auto;
}

/* ---------- Static content pages (About / Privacy) ---------- */

.content-page {
  padding: 48px 0 20px;
  max-width: 720px;
}

.content-page h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.content-page .updated-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 36px;
}

.content-page h2 {
  font-family: var(--font-display);
  font-size: 21px;
  margin: 36px 0 12px;
  color: var(--text-primary);
}

.content-page p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0 0 16px;
  font-size: 15px;
}

.content-page ul {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 15px;
  padding-left: 22px;
}

.content-page li { margin-bottom: 8px; }

/* ---------- Contact form ---------- */

.contact-form-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-top: 32px;
  box-shadow: 0 1px 2px var(--shadow-color);
}

.contact-form-row {
  margin-bottom: 18px;
}

.contact-form-row label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.contact-form-row .optional-tag {
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
}

.contact-form-row input,
.contact-form-row textarea {
  width: 100%;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14.5px;
  padding: 12px 14px;
  transition: border-color 0.15s ease;
}

.contact-form-row textarea {
  resize: vertical;
  min-height: 130px;
  line-height: 1.6;
}

.contact-form-row input:focus,
.contact-form-row textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.contact-form-status {
  font-size: 13.5px;
  min-height: 20px;
  margin-bottom: 14px;
}

.contact-form-status.is-success { color: var(--success); }
.contact-form-status.is-error { color: var(--error); }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- Focus visibility ---------- */

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
.option-card:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
