:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-alt: #eef4f7;
  --text: #17202a;
  --muted: #5c6f82;
  --line: #d8e1e8;
  --teal: #008a7a;
  --teal-dark: #00685d;
  --amber: #b86b00;
  --red: #bd2f3d;
  --green: #247a41;
  --blue: #2868b5;
  --shadow: 0 16px 40px rgba(23, 32, 42, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

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

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(247, 249, 252, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  text-decoration: none;
}

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

.brand strong {
  font-size: 1rem;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid #8fd1c8;
  border-radius: var(--radius);
  background: #dff8f4;
  color: var(--teal-dark);
  font-weight: 800;
}

.navlinks {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.navlinks a {
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
}

.navlinks a:hover,
.navlinks a:focus-visible {
  background: var(--surface-alt);
  color: var(--text);
  outline: none;
}

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

.alert-strip {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #e7c987;
  border-radius: var(--radius);
  background: #fff8e7;
  color: #473417;
  font-size: 0.95rem;
}

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

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

.input-panel,
.support-panel,
.result-panel,
.report-panel {
  padding: clamp(18px, 3vw, 28px);
}

.section-kicker {
  margin-bottom: 8px;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 800px;
  margin-bottom: 12px;
  font-size: clamp(2rem, 4.5vw, 4rem);
  line-height: 1.03;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  line-height: 1.15;
}

.lede {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.05rem;
}

.checker-form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field span,
.signals legend {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 750;
}

textarea,
select {
  width: 100%;
  border: 1px solid #c6d2dc;
  border-radius: var(--radius);
  background: #fbfdff;
  color: var(--text);
}

textarea {
  min-height: 92px;
  padding: 12px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

select {
  min-height: 44px;
  padding: 0 12px;
}

textarea:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 138, 122, 0.16);
  outline: none;
}

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

.signals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
}

.signals legend {
  padding: 0 6px;
}

.signals label {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  min-width: 0;
  color: #354657;
  font-size: 0.92rem;
}

.signals input {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  accent-color: var(--teal);
}

.action-row,
.sample-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.action-row.tight {
  gap: 8px;
}

button,
.secondary-link,
.primary-link {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

button:hover,
.secondary-link:hover,
.primary-link:hover {
  transform: translateY(-1px);
}

.primary-button,
.primary-link {
  background: var(--teal);
  color: #ffffff;
}

.primary-button:hover,
.primary-link:hover {
  background: var(--teal-dark);
}

.secondary-button,
.secondary-link {
  border-color: #b8ccd8;
  background: #eef6f6;
  color: #174e57;
}

.secondary-button:hover,
.secondary-link:hover {
  background: #e1efef;
}

.ghost-button {
  border-color: var(--line);
  background: #ffffff;
  color: var(--muted);
}

.sample-row {
  margin-top: 16px;
}

.sample-row button {
  min-height: 34px;
  padding: 7px 10px;
  border-color: var(--line);
  background: #f5f8fb;
  color: #415467;
  font-size: 0.86rem;
  font-weight: 700;
}

.support-panel {
  position: sticky;
  top: 94px;
}

.support-panel p,
.fine-print {
  color: var(--muted);
}

.qr-code {
  display: block;
  width: min(100%, 236px);
  aspect-ratio: 1;
  margin: 18px auto 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

code {
  display: block;
  max-width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f5f8fb;
  color: #2c3640;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.fine-print {
  margin-top: 14px;
  margin-bottom: 0;
  font-size: 0.84rem;
}

.results-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.85fr);
  gap: 18px;
  margin-top: 18px;
}

.result-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.score-badge {
  display: grid;
  width: 88px;
  height: 88px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7fafc;
  text-align: center;
}

.score-badge span {
  display: block;
  color: var(--text);
  font-size: 1.55rem;
  font-weight: 850;
  line-height: 1;
}

.score-badge small {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.score-badge.low {
  border-color: #96d8aa;
  background: #edfff2;
}

.score-badge.medium {
  border-color: #e4ca77;
  background: #fff9df;
}

.score-badge.high {
  border-color: #f3a35d;
  background: #fff0df;
}

.score-badge.block {
  border-color: #eba3a8;
  background: #fff0f2;
}

.meter {
  width: 100%;
  height: 10px;
  margin: 16px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f5;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--muted);
  transition: width 180ms ease;
}

.meter span.low {
  background: var(--green);
}

.meter span.medium {
  background: var(--amber);
}

.meter span.high {
  background: #dc6d1d;
}

.meter span.block {
  background: var(--red);
}

.facts {
  display: grid;
  gap: 10px;
  margin: 0;
}

.facts div {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.facts dt {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.facts dd {
  margin: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

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

.finding-list li {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 6px;
  background: #fbfdff;
  color: #314253;
}

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

.finding-list li.good {
  border-left-color: var(--green);
}

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

.finding-list li.danger {
  border-left-color: var(--red);
}

#report-output {
  min-height: 250px;
  margin: 8px 0 14px;
}

.case-section {
  margin-top: 34px;
}

.section-title-row {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(280px, 0.58fr);
  gap: 18px;
  align-items: end;
  margin-bottom: 16px;
}

.section-title-row p {
  margin-bottom: 0;
  color: var(--muted);
}

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

.case-card {
  min-height: 210px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.case-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.case-card p {
  margin-bottom: 12px;
  color: #394a5c;
  font-size: 0.92rem;
}

.case-card .tag {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf4f8;
  color: #315568;
  font-size: 0.75rem;
  font-weight: 800;
}

.case-card ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.86rem;
}

.deploy-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-top: 34px;
  padding: 20px;
  border: 1px solid #bad4dc;
  border-radius: var(--radius);
  background: #eef9fa;
}

.deploy-strip p {
  margin-bottom: 0;
  color: #3d5b64;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid #b8ccd8;
  border-radius: var(--radius);
  background: #16212c;
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .workspace,
  .results-grid,
  .section-title-row,
  .deploy-strip {
    grid-template-columns: 1fr;
  }

  .support-panel {
    position: static;
  }

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

@media (max-width: 700px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .navlinks {
    justify-content: flex-start;
  }

  .page-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 16px;
  }

  h1 {
    font-size: 2.15rem;
  }

  .form-row,
  .signals,
  .case-grid {
    grid-template-columns: 1fr;
  }

  .result-head {
    flex-direction: column;
  }

  .score-badge {
    width: 100%;
    height: 70px;
  }

  .facts div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
