/* Соцконтракт — тёплый современный интерфейс. Без внешних шрифтов и картинок. */

:root {
  --bg: #faf6f0;
  --surface: #ffffff;
  --ink: #2b2118;
  --muted: #7a6a5c;
  --line: #e8dfd4;
  --accent: #e0763b;      /* тепло-оранжевый (искорка) */
  --accent-ink: #fff7ef;
  --soft: #fceee2;
  --green: #4c8c4a;
  --green-soft: #e9f2e4;
  --red: #c14b3c;
  --red-soft: #f9e6e2;
  --shadow: 0 6px 20px rgba(80, 50, 20, 0.08);
  --radius: 16px;
  --focus: #b3541e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5;
  font-size: 16px;
}

/* фокус-доступность */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  padding: 8px 14px;
  z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ===== верхняя панель ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: max-content; }
.mascot {
  font-size: 30px;
  display: inline-block;
  animation: float 4s ease-in-out infinite;
  filter: drop-shadow(0 3px 4px rgba(224, 118, 59, 0.35));
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-weight: 800; font-size: 16px; }
.brand-sub { color: var(--muted); font-size: 12px; }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}
.nav-btn {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-btn:hover { background: var(--soft); }
.nav-btn[aria-current="page"] {
  background: var(--accent);
  color: var(--accent-ink);
}

.backup-nav { display: flex; gap: 8px; }
.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
  transition: box-shadow 0.15s, background 0.15s;
}
.btn:hover { box-shadow: var(--shadow); }
.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn.small { padding: 5px 10px; font-size: 14px; }

/* ===== контент ===== */
.main {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
h1 { font-size: 24px; margin: 0 0 6px; }
h2 { font-size: 19px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.fine { font-size: 13px; color: var(--muted); }
.note {
  background: var(--soft);
  border-left: 4px solid var(--accent);
  padding: 10px 14px;
  border-radius: 0 10px 10px 0;
  margin: 12px 0;
  font-size: 14px;
}
.warn {
  background: var(--red-soft);
  border-left: 4px solid var(--red);
  padding: 10px 14px;
  border-radius: 0 10px 10px 0;
  margin: 12px 0;
  font-size: 14px;
}
.ok-box { background: var(--green-soft); border-left: 4px solid var(--green); padding: 10px 14px; border-radius: 0 10px 10px 0; margin: 12px 0; font-size: 14px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

label.field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
input[type="text"], input[type="number"], input[type="search"], select, textarea {
  font: inherit;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}
textarea { min-height: 120px; resize: vertical; }

/* ===== вопросы теста ===== */
.question-wrap { margin-top: 8px; }
.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 8px;
}
.option:hover { border-color: var(--accent); background: var(--soft); }
.option .marker {
  flex: none;
  width: 22px; height: 22px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: transparent;
}
.option.selected { border-color: var(--accent); background: var(--soft); }
.option.selected .marker { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.option.correct { border-color: var(--green); background: var(--green-soft); }
.option.correct .marker { background: var(--green); border-color: var(--green); color: #fff; }
.option.wrong { border-color: var(--red); background: var(--red-soft); }
.option.wrong .marker { background: var(--red); border-color: var(--red); color: #fff; }
.option:disabled { cursor: default; }

.hint-block {
  background: var(--soft);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 10px;
  font-size: 14px;
}
.split { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ===== персонаж «Искорка» и кнопка подсказки ===== */
.spark {
  display: inline-block;
  vertical-align: middle;
  filter: drop-shadow(0 2px 3px rgba(224, 118, 59, 0.35));
}
.hint-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.hint-row { gap: 2px; }
.storage-banner {
  max-width: 860px;
  margin: 12px auto 0;
  position: sticky;
  top: 68px;
  z-index: 35;
}

/* ===== прогресс ===== */
.progressbar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progressbar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.25s; }
.badge {
  display: inline-block;
  background: var(--soft);
  color: var(--ink);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 700;
}

/* ===== чеклист ===== */
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--line);
}
.check-item:last-child { border-bottom: 0; }
.check-item input[type="checkbox"] {
  width: 22px; height: 22px;
  accent-color: var(--accent);
  cursor: pointer;
  flex: none;
  margin-top: 2px;
}
.check-item label { font: inherit; display: block; }
.check-item.done label { color: var(--muted); text-decoration: line-through; }

/* ===== подсветка блока ===== */
.result-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.result-line:last-child { border-bottom: 0; }
.result-line .k { color: var(--muted); }
.result-line .v { font-weight: 800; }

/* ===== подвал ===== */
.footer { text-align: center; padding: 12px 16px 32px; }

/* ===== адаптивность (мобильные) ===== */
@media (max-width: 640px) {
  .grid2 { grid-template-columns: 1fr; }
  .topbar { padding: 8px 10px; }
  .nav { order: 3; flex-basis: 100%; justify-content: space-between; overflow-x: auto; flex-wrap: nowrap; }
  .nav-btn { padding: 7px 10px; font-size: 14px; }
  .backup-nav { margin-left: auto; }
  .main { padding: 14px 12px 32px; }
  .card { padding: 14px; }
}

/* ===== уменьшенное движение ===== */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
