/* Хирад Онлайн: общий стиль (S2 → S7). Сначала телефон (360 px), затем планшет и компьютер.

   Изменено 13.11.2026 (выбор владельца — вариант A «Тетрадь олимпиадника», docs/design/варианты.html):
   бумага, чернила и один синий акцент; заголовки — Literata (с засечками), текст — Inter; оба шрифта лежат
   на нашем сервере (static/fonts, лицензия OFL), без обращений к сторонним сайтам. Три темы — ниже.
   От прежней идеи (S7, «медаль и дорожка») остались: дорожка тем в курсе и тон предмета (--tone) — им окрашены
   корешок карточки курса, шапка курса и линия дорожки. Имена --gold* сохранены как синонимы «отметки выбранного».
   Таджикские ӣ ӯ қ ҳ ҷ ғ лежат в наборе cyrillic-ext обоих шрифтов. Зелёный (--ok) — только «решено» и «верно».
   Без градиентов, теней у покоящихся элементов и украшений: плоские поля цвета, форма и размер несут смысл.
   Зоны нажатия не меньше 48 px (требование владельца: не меньше 44). Цвета — только через токены тем:
   жёстко заданный цвет ломает «Ночь» (16.11.2026 так были нечитаемы таблицы админки и название предмета). */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/inter-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/inter-cyrillic-400-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/inter-cyrillic-ext-400-normal.woff2") format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/static/fonts/inter-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/static/fonts/inter-cyrillic-600-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/static/fonts/inter-cyrillic-ext-600-normal.woff2") format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/fonts/inter-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/fonts/inter-cyrillic-700-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/fonts/inter-cyrillic-ext-700-normal.woff2") format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/static/fonts/literata-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/static/fonts/literata-cyrillic-600-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/static/fonts/literata-cyrillic-ext-600-normal.woff2") format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/fonts/literata-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/fonts/literata-cyrillic-700-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/fonts/literata-cyrillic-ext-700-normal.woff2") format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }

/* --- Темы (13.11.2026): «Бумага» (по умолчанию), «Небо», «Ночь»; «Авто» — как в системе телефона.
   Тема — атрибут data-theme у <html> (cookie kh_theme, страница /theme). Все цвета — только через эти токены.
   --deep / --on-deep — тёмные поля (подвал, нижняя панель, тёмные плашки), которые остаются тёмными в любой теме. */

:root, :root[data-theme="paper"] {
  color-scheme: light;
  --ground: #f6f3ec;
  --surface: #ffffff;
  --field: #ece6d8;
  --ink: #17171b;
  --ink-soft: #55534d;
  --accent: #1f4fd8;
  --accent-deep: #173da8;
  --on-accent: #ffffff;
  --mark: #dfe6fb;          /* выбранное и текущее: светлый тон акцента под тёмным текстом */
  --deep: #17171b;
  --on-deep: #f6f3ec;
  --on-deep-soft: #c9c5ba;
  --deep-accent: #a9bfff;
  --gold: var(--mark);      /* старые имена: «золото» теперь отметка выбранного */
  --gold-deep: #9fb3ea;
  --gold-soft: #eef2fd;
  --line: #77736a;          /* рамки полей ввода: ≥ 4,5:1 к белому */
  --rule: #e4dfd3;
  --danger: #a3241d;
  --danger-bg: #fbe9e7;
  --danger-ink: #5c1410;
  --ok: #1d7a46;
  --ok-bg: #e2efe5;
  --ok-ink: #0d3b24;
  --warn-bg: #fbf1d6;
  --code-bg: #17171b;
  --code-ink: #ecebe6;
  --code-btn: #2b2b31;
  --tap: rgba(31, 79, 216, 0.18);
}

