/* Оформление. Основа спокойная: приглушённые цвета, волосяные границы вместо теней,
   никакого постоянного движения. Всё считается от мобильного экрана, дальше расширяется. */

:root {
  /* Светлая тема по умолчанию: сервисом пользуются днём, с детьми,
     и системная тёмная схема тут выглядит мрачно. Тёмная включается вручную. */
  color-scheme: light;

  --bg: #f4f7f3;
  --bg-soft: #eaefe8;
  --surface: #ffffff;
  --surface-2: #f8faf7;
  --ink: #1e2a26;
  --ink-soft: #3b4a44;
  --muted: #63716b;
  --line: #e2e8df;
  --line-strong: #ccd6ca;

  --pine: #2e6d5e;
  --pine-hover: #24564a;
  --pine-soft: #e8f2ed;
  --mustard: #c08c34;
  --mustard-soft: #fbf3e4;
  --alert-ink: #8a504b;
  --alert-bg: #fbeeeb;
  --good-ink: #2f6b4f;
  --good-bg: #eaf4ee;

  --cell-empty: #e4ebe4;
  --cell-filled: #7cb094;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;

  --tap: 48px;
  --pad: clamp(1rem, 4vw, 1.6rem);
  --gap: clamp(.75rem, 3vw, 1.1rem);
}

/* Тёмная тема: не чёрная, а приглушённо-зелёная, с мягким контрастом.
   Включается выбором в настройках или системной схемой в режиме «как в системе». */
html[data-theme='dark'] {
  color-scheme: dark;

  --bg: #1c2320;
  --bg-soft: #232b28;
  --surface: #252e2a;
  --surface-2: #2b3531;
  --ink: #eef3ef;
  --ink-soft: #d3ddd7;
  --muted: #9fada6;
  --line: #36423d;
  --line-strong: #47544e;

  --pine: #64b399;
  --pine-hover: #7cc4ac;
  --pine-soft: #2c3b35;
  --mustard: #d9ac63;
  --mustard-soft: #3a3226;
  --alert-ink: #eab2ab;
  --alert-bg: #3a2a27;
  --good-ink: #a9d9bd;
  --good-bg: #26362d;

  --cell-empty: #313b37;
  --cell-filled: #59a184;
}

* { box-sizing: border-box; }

/* Скрытые элементы прячем даже с display из своих классов */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: clamp(16px, 1rem + .2vw, 17.5px);
  line-height: 1.62;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

/* Типографика: крупный шаг на заголовках, спокойный на тексте */
h1, h2, h3 { color: var(--ink); font-weight: 800; letter-spacing: -.015em; line-height: 1.18; margin: 0 0 .55em; }
h1 { font-size: clamp(1.6rem, 1.35rem + 1.6vw, 2.15rem); }
h2 { font-size: clamp(1.2rem, 1.1rem + .7vw, 1.4rem); margin-top: 1.7em; }
h3 { font-size: 1.06rem; font-weight: 700; margin-bottom: .3em; }
p { margin: 0 0 1em; max-width: 66ch; }
p:last-child { margin-bottom: 0; }
ul { margin: 0 0 1em; padding-left: 1.15rem; max-width: 66ch; }
li { margin-bottom: .35em; }
a { color: var(--pine); text-decoration-thickness: 1px; text-underline-offset: 2px; }
strong { font-weight: 700; }

