@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;0,9..144,600;1,9..144,300;1,9..144,400&family=Instrument+Sans:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Mono:wght@300;400;500;600&display=swap");

:root,
:root[data-theme="dark"] {
  --ink:           #0a0a0c;
  --ink-rise:      #101015;
  --ink-hover:     #16161d;
  --line:          rgba(245, 241, 234, 0.08);
  --line-strong:   rgba(245, 241, 234, 0.18);
  --line-gold:    rgba(201, 169, 110, 0.32);

  --paper:         #ece6d8;
  --paper-dim:     #968f80;
  --paper-faint:   #5e584e;

  --gold:          #c9a96e;
  --gold-bright:   #e1c282;
  --gold-soft:     rgba(201, 169, 110, 0.16);
  --gold-faint:    rgba(201, 169, 110, 0.06);

  --positive:      #84b685;
  --negative:      #d4685a;
  --neutral:       #6e6a60;

  --grain-blend:   overlay;
  --grain-opacity: 0.035;

  --font-display:  "Fraunces", "Times New Roman", serif;
  --font-body:     "Instrument Sans", "Helvetica Neue", sans-serif;
  --font-mono:     "IBM Plex Mono", "SF Mono", "Courier New", monospace;

  --gutter:        clamp(20px, 4vw, 56px);
  --max:           1480px;
}

:root[data-theme="light"] {
  --ink:           #f8f3e8;
  --ink-rise:      #f1ebda;
  --ink-hover:     #ebe4d0;
  --line:          rgba(20, 18, 12, 0.10);
  --line-strong:   rgba(20, 18, 12, 0.22);
  --line-gold:    rgba(141, 105, 50, 0.42);

  --paper:         #1c1814;
  --paper-dim:     #5e564a;
  --paper-faint:   #908874;

  --gold:          #8d6932;
  --gold-bright:   #b08642;
  --gold-soft:     rgba(141, 105, 50, 0.18);
  --gold-faint:    rgba(141, 105, 50, 0.07);

  --positive:      #4f8a5d;
  --negative:      #aa4a3a;
  --neutral:       #7a7468;

  --grain-blend:   multiply;
  --grain-opacity: 0.05;
}

html { transition: background-color 0.4s ease; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 70% 50% at 12% 0%, var(--gold-faint), transparent 60%),
    radial-gradient(ellipse 80% 60% at 95% 8%, var(--gold-faint), transparent 65%),
    var(--ink);
  background-attachment: fixed;
  transition: background-color 0.4s ease;
}

/* Subtle film grain on top of everything */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: var(--grain-blend);
}

.ambient { display: none; }

::selection { background: var(--gold-soft); color: var(--gold-bright); }

/* ───────────────────── LAYOUT ───────────────────── */

.app {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter) 96px;
}

/* ───────────────────── HERO ───────────────────── */

.hero {
  display: block;
  margin: 0;
  padding: 0;
  background: none;
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 0 24px;
  border-bottom: 1px solid var(--line);
}

.topbar-brand {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.32em;
  color: var(--paper-dim);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-toggle {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  background: transparent;
}

.theme-toggle button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--paper-faint);
  padding: 6px 14px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  transition: color 0.25s ease, background 0.25s ease;
  border-right: 1px solid var(--line-strong);
}

.theme-toggle button:last-child { border-right: none; }
.theme-toggle button:hover { color: var(--paper); }

.theme-toggle button.active {
  color: var(--ink);
  background: var(--gold);
}

.hero > div:first-child {
  padding: 56px 0 24px;
  max-width: 720px;
}

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 10.5px;
  color: var(--gold);
  margin: 0 0 28px;
}

.eyebrow::before {
  content: "00 / ";
  color: var(--paper-faint);
}

h1 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 300;
  font-style: italic;
  font-size: clamp(48px, 7vw, 96px);
  line-height: 0.98;
  letter-spacing: -0.02em;
  margin: 0 0 28px;
  color: var(--paper);
}

h1::after {
  content: "";
  display: block;
  width: 64px;
  height: 1px;
  background: var(--gold);
  margin-top: 32px;
}

