:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #5a6c7d;
  --line: #d9e2ea;
  --panel: #ffffff;
  --page: #f5f8fb;
  --accent: #0f5f8f;
  --accent-2: #4f7d3f;
  --warn: #9c5a05;
  --danger: #b22727;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
}

a {
  color: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

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

.brand small {
  color: var(--muted);
  font-size: 12px;
}

nav {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

nav a {
  text-decoration: none;
}

main {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 44px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 28px;
  align-items: end;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.02;
  letter-spacing: 0;
  max-width: 900px;
}

.intro {
  max-width: 760px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.status-grid {
  display: grid;
  gap: 10px;
}

.status-grid div,
.input-panel,
.result-panel,
.results {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
}

.status-grid div {
  padding: 14px;
}

.status-grid strong,
.status-grid span {
  display: block;
}

.status-grid span {
  color: var(--muted);
  margin-top: 4px;
  font-size: 14px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 18px;
  align-items: stretch;
}

.input-panel,
.result-panel {
  padding: 18px;
}

.panel-head,
.run-row,
.score-row,
.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h2 {
  margin: 0;
  font-size: 20px;
}

.actions,
.result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  min-height: 38px;
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

textarea {
  width: 100%;
  min-height: 330px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 14px 0;
  padding: 14px;
  font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink);
}

#status {
  color: var(--muted);
  font-size: 14px;
}

.score-row {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}

#score {
  font-size: 44px;
  color: var(--accent);
}

#grade {
  font-size: 18px;
}

.counts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 0;
}

.count {
  background: #f2f6fa;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.count strong,
.count span {
  display: block;
}

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

.results {
  margin-top: 18px;
  overflow: hidden;
}

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

.tab {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  min-width: 120px;
}

.tab.active {
  color: #fff;
  background: var(--accent-2);
}

.view {
  display: none;
  padding: 16px;
}

.view.active {
  display: block;
}

.observable,
.note {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.pill {
  width: max-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 5px 9px;
  background: #eaf2f7;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.context,
.note p {
  color: var(--muted);
  margin: 4px 0 0;
  line-height: 1.5;
}

.severity-high {
  color: var(--danger);
}

.severity-medium {
  color: var(--warn);
}

.report {
  min-height: 300px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 0 0 28px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 840px) {
  .topbar,
  footer {
    flex-direction: column;
    align-items: flex-start;
  }

  nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .score-row,
  .panel-head,
  .run-row {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .observable,
  .note {
    grid-template-columns: 1fr;
  }
}