:root[data-theme="sky"] {
  color-scheme: light;
  --ground: #eef4f9;
  --surface: #ffffff;
  --field: #dbe8f3;
  --ink: #0d1b2a;
  --ink-soft: #4a5868;
  --accent: #1565c0;        /* синий, а не бирюзовый: бирюзовый почти не отличался от зелёного «решено» */
  --accent-deep: #0d47a1;
  --on-accent: #ffffff;
  --mark: #d6e6f8;
  --deep: #0d1b2a;
  --on-deep: #eef4f9;
  --on-deep-soft: #b6c4d2;
  --deep-accent: #8fc1ff;
  --gold-deep: #9cc3ec;
  --gold-soft: #e9f2fb;
  --line: #6b7a89;
  --rule: #d6e2ec;
  --tap: rgba(21, 101, 192, 0.18);
}

:root[data-theme="night"] {
  color-scheme: dark;
  --ground: #111316;
  --surface: #1a1d22;
  --field: #22262d;
  --ink: #ebe8e1;
  --ink-soft: #aaa69e;
  --accent: #86a6ff;
  --accent-deep: #adc2ff;
  --on-accent: #0d1220;
  --mark: #2a3654;
  --deep: #07080a;
  --on-deep: #ebe8e1;
  --on-deep-soft: #aaa69e;
  --deep-accent: #a9bfff;
  --gold-deep: #4a5d8f;
  --gold-soft: #1f2636;
  --line: #85827a;
  --rule: #2d3139;
  --danger: #ff8f80;
  --danger-bg: #3a201d;
  --danger-ink: #ffd9d3;
  --ok: #63d394;
  --ok-bg: #18301f;
  --ok-ink: #cdeedb;
  --warn-bg: #362f1d;
  --code-bg: #07080a;
  --code-ink: #ecebe6;
  --code-btn: #23262c;
  --tap: rgba(134, 166, 255, 0.2);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --ground: #111316; --surface: #1a1d22; --field: #22262d; --ink: #ebe8e1; --ink-soft: #aaa69e;
    --accent: #86a6ff; --accent-deep: #adc2ff; --on-accent: #0d1220; --mark: #2a3654;
    --deep: #07080a; --on-deep: #ebe8e1; --on-deep-soft: #aaa69e; --deep-accent: #a9bfff;
    --gold-deep: #4a5d8f; --gold-soft: #1f2636; --line: #85827a; --rule: #2d3139;
    --danger: #ff8f80; --danger-bg: #3a201d; --danger-ink: #ffd9d3; --ok: #63d394; --ok-bg: #18301f; --ok-ink: #cdeedb;
    --warn-bg: #362f1d; --code-bg: #07080a; --code-ink: #ecebe6; --code-btn: #23262c; --tap: rgba(134, 166, 255, 0.2);
  }
}

:root {
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", Arial, sans-serif;
  --display: "Literata", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --tone: #0f7a45;          /* цвет предмета; переопределяется [data-subject] ниже */

  --step-0: 1.0625rem;   /* 17 px: основной текст */
  --step-1: 1.25rem;
  --step-2: 1.75rem;
  --step-3: clamp(2.4rem, 10vw, 4.25rem);

  --gutter: 1rem;
  --radius: 0.375rem;
  --section: 3rem;
  --tabs: 4.25rem;       /* высота нижней панели на телефоне */
}

