/* ============ ХАБ ИНСТРУМЕНТОВ ============ */
.tools-group { margin-bottom: 56px; }
.tools-group:last-child { margin-bottom: 0; }
.tools-group .section__title { font-size: 26px; margin-bottom: 6px; }
.tools-group .section__subtitle { font-size: 15.5px; margin-bottom: 24px; }
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.tools-tabs { margin-bottom: 36px; }
.tools-tabs button { font-size: 14.5px; padding: 10px 20px; }

/* ============ СТРАНИЦА КАЛЬКУЛЯТОРА ============ */
.calc-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 34px;
  margin: 8px 0 36px;
}
.calc-card h2 { font-size: 19px; font-weight: 700; margin: 0 0 18px; }

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}
.calc-grid--3 { grid-template-columns: 1fr 1fr 1fr; }
.calc-grid .field--full { grid-column: 1 / -1; }

.calc-card .btn { margin-top: 4px; }

.calc-result {
  margin-top: 26px;
  border-radius: 16px;
  padding: 22px 24px;
  background: var(--bg-gray);
  border: 1px solid var(--border);
}
.calc-result[hidden] { display: none; }
.calc-result__row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.calc-result__value { font-size: 40px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.calc-result__unit { font-size: 15px; font-weight: 600; color: var(--text-muted); }
.calc-result__label { font-size: 13.5px; color: var(--text-muted); margin-top: 4px; }

.calc-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 700;
  margin-top: 12px;
}
.calc-badge--ok { background: var(--ok-bg); color: var(--ok); }
.calc-badge--attn { background: var(--attn-bg); color: #92650a; }
.calc-badge--high { background: var(--high-bg); color: var(--high); }
.calc-badge--low { background: var(--low-bg); color: var(--low); }

.calc-result__note {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

.calc-consult {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}
.calc-consult::before {
  content: '';
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.calc-scale {
  position: relative;
  margin-top: 18px;
  height: 10px;
  border-radius: 6px;
  --s1: 20%; --s2: 40%; --s3: 55%;
  background: linear-gradient(90deg, var(--low) 0 var(--s1), var(--ok) var(--s1) var(--s2), var(--attn) var(--s2) var(--s3), var(--high) var(--s3) 100%);
}
.calc-scale__marker {
  position: absolute;
  top: -5px;
  width: 4px;
  height: 20px;
  border-radius: 2px;
  background: #0f172a;
  transform: translateX(-50%);
  transition: left var(--dur-moderate) var(--ease-out-soft);
}

.calc-sub-results {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.calc-sub-results__item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: center;
}
.calc-sub-results__item b { display: block; font-size: 20px; font-weight: 800; }
.calc-sub-results__item span { font-size: 12.5px; color: var(--text-muted); }

/* Таблица зон / результатов (пульс, прививки) */
.calc-table {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 8px 0 28px;
}
.calc-table__row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1.6fr;
  gap: 10px;
  align-items: center;
  padding: 13px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.calc-table__row:last-child { border-bottom: none; }
.calc-table__row--head {
  background: var(--bg-gray);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}
.calc-table__row--past { opacity: .5; }
.calc-table__row--next { background: var(--primary-light); }
.calc-table__row b { font-weight: 600; }

/* Конвертер единиц */
.conv {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: end;
}
.conv__eq { text-align: center; font-size: 22px; color: var(--text-muted); padding-bottom: 14px; }
.conv-unit { display: flex; gap: 8px; align-items: center; }
.conv-unit select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 10px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: #fff;
}
.conv-type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}
.conv-type-tabs button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 100px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--dur-base) var(--ease-out-soft), color var(--dur-base) var(--ease-out-soft), border-color var(--dur-base) var(--ease-out-soft);
}
.conv-type-tabs button.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============ ОПРОСНИКИ (Likert-шкала) ============ */
.qlist { display: grid; gap: 18px; margin-bottom: 22px; }
.qitem {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
}
.qitem__num { font-size: 12.5px; font-weight: 700; color: var(--primary); margin-bottom: 6px; display: block; }
.qitem__text { font-size: 15px; font-weight: 600; margin-bottom: 14px; line-height: 1.45; }
.qitem__opts { display: grid; gap: 8px; }
@media (min-width: 560px) { .qitem__opts { grid-template-columns: repeat(var(--opt-cols, 4), 1fr); } }
.qopt { position: relative; }
.qopt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.qopt span {
  display: block;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 8px;
  font-size: 13px;
  color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease-out-soft), border-color var(--dur-fast) var(--ease-out-soft), color var(--dur-fast) var(--ease-out-soft);
}
.qopt input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.qopt input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.qprogress { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }

