:root {
  --bg: #f7f6f3;
  --paper: #ffffff;
  --ink: #1b1b1a;
  --muted: #6b6a66;
  --line: #e2e0da;
  --cat: #2f7d1f;
  --att: #1a3fd0;
  --err: #e0201b;
  --accent: #7a2c1c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.wrap { max-width: 900px; margin: 0 auto; padding: 0 20px; }

/* ------------------------------------------------------------ шапка сайта */
.site-head {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.site-head .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
  gap: 16px;
}
.brand {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--ink);
}
.brand span { color: var(--accent); }
.site-head nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 18px;
  font-size: 15px;
}
.site-head nav a:hover { color: var(--ink); }

/* ------------------------------------------------------------ главная */
.hero { padding: 54px 0 30px; }
.hero h1 {
  font-size: 40px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  max-width: 20ch;
}
.hero p { max-width: 62ch; color: #3b3a37; margin: 0 0 12px; }

.notice {
  background: #fdf6e8;
  border: 1px solid #ecd9ae;
  border-radius: 10px;
  padding: 16px 18px;
  margin: 26px 0 8px;
  font-size: 15.5px;
  color: #5a4a2a;
}
.notice b { color: #4a3a1c; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  padding: 26px 0 60px;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card:hover {
  border-color: #c9c5ba;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(30, 25, 15, 0.06);
}
.card h3 { margin: 0 0 8px; font-size: 17px; line-height: 1.3; }
.card p { margin: 0; font-size: 14.5px; color: var(--muted); flex: 1; }
.card .go { margin-top: 14px; font-size: 14px; color: var(--accent); font-weight: 600; }

.section { padding: 10px 0 50px; }
.section h2 { font-size: 24px; margin: 0 0 12px; }
.section p { max-width: 70ch; }

footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding: 24px 0;
  font-size: 14px;
  color: var(--muted);
}
footer p { margin: 4px 0; max-width: 75ch; }

/* ------------------------------------------------------------ страница теста */
.page-test { background: var(--paper); }
.intro { padding: 40px 0 60px; }
.intro h1 { font-size: 30px; margin: 0 0 18px; }
.intro ul { max-width: 66ch; padding-left: 20px; }
.intro li { margin-bottom: 8px; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 13px 22px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
.btn:hover { background: #63220f; }
.btn.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid #d9c8c1;
}
.btn.ghost:hover { background: #f6eeeb; }

/* ------------------------------------------------------------ экран задачи */
#task {
  display: none;
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 50;
  overflow: hidden;
}
body.running #task { display: block; }

.head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px 28px 0;
  min-height: 168px;
}
.head-col {
  width: 42%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.head-key {
  font-family: "Courier New", monospace;
  font-size: 14px;
  color: #555;
  margin-bottom: 6px;
}
.lab-cat, .lab-att {
  font-size: 25px;
  font-weight: 700;
  line-height: 1.15;
  text-transform: uppercase;
}
.lab-cat { color: var(--cat); }
.lab-att { color: var(--att); }
.head-or { font-size: 20px; color: #333; margin: 2px 0; }
.label-img { height: 62px; border-radius: 4px; }
.inline-label { height: 34px; vertical-align: middle; border-radius: 3px; }

.stage {
  position: relative;
  height: calc(100vh - 300px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.stim {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.st-cat, .st-att {
  font-size: 34px;
  font-weight: 700;
  text-transform: uppercase;
}
.st-cat { color: var(--cat); }
.st-att { color: var(--att); }
img.st-cat, img.st-att {
  /* исходники маленькие (72-300 px), поэтому задаём высоту и даём браузеру сгладить */
  height: 190px;
  width: auto;
  border-radius: 6px;
}
.err {
  color: var(--err);
  font-size: 60px;
  font-weight: 700;
  line-height: 1;
  height: 70px;
  margin-top: 6px;
}
.reminder {
  position: absolute;
  bottom: 26px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 15px;
  color: #333;
}
.reminder .x, .inst .x { color: var(--err); font-weight: 700; }

.inst {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 24px 40px;
}
.inst .part {
  text-align: center;
  text-decoration: underline;
  font-size: 19px;
  margin: 0 0 22px;
}
.inst-body { font-size: 18px; line-height: 1.6; }
.inst .c-cat { color: var(--cat); }
.inst .c-att { color: var(--att); }
.inst .ready { text-align: center; margin-top: 26px; font-size: 18px; }

/* сенсорные кнопки */
.touch-zones { display: none; }
body.touch.running .touch-zones {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 92px;
  z-index: 60;
}
body.touch .reminder { bottom: 104px; }
body.touch .stage { height: calc(100vh - 400px); }
.zone {
  flex: 1;
  background: #dff0d8;
  border-top: 2px solid #b6d8a8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #2f5d24;
  user-select: none;
}
.zone:active { background: #cbe6bd; }
.zone + .zone { border-left: 2px solid #b6d8a8; }

/* ------------------------------------------------------------ результат */
.result { padding: 40px 0 70px; }
.result h1 { font-size: 28px; margin: 0 0 10px; }
.verdict {
  background: #f2f7f1;
  border: 1px solid #cfe2ca;
  border-left: 5px solid var(--cat);
  border-radius: 8px;
  padding: 20px 22px;
  font-size: 19px;
  line-height: 1.5;
  margin: 18px 0 26px;
}
.verdict.warn {
  background: #fdf3f2;
  border-color: #e8c8c5;
  border-left-color: var(--err);
}
.stats {
  border-collapse: collapse;
  width: 100%;
  max-width: 520px;
  font-size: 15px;
  margin: 8px 0 28px;
}
.stats td {
  border-bottom: 1px solid var(--line);
  padding: 9px 4px;
}
.stats td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.scale {
  max-width: 620px;
  margin: 0 0 28px;
}
.scale-bar {
  position: relative;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #2f7d1f 0%, #d8e3d5 50%, #1a3fd0 100%);
}
.scale-pin {
  position: absolute;
  top: -6px;
  width: 3px;
  height: 24px;
  background: #1b1b1a;
  border-radius: 2px;
}
.scale-legend {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}
.disclaimer {
  font-size: 14.5px;
  color: var(--muted);
  max-width: 70ch;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

@media (max-width: 640px) {
  .hero h1 { font-size: 30px; }
  .lab-cat, .lab-att { font-size: 18px; }
  .st-cat, .st-att { font-size: 26px; }
  img.st-cat, img.st-att { max-height: 180px; max-width: 220px; }
  .head { padding: 14px 12px 0; min-height: 150px; }
  .inst-body { font-size: 16px; }
}
