:root {
  --background: #f5f2ea;
  --surface: #fffdf7;
  --surface-strong: #fff8ea;
  --ink: #171717;
  --muted: #6b665c;
  --border: #d8d0c0;
  --accent: #d9480f;
  --positive: #13795b;
  --negative: #b42318;
  --warning: #b7791f;
  --shadow: 0 18px 50px rgba(23, 23, 23, 0.08);
  --radius: 4px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

a {
  color: inherit;
}

a.sponsor {
  color: inherit;
  text-decoration: none;
}

.site-header,
main,
.site-footer {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 42px 0 20px;
  border-bottom: 2px solid var(--ink);
}

.eyebrow {
  display: block;
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  text-decoration: none;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(38px, 6vw, 76px);
  line-height: 0.92;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.15;
}

.tagline {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
}

.header-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px 14px;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  background: #fff3ea;
  font-weight: 800;
  text-align: left;
}

main {
  padding: 18px 0 48px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0 28px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

.site-footer div {
  display: grid;
  gap: 4px;
}

.site-footer strong {
  color: var(--ink);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: flex-end;
}

.sponsor {
  border: 1px dashed var(--warning);
  background: #fff8df;
}

.sponsor span {
  color: var(--warning);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.sponsor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 12px 16px;
  margin-bottom: 18px;
}

.sponsor-feed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: 16px;
}

.sponsor-feed p {
  margin: 4px 0 0;
  color: var(--muted);
}

.sponsor-link {
  display: grid;
  gap: 8px;
  padding: 16px;
  color: inherit;
  text-decoration: none;
}

a.sponsor:hover,
.sponsor-link:hover {
  border-style: solid;
  background: #fff3cf;
}

.scoreboard-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}