.subhead {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--paper-dim);
  max-width: 560px;
  margin: 0;
}

.hero-meta {
  margin: 32px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--paper-dim);
}

.hero-meta .sep {
  color: var(--paper-faint);
  opacity: 0.5;
}

/* The dominance card — inscribed-ticker block */

.dominance-card {
  position: relative;
  margin: 56px 0 0;
  padding: 48px 0 56px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 48px;
  align-items: center;
  background: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.dominance-card::before {
  content: "INDEX";
  position: absolute;
  top: 16px;
  left: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--paper-faint);
}

.dominance-label {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 10.5px;
  color: var(--paper-dim);
  margin: 0 0 14px;
}

.dominance-score {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(140px, 18vw, 240px);
  line-height: 0.85;
  letter-spacing: -0.04em;
  color: var(--paper);
  margin: 0;
  font-variant-numeric: lining-nums;
}

.dominance-status {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 13px;
  color: var(--gold);
  font-weight: 500;
  margin: 18px 0 28px;
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--line-gold);
  background: var(--gold-faint);
  transition: background 0.4s ease, border-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease;
}

.dominance-status.status-at-risk {
  color: var(--negative);
  border-color: rgba(212, 104, 90, 0.45);
  background: rgba(212, 104, 90, 0.08);
}

.dominance-status.status-slipping {
  color: var(--paper-dim);
  border-color: var(--line-strong);
  background: transparent;
}

.dominance-status.status-stable {
  color: var(--paper);
  border-color: var(--line-strong);
  background: rgba(245, 241, 234, 0.04);
}

.dominance-status.status-gaining {
  color: var(--gold);
  border-color: var(--line-gold);
  background: var(--gold-faint);
}

.dominance-status.status-dominating {
  color: var(--gold-bright);
  border-color: rgba(225, 194, 130, 0.55);
  background: rgba(225, 194, 130, 0.12);
  box-shadow: 0 0 32px rgba(225, 194, 130, 0.18);
}

.dominance-bar {
  position: relative;
  width: 100%;
  height: 2px;
  background: var(--line);
  border-radius: 0;
  overflow: visible;
  margin: 32px 0 12px;
}

.dominance-fill {
  height: 100%;
  background: var(--gold);
  width: 0%;
  transition: width 1.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
}

.dominance-fill::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -5px;
  width: 2px;
  height: 12px;
  background: var(--gold-bright);
}

.dominance-foot {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-faint);
  display: flex;
  justify-content: space-between;
}

.dominance-foot::before { content: "0"; }
.dominance-foot::after { content: "160"; }

/* ───────────────────── CONTROLS ───────────────────── */

.controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr) auto;
  gap: 0;
  margin: 0;
  padding: 0;
  background: none;
  box-shadow: none;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
}

.control {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px 24px 24px 0;
  border-right: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--paper-dim);
}

.control:first-child { padding-left: 0; }
.control:nth-child(4) { padding-right: 24px; }

.control input,
.control select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--paper);
  cursor: pointer;
}

.control input:focus,
.control select:focus {
  outline: none;
  color: var(--gold-bright);
}

.control input::-webkit-calendar-picker-indicator {
  filter: invert(0.6) sepia(1) hue-rotate(5deg) saturate(0.6);
  cursor: pointer;
}

.control select {
  background-image: linear-gradient(45deg, transparent 50%, var(--paper-dim) 50%),
                    linear-gradient(135deg, var(--paper-dim) 50%, transparent 50%);
  background-position: calc(100% - 12px) 50%, calc(100% - 7px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 24px;
}

.control select option {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
}

#applyFilters {
  border: none;
  background: var(--gold);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  padding: 0 28px;
  margin-left: 24px;
  cursor: pointer;
  align-self: stretch;
  transition: background 0.25s ease;
  border-radius: 0;
  box-shadow: none;
}

#applyFilters:hover { background: var(--gold-bright); transform: none; }

/* ───────────────────── SECTION CHROME ───────────────────── */

