/* Тема «лаборатория»: чистый белый стол, бирюзовый акцент, янтарь для наград */
:root {
  --bg: #f3f6f5;
  --bg-2: #e6eeec;
  --card: #ffffff;
  --ink: #1b272b;
  --muted: #5a6a6f;
  --accent: #0d8578;
  --accent-ink: #ffffff;
  --accent-soft: #d9f0ec;
  --amber: #c27a10;
  --ok: #2b8a4b;
  --ok-soft: #e1f3e6;
  --bad: #c2410c;
  --bad-soft: #fbe7dc;
  --border: #d6e0dd;
  --glass: #7f9399;
  --bond: #7d8a8f;
  --atom-stroke: rgba(0, 0, 0, .35);
  --shadow: 0 2px 10px rgba(20, 50, 45, .08);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1517;
    --bg-2: #162024;
    --card: #182327;
    --ink: #e5eeec;
    --muted: #9cb0b0;
    --accent: #36c2b1;
    --accent-ink: #062723;
    --accent-soft: #143a36;
    --amber: #f0b24a;
    --ok: #5bd085;
    --ok-soft: #173826;
    --bad: #ff8a5c;
    --bad-soft: #3d2117;
    --border: #2a3a3f;
    --glass: #9fb4ba;
    --bond: #a7b4b8;
    --atom-stroke: rgba(255, 255, 255, .45);
    --shadow: 0 2px 10px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
/* атрибут hidden должен прятать всегда, даже если у элемента свой display (как у .btn) */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; }
h2 { font-size: 1.35rem; margin: 0 0 .5rem; }
h3 { font-size: 1.1rem; }
sub { font-size: .7em; }
.muted { color: var(--muted); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 760px; }
main.wrap > section { margin: 28px 0; }
.foot { padding-bottom: 32px; font-size: .9rem; }

/* ───── Шапки ───── */
.hero {
  background: linear-gradient(135deg, var(--accent-soft), var(--bg-2));
  border-bottom: 1px solid var(--border);
  padding: 40px 0 32px;
}
.hero h1 { font-size: clamp(2rem, 6vw, 3rem); margin: 0 0 .5rem; }
.hero .lead { max-width: 680px; font-size: 1.1rem; margin: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; color: var(--accent); font-weight: 700; margin: 0 0 .4rem; }
.topbar { display: flex; gap: 16px; justify-content: space-between; max-width: 980px; margin: 0 auto; padding: 12px 16px; }
.back { text-decoration: none; font-weight: 600; }

/* ───── Карточки, кнопки, чипы ───── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 16px 0;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600;
  background: var(--accent); color: var(--accent-ink);
  border: 2px solid var(--accent); border-radius: 999px;
  padding: 10px 20px; cursor: pointer; text-decoration: none;
  min-height: 44px;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { padding: 6px 14px; font-size: .92rem; min-height: 38px; }
.btn.big { font-size: 1.08rem; padding: 12px 26px; }
.btn:focus-visible, .opt:focus-visible, .jar:focus-visible, .mission:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.chip {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--ink); font-size: .9rem; font-weight: 600;
}

/* ───── Статистика ───── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stats > * {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; text-align: center; text-decoration: none; color: inherit;
}
.stats b { display: block; font-size: 1.6rem; color: var(--accent); }
.stats span { font-size: .85rem; color: var(--muted); }
.stats .pulse { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
@media (max-width: 600px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ───── Сферы ───── */
.spheres { display: flex; flex-wrap: wrap; gap: 8px; }
.sphere {
  display: inline-flex; gap: 6px; align-items: center;
  border: 1px dashed var(--border); border-radius: 999px; padding: 4px 12px;
  font-size: .9rem; color: var(--muted); filter: grayscale(1); opacity: .65;
}
.sphere.open { border-style: solid; border-color: var(--accent); color: var(--ink); filter: none; opacity: 1; background: var(--accent-soft); }

/* ───── Модули и миссии ───── */
.modules { list-style: none; padding: 0; margin: 0; position: relative; }
.modules::before { content: ""; position: absolute; left: 21px; top: 10px; bottom: 10px; width: 2px; background: var(--border); }
.module { display: flex; gap: 16px; margin-bottom: 14px; position: relative; }
.module-n {
  flex: 0 0 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700;
  background: var(--card); border: 2px solid var(--accent); color: var(--accent);
}
.module.soon .module-n { border-color: var(--border); color: var(--muted); }
.module-body { flex: 1; min-width: 0; }
.module-body h3 { margin: 8px 0 6px; }
.module.soon h3 { color: var(--muted); }
.plan { margin: 4px 0 0; font-size: .9rem; color: var(--muted); }
.mission {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; text-decoration: none; color: inherit; box-shadow: var(--shadow);
}
a.mission:hover { border-color: var(--accent); }
.mission.locked { opacity: .6; }
.m-sphere { font-size: 1.6rem; }
.m-text { flex: 1; min-width: 0; }
.m-text b, .m-text small { display: block; }
.m-text small { color: var(--muted); }
.m-status { font-size: .85rem; font-weight: 700; white-space: nowrap; color: var(--accent); }
.m-status.done, .m-status.mastered { color: var(--ok); }
.m-status.locked { color: var(--muted); }

/* ───── Варианты ответа (гипотеза и тренировка) ───── */
.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0; }
.options.wide { grid-template-columns: 1fr; }
@media (max-width: 600px) { .options { grid-template-columns: 1fr; } }
.opt {
  font: inherit; text-align: left; cursor: pointer;
  background: var(--bg); color: var(--ink);
  border: 2px solid var(--border); border-radius: 12px; padding: 12px 16px; min-height: 48px;
}
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt.chosen { border-color: var(--accent); background: var(--accent-soft); }
.opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt:disabled { cursor: default; }

/* Цвета элементов — те же, что у шариков в «лупе» */
.el { font-weight: 700; padding: 0 1px; border-bottom: 3px solid currentColor; }
.el-H { color: #8d969a; }
.el-C { color: #41474d; }
.el-O { color: #d23c32; }
.el-Na { color: #8a4fd6; }
.el-N { color: #3b6fe0; }
.el-Cl { color: #2fa84f; }
.el-Fe { color: #b8541f; }
.el-Al { color: #6f7c86; }
.el-Li { color: #a55be0; }
.el-K { color: #7d3fc4; }
.el-P { color: #d9711a; }
.el-S { color: #b0920f; }
.el-Ca { color: #3e8a5c; }
.el-Cu { color: #b06a28; }
.el-Mg { color: #4f9030; }
.missions { display: flex; flex-direction: column; gap: 8px; }
@media (prefers-color-scheme: dark) {
  .el-C { color: #c3ccd1; }
  .el-H { color: #e8eef0; }
  .el-O { color: #ff7a6e; }
  .el-Na { color: #c39bff; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