/* ============ МИНИ-ИГРЫ ============ */
.game-stage {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
}
.game-hud { display: flex; justify-content: center; gap: 24px; margin-bottom: 18px; font-size: 14px; color: var(--text-muted); flex-wrap: wrap; }
.game-hud b { color: var(--text); font-size: 18px; display: block; }

.schulte-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-width: 380px;
  margin: 0 auto;
  aspect-ratio: 1;
}
.schulte-cell {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-gray);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--dur-instant) var(--ease-out-soft), color var(--dur-instant) var(--ease-out-soft);
}
.schulte-cell:hover { background: var(--primary-light); }
.schulte-cell.is-done { background: var(--ok-bg); color: var(--ok); cursor: default; }

.reaction-box {
  height: 240px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  user-select: none;
  background: #64748b;
  transition: background .1s;
}
.reaction-box.wait { background: #dc2626; }
.reaction-box.go { background: #16a34a; }

.mem-digits {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: .15em;
  margin: 20px 0;
}
.mem-input { text-align: center; font-size: 20px; letter-spacing: .1em; }

.type-passage {
  background: var(--bg-gray);
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 14px;
  color: var(--text-muted);
}
.type-passage span.done { color: var(--ok); }
.type-passage span.wrong { color: var(--high); text-decoration: underline; }
.type-passage span.cur { background: var(--primary-light); border-radius: 2px; }

.vision-row { text-align: center; margin: 24px 0; }
.vision-letter { font-size: clamp(40px, 12vw, 96px); font-weight: 700; font-family: Georgia, serif; letter-spacing: .3em; }
.vision-swatches { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin: 20px 0; }
.vision-swatch { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; font-weight: 800; color: rgba(0,0,0,.001); }

.amsler-grid {
  width: min(320px, 90vw);
  aspect-ratio: 1;
  margin: 20px auto;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 10% 10%;
  border: 2px solid var(--text);
  position: relative;
}
.amsler-grid::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 8px; height: 8px;
  background: var(--high);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.astig-fan {
  width: min(320px, 90vw);
  aspect-ratio: 1;
  margin: 20px auto;
  border-radius: 50%;
  background: repeating-conic-gradient(#0f172a 0deg 3deg, #fff 3deg 9deg);
}

/* ============ ПОИСК ПОКАЗАТЕЛЯ ============ */
.ind-search { position: relative; margin-bottom: 22px; }
.ind-search__list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--elevation-4);
  max-height: 300px;
  overflow-y: auto;
}
.ind-search__opt {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: background .1s;
}
.ind-search__opt:hover, .ind-search__opt.is-active { background: var(--primary-light); }
.ind-search__opt small { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
.ind-search__empty { padding: 14px 16px; font-size: 13.5px; color: var(--text-muted); }

.ind-rows { display: grid; gap: 10px; margin-bottom: 20px; }
.ind-empty-hint {
  text-align: center;
  padding: 26px 16px;
  color: var(--text-muted);
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.ind-row {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
}
.ind-row__main {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 10px;
  align-items: center;
}
.ind-row__name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ind-row__input-wrap { display: flex; align-items: center; gap: 8px; }
.ind-row__input-wrap input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 10px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.ind-row__input-wrap input:focus { border-color: var(--primary); }
.ind-row__unit { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.ind-row__remove {
  border: none;
  background: var(--bg-gray);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background .15s, color .15s;
}
.ind-row__remove:hover { background: var(--high-bg); color: var(--high); }
.ind-row__status {
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}
.ind-row.has-result .ind-row__status { display: flex; }

@media (max-width: 640px) {
  .tools-grid { grid-template-columns: 1fr; }
  .calc-card { padding: 22px 18px; }
  .calc-grid, .calc-grid--3 { grid-template-columns: 1fr; }
  .calc-sub-results { grid-template-columns: 1fr; }
  .calc-table__row { grid-template-columns: 1fr; gap: 3px; padding: 12px 14px; }
  .conv { grid-template-columns: 1fr; }
  .conv__eq { padding-bottom: 0; }
  .qitem__opts { grid-template-columns: 1fr 1fr; }
  .game-stage { padding: 16px; }
  .ind-row__main { grid-template-columns: 1fr; }
  .ind-row__name { white-space: normal; }
}
