:root {
  color-scheme: light;
  --ink: #14232a;
  --muted: #5f6f74;
  --line: #d8e1e3;
  --panel: #ffffff;
  --soft: #f2f7f6;
  --brand: #17616a;
  --brand-dark: #123f46;
  --accent: #d18b2c;
  --danger: #b73535;
  --warn: #a5651a;
  --ok: #22734f;
  --info: #3563a6;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: #eef4f3;
}

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #e9f2f0 0, #f8faf8 420px, #f8faf8 100%);
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px max(18px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(20, 35, 42, 0.1);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 4;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand-dark);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

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

.brand small {
  color: var(--muted);
  margin-top: 2px;
}

nav {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  font-weight: 700;
}

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
  gap: 28px;
  align-items: end;
  padding: 56px 0 36px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

h1 {
  max-width: 920px;
  margin-bottom: 16px;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.02;
  letter-spacing: 0;
}

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

.hero-panel,
.editor,
.results {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 38px rgba(22, 49, 56, 0.08);
}

.hero-panel {
  padding: 22px;
}

.score-ring {
  width: 132px;
  height: 132px;
  border: 12px solid #d7ece7;
  border-top-color: var(--accent);
  border-right-color: var(--brand);
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
}

.score-ring span {
  display: block;
  font-size: 34px;
  font-weight: 850;
}

.score-ring small {
  color: var(--muted);
  font-weight: 700;
}

dl,
dd {
  margin: 0;
}

dt {
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 2px 0 14px;
  line-height: 1.35;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: stretch;
}

.editor,
.results {
  padding: 20px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-title h2 {
  margin: 0;
  font-size: 22px;
}

.section-title.compact {
  margin-top: 46px;
}

.actions,
.result-actions,
.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

button:hover:not(:disabled) {
  border-color: var(--brand);
}

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

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

.ghost,
.filter {
  background: #f7fbfa;
}

.filter.active {
  border-color: var(--brand);
  background: #dff0ed;
  color: var(--brand-dark);
}

textarea {
  width: 100%;
  min-height: 430px;
  resize: vertical;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfdfc;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(23, 97, 106, 0.22);
  outline-offset: 2px;
}

.editor-footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-top: 12px;
}

.editor-footer span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.grade {
  min-width: 62px;
  min-height: 62px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 30px;
  font-weight: 900;
}

.grade-a,
.grade-b {
  color: var(--ok);
}

.grade-c,
.grade-d {
  color: var(--warn);
}

.grade-f {
  color: var(--danger);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metrics div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfc;
}

.metrics span {
  display: block;
  font-size: 26px;
  font-weight: 900;
}

.metrics small {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.result-actions {
  justify-content: stretch;
}

.result-actions button {
  flex: 1;
}

.status {
  margin-top: 14px;
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
  color: var(--muted);
  line-height: 1.45;
  font-weight: 700;
}

.status.bad {
  background: #f9e7e4;
  color: var(--danger);
}

.status.good {
  background: #e1f2e8;
  color: var(--ok);
}

.findings-band {
  margin-bottom: 32px;
}

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

.findings.empty {
  display: block;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  background: #fff;
  color: var(--muted);
}

.finding {
  border: 1px solid var(--line);
  border-left-width: 6px;
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.finding.fail {
  border-left-color: var(--danger);
}

.finding.warn {
  border-left-color: var(--warn);
}

.finding.info {
  border-left-color: var(--info);
}

.finding.pass {
  border-left-color: var(--ok);
}

.finding-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.pill {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
}

.pill.fail {
  background: #f9e7e4;
  color: var(--danger);
}

.pill.warn {
  background: #fff0dc;
  color: var(--warn);
}

.pill.info {
  background: #e5edfb;
  color: var(--info);
}

.pill.pass {
  background: #e1f2e8;
  color: var(--ok);
}

.category {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.finding h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.finding p {
  color: var(--muted);
  line-height: 1.55;
}

pre {
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f7fbfa;
  color: #25363c;
  white-space: pre-wrap;
  word-break: break-word;
}

.fix {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
  line-height: 1.45;
}

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

.reference-grid h2 {
  font-size: 22px;
}

.reference-grid li {
  margin-bottom: 10px;
  line-height: 1.5;
}

footer {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  display: flex;
  gap: 16px;
  padding: 24px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

footer span {
  margin-right: auto;
  font-weight: 800;
}

@media (max-width: 880px) {
  .topbar,
  .hero,
  .workspace,
  .findings,
  .reference-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

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

  .hero {
    padding-top: 34px;
  }

  h1 {
    font-size: 38px;
  }

  textarea {
    min-height: 330px;
  }
}

@media (max-width: 540px) {
  main,
  footer {
    width: min(100vw - 22px, 1180px);
  }

  .section-title,
  .editor-footer,
  footer {
    align-items: stretch;
    flex-direction: column;
  }

  .actions,
  .filter-group,
  .result-actions {
    justify-content: stretch;
  }

  .actions button,
  .filter-group button,
  .editor-footer button {
    flex: 1;
  }

  h1 {
    font-size: 34px;
  }
}
