:root {
  --consistency-cyan: #47e5ff;
  --consistency-gold: #ffc94d;
  --consistency-green: #65efab;
  --consistency-red: #ff7187;
  --consistency-border: #29364b;
  --consistency-panel: #0b101b;
}

body[data-page="league-consistency"] {
  background: #070b14;
}

body[data-page="league-consistency"] .workspace-main,
.consistency-page {
  min-width: 0;
}

.consistency-page {
  width: min(100%, 1580px);
  margin: 0 auto;
  padding: clamp(18px, 2.6vw, 34px);
}

.consistency-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 390px);
  gap: 24px;
  align-items: end;
  padding: clamp(18px, 2.5vw, 30px);
  border: 1px solid rgba(71, 229, 255, .24);
  border-radius: 18px 18px 0 0;
  background:
    radial-gradient(circle at 85% 0, rgba(228, 64, 207, .14), transparent 45%),
    linear-gradient(135deg, rgba(16, 27, 47, .98), rgba(8, 14, 25, .98));
}

.consistency-kicker,
.consistency-heading span {
  color: var(--consistency-cyan);
  font: 800 10px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .1em;
}

.consistency-hero h1 {
  margin: 8px 0 7px;
  color: #f7faff;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
}

.consistency-hero p {
  max-width: 780px;
  margin: 0;
  color: #aab8ce;
  font-size: 14px;
  line-height: 1.65;
}

.consistency-definition {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(71, 229, 255, .22);
  border-radius: 13px;
  background: rgba(7, 20, 31, .82);
}

.consistency-definition div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.consistency-definition dt,
.consistency-definition dd {
  margin: 0;
  font: 700 11px/1.35 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.consistency-definition dt {
  color: #7f90aa;
}

.consistency-definition dd {
  color: #e0faff;
  text-align: right;
}

.consistency-status {
  padding: 12px 16px;
  border: solid var(--consistency-border);
  border-width: 0 1px 1px;
  color: #a9bbd4;
  background: #0b1320;
  font-size: 12px;
}

.consistency-status[data-state="ready"] {
  border-color: rgba(80, 237, 154, .26);
  color: #c1f9dc;
  background: rgba(11, 44, 34, .62);
}

.consistency-status[data-state="error"] {
  color: #ffd1d8;
  background: rgba(67, 17, 28, .72);
}

.consistency-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 20px 0;
}

.consistency-summary article {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--consistency-border);
  border-radius: 13px;
  background: rgba(17, 24, 39, .92);
}

.consistency-summary span {
  color: #8292aa;
  font: 800 9px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.consistency-summary strong {
  overflow: hidden;
  color: #f5f8ff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.consistency-summary b {
  color: var(--consistency-green);
  font: 800 12px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.consistency-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 6px 0 12px;
}

.consistency-heading h2 {
  margin: 5px 0 0;
  color: #f5f8ff;
  font-size: clamp(21px, 3vw, 31px);
}

.consistency-heading p {
  margin: 0;
  color: #8d9bb0;
  font-size: 11px;
  text-align: right;
}

.consistency-heading i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 5px 0 10px;
  border-radius: 50%;
}

.consistency-heading i.positive { background: var(--consistency-green); }
.consistency-heading i.negative { background: var(--consistency-red); }

.consistency-table-shell {
  max-width: 100%;
  max-height: min(74vh, 820px);
  overflow: auto;
  border: 1px solid var(--consistency-border);
  border-radius: 14px;
  background: rgba(8, 12, 21, .94);
  scrollbar-color: #53647c #0c1320;
  scrollbar-width: thin;
}

.consistency-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
}

.consistency-table th,
.consistency-table td {
  padding: 11px 12px;
  border: solid #202b3e;
  border-width: 0 0 1px;
  text-align: right;
  white-space: nowrap;
}

.consistency-table thead {
  position: sticky;
  top: 0;
  z-index: 3;
}

.consistency-table thead th {
  color: var(--consistency-cyan);
  background: #111a2a;
  font: 800 9px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.consistency-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 185px;
  text-align: left;
}

.consistency-table thead th:first-child {
  z-index: 4;
}

.consistency-table tbody th {
  background: #0d1421;
}

.consistency-table tbody tr:last-child > * {
  border-bottom: 0;
}

.consistency-table tbody tr:hover > * {
  filter: brightness(1.08);
}

.consistency-table tbody th b {
  display: inline-block;
  min-width: 31px;
  margin-right: 7px;
  color: var(--consistency-gold);
  font: 800 10px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.consistency-table tbody th span,
.consistency-table td span {
  display: block;
  margin-top: 4px;
  color: #75849a;
  font-size: 9px;
}

.consistency-table .heat-cell {
  min-width: 80px;
  color: #e9effa;
  background: rgba(89, 102, 128, calc(.08 + var(--heat) * .08));
  font: 700 10px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.consistency-table .heat-cell.is-positive {
  background: rgba(37, 171, 104, calc(.08 + var(--heat) * .38));
}

.consistency-table .heat-cell.is-negative {
  background: rgba(204, 56, 83, calc(.08 + var(--heat) * .42));
}

.consistency-table .heat-cell.is-neutral {
  color: var(--consistency-gold);
}

.consistency-table .heat-cell.is-unknown {
  color: #657389;
}

.consistency-table .pattern-cell b {
  color: var(--consistency-cyan);
  font: 800 11px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.consistency-empty {
  padding: 32px !important;
  color: #98a8bd;
  text-align: center !important;
}

.consistency-scope {
  margin: 16px 0 0;
  padding: 14px 16px;
  border: 1px solid rgba(255, 201, 77, .2);
  border-radius: 12px;
  color: #8999ae;
  background: rgba(29, 24, 11, .38);
  font-size: 11px;
  line-height: 1.65;
}

.consistency-scope strong {
  color: #e8d99e;
}

@media (max-width: 760px) {
  .consistency-page {
    padding: 12px 8px 22px;
  }

  .consistency-hero {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 17px 14px;
  }

  .consistency-definition {
    padding: 11px;
  }

  .consistency-summary {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 14px 0;
  }

  .consistency-summary article {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 5px 10px;
    padding: 12px;
  }

  .consistency-summary article span {
    grid-column: 1 / -1;
  }

  .consistency-heading {
    display: grid;
    gap: 8px;
  }

  .consistency-heading p {
    text-align: left;
  }

  .consistency-table-shell {
    max-height: 68vh;
  }

  .consistency-table {
    min-width: 1020px;
  }

  .consistency-table th:first-child {
    min-width: 150px;
  }
}
