:root {
  --ink: #202124;
  --muted: #667085;
  --line: #d9dee7;
  --paper: #f7f5ef;
  --panel: #ffffff;
  --green: #177245;
  --yellow: #a66b00;
  --red: #b42318;
  --blue: #2364aa;
  --shadow: 0 16px 45px rgba(38, 44, 55, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    linear-gradient(135deg, rgba(35, 100, 170, 0.13), transparent 36%),
    linear-gradient(225deg, rgba(23, 114, 69, 0.14), transparent 40%),
    var(--paper);
}

.shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 36px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-weight: 700;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(34px, 5vw, 68px);
  line-height: 1.02;
  letter-spacing: 0;
}

.lead {
  max-width: 740px;
  margin-bottom: 0;
  color: #3f4652;
  font-size: 18px;
  line-height: 1.7;
}

.verdict,
.panel,
.metrics article {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.verdict {
  display: flex;
  min-height: 188px;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
}

.verdict.safe {
  border-color: rgba(23, 114, 69, 0.35);
}

.verdict.warn {
  border-color: rgba(166, 107, 0, 0.45);
}

.verdict.danger {
  border-color: rgba(180, 35, 24, 0.45);
}

.label,
.metrics span,
th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.verdict strong {
  display: block;
  margin: 10px 0;
  font-size: 34px;
}

.verdict small,
.metrics small,
.panel-head span,
td {
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.panel,
.inputs {
  padding: 20px;
}

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

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

button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: white;
  padding: 9px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.group {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 18px;
}

.group.compact {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.group h3 {
  margin-bottom: 12px;
  font-size: 15px;
}

.advanced {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 16px;
}

.advanced summary {
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

label {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 12px;
  align-items: center;
  margin: 10px 0;
  color: #384150;
  font-size: 14px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  padding: 9px 10px;
  color: var(--ink);
  font: inherit;
}

.results {
  display: grid;
  gap: 18px;
}

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

.metrics article {
  position: relative;
  min-height: 120px;
  padding: 18px;
}

.metrics strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 28px;
}

.metric-help {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  padding: 0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.metric-help::after {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  z-index: 5;
  display: none;
  width: min(320px, calc(100vw - 48px));
  border: 1px solid var(--line);
  background: var(--ink);
  color: #fff;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  content: attr(data-tooltip);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.55;
  text-align: left;
}

.metric-help:hover::after,
.metric-help:focus-visible::after {
  display: block;
}

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

.breakdown-grid div,
.comparison-grid div {
  border: 1px solid var(--line);
  background: #fbfcfd;
  padding: 14px;
}

.breakdown-grid span,
.comparison-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.breakdown-grid strong,
.comparison-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.comparison-grid small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 8px;
  text-align: left;
  white-space: nowrap;
}

td strong {
  color: var(--ink);
}

.tag {
  display: inline-flex;
  min-width: 64px;
  justify-content: center;
  border: 1px solid currentColor;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 700;
}

.tag.safe,
.good {
  color: var(--green);
}

.tag.warn,
.medium {
  color: var(--yellow);
}

.tag.danger,
.bad {
  color: var(--red);
}

.bars {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 72px;
  gap: 12px;
  align-items: center;
}

.bar-track {
  height: 12px;
  border: 1px solid var(--line);
  background: #f0f2f5;
}

.bar-fill {
  height: 100%;
  background: var(--green);
}

.bar-fill.warn {
  background: var(--yellow);
}

.bar-fill.danger {
  background: var(--red);
}

.advice ul,
.notes ul {
  margin: 0;
  padding-left: 20px;
}

.advice li,
.notes li {
  margin: 10px 0;
  color: #46505f;
  line-height: 1.65;
}

.notes p {
  color: #46505f;
  line-height: 1.75;
}

@media (max-width: 980px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 620px) {
  .shell {
    width: min(100vw - 20px, 1280px);
    padding-top: 18px;
  }

  h1 {
    font-size: 36px;
  }

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

  .breakdown-grid,
  .comparison-grid {
    grid-template-columns: 1fr;
  }

  label {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