.section-block {
  padding: 80px 0 0;
  border-top: 1px solid var(--line);
  margin-top: 56px;
}

.section-block:first-of-type { border-top: none; margin-top: 0; padding-top: 64px; }

.section-marker {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  color: var(--gold);
  margin: 0 0 14px;
}

.section-marker .num {
  color: var(--paper-faint);
  margin-right: 14px;
}

.section-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(28px, 3.6vw, 44px);
  letter-spacing: -0.015em;
  line-height: 1.05;
  margin: 0 0 14px;
  color: var(--paper);
}

.section-sub {
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--paper-dim);
  max-width: 620px;
  margin: 0 0 36px;
  font-style: italic;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin: 0 0 36px;
  border-bottom: none;
  padding: 0;
}

.section-header > div { padding: 0; }
.section-header h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(24px, 2.6vw, 32px);
  letter-spacing: -0.012em;
  margin: 0 0 8px;
  color: var(--paper);
}
.section-header p {
  margin: 0;
  font-size: 13.5px;
  color: var(--paper-dim);
  font-style: italic;
}

#sourceCount {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--paper-dim);
  white-space: nowrap;
}

/* ───────────────────── KPI ROW ───────────────────── */

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric-card {
  background: none;
  border: none;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 28px 28px 32px;
  box-shadow: none;
  position: relative;
  transition: background 0.3s ease;
}

.metric-card:last-child { border-right: none; }
.metric-card:hover { background: var(--ink-rise); }

.metric-card h3 {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  color: var(--paper-dim);
  margin: 0 0 24px;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 38px;
  font-weight: 400;
  line-height: 1;
  color: var(--paper);
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums lining-nums;
}

.metric-caption {
  font-family: var(--font-body);
  font-size: 12.5px;
  font-style: italic;
  color: var(--paper-faint);
  margin: 14px 0 0;
}

.metric-delta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 14px 0 0;
  font-family: var(--font-mono);
}

.delta-value {
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: 0.02em;
}

.delta-value.positive { color: var(--positive); }
.delta-value.negative { color: var(--negative); }
.delta-value.neutral  { color: var(--paper-faint); }

.delta-value .arrow {
  display: inline-block;
  margin-right: 4px;
  font-size: 10px;
  vertical-align: 1px;
}

.delta-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--paper-faint);
}

.metric-spark {
  margin-top: 16px;
  height: 32px;
  width: 100%;
  position: relative;
}

.metric-spark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.metric-spark::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--line);
}

/* ───────────────────── BRAND vs NON-BRAND SPLIT ───────────────────── */

.brand-split,
.competitive,
.seo-progress { padding-top: 56px; margin-top: 0; }

.split-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.split-card {
  background: none;
  border: none;
  border-right: 1px solid var(--line);
  border-top: none;
  border-radius: 0;
  padding: 32px 28px 36px;
  box-shadow: none;
  position: relative;
}

.split-card:last-child { border-right: none; }

.split-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 1px;
  background: var(--line-strong);
}

.split-card.brand::before { background: var(--paper-dim); }
.split-card.non-brand::before { background: var(--gold); width: 64px; }
.split-card.total::before { background: var(--paper-faint); }

.split-label {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 10.5px;
  color: var(--paper-dim);
  margin: 0 0 18px;
}

.split-card.non-brand .split-label::after {
  content: "  · KEY METRIC";
  color: var(--gold);
}

.split-value {
  font-family: var(--font-mono);
  font-size: 44px;
  font-weight: 400;
  line-height: 1;
  color: var(--paper);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums lining-nums;
  margin: 0;
}

.split-card.non-brand .split-value { color: var(--gold-bright); }

.split-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--paper-faint);
  letter-spacing: 0.04em;
  margin: 16px 0 0;
}

/* ───────────────────── TABLES ───────────────────── */

.source-table-wrap {
  width: 100%;
  max-height: 540px;
  overflow: auto;
  background: none;
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.source-table-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.source-table-wrap::-webkit-scrollbar-track { background: var(--ink); }
.source-table-wrap::-webkit-scrollbar-thumb { background: var(--line-strong); }

.serp-table,
.source-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 13px;
  font-feature-settings: "tnum", "lnum";
}

