:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #1c2430;
  --muted: #667085;
  --line: #d9e0e7;
  --accent: #166a73;
  --accent-dark: #0f4e55;
  --good: #287a3e;
  --warn: #a56106;
  --bad: #a12b2b;
  --shadow: 0 18px 45px rgba(24, 37, 56, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0;
}

.intro {
  margin-bottom: 24px;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.12;
}

h1 {
  font-size: clamp(34px, 5vw, 58px);
}

h2 {
  font-size: 22px;
}

.lead {
  max-width: 720px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

form.panel {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input,
select {
  height: 46px;
  padding: 0 13px;
}

textarea {
  min-height: 330px;
  resize: vertical;
  padding: 13px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 106, 115, 0.16);
}

.row {
  display: flex;
  gap: 12px;
  align-items: end;
}

.grow {
  flex: 1;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: progress;
  opacity: 0.72;
}

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

.results {
  min-height: 520px;
  padding: 20px;
}

.results-head {
  display: flex;
  gap: 14px;
  align-items: start;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.badge {
  min-width: 96px;
  border-radius: 999px;
  padding: 7px 11px;
  text-align: center;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.badge.muted {
  background: #7b8794;
}

.badge.good {
  background: var(--good);
}

.badge.warn {
  background: var(--warn);
}

.badge.bad {
  background: var(--bad);
}

#result-body {
  padding-top: 16px;
}

.empty {
  color: var(--muted);
}

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

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

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

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  line-height: 1.1;
}

.metric a,
.report-link {
  color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

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

.detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.detail-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 750;
}

.report-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 700;
}

.params {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.params li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.error {
  border-left: 4px solid var(--bad);
  padding: 10px 12px;
  background: #fff5f5;
  color: #7f1d1d;
}

pre {
  overflow: auto;
  max-height: 360px;
  padding: 12px;
  border-radius: 8px;
  background: #17212b;
  color: #e8eef5;
  font-size: 13px;
}

@media (max-width: 900px) {
  .shell {
    width: min(100% - 20px, 680px);
    padding: 24px 0;
  }

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

  .row,
  .actions,
  .results-head {
    flex-direction: column;
    align-items: stretch;
  }

  .toggle {
    width: 100%;
  }

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