:root {
  --bg: #070b12;
  --bg-elevated: #0b111c;
  --panel: #101927;
  --panel-strong: #142033;
  --line: #263248;
  --line-soft: #1b2638;
  --text: #f4f7fb;
  --muted: #9ba9bc;
  --quiet: #728198;
  --forge: #ffb547;
  --forge-strong: #ff8f1f;
  --ice: #79b8ff;
  --good: #51d88a;
  --warning: #ffc857;
  --danger: #ff6b6b;
  --radius: 16px;
  --shadow: 0 20px 70px rgb(0 0 0 / 28%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 10% -10%, rgb(255 181 71 / 10%), transparent 35rem),
    radial-gradient(circle at 100% 20%, rgb(121 184 255 / 7%), transparent 32rem), var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--ice);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 1rem;
  left: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem clamp(1rem, 4vw, 3.5rem);
  border-bottom: 1px solid rgb(38 50 72 / 80%);
  background: rgb(7 11 18 / 88%);
  backdrop-filter: blur(18px);
}

.brand-lockup,
.topbar-actions {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 0.8rem;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
}

.brand-lockup strong {
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.brand-lockup small {
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgb(255 181 71 / 45%);
  border-radius: 10px 10px 10px 3px;
  background: linear-gradient(145deg, rgb(255 181 71 / 20%), rgb(255 143 31 / 5%));
  color: var(--forge);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.topbar-actions {
  gap: 0.75rem;
}

.mode-pill,
.status-tag,
.panel-kicker {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.button {
  min-height: 42px;
  padding: 0.6rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 750;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.button-secondary {
  border-color: var(--line);
  background: var(--panel);
  color: var(--text);
}

.button-secondary:hover:not(:disabled) {
  border-color: var(--forge);
  background: var(--panel-strong);
}

.shell {
  width: min(1400px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(2.25rem, 6vw, 5rem) 0 4rem;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

.page-heading h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.page-heading p:not(.eyebrow) {
  max-width: 720px;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--forge);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.system-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.55rem;
  min-height: 40px;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.system-badge-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 5px rgb(255 200 87 / 8%);
}

.system-badge[data-state="healthy"] {
  border-color: rgb(81 216 138 / 35%);
  color: var(--good);
}

.system-badge[data-state="healthy"] .system-badge-dot {
  background: var(--good);
  box-shadow: 0 0 0 5px rgb(81 216 138 / 9%);
}

.system-badge[data-state="error"] {
  border-color: rgb(255 107 107 / 38%);
  color: var(--danger);
}

.system-badge[data-state="error"] .system-badge-dot {
  background: var(--danger);
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: 1rem;
}

.panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgb(20 32 51 / 88%), rgb(11 17 28 / 94%));
  box-shadow: var(--shadow);
}

.readiness-panel,
.contest-panel,
.sources-panel {
  padding: clamp(1.25rem, 3vw, 2rem);
}

.panel-heading,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.panel-heading h2,
.section-heading h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  letter-spacing: -0.025em;
}

.panel-kicker {
  color: var(--ice);
}

.readiness-meter {
  height: 6px;
  margin: 2rem 0;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line-soft);
}

.readiness-meter-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--forge-strong), var(--forge), var(--ice));
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 0;
}

.metric-row div {
  min-width: 0;
}

.metric-row dt {
  margin-bottom: 0.35rem;
  color: var(--quiet);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-row dd {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.truth-note {
  margin: 1.75rem 0 0;
  padding: 1rem;
  border: 1px solid rgb(121 184 255 / 16%);
  border-radius: 10px;
  background: rgb(121 184 255 / 5%);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.status-neutral {
  color: var(--quiet);
}

.empty-contest {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line-soft);
}

.empty-icon {
  display: grid;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--forge);
  font-size: 0.86rem;
  font-weight: 800;
}

.empty-contest strong {
  font-size: 1rem;
}

.empty-contest p {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.workflow {
  margin: 3.5rem 0;
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-top: 1.25rem;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--line-soft);
}

.workflow-grid article {
  min-height: 210px;
  padding: 1.5rem;
  background: var(--bg-elevated);
}

.workflow-grid span {
  color: var(--forge);
  font-size: 0.8rem;
  font-weight: 800;
}

.workflow-grid h3 {
  margin: 2.8rem 0 0.65rem;
  font-size: 1.05rem;
}

.workflow-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.sources-heading {
  align-items: center;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--line-soft);
}

.source-summary {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  color: var(--quiet);
  font-size: 0.82rem;
}

.source-summary strong {
  color: var(--text);
  font-size: 1rem;
}

.source-summary i {
  width: 1px;
  height: 18px;
  margin: 0 0.35rem;
  background: var(--line);
}

.source-list {
  display: grid;
}

.source-item {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(150px, 0.55fr) minmax(260px, 1.35fr) auto;
  align-items: center;
  gap: 1rem;
  min-height: 86px;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.source-item:last-child {
  border-bottom: 0;
}

.source-name strong,
.source-name small {
  display: block;
}

.source-name strong {
  font-size: 0.95rem;
}

.source-name small,
.source-cadence,
.source-purpose {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.source-name small {
  margin-top: 0.25rem;
  color: var(--quiet);
  text-transform: capitalize;
}

.source-state {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--quiet);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.source-loading,
.source-error {
  padding: 2rem 0;
  color: var(--muted);
}

.source-error {
  color: var(--danger);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: min(1400px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--line-soft);
  color: var(--quiet);
  font-size: 0.78rem;
}

@media (max-width: 980px) {
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }

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

  .source-item {
    grid-template-columns: 1fr auto;
  }

  .source-cadence,
  .source-purpose {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    align-items: flex-end;
    flex-direction: column;
  }

  .mode-pill {
    display: none;
  }

  .button {
    min-height: 44px;
  }

  .shell {
    width: min(100% - 1.25rem, 1400px);
    padding-top: 2.5rem;
  }

  .page-heading h1 {
    font-size: clamp(2.3rem, 14vw, 3.4rem);
  }

  .metric-row {
    grid-template-columns: 1fr;
  }

  .metric-row div {
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--line-soft);
  }

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

  .workflow-grid {
    grid-template-columns: 1fr;
  }

  .workflow-grid article {
    min-height: 170px;
  }

  .sources-heading,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .source-summary {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