.serp-table { min-width: 720px; }
.source-table { min-width: 880px; }

.serp-table th,
.source-table th,
.serp-table td,
.source-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.serp-table th,
.source-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ink);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--paper-dim);
  padding-top: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-strong);
}

.serp-table tr:last-child td,
.source-table tr:last-child td { border-bottom: none; }

.serp-table tbody tr:hover td,
.source-table tbody tr:hover td { background: var(--ink-rise); }

.serp-table th,
.serp-table td {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.serp-table th:first-child,
.serp-table td:first-child {
  text-align: left;
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--paper);
  font-weight: 500;
}

.serp-table th.us-col { color: var(--gold); }

.serp-table td.pos-best {
  color: var(--gold-bright);
  font-weight: 500;
  position: relative;
}

.serp-table td.pos-best::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  width: 18px;
  height: 1px;
  background: var(--gold);
}

.serp-table td.pos-none { color: var(--paper-faint); }

.engine-badge {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 6px 1px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  vertical-align: 1px;
  border: 1px solid var(--line-strong);
  color: var(--paper-dim);
  background: transparent;
}

.engine-badge.yandex {
  color: var(--negative);
  border-color: rgba(212, 104, 90, 0.4);
}

/* ───────────────────── SERP ENGINE SUMMARY ───────────────────── */

.serp-engine-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0;
  margin: 0 0 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.engine-tile {
  padding: 18px 22px 20px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.engine-tile:last-child { border-right: none; }

.engine-tile::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 1px;
  background: var(--paper-faint);
}

.engine-tile.engine-google::before { background: var(--gold); width: 48px; }
.engine-tile.engine-yandex::before { background: var(--negative); width: 48px; }
.engine-tile.coverage::before { background: var(--gold-bright); width: 64px; }

.engine-tile-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  color: var(--paper-dim);
}

.engine-tile-stat {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--paper);
  font-variant-numeric: tabular-nums lining-nums;
}

.engine-tile-stat b {
  font-weight: 500;
  color: var(--paper);
}

.engine-tile-stat em {
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 10px;
  color: var(--paper-faint);
  margin-left: 4px;
}

.engine-tile.coverage .coverage-value b {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 30px;
  color: var(--gold-bright);
  letter-spacing: -0.02em;
}

/* ───────────────────── SERP MOVERS ───────────────────── */

.serp-movers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 0 0 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.mover-card {
  padding: 22px 24px 24px;
  border-right: 1px solid var(--line);
  position: relative;
}

.mover-card:last-child { border-right: none; }

.mover-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 48px;
  height: 1px;
}

.mover-card.mover-winning::before { background: var(--positive); }
.mover-card.mover-missing::before { background: var(--negative); }
.mover-card.mover-open::before    { background: var(--gold); }

.mover-title {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  color: var(--paper-dim);
  margin: 0 0 18px;
}

.mover-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: mover;
  display: grid;
  gap: 12px;
}

.mover-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding-bottom: 11px;
  border-bottom: 1px dotted var(--line);
  counter-increment: mover;
  position: relative;
  padding-left: 22px;
}

.mover-list li:last-child { border-bottom: none; padding-bottom: 0; }

.mover-list li::before {
  content: counter(mover, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--paper-faint);
  letter-spacing: 0.04em;
}

.mover-list li.mover-empty {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 13px;
  color: var(--paper-faint);
  padding-left: 0;
  display: block;
}

.mover-list li.mover-empty::before { display: none; }

.mover-kw {
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--paper);
  line-height: 1.35;
}

.mover-engine {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  vertical-align: 2px;
  border: 1px solid var(--line-strong);
  color: var(--paper-dim);
}

.mover-stat {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--paper);
  text-align: right;
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
}

.mover-stat b { color: var(--paper); font-weight: 500; }
.mover-stat em {
  font-style: normal;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--paper-faint);
  margin-right: 4px;
}