/* Шапка: залипает, высота небольшая, безопасные отступы под вырезы */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* На узком экране с крупным системным шрифтом строка не влезает,
     поэтому разрешаем перенос вместо обрезки по краю. */
  flex-wrap: wrap;
  gap: .5rem 1rem;
  padding: .7rem max(1rem, env(safe-area-inset-left)) .7rem max(1rem, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
@supports not (backdrop-filter: blur(2px)) {
  .topbar { background: var(--surface); }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  flex-shrink: 0;
  font-weight: 800;
  font-size: clamp(1rem, .95rem + .4vw, 1.08rem);
  letter-spacing: -.02em;
  color: var(--ink);
  text-decoration: none;
}
.brand::before {
  content: '';
  width: 20px; height: 20px;
  border-radius: 6px;
  /* Три ступеньки: знак сервиса, без картинки */
  background:
    linear-gradient(to top, var(--pine) 0 33%, transparent 33%) left / 34% 100% no-repeat,
    linear-gradient(to top, var(--pine) 0 66%, transparent 66%) center / 34% 100% no-repeat,
    linear-gradient(to top, var(--pine) 0 100%, transparent 100%) right / 34% 100% no-repeat;
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: .4rem;
  min-width: 0;
}
/* В узкой шапке помещаются только вход и регистрация, остальное есть в подвале */
@media (max-width: 560px) {
  /* Всё, что не помещается в узкую шапку, есть в подвале и на страницах */
  .topnav .only-wide { display: none; }
  .topbar { padding-top: .55rem; padding-bottom: .55rem; gap: .4rem .6rem; }
  .topnav { font-size: .88rem; gap: .2rem; }
  .topnav a { min-height: 36px; padding: 0 .45rem; }
  .topnav a.btn-mini { padding: 0 .7rem; }
  .theme-toggle { width: 34px; height: 34px; }
  .theme-toggle svg { width: 17px; height: 17px; }
  .brand::before { width: 18px; height: 18px; }
}
.topnav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: .3rem;
  font-size: .95rem;
}
/* У вошедшего родителя те же пункты есть во вкладках, в узкой шапке они лишние */
@media (max-width: 699px) {
  .topnav.in-cabinet { display: none; }
}
.topnav a {
  display: inline-flex; align-items: center;
  min-height: 40px; padding: 0 .6rem;
  border-radius: var(--r-sm);
  color: var(--ink-soft); text-decoration: none; font-weight: 600;
}
.topnav a:hover { background: var(--bg-soft); color: var(--ink); }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--line-strong); background: var(--bg-soft); }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* Показываем значок того режима, в который переключит нажатие */
.theme-toggle .i-dark, .theme-toggle .i-auto { display: none; }
html[data-theme='dark'] .theme-toggle .i-light { display: none; }
html[data-theme='dark'] .theme-toggle .i-dark { display: block; }
.theme-toggle[data-mode='auto'] .i-light,
.theme-toggle[data-mode='auto'] .i-dark { display: none !important; }
.theme-toggle[data-mode='auto'] .i-auto { display: block; }

.topnav a.btn-mini {
  background: var(--pine); color: #fff; padding: 0 .95rem; font-weight: 700;
}
.topnav a.btn-mini:hover { background: var(--pine-hover); }

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(var(--pad) * .9) max(1rem, env(safe-area-inset-left)) 3.5rem max(1rem, env(safe-area-inset-right));
}

/* Карточка: граница вместо тени, скругление по значимости блока */
/* Карточка: граница вместо тени, скругление по значимости блока */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--pad);
  margin-bottom: var(--gap);
}
.card.narrow { max-width: 460px; }
.note { color: var(--muted); font-size: .94rem; }

/* Кнопки: цель нажатия не меньше 48px, на узком экране тянутся на всю ширину */
.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: .6rem 1.3rem;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--pine);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease;
}
.btn:hover { background: var(--pine-hover); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--pine); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--pine-soft); border-color: var(--pine); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.btn-row .btn { flex: 1 1 auto; }
@media (max-width: 420px) {
  .btn-row .btn { flex: 1 1 100%; }
}

/* В тёмной теме акцент светлый, поэтому текст поверх него тёмный.
   Прозрачных кнопок это не касается: у них текст сам акцентного цвета. */
html[data-theme='dark'] .btn:not(.ghost),
html[data-theme='dark'] .btn-mini,
html[data-theme='dark'] .msg.me,
html[data-theme='dark'] .choice.right,
html[data-theme='dark'] .keys button.lit,
html[data-theme='dark'] .seq-note.now { color: #16211d; }

@media (min-width: 700px) {
  html[data-theme='dark'] .tabbar a.on { color: #16211d; }
}

:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; border-radius: 6px; }

/* Формы */
label { display: block; font-weight: 600; font-size: .95rem; margin: 1.1rem 0 .3rem; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%;
  min-height: var(--tap);
  padding: .6rem .85rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
}
input:focus, textarea:focus { background: var(--surface); }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input[type=checkbox], input[type=radio] {
  width: 22px; height: 22px; min-height: 0;
  accent-color: var(--pine);
  vertical-align: -4px;
}

.err, .ok-msg {
  padding: .8rem 1rem;
  border-radius: var(--r-md);
  margin-bottom: 1rem;
  font-size: .96rem;
}
.err { background: var(--alert-bg); color: var(--alert-ink); }
.ok-msg { background: var(--good-bg); color: var(--good-ink); }

/* Первый экран главной */
.hero { padding: .4rem 0 1.2rem; }
.hero h1 { max-width: 24ch; }
.hero .lead {
  font-size: clamp(1.04rem, 1rem + .5vw, 1.16rem);
  color: var(--ink-soft);
  max-width: 52ch;
}

/* Главная и «О проекте»: шире колонка, первый экран по центру на большом экране */
.wrap.landing { max-width: 940px; }

/* Демонстрация игры: поле, стартовая фигура, рамка и схема клавиш */
.hero-demo {
  display: flex;
  align-items: center;
  gap: clamp(.8rem, 4vw, 1.6rem);
  margin: clamp(1.2rem, 5vw, 1.8rem) 0 .7rem;
}
.hero-field {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(4px, 1.4vw, 7px);
  width: min(280px, 56vw);
}
.hero-field i {
  display: block;
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--cell-empty);
  transition: background .18s linear;
}
.hero-field i.filled { background: var(--cell-filled); }
/* Рамка показывает, где сейчас курсор игрока */
.hero-field i.cursor { box-shadow: inset 0 0 0 3px var(--mustard); }

