:root {
  color-scheme: light;
  --ink: #111315;
  --muted: #60666c;
  --soft: #8b9197;
  --line: #dfe3e6;
  --paper: #f5f6f7;
  --surface: #ffffff;
  --surface-soft: #fafbfb;
  --green: #0f7b68;
  --green-dark: #08594b;
  --red: #c2412d;
  --yellow: #b98114;
  --blue: #285fbd;
  --shadow: 0 22px 70px rgba(20, 23, 28, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  min-height: 72px;
  padding: 16px clamp(18px, 4vw, 52px);
}

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

.brand-mark {
  align-items: center;
  background: var(--ink);
  color: white;
  display: grid;
  flex: 0 0 auto;
  height: 34px;
  justify-items: center;
  width: 34px;
}

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

.brand strong {
  font-size: 16px;
  line-height: 1.05;
}

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

.top-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  display: grid;
  height: 42px;
  justify-items: center;
  text-decoration: none;
  width: 42px;
}

.icon-button:hover,
.preset-row button:hover {
  border-color: var(--ink);
}

.workspace {
  display: grid;
  gap: 22px;
  margin: 0 auto;
  max-width: 1380px;
  padding: clamp(16px, 3vw, 38px);
  padding-top: clamp(8px, 2vw, 22px);
}

.intro {
  max-width: 920px;
}

.eyebrow {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 850;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.intro h1 {
  font-size: clamp(40px, 5.2vw, 72px);
  font-weight: 700;
  line-height: 1.02;
  margin: 0;
}

.intro p {
  color: var(--muted);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.45;
  margin: 16px 0 0;
  max-width: 860px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preset-row button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  display: inline-flex;
  font-weight: 850;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
}

.filter-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1fr);
}

.input-panel,
.result-panel,
.decision-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.input-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.panel-title {
  align-items: center;
  color: var(--ink);
  display: flex;
  font-size: 15px;
  font-weight: 900;
  gap: 8px;
}

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

label {
  color: var(--ink);
  display: grid;
  font-size: 13px;
  font-weight: 850;
  gap: 7px;
}

.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--ink);
  min-height: 46px;
  outline: 0;
  padding: 11px 12px;
  width: 100%;
}

textarea {
  line-height: 1.45;
  min-height: 88px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15, 123, 104, 0.14);
}

.result-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  position: sticky;
  top: 18px;
}

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

.verdict span {
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.verdict h2 {
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.05;
  margin: 0;
}

.verdict p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
  margin: 12px 0 0;
}

.verdict.pass {
  background: #ecf8f3;
  border-color: #afdccc;
}

.verdict.watch {
  background: #fff7e8;
  border-color: #e9c989;
}

.verdict.fail {
  background: #fff0ed;
  border-color: #eab0a7;
}

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

.metric-grid article {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  min-height: 92px;
  padding: 13px;
}

.metric-grid small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
  min-height: 30px;
}

.metric-grid strong {
  display: block;
  font-size: clamp(22px, 2.4vw, 32px);
  line-height: 1;
  margin-top: 8px;
}

.score-panel,
.math-panel {
  border: 1px solid var(--line);
  padding: 15px;
}

.score-top {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.score-top span {
  color: var(--muted);
  font-weight: 850;
}

.score-top strong {
  font-size: 18px;
}

.score-track {
  background: #e8ecef;
  height: 12px;
  overflow: hidden;
}

.score-track span {
  background: var(--green);
  display: block;
  height: 100%;
  transition: width 180ms ease, background 180ms ease;
  width: 0;
}

.score-track span.watch {
  background: var(--yellow);
}

.score-track span.fail {
  background: var(--red);
}

.math-panel h3 {
  font-size: 15px;
  margin: 0 0 10px;
}

dl {
  display: grid;
  gap: 0;
  margin: 0;
}

dl div {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 38px;
}

dl div:first-child {
  border-top: 0;
}

dt {
  color: var(--muted);
  font-weight: 750;
}

dd {
  font-weight: 900;
  margin: 0;
}

.decision-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
}

.decision-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.decision-panel ul {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.decision-panel li {
  border-top: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.45;
  padding-top: 10px;
}

.decision-panel li:first-child {
  border-top: 0;
  padding-top: 0;
}

.decision-panel strong {
  color: var(--ink);
}

.toast {
  background: var(--ink);
  bottom: 18px;
  color: white;
  font-weight: 850;
  left: 50%;
  padding: 11px 16px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 50;
}

[hidden] {
  display: none !important;
}

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

  .result-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  .topbar {
    padding: 14px 16px;
  }

  .workspace {
    padding: 12px;
  }

  .intro h1 {
    font-size: 40px;
  }

  .intro p {
    font-size: 17px;
  }

  .field-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .preset-row button {
    width: 100%;
  }
}