.mover-winning .mover-stat b { color: var(--positive); }
.mover-missing .mover-stat b { color: var(--negative); }
.mover-open    .mover-stat em { color: var(--gold); }

@media (max-width: 900px) {
  .serp-engine-summary,
  .serp-movers { grid-template-columns: 1fr; }
  .engine-tile,
  .mover-card { border-right: none; border-bottom: 1px solid var(--line); }
  .engine-tile:last-child,
  .mover-card:last-child { border-bottom: none; }
}

/* ───────────────────── LIGHT-THEME FIXES ───────────────────── */

:root[data-theme="light"] .control input::-webkit-calendar-picker-indicator {
  filter: invert(0.3) sepia(0.6) hue-rotate(355deg) saturate(0.6);
}

:root[data-theme="light"] .source-table-wrap::-webkit-scrollbar-track {
  background: var(--ink);
}

:root[data-theme="light"] .dominance-status.status-stable {
  background: rgba(20, 18, 12, 0.04);
}

:root[data-theme="light"] .dominance-status.status-dominating {
  box-shadow: 0 0 28px rgba(141, 105, 50, 0.18);
}

:root[data-theme="light"] body::after {
  /* darker grain spec for light bg */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.source-table th:nth-child(n+4),
.source-table td:nth-child(n+4) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.source-table td:nth-child(-n+3) {
  font-family: var(--font-body);
  color: var(--paper);
}

.source-table td.numeric-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.empty-cell {
  color: var(--paper-faint);
  text-align: center !important;
  font-style: italic;
  font-family: var(--font-body) !important;
  padding: 36px !important;
}

/* ───────────────────── SEO PROGRESS ───────────────────── */

.progress-summary {
  background: none;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 36px 0;
  display: grid;
  grid-template-columns: 220px 1fr 280px;
  gap: 56px;
  align-items: center;
  box-shadow: none;
}

.progress-pct {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 76px;
  color: var(--paper);
  line-height: 0.9;
  letter-spacing: -0.03em;
  font-variant-numeric: lining-nums tabular-nums;
}

.progress-bar {
  height: 2px;
  background: var(--line);
  border-radius: 0;
  overflow: visible;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--gold);
  width: 0%;
  transition: width 1.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
}

.progress-fill::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -5px;
  width: 2px;
  height: 12px;
  background: var(--gold-bright);
}

.progress-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--paper-dim);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  text-align: right;
  white-space: nowrap;
}

.cluster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0;
  margin-top: 32px;
  border-top: 1px solid var(--line);
}

.cluster-card {
  background: none;
  border-radius: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 22px 22px 24px;
  transition: background 0.3s ease;
}

.cluster-card:hover { background: var(--ink-rise); }

.cluster-card .name {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--paper-dim);
  margin: 0 0 14px;
  font-weight: 500;
  line-height: 1.4;
  min-height: 28px;
}

.cluster-card .stats {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 12px;
}

.cluster-card .pct {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 400;
  color: var(--paper);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.01em;
}

.cluster-card .ratio {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--paper-faint);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.cluster-card .mini-bar {
  height: 1px;
  background: var(--line-strong);
  border-radius: 0;
  overflow: visible;
  position: relative;
}

.cluster-card .mini-bar .fill {
  height: 100%;
  background: var(--gold);
  width: 0;
  transition: width 1s ease;
}

/* ───────────────────── CHARTS ───────────────────── */

.charts {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 0;
  margin: 0;
  padding-top: 0;
  border-top: 1px solid var(--line);
}

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

.chart-card {
  background: none;
  border: none;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 28px 28px 28px;
  box-shadow: none;
}

.chart-card:last-child { border-right: none; }

.chart-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}

.chart-card h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 22px;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--paper);
}

.chart-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--paper-dim);
  white-space: nowrap;
}

.chart {
  min-height: 220px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--paper-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-style: italic;
}

.chart svg { display: block; }

/* ───────────────────── INSIGHTS ───────────────────── */