/* Схема клавиш: подсвечивается стрелка, которой сделан шаг */
.hero-keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: clamp(84px, 26vw, 108px);
}
.hero-key {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 1rem;
  transition: background .12s linear, color .12s linear, border-color .12s linear;
}
.hero-key[data-dir="up"] { grid-column: 2; }
.hero-key[data-dir="left"] { grid-column: 1; grid-row: 2; }
.hero-key[data-dir="down"] { grid-column: 2; grid-row: 2; }
.hero-key[data-dir="right"] { grid-column: 3; grid-row: 2; }
.hero-key.on { background: var(--mustard); border-color: var(--mustard); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-field i { transition: none; }
  .btn:active { transform: none; }
}

@media (min-width: 760px) {
  /* Блок .hero есть только на главной, отдельный класс колонки тут не нужен */
  .hero { text-align: center; }
  .hero h1 { max-width: 22ch; margin-left: auto; margin-right: auto; }
  .hero .lead,
  .hero .note { margin-left: auto; margin-right: auto; }
  .hero .hero-demo { width: fit-content; margin-left: auto; margin-right: auto; }
  .hero .btn-row { justify-content: center; }
  .hero .btn-row .btn,
  .wrap.landing .btn-row .btn { flex: 0 0 auto; }

  /* Заголовки разделов и абзацы между блоками тоже по центру */
  .wrap.landing > h2 { text-align: center; }
  .wrap.landing > p { max-width: 72ch; margin-left: auto; margin-right: auto; text-align: center; }
  .wrap.landing > .btn-row { justify-content: center; }
  .wrap.landing .disclaimer { max-width: 70ch; margin-left: auto; margin-right: auto; }
  .wrap.landing .tiles { grid-template-columns: repeat(3, 1fr); }
}

.disclaimer {
  border: 1px solid var(--line);
  border-left: 4px solid var(--mustard);
  background: var(--mustard-soft);
  border-radius: var(--r-md);
  padding: 1rem 1.1rem;
  margin: 1.5rem 0;
  font-size: .96rem;
  color: var(--ink-soft);
}
.disclaimer strong { display: block; margin-bottom: .25rem; color: var(--ink); }

.tiles { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 620px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
}
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.05rem 1.15rem;
  color: inherit;
  text-decoration: none;
  display: block;
}
a.tile:hover { border-color: var(--pine); background: var(--pine-soft); }
.tile h3 { margin-top: 0; }
.tile p { margin: 0; color: var(--muted); font-size: .94rem; }