/* Тон предмета: белый текст на каждом ≥ 4,5:1 */
[data-subject="informatika"]  { --tone: #5b4bb7; }   /* не зелёный: зелёным сайт показывает только «решено» и «верно» */
[data-subject="matematika"]   { --tone: #1b6f8a; }
[data-subject="fizika"]       { --tone: #b0501a; }
[data-subject="himiya"]       { --tone: #5f7010; }
[data-subject="biologiya"]    { --tone: #2a7d5d; }
[data-subject="geografiya"]   { --tone: #1f5fa3; }
[data-subject="istoriya"]     { --tone: #a3432b; }
[data-subject="tojiki"]       { --tone: #8a6408; }
[data-subject="russkiy"]      { --tone: #a43a58; }
[data-subject="angliyskiy"]   { --tone: #2d6a9a; }
[data-subject="literatura"]   { --tone: #7d5524; }

/* Тон предмета как ЦВЕТ ТЕКСТА и значков (--tone-ink). В светлых темах это сам тон; в «Ночи» тон слишком тёмный
   для тёмного фона (контраст около 3:1), поэтому он осветляется наполовину. Объявляется и у :root, и у
   [data-subject]: переменная вычисляется там, где задана, а --tone меняется как раз на [data-subject]. */
:root, [data-subject] { --tone-ink: var(--tone); }
:root[data-theme="night"], :root[data-theme="night"] [data-subject] { --tone-ink: color-mix(in srgb, var(--tone) 50%, #fff); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"], :root[data-theme="auto"] [data-subject] { --tone-ink: color-mix(in srgb, var(--tone) 50%, #fff); }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--tabs) + env(safe-area-inset-bottom, 0px));
  -webkit-tap-highlight-color: var(--tap);
}

main { flex: 1 0 auto; }
img, svg { max-width: 100%; height: auto; }

h1, h2, h3 { line-height: 1.12; margin: 0 0 0.6em; letter-spacing: -0.02em; font-weight: 700; }
h1, h2 { font-family: var(--display); }
h1 { font-size: var(--step-3); letter-spacing: -0.03em; line-height: 1.04; overflow-wrap: anywhere; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0 0 1em; }
a { color: var(--accent-deep); text-underline-offset: 0.18em; text-decoration-thickness: 0.09em; }
a:hover { color: var(--ink); }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--mark); color: var(--ink); }

.wrap { width: 100%; max-width: 72rem; margin-inline: auto; padding-inline: var(--gutter); }
.narrow { max-width: 36rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 30;
  background: var(--deep); color: var(--on-deep); padding: 0.75rem 1rem; border-radius: var(--radius);
}
.skip:focus { top: 0.5rem; }

/* --- Значки (встроенный SVG, цвет — от текста) ----------------------------------------------- */

.ico { width: 1.5rem; height: 1.5rem; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* --- Шапка ------------------------------------------------------------------------------ */

.bar { background: var(--ground); }
.bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: 3.75rem; padding-block: 0.4rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 1.25rem; min-height: 3rem; }
.brand:hover { color: var(--ink); }
.brand-mark {
  display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent); font-size: 1.25rem; font-weight: 700;
}
.nav { display: none; align-items: center; gap: 0.25rem; margin-left: auto; }
.nav form { margin: 0; }
.nav a:not(.btn) {
  display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 0.85rem; border-radius: var(--radius);
  font-weight: 600; text-decoration: none; color: var(--ink);
}
.nav a:not(.btn):hover { background: var(--field); }
.nav a[aria-current="page"] { background: var(--mark); }

/* Переключатель языка: тихий, без рамок (язык выбирают один раз); выбранный — тёмный и подчёркнут */
.langs-switch { display: flex; margin: 0; gap: 0.1rem; }
.lang-btn {
  min-width: 2.75rem; min-height: 2.75rem; padding: 0 0.5rem; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--ink-soft); font: inherit; font-size: 0.9375rem; font-weight: 600; cursor: pointer;
}
.lang-btn:hover { background: var(--field); color: var(--ink); }
.lang-btn[aria-pressed="true"] {
  color: var(--ink); font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.3em;
}

/* --- Нижняя панель телефона ------------------------------------------------------------- */

.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  min-height: var(--tabs); padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--deep); color: var(--on-deep-soft);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem;
  min-height: var(--tabs); padding: 0.4rem 0.25rem; color: inherit; text-decoration: none;
  font-size: 0.75rem; font-weight: 700; line-height: 1.1; text-align: center; overflow-wrap: anywhere;
}
.tabs .ico { width: 1.6rem; height: 1.6rem; padding: 0.15rem 0.7rem; box-sizing: content-box; border-radius: var(--radius); }
.tabs a[aria-current="page"] { color: var(--on-deep); }
.tabs a[aria-current="page"] .ico { background: var(--accent); color: var(--on-accent); }
.tabs a:focus-visible { outline-color: var(--deep-accent); outline-offset: -4px; }
/* Экранная клавиатура открыта: панель только отнимает место у поля ввода.
   Изменено S9: раньше панель пряталась и для галочки (клавиатуры у неё нет) и возвращалась сразу при
   нажатии на кнопку под полем — появлялась прямо под пальцем, нажатие уходило на вкладку, и «Создать
   аккаунт» / «Проверить» у нижнего края экрана не срабатывали с первого раза. Теперь: только поля для
   текста; возвращается через 0,4 с (нажатие успевает закончиться); отступ страницы не меняется (без скачка). */
.tabs { transition: visibility 0s linear 0.4s; }
body:has(input:not([type="checkbox"]):not([type="radio"]):focus, textarea:focus, select:focus) .tabs {
  visibility: hidden; transition: none;
}

/* --- Кнопки ----------------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 3rem; padding: 0.5rem 1.5rem; border: 2px solid transparent; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; text-decoration: none; text-align: center;
  cursor: pointer; transition: transform 0.08s ease, background-color 0.12s ease;
}
.btn:hover { background: var(--accent-deep); color: var(--on-accent); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-quiet:hover { background: var(--ink); color: var(--ground); }
.btn-quiet[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.btn-gold { background: var(--ink); color: var(--ground); }
.btn-gold:hover { background: var(--accent-deep); color: var(--on-accent); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger); filter: brightness(0.85); }  /* затемнение в любой теме: текст кнопки остаётся читаемым */
.btn-small { min-height: 2.75rem; padding-inline: 1.1rem; }
.btn-block { width: 100%; }
.btn-text {  /* вторичное действие без рамки: подсказка, «сдаюсь» */
  background: transparent; color: var(--ink); border-color: transparent; text-decoration: underline;
  text-decoration-thickness: 0.09em; text-underline-offset: 0.2em; padding-inline: 0.75rem;
}
.btn-text:hover { background: var(--rule); color: var(--ink); }

/* --- Шапка страницы: цветное поле с заголовком ------------------------------------------ */

.band { background: var(--field); padding-block: 1.5rem 1.75rem; }
.band h1 { font-size: clamp(2rem, 9vw, 3.25rem); margin: 0; max-width: 20ch; }
.band .lead { margin: 0.6rem 0 0; color: var(--ink); }
.band-ink { background: var(--deep); color: var(--on-deep); }
.band-ink .lead { color: var(--on-deep-soft); }
.band-tone { background: var(--tone); color: #fff; }
.band-tone a { color: #fff; }
.band-tone .lead { color: #fff; }

/* --- Главная ---------------------------------------------------------------------------- */

.hero { background: var(--ground); padding-block: 2.25rem 2.75rem; }
.hero .wrap { display: grid; gap: 1.75rem; }
.hero h1 { max-width: 13ch; margin-bottom: 0.4em; }
@media (min-width: 48rem) { .hero h1 { max-width: 16ch; } }
.hero-lead { font-size: var(--step-1); max-width: 30rem; margin-bottom: 1.5rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero-actions .btn { flex: 1 1 11rem; }
.hero-aside { background: var(--surface); border-radius: var(--radius); padding: 1.5rem 1.6rem; align-self: end; }
.hero-aside h2 { font-size: var(--step-1); margin-bottom: 0.4em; }
.hero-aside p:last-child { margin-bottom: 0; }

/* --- Страницы-формы --------------------------------------------------------------------- */

.page { padding-block: 1.5rem var(--section); }
.page h1 { font-size: clamp(2rem, 8vw, 2.75rem); }
.lead { font-size: var(--step-1); color: var(--ink-soft); max-width: 36rem; }

.form { display: grid; gap: 1.25rem; margin-top: 1.25rem; }
.field { display: grid; gap: 0.35rem; }
.field label, .field .label { font-weight: 700; }
.field input[type="text"], .field input[type="password"], .field select {
  width: 100%; min-height: 3.25rem; padding: 0.5rem 0.9rem; font: inherit; color: var(--ink);
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
}
.field input:focus-visible, .field select:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--ink); }
.field[data-invalid] input { border-color: var(--danger); }
.hint { color: var(--ink-soft); font-size: 0.9375rem; margin: 0; }

.check { display: grid; grid-template-columns: auto 1fr; gap: 0.75rem; align-items: start; }
.check input { width: 1.5rem; height: 1.5rem; margin: 0.15rem 0 0; accent-color: var(--accent); }

.pw { position: relative; }
.pw input { padding-right: 5.5rem; }
.pw-toggle {
  position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%); min-height: 2.75rem;
  padding: 0 0.75rem; border: 0; border-radius: var(--radius); background: var(--field); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer;
}

.alert, .notice { padding: 1rem 1.1rem; border-radius: var(--radius); margin-top: 1.25rem; }
.alert { background: var(--danger-bg); color: var(--danger-ink); border-left: 6px solid var(--danger); }
.alert strong { display: block; margin-bottom: 0.25rem; }
.alert ul { margin: 0.25rem 0 0; padding-left: 1.2rem; }
.alert p { margin: 0; }
.alert p + p { margin-top: 0.4rem; }
.notice { background: var(--ok-bg); color: var(--ok-ink); font-weight: 600; border-left: 6px solid var(--ok); }

.aside-links { margin-top: 1.5rem; display: grid; gap: 0.25rem; }
.aside-links p { margin: 0; }
.aside-links a { display: inline-flex; align-items: center; min-height: 2.75rem; }

.card { background: var(--surface); border-radius: var(--radius); padding: 1.25rem; }
.card .form:first-child { margin-top: 0; }
.card h2 { font-size: var(--step-1); margin-bottom: 0.4em; }
.page > * + .card, .page > .card + *, .page > .me-links + .card { margin-top: 1rem; }
.page > .card:first-child { margin-top: 0; }
.logout { margin-top: 1.5rem; }

/* --- Ключ восстановления ---------------------------------------------------------------- */

.key {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; margin: 1.5rem 0 1rem;
  padding: 1rem; background: var(--surface); border-radius: var(--radius); border: 3px solid var(--ink);
}
.key code {
  font-family: var(--mono); font-size: clamp(1.25rem, 6vw, 1.75rem); font-weight: 700;
  letter-spacing: 0.08em; text-align: center; padding: 0.35rem 0; user-select: all;
}
.key-tools { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.25rem; }
.warn { font-weight: 700; }

/* --- Профиль и панели ------------------------------------------------------------------- */

.panel { background: var(--surface); border-radius: var(--radius); padding: 1.25rem; margin-top: 1rem; }
.panel h2 { font-size: var(--step-1); margin-bottom: 0.5em; }
.panel .form { margin-top: 1rem; }
.panel-danger { background: var(--danger-bg); }
.facts { display: grid; gap: 0.75rem; margin: 0; }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; }
.big-code { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; letter-spacing: 0.1em; overflow-wrap: anywhere; }
.inline-form { display: inline; margin: 0; }
.langs { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.me-id { margin-top: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 1rem; align-items: center; }
.avatar {
  grid-row: span 2; display: grid; place-items: center; width: 4.25rem; height: 4.25rem; border-radius: 50%;
  background: var(--deep); color: var(--deep-accent); font-family: var(--display); font-size: 2rem; font-weight: 700; text-transform: uppercase;
}
.me-id h2 { margin: 0; font-size: var(--step-2); overflow-wrap: anywhere; }
.me-id .hint { align-self: start; }
.me-links { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.me-links a {
  display: flex; align-items: center; gap: 0.85rem; min-height: 3.5rem; padding: 0.5rem 1rem; border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font-weight: 700; text-decoration: none;
}
.me-links a:hover { background: var(--gold-soft); }
.me-links .ico { color: var(--accent-deep); }
.me-links .go { margin-left: auto; }

.fold { background: var(--surface); border-radius: var(--radius); margin-top: 0.75rem; }
.fold > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-height: 3.5rem; padding: 0.5rem 1.25rem;
  font-weight: 800; font-size: var(--step-0); cursor: pointer; list-style: none;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: ""; width: 0.6rem; height: 0.6rem; border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(45deg); margin-right: 0.2rem; transition: transform 0.15s ease; }
.fold[open] > summary::after { transform: rotate(225deg); }
.fold > :not(summary) { margin-inline: 1.25rem; }
.fold > :last-child { margin-bottom: 1.25rem; }
.fold-danger { background: var(--danger-bg); }

/* Список «решено» с датой (друзья, страница задачи) */
.solved { list-style: none; margin: 0; padding: 0; }
.solved li { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.55rem 0; border-top: 1px solid var(--rule); }
.solved li:first-child { border-top: 0; }
.solved time { flex: none; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* --- Ошибки, правила -------------------------------------------------------------------- */

.error-page { padding-block: 3rem var(--section); }
.error-page h1 { font-size: clamp(2rem, 8vw, 3rem); }
.prose { max-width: 38rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: 0.75rem; }

/* --- Подвал ----------------------------------------------------------------------------- */

.foot { background: var(--deep); color: var(--on-deep-soft); margin-top: 2.5rem; padding-block: 2rem 1.75rem; }
.foot a { color: var(--on-deep); display: inline-flex; align-items: center; min-height: 2.75rem; }
.foot-name { font-family: var(--display); font-size: clamp(2rem, 11vw, 4.5rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1; margin: 0 0 1rem; color: var(--on-deep); }
.foot-row { display: flex; flex-wrap: wrap; gap: 0.25rem 2rem; align-items: center; justify-content: space-between; }
.foot .note { margin: 0.5rem 0 0; color: var(--on-deep-soft); font-size: 0.9375rem; }
/* Выбор темы в подвале (16.11.2026): виден и гостю. Подвал тёмный в любой теме, поэтому цвета — от --on-deep. */
.foot-themes { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 1rem 0 0; }
.foot-themes-label { margin-right: 0.35rem; font-size: 0.9375rem; font-weight: 600; }
.theme-btn {
  min-height: 2.75rem; padding: 0 0.9rem; border: 1px solid var(--on-deep-soft); border-radius: var(--radius);
  background: transparent; color: var(--on-deep); font: inherit; font-size: 0.9375rem; font-weight: 600; cursor: pointer;
}
.theme-btn:hover { border-color: var(--on-deep); }
.theme-btn[aria-pressed="true"] { background: var(--on-deep); border-color: var(--on-deep); color: var(--deep); }
.theme-btn:focus-visible { outline-color: var(--deep-accent); }

.needs-review { background: var(--mark); color: var(--ink); border-radius: 0.25rem; padding: 0 0.2em; }

/* --- Шире телефона ---------------------------------------------------------------------- */

@media (min-width: 48rem) {
  :root { --gutter: 2rem; --section: 4.5rem; }
  body { padding-bottom: 0; }
  .tabs { display: none; }
  .nav { display: flex; }
  .bar .wrap { min-height: 4.25rem; }
  .hero { padding-block: 4.5rem 5rem; }
  .hero .wrap { grid-template-columns: 1.3fr 1fr; align-items: end; gap: 3rem; }
  .hero-actions .btn { flex: 0 0 auto; }
  .band { padding-block: 2.5rem 2.75rem; }
  .page { padding-block: 2.5rem var(--section); }
  .key { grid-template-columns: repeat(4, 1fr); }
  .facts { grid-template-columns: max-content 1fr; gap: 0.75rem 2rem; }
  .panel, .card { padding: 1.75rem; }
  .foot { padding-block: 3rem 2.25rem; }
}

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

@media print { .tabs, .bar, .foot { display: none; } }

/* --- Приложение (PWA, S7b) -------------------------------------------------------------- */

.btn-install { margin-top: 0.75rem; background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-install:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--on-accent); }
.foot [data-pwa-ios] { margin-top: 0.75rem; }
.offline-note { margin: 0; padding: 0.6rem var(--gutter); background: var(--gold-soft); color: var(--ink); font-weight: 600; text-align: center; border-bottom: 1px solid var(--rule); }
.offline-text:not([hidden]) ~ .offline-text:not([hidden]) { margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid var(--rule); }