.insights {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.insight-card {
  background: none;
  border: none;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 32px 28px 36px;
  box-shadow: none;
}

.insight-card:last-child { border-right: none; }

.insight-card h3 {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  color: var(--gold);
  margin: 0 0 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.insight-card p {
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--paper-dim);
  margin: 0 0 18px;
}

.weights {
  display: grid;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--paper);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.weights div {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dotted var(--line);
}

.weights div:last-child { border-bottom: none; }

#leadEventsList,
#activityList,
#sourceStatusList {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0;
  font-family: var(--font-mono);
  font-size: 12px;
}

#leadEventsList li,
#activityList li,
#sourceStatusList li {
  padding: 8px 0;
  border-bottom: 1px dotted var(--line);
  background: none;
  border-radius: 0;
  color: var(--paper);
  letter-spacing: 0.02em;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

#leadEventsList li:last-child,
#activityList li:last-child,
#sourceStatusList li:last-child { border-bottom: none; }

#sourceStatusList .ok {
  color: var(--positive);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

#sourceStatusList .miss {
  color: var(--negative);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

/* ───────────────────── TAGS ───────────────────── */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 0;
  background: var(--gold-faint);
  border: 1px solid var(--line-gold);
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  white-space: nowrap;
  font-weight: 400;
}

.tag.warn {
  background: rgba(212, 104, 90, 0.06);
  border-color: rgba(212, 104, 90, 0.32);
  color: var(--negative);
}

.tag.muted {
  background: none;
  border-color: var(--line);
  color: var(--paper-faint);
}

/* ───────────────────── FOOTER ───────────────────── */

.footer {
  margin-top: 96px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--paper-faint);
}

/* ───────────────────── MOTION ───────────────────── */

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero,
.controls,
.section-block,
.metrics {
  animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.controls { animation-delay: 0.08s; }
.metrics { animation-delay: 0.16s; }
.section-block:nth-of-type(1) { animation-delay: 0.24s; }
.section-block:nth-of-type(2) { animation-delay: 0.32s; }
.section-block:nth-of-type(3) { animation-delay: 0.40s; }
.section-block:nth-of-type(4) { animation-delay: 0.48s; }
.section-block:nth-of-type(5) { animation-delay: 0.56s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ───────────────────── ENGINE BADGE ───────────────────── */

.engine-badge {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  vertical-align: 1px;
  background: var(--gold-faint);
  color: var(--gold);
  border: 1px solid var(--line-gold);
}

.engine-badge.yandex {
  background: rgba(212, 104, 90, 0.08);
  color: var(--negative);
  border-color: rgba(212, 104, 90, 0.28);
}

/* ───────────────────── RESPONSIVE ───────────────────── */

@media (max-width: 1100px) {
  .dominance-card { grid-template-columns: 1fr; gap: 24px; padding: 36px 0 44px; }
  .controls { grid-template-columns: repeat(2, 1fr); }
  .control { padding: 20px 16px; border-right: none; border-bottom: 1px solid var(--line); }
  #applyFilters { margin-left: 0; padding: 18px; grid-column: 1 / -1; }
  .metrics, .insights { grid-template-columns: repeat(2, 1fr); }
  .metric-card:nth-child(2n) { border-right: none; }
  .metric-card:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .insight-card:nth-child(2n) { border-right: none; }
  .insight-card:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .split-grid { grid-template-columns: 1fr; }
  .split-card { border-right: none; border-bottom: 1px solid var(--line); }
  .split-card:last-child { border-bottom: none; }
  .progress-summary { grid-template-columns: 1fr; gap: 24px; padding: 28px 0; }
  .progress-meta { text-align: left; }
}

@media (max-width: 600px) {
  .hero::before { font-size: 9px; letter-spacing: 0.22em; }
  .hero > div:first-child { padding: 36px 0 16px; }
  .dominance-score { font-size: 120px; }
  .progress-pct { font-size: 60px; }
  .metrics, .insights { grid-template-columns: 1fr; }
  .metric-card, .insight-card { border-right: none; border-bottom: 1px solid var(--line); }
  .metric-card:last-child, .insight-card:last-child { border-bottom: none; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .footer { flex-direction: column; gap: 12px; }
}