/* Меню кабинета: на телефоне нижняя панель вкладок, на ПК строка под шапкой.
   Пять пунктов помещаются всегда, прокручивать ничего не нужно. */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: .3rem max(.2rem, env(safe-area-inset-left)) calc(.3rem + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-top: 1px solid var(--line);
}
@supports not (backdrop-filter: blur(2px)) {
  .tabbar { background: var(--surface); }
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .15rem;
  min-height: 54px;
  padding: .3rem .1rem;
  border-radius: var(--r-md);
  color: var(--muted);
  text-decoration: none;
  font-size: .76rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
}
.tabbar a svg {
  width: 22px; height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tabbar a.on { color: var(--pine); background: var(--pine-soft); }
.tabbar a:active { background: var(--bg-soft); }
/* Панель прижата к низу экрана, поэтому место под неё даёт отступ страницы,
   а не распорка в потоке разметки */
.tabbar-spacer { display: none; }

@media (max-width: 699px) {
  .wrap { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
}

@media (min-width: 700px) {
  .tabbar {
    position: static;
    display: flex;
    justify-content: flex-start;
    gap: .4rem;
    margin: 0 0 var(--gap);
    padding: 0;
    background: none;
    backdrop-filter: none;
    border-top: 0;
  }
  .tabbar a {
    flex-direction: row;
    gap: .45rem;
    min-height: 42px;
    padding: 0 1rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-soft);
    font-size: .95rem;
  }
  .tabbar a:hover { border-color: var(--line-strong); }
  .tabbar a.on { background: var(--pine); border-color: var(--pine); color: #fff; }
  .tabbar a svg { width: 18px; height: 18px; }
  .tabbar-spacer { display: none; }
}

/* Прогресс */
.stats { display: grid; gap: .6rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 620px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: .8rem .9rem;
}
.stat b {
  display: block;
  font-size: clamp(1.5rem, 1.3rem + 1.2vw, 1.85rem);
  font-weight: 800; line-height: 1.1; letter-spacing: -.02em;
}
.stat span { display: block; color: var(--muted); font-size: .85rem; line-height: 1.35; margin-top: .15rem; }

.stats + h3 { margin-top: 1.4rem; }

.level-bar {
  height: 10px; border-radius: 999px;
  background: var(--cell-empty);
  overflow: hidden;
  margin: .5rem 0 .35rem;
}
.level-bar i { display: block; height: 100%; background: var(--pine); border-radius: 999px; }

.tag {
  display: inline-block;
  background: var(--pine-soft); color: var(--pine);
  border-radius: 999px; padding: .15rem .65rem;
  font-size: .84rem; font-weight: 600;
}

/* Чат опроса */
.chat { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1rem; }
.msg {
  padding: .75rem 1rem;
  border-radius: var(--r-lg);
  max-width: 88%;
  white-space: pre-wrap;
  font-size: .99rem;
}
.msg.ai { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 6px; align-self: flex-start; }
.msg.me { background: var(--pine); color: #fff; border-bottom-right-radius: 6px; align-self: flex-end; }
.msg.sys {
  background: var(--mustard-soft); color: var(--ink-soft);
  border: 1px solid var(--line);
  align-self: stretch; max-width: 100%; font-size: .93rem;
}
.chat-form { display: grid; gap: .6rem; grid-template-columns: 1fr; }
.chat-form textarea { min-height: 76px; margin: 0; }
@media (min-width: 620px) {
  .chat-form { grid-template-columns: 1fr auto; align-items: end; }
}
.typing { color: var(--muted); font-size: .93rem; margin-bottom: .6rem; }

/* Игра с полем */
.field {
  display: grid;
  gap: clamp(3px, 1vw, 5px);
  width: min(430px, 100%);
  margin: .4rem auto 1.1rem;
  touch-action: manipulation;
}
.field div {
  aspect-ratio: 1;
  background: var(--cell-empty);
  border-radius: clamp(3px, 1.2vw, 6px);
  transition: background .12s linear;
}
.field div.filled { background: var(--cell-filled); }
.field div.cursor { box-shadow: inset 0 0 0 3px var(--mustard); }

.pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(64px, 78px));
  gap: .55rem;
  justify-content: center;
  margin: 0 auto 1rem;
}
.pad button {
  aspect-ratio: 1;
  min-height: 64px;
  font-size: 1.45rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  cursor: pointer;
  touch-action: manipulation;
}
.pad button:active { background: var(--pine-soft); }
.pad .sp { visibility: hidden; }

.reward {
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.3rem 1rem;
  margin-bottom: 1rem;
}
.reward .emoji { font-size: clamp(3.5rem, 18vw, 5rem); line-height: 1; }
.reward .ask { font-size: 1.06rem; font-weight: 600; margin: .5rem auto .8rem; max-width: 30ch; }
.reward .name { font-size: 1.35rem; font-weight: 800; margin-top: .6rem; }
.reward p { margin: .4rem auto 0; }

/* Музыка */
.keys {
  display: flex; gap: .45rem;
  justify-content: center; flex-wrap: wrap;
  margin: 1.1rem 0;
}
.keys button {
  flex: 0 0 auto;
  width: clamp(52px, 15vw, 64px);
  height: clamp(96px, 26vw, 118px);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  font: inherit; font-weight: 700; font-size: .98rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: background .1s linear, color .1s linear;
}
.keys button.lit { background: var(--mustard); border-color: var(--mustard); color: #fff; }
.keys button.bad { background: var(--alert-bg); border-color: var(--alert-ink); color: var(--alert-ink); }
/* Ноты мелодии по порядку: наизусть запоминать не нужно */
.seq-list {
  display: flex; flex-wrap: wrap; gap: .35rem;
  justify-content: center;
  margin: .3rem 0 .8rem;
}
.seq-note {
  min-width: 2.9rem;
  padding: .3rem .55rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: .95rem; font-weight: 700; text-align: center;
}
.seq-note.done { background: var(--pine-soft); border-color: var(--pine); color: var(--pine); }
.seq-note.now { background: var(--mustard); border-color: var(--mustard); color: #fff; }

.keys button small {
  display: block;
  margin-top: .2rem;
  font-size: .74rem;
  font-weight: 500;
  color: var(--muted);
}
.keys button.lit small, .keys button.bad small { color: inherit; opacity: .8; }

/* Занятия с выбором ответа: счёт и чтение */
.q-objects {
  display: flex; flex-wrap: wrap; gap: .35rem;
  align-items: center; justify-content: center;
  min-height: 84px;
  margin: .6rem 0 1rem;
  padding: .8rem .6rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.q-objects .thing { font-size: clamp(1.9rem, 8vw, 2.5rem); line-height: 1.1; }
/* Слагаемые держим отдельными группами, иначе они сливаются в одну кучу */
.q-objects .group {
  display: inline-flex; flex-wrap: wrap; gap: .3rem;
  align-items: center; justify-content: center;
  max-width: 46%;
  padding: .3rem .45rem;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
}
.q-objects .sign { font-size: clamp(1.6rem, 6vw, 2rem); font-weight: 800; margin: 0 .4rem; color: var(--muted); }
.q-objects .gone { display: inline-flex; gap: .35rem; opacity: .4; text-decoration: line-through; }
.q-objects .big-letter {
  font-size: clamp(2.4rem, 12vw, 3.4rem); font-weight: 800; letter-spacing: .06em;
}
.q-objects .big-emoji { font-size: clamp(3rem, 16vw, 4.2rem); line-height: 1; }

.q-text {
  text-align: center;
  font-size: clamp(1.15rem, 1rem + 1.4vw, 1.45rem);
  font-weight: 700;
  margin: 0 auto .9rem;
}

.choices {
  display: grid;
  gap: .55rem;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  margin-bottom: .8rem;
}
.choice {
  min-height: 62px;
  padding: .5rem .7rem;
  font: inherit;
  font-size: clamp(1.15rem, 1rem + 1vw, 1.4rem);
  font-weight: 800;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  cursor: pointer;
  touch-action: manipulation;
}
.choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .1rem;
}
.choice small {
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
}
/* Номера нужны только там, где есть клавиатура */
@media (max-width: 699px) {
  .choice small { display: none; }
}
.choice:hover { border-color: var(--pine); }
.choice.right { background: var(--pine); border-color: var(--pine); color: #fff; }
.choice.wrong { background: var(--alert-bg); border-color: var(--alert-ink); color: var(--alert-ink); }
.choice[disabled] { opacity: .55; cursor: default; }

/* Задания */
.task {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.05rem 1.15rem;
  margin-bottom: var(--gap);
}
.task.done { background: var(--surface-2); }
.task.done strong { color: var(--ink-soft); }
.task-meta { color: var(--muted); font-size: .86rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.task h3 { margin: .45rem 0 .3rem; }

/* Таблицы: на телефоне превращаются в список пар "поле - значение" */
table.data { width: 100%; border-collapse: collapse; font-size: .94rem; }
table.data th, table.data td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); }
table.data th { color: var(--muted); font-weight: 600; font-size: .86rem; }
table.data tr:last-child td { border-bottom: 0; }

@media (max-width: 560px) {
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr:first-child { display: none; } /* строка заголовков не нужна */
  table.data tr {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: .5rem .7rem;
    margin-bottom: .55rem;
  }
  table.data td {
    border: 0;
    padding: .18rem 0;
    display: flex;
    gap: .5rem;
    justify-content: space-between;
    align-items: baseline;
  }
  /* Подпись столбца берётся из data-label: на телефоне строка читается как список */
  table.data td[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600;
    flex: 0 0 auto;
  }
  table.data td:not([data-label]) { display: block; margin-top: .4rem; }
}

/* Подвал: предупреждение видно на каждой странице */
.foot {
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: .89rem;
  padding: 1.4rem max(1rem, env(safe-area-inset-left)) calc(1.4rem + env(safe-area-inset-bottom));
}
.foot p { max-width: 72ch; margin: 0 auto .7rem; }
.foot-links { text-align: center; }
.foot-links a { color: var(--muted); }

/* Предупреждение можно свернуть до одной строки, но не убрать совсем:
   оно должно оставаться доступным на любой странице. */
.foot-actions { text-align: center; }
.foot-actions .btn { min-height: 40px; padding: .35rem 1rem; font-size: .9rem; }
.foot-short { display: none; text-align: center; }
.foot.collapsed .foot-full { display: none; }
.foot.collapsed .foot-short { display: block; }
.foot-link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 700;
  color: var(--pine);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.crumbs { margin-bottom: .8rem; font-size: .93rem; }