.scoreboard-main,
.panel,
.detail-panel {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

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

.section-heading,
.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.panel-heading span {
  color: var(--muted);
  font-size: 13px;
}

.search-box {
  display: grid;
  gap: 5px;
  min-width: 220px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

.tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}

.tabs button {
  min-height: 44px;
  white-space: nowrap;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
  font-weight: 800;
}

.tabs button.active {
  background: var(--ink);
  color: #fff;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

th button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font-weight: 900;
  text-transform: uppercase;
}

th button[data-active="true"] {
  color: var(--ink);
}

th button[data-active="true"]::after {
  content: " ↑";
  color: var(--accent);
}

th button[data-active="true"][data-direction="desc"]::after {
  content: " ↓";
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover {
  background: #fff9ef;
}

tbody tr.active-row {
  background: #fff3e6;
  box-shadow: inset 4px 0 0 var(--accent);
}

tbody tr.active-row .company-button strong {
  color: var(--accent);
}

.rank {
  font-size: 21px;
  font-weight: 900;
}

.company-button {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: left;
}

.company-button strong {
  display: block;
  font-size: 16px;
}

.company-button span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.score {
  font-size: 24px;
  font-weight: 900;
}

.trend {
  display: inline-flex;
  align-items: center;
  min-width: 44px;
  min-height: 28px;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 900;
}

.trend.up {
  color: var(--positive);
  border-color: rgba(19, 121, 91, 0.35);
  background: rgba(19, 121, 91, 0.08);
}

.trend.down {
  color: var(--negative);
  border-color: rgba(180, 35, 24, 0.35);
  background: rgba(180, 35, 24, 0.08);
}

.trend.flat,
.trend.new {
  color: var(--muted);
  background: #f7f3ea;
}

.right-rail {
  display: grid;
  gap: 18px;
}

.panel {
  padding: 0;
}

.panel > p,
.panel > h2,
.panel > pre,
.panel > ul,
.panel > .stack,
.panel > .leader-grid,
.panel > .compare-controls,
.panel > .compare-result,
.panel > .watchlist {
  margin: 0;
  padding: 16px;
}

.stack {
  display: grid;
  gap: 10px;
}

.mini-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.mini-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.newsletter {
  padding: 16px;
}

.newsletter h2,
.newsletter p {
  margin-bottom: 10px;
}

.newsletter form {
  display: grid;
  gap: 8px;
}

.newsletter button {
  min-height: 40px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.form-message {
  min-height: 18px;
  color: var(--positive);
  font-size: 13px;
  line-height: 1.35;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.leader-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.leader-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.leader-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.leader-card strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.bar {
  height: 8px;
  margin-top: 10px;
  background: #ece5d8;
  border-radius: 2px;
}

.bar div {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.compare-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.compare-result {
  display: grid;
  gap: 10px;
}

.compare-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.compare-row strong:first-child {
  text-align: right;
}

.compare-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.compare-row.left-wins strong:first-child,
.compare-row.right-wins strong:last-child {
  color: var(--positive);
}

.watchlist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.watchlist span {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 7px 10px;
  font-weight: 800;
}

.link-list {
  display: grid;
  gap: 9px;
  color: var(--muted);
}

.pro-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--radius);
  background: #171717;
  color: #fffdf7;
}

.pro-panel p:last-child {
  margin-bottom: 0;
  color: #d8d0c0;
}

.pro-message {
  min-height: 18px;
  margin-top: 8px;
  color: #f7c08a;
  font-size: 13px;
}

.pro-panel button {
  min-height: 42px;
  border: 1px solid #fffdf7;
  border-radius: var(--radius);
  background: #fffdf7;
  color: #171717;
  padding: 0 14px;
  font-weight: 900;
  white-space: nowrap;
}

.detail-panel {
  margin-top: 18px;
  padding: 16px;
}

.empty-state,
.load-error {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff8ea;
}

.empty-state span,
.load-error span {
  color: var(--muted);
  font-size: 13px;
}

.load-error {
  border-color: rgba(180, 35, 24, 0.35);
  background: rgba(180, 35, 24, 0.06);
}

.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 28px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
  margin-bottom: 16px;
}

.detail-identity {
  flex: 0 0 200px;
  border-right: 1px solid var(--border);
  padding-right: 28px;
}

.detail-summary {
  flex: 1 1 0;
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

.detail-close {
  flex: 0 0 auto;
  align-self: flex-start;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}

.detail-identity h2 {
  margin-bottom: 14px;
}

.detail-score-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-score {
  font-size: 48px;
  font-weight: 900;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.detail-score-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.detail-close:hover {
  color: var(--ink);
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.score-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px;
}

.score-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.score-card strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.methodology-page {
  display: grid;
  gap: 18px;
}

.static-page {
  display: grid;
  gap: 18px;
}

.methodology-page .panel,
.static-page > .panel {
  padding: 16px;
}

.methodology-page .panel > h2,
.methodology-page .panel > p,
.methodology-page .panel > pre,
.methodology-page .panel > ul,
.methodology-page .panel > .table-wrap,
.static-page > .panel > h2,
.static-page > .panel > p,
.static-page > .panel > ul {
  padding: 0;
}

.methodology-page .panel > h2,
.static-page > .panel > h2 {
  margin-bottom: 10px;
}

.methodology-page .panel > p,
.static-page > .panel > p {
  max-width: 78ch;
  color: var(--muted);
  line-height: 1.55;
}

.notice-panel {
  border-color: var(--ink);
  background: var(--surface-strong);
}

.sponsor-grid {
  margin-top: 0;
}

.placement-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.placement-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.placement-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--warning);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.placement-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

.placement-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.sponsor-cta a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid #fffdf7;
  border-radius: var(--radius);
  background: #fffdf7;
  color: #171717;
  padding: 0 14px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

pre {
  overflow-x: auto;
  background: #211f1b;
  color: #fff7e8;
  padding: 16px;
  border-radius: var(--radius);
}

@media (max-width: 1040px) {
  .scoreboard-shell,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .placement-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .right-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .site-header,
  main,
  .site-footer {
    width: min(100% - 24px, 1440px);
  }

  .site-header {
    align-items: start;
    flex-direction: column;
    gap: 14px;
    padding: 20px 0 14px;
  }

  h1 {
    font-size: 42px;
    line-height: 0.96;
  }

  h2 {
    font-size: 20px;
  }

  .tagline {
    font-size: 16px;
  }

  .header-meta {
    justify-content: flex-start;
    text-align: left;
  }

  .section-heading,
  .panel-heading,
  .sponsor-top,
  .sponsor-feed,
  .pro-panel,
  .detail-header,
  .site-footer {
    align-items: start;
    flex-direction: column;
  }

  .site-footer nav {
    justify-content: flex-start;
  }

  .search-box {
    width: 100%;
    min-width: 0;
  }

  main {
    padding-top: 12px;
  }

  .sponsor-top,
  .sponsor-feed,
  .section-heading,
  .panel-heading {
    gap: 10px;
    padding: 12px;
  }

  .sponsor-top {
    min-height: 0;
    margin-bottom: 12px;
  }

  .scoreboard-shell,
  .content-grid,
  .right-rail {
    gap: 12px;
  }

  .right-rail,
  .leader-grid,
  .compare-controls,
  .score-grid,
  .placement-grid {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 720px;
  }

  th,
  td {
    padding: 10px 12px;
  }
}

.inner-page .site-header {
  padding-top: 48px;
}

.inner-page .site-header .eyebrow {
  margin-bottom: 32px;
}

.inner-page .site-header h1 {
  font-size: clamp(26px, 3.5vw, 36px);
  line-height: 1.05;
  margin-bottom: 10px;
}

.inner-page .site-header .tagline {
  font-size: 15px;
}
