:root {
  --accent: #1e6f5c;
  --accent-dark: #0f4c3f;
  --bg: #f9fafb;
  --text: #1f2937;
  --border: #cbd5e1;
  --muted: #64748b;
  --error-text: #b91c1c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: flex-start; /* не по центру по высоте: иначе страница прыгает, когда раскрываешь совет */
  justify-content: center;
  padding: 20vh 16px 16px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

main {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

input {
  flex: 1 1 260px;
  min-width: 0;
  padding: 12px 14px;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button, .button {
  padding: 12px 20px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
button:hover, .button:hover { background: var(--accent-dark); }
.button { display: inline-block; margin-left: 12px; text-decoration: none; }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.spinner {
  flex: none;
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

p { margin: 0; }

.error { color: var(--error-text); }

#result, #generate-form { display: flex; flex-direction: column; gap: 12px; }
#result[hidden], #done[hidden] { display: none; }

/* Кнопки «развернуть / свернуть» в отчёте выглядят как текст со стрелкой */
.toggle {
  padding: 4px 0;
  font-weight: 600;
  color: var(--text);
  background: none;
  text-align: left;
}
.toggle:hover { background: none; color: var(--accent); }
.toggle::before { content: "▸ "; color: var(--accent); }
.toggle[aria-expanded="true"]::before { content: "▾ "; }

#advice { padding: 0 0 0 16px; }
#no-important { margin: 4px 0; }
.advice-list { margin: 0; padding: 0 0 0 16px; list-style: none; }
.advice-title { font-weight: 400; }
.advice-details { padding: 0 0 8px 18px; color: var(--muted); }
.advice-details p + p, .advice-details code { margin-top: 4px; }
.advice-details code {
  display: block;
  padding: 6px 8px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-wrap: anywhere;
  white-space: pre-wrap; /* несколько строк кода — каждая на своей строке */
}

#files { margin: 0; padding: 0; list-style: none; }
#files li { position: relative; padding: 4px 0; }
#files input { margin: 0 6px 0 0; accent-color: var(--accent); }
#files .status { margin-left: 8px; color: var(--muted); }
.reason { padding-left: 22px; font-size: 0.9em; color: var(--muted); }
.badge {
  margin-left: 8px;
  padding: 1px 8px;
  font-size: 0.85em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
}

/* Кнопка «?» с пояснением: подсказка при наведении, фокусе и по нажатию */
.info-wrap { margin-left: 6px; } /* подсказка привязана к строке файла, чтобы не вылезать за экран */
.info {
  width: 20px;
  height: 20px;
  padding: 0;
  font-size: 0.8em;
  line-height: 20px;
  border-radius: 50%;
}
.tip {
  display: none;
  position: absolute;
  left: 0;
  top: 30px;
  z-index: 1;
  width: min(360px, 100%);
  padding: 8px 10px;
  font-size: 0.9em;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.08);
}
.info-wrap:hover .tip, .info-wrap:focus-within .tip, .info-wrap.open .tip { display: block; }

header h1 { margin: 0; font-size: 1.8em; line-height: 1.2; color: var(--accent); }
.lead { margin-top: 4px; color: var(--muted); }
.about p { margin: 4px 0; }
.url-label { margin-top: 8px; font-weight: 600; }
input::placeholder { color: var(--muted); }

/* Вкладки «Проверка сайта» и «MCP-сервер» (этап 11.1) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 10px 18px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  margin-bottom: -1px;
}
.tab:hover { color: var(--accent); background: none; }
.tab[aria-selected="true"] { color: var(--accent); background: #fff; border-color: var(--border); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 12px 12px;
}
.panel[hidden] { display: none; }
#result { gap: 0; }
#report { padding-bottom: 16px; border-bottom: 1px solid var(--border); }

/* «Что в порядке» (этап 11.2): пройденные — зелёной галочкой, непроверенные — серым */
#passed-group { margin-top: 8px; }
#passed-group[hidden] { display: none; }
.check-list { margin: 4px 0 0; padding: 0 0 0 16px; list-style: none; }
.check-list[hidden] { display: none; }
.check-list li { position: relative; padding: 2px 0 2px 22px; }
.check-list li::before { position: absolute; left: 0; font-weight: 700; }
.check-list .passed::before { content: "✓"; color: var(--accent); }
.check-list .skipped { color: var(--muted); }
.check-list .skipped::before { content: "–"; color: var(--muted); }

/* Вкладка MCP */
.offer { position: relative; }
.warning { padding: 8px 12px; background: #fef9c3; border-radius: 8px; }
.warning[hidden], .guide[hidden], #mcp-done[hidden] { display: none; }
.guide { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px; background: var(--bg); border-radius: 8px; overflow-wrap: anywhere; }
@media (max-width: 480px) { .panel { padding: 14px; } }
.guide ol { margin: 0; padding-left: 20px; }
.guide a { color: var(--accent); overflow-wrap: anywhere; }
.guide .own { margin-top: 6px; font-weight: 600; }
#mcp-generate-form { display: flex; flex-direction: column; gap: 12px; }

/* Анкета MCP-сервера */
#mcp-form { display: flex; flex-direction: column; gap: 14px; }
#mcp-form[hidden], .question[hidden], .question .option[hidden] { display: none; }
.question { position: relative; margin: 0; padding: 0; border: 0; }
.question.missing { outline: 2px solid var(--error-text); outline-offset: 6px; border-radius: 4px; } /* не ответили (этап 10.7) */
.question legend { padding: 0; margin-bottom: 4px; font-weight: 600; }
.question .option { display: block; padding: 2px 0; }
.question .tip { top: auto; margin-top: 26px; } /* подсказка — под строкой с «?» */
.simplest { font-weight: 400; margin-right: 2px; }
.question input { margin: 0 6px 0 0; accent-color: var(--accent); }
.question textarea { width: 100%; box-sizing: border-box; margin-top: 4px; font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; }
.muted { color: var(--muted); }
.ai-note { margin-top: 4px; font-size: 0.9em; color: var(--muted); }
.copy { margin-left: 4px; padding: 2px 10px; font-size: 0.95em; font-weight: 400; }
