/* ==========================================================================
   WebPhysics — стили конкретных страниц
   ========================================================================== */

/* ======================================================================
   ГЛАВНАЯ
   ====================================================================== */
.hero {
  position: relative;
  border-radius: var(--r-2xl);
  padding: clamp(30px, 5vw, 58px);
  margin-bottom: 30px;
  overflow: hidden;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
}
/* Мягкие «световые пятна» за стеклом */
.hero::before {
  content: "";
  position: absolute;
  width: 460px; height: 460px;
  right: -120px; top: -220px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), transparent 65%);
  filter: blur(30px);
  animation: float-slow 14s ease-in-out infinite;
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  width: 340px; height: 340px;
  left: -140px; bottom: -190px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--purple) 34%, transparent), transparent 65%);
  filter: blur(34px);
  animation: float-slow 18s ease-in-out infinite reverse;
  pointer-events: none;
}
@keyframes float-slow {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-26px, 22px) scale(1.09); }
}
.hero-content { position: relative; z-index: 1; max-width: 660px; }
.hero h1 {
  font-size: clamp(30px, 5.2vw, 50px);
  line-height: 1.08;
  letter-spacing: -.035em;
  margin-bottom: 16px;
  font-family: var(--font-display);
}
.hero h1 .grad {
  background: linear-gradient(120deg, var(--accent), color-mix(in srgb, var(--purple) 70%, var(--accent)));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero p { font-size: clamp(15px, 1.7vw, 18px); color: var(--text-2); margin-bottom: 26px; max-width: 56ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 32px;
  position: relative;
  z-index: 1;
}
.stat-tile {
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: var(--fill-2);
  border: 1px solid var(--separator);
}
.stat-tile .st-value { font-size: 26px; font-weight: 740; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-tile .st-label { font-size: 12.5px; color: var(--text-4); margin-top: 2px; }

/* Сетка разделов */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 14px;
}
.section-card {
  position: relative;
  padding: 20px;
  border-radius: var(--r-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) ease;
}
.section-card::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(120% 100% at 100% 0%, hsl(var(--hue) 90% 55% / .16), transparent 62%);
  transition: opacity var(--dur) ease;
}
.section-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.section-card .sc-icon { font-size: 30px; margin-bottom: 12px; position: relative; }
.section-card .sc-title { font-size: 15.5px; font-weight: 660; letter-spacing: -.02em; position: relative; }
.section-card .sc-count { font-size: 12.5px; color: var(--text-4); margin-top: 3px; position: relative; }

/* ======================================================================
   КАТАЛОГ / КАРТОЧКИ ПАРАГРАФОВ
   ====================================================================== */
.filters-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  /* Никакой элемент фильтров не имеет права раздвинуть страницу по ширине */
  max-width: 100%;
}
.filters-bar > * { min-width: 0; max-width: 100%; }
.chips-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips-scroll::-webkit-scrollbar { display: none; }

/* --------------------------------------------------------------------------
   Кнопки перемотки горизонтальной ленты.
   Пальцем ленту листают свайпом, а мышкой листать нечем — колесо прокручивает
   страницу. Поэтому по краям лежат полупрозрачные кнопки «‹» и «›»,
   и появляются они только тогда, когда в эту сторону есть что прокручивать
   (класс is-on ставится из ui/components.js).
   -------------------------------------------------------------------------- */
.chips-rail { position: relative; min-width: 0; }
.chips-rail .rail-arrow {
  position: absolute;
  top: 50%;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--r-full);
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(16px) saturate(var(--glass-saturate));
  backdrop-filter: blur(16px) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  color: var(--text-2);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-50%) scale(.8);
  transition: opacity var(--dur) ease, transform var(--dur) var(--ease-out),
              visibility var(--dur), background var(--dur-fast) ease;
  z-index: 2;
}
.chips-rail .rail-arrow.is-prev { left: -2px; }
.chips-rail .rail-arrow.is-next { right: -2px; }
.chips-rail .rail-arrow.is-on {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}
.chips-rail .rail-arrow:hover { background: var(--hover-tint); }
.chips-rail .rail-arrow:active { transform: translateY(-50%) scale(.92); }
/* На сенсорных экранах ленту листают пальцем — стрелки только мешали бы */
@media (hover: none) { .chips-rail .rail-arrow { display: none; } }

.paragraph-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 16px;
}

.p-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--r-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) ease, border-color var(--dur) ease;
  position: relative;
}
.p-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.p-card .pc-cover {
  height: 132px;
  background: linear-gradient(140deg, var(--accent-soft), color-mix(in srgb, var(--purple) 12%, transparent));
  background-size: cover;
  background-position: center;
  position: relative;
}
.p-card .pc-cover::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top, color-mix(in srgb, var(--bg-elevated) 92%, transparent), transparent 55%);
}
.p-card .pc-emoji { position: absolute; left: 16px; bottom: 10px; font-size: 27px; z-index: 1; }
.p-card .pc-body { padding: 15px 17px 17px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.p-card .pc-title { font-size: 16px; font-weight: 660; letter-spacing: -.02em; line-height: 1.3; }
.p-card .pc-desc { font-size: 13.2px; color: var(--text-3); line-height: 1.5; flex: 1; }
.p-card .pc-meta { display: flex; align-items: center; gap: 8px; font-size: 11.8px; color: var(--text-4); margin-top: 4px; }
.p-card .pc-marks { position: absolute; top: 11px; right: 11px; display: flex; gap: 6px; z-index: 2; }
.p-card .pc-mark {
  width: 27px; height: 27px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12.5px;
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
}
.p-card .pc-mark.is-read { color: var(--green); }
.p-card .pc-mark.is-fav { color: var(--orange); }

/* Полоска сложности */
.difficulty { display: inline-flex; gap: 2.5px; align-items: center; }
.difficulty i { width: 5px; height: 5px; border-radius: 50%; background: var(--fill); display: block; }
.difficulty i.on { background: var(--accent); }

/* ======================================================================
   СТРАНИЦА ПАРАГРАФА
   ====================================================================== */
.article-hero {
  border-radius: var(--r-xl);
  overflow: hidden;
  margin-bottom: 26px;
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
}
.article-hero .ah-cover { height: clamp(160px, 26vw, 280px); background-size: cover; background-position: center; }
.article-hero .ah-body { padding: 22px 26px 26px; }
.article-hero h1 {
  font-size: clamp(25px, 3.8vw, 40px);
  letter-spacing: -.032em;
  line-height: 1.12;
  margin-bottom: 12px;
  font-family: var(--font-display);
}
.article-hero .ah-desc { color: var(--text-2); font-size: 16px; line-height: 1.6; max-width: 68ch; }
.article-hero .ah-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }

.article-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 14px 0 4px;
}

/* Прогресс чтения сверху страницы */
.read-progress {
  position: fixed;
  top: calc(var(--header-h) + var(--safe-top));
  left: 0; right: 0;
  height: 3px;
  z-index: 49;
  background: transparent;
  pointer-events: none;
}
.read-progress .rp-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, #64d2ff));
  border-radius: 0 var(--r-full) var(--r-full) 0;
  transition: width .12s linear;
}
@media (max-width: 1023px) { .read-progress { left: 0; } }

/* Типографика статьи */
/*
 * Комфортная длина строки ограничивается у текстовых блоков, а не у всего
 * тела статьи: иначе широкие блоки — симуляции, таблицы, изображения —
 * сжимались до ширины колонки текста и становились нечитаемыми.
 */
/*
 * Пользовательский масштаб текста действует именно здесь — на содержании
 * параграфа. Интерфейс остаётся прежнего размера, поэтому увеличение
 * шрифта не растягивает кнопки и не ломает раскладку.
 */
.article-body {
  font-size: calc(16.5px * var(--font-scale, 1));
  line-height: 1.75;
  color: var(--text-2);
}
.article-body > p,
.article-body > h2,
.article-body > h3,
.article-body > ul,
.article-body > ol,
.article-body > .note-block,
.article-body > .quote-block,
.article-body > .formula-block { max-width: 74ch; }

.article-body > * + * { margin-top: 20px; }
.article-body h2 {
  font-size: clamp(20px, 2.4vw, 27px);
  color: var(--text);
  letter-spacing: -.028em;
  margin-top: 40px;
  scroll-margin-top: 90px;
  font-family: var(--font-display);
}
.article-body h3 { font-size: 19px; color: var(--text); margin-top: 30px; scroll-margin-top: 90px; }
.article-body strong { color: var(--text); font-weight: 650; }
.article-body em { font-style: italic; }
.article-body code {
  font-family: var(--font-mono);
  font-size: .88em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--fill-2);
  color: var(--accent);
}
.article-body ul, .article-body ol { padding-left: 1.4em; }
.article-body li { margin-bottom: 8px; }
.article-body li::marker { color: var(--accent); font-weight: 700; }
.article-body a { color: var(--accent); border-bottom: 1px solid var(--accent-soft); }

/* Формула */
.formula-block {
  padding: 22px 26px;
  border-radius: var(--r-md);
  background: var(--fill-2);
  border: 1px solid var(--separator);
  text-align: center;
}
.formula-block .fb-text {
  font-family: var(--font-formula);
  font-size: clamp(17px, 2.4vw, 23px);
  color: var(--text);
  letter-spacing: .01em;
  line-height: 1.5;
  overflow-x: auto;
}
.formula-block .fb-caption { font-size: 12.8px; color: var(--text-4); margin-top: 10px; }

/* Врезка-заметка */
.note-block {
  padding: 17px 20px;
  border-radius: var(--r-md);
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
}
.note-block .nb-title { font-weight: 660; color: var(--text); margin-bottom: 5px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.note-block .nb-text { font-size: 14.5px; color: var(--text-2); line-height: 1.6; }
.note-block.is-warning { border-left-color: var(--orange); background: color-mix(in srgb, var(--orange) 12%, transparent); }
.note-block.is-tip { border-left-color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }
.note-block.is-danger { border-left-color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }

/* Цитата */
.quote-block { padding-left: 22px; border-left: 3px solid var(--separator); font-style: italic; font-size: 17.5px; color: var(--text); }
.quote-block .qb-author { display: block; margin-top: 10px; font-style: normal; font-size: 13.5px; color: var(--text-4); font-weight: 600; }

/* Изображение */
.image-block figure { margin: 0; }
.image-block img { width: 100%; border-radius: var(--r-md); border: 1px solid var(--separator); background: var(--fill-2); }
.image-block figcaption { font-size: 12.8px; color: var(--text-4); text-align: center; margin-top: 9px; }
.image-block.is-wide { max-width: none; }

/* Таблица */
.table-block { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--separator); }
.table-block table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table-block th, .table-block td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--separator); }
.table-block th { background: var(--fill-2); font-weight: 650; color: var(--text); font-size: 13.5px; }
.table-block tr:last-child td { border-bottom: none; }

/* Встроенная симуляция */
.sim-embed {
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--separator);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}
.sim-embed .se-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--separator);
  background: var(--fill-2);
}
.sim-embed .se-icon { font-size: 19px; }
.sim-embed .se-title { font-size: 14.5px; font-weight: 640; color: var(--text); }
.sim-embed .se-head .btn { margin-left: auto; }
.sim-embed .se-caption {
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text-4);
  border-top: 1px solid var(--separator);
  line-height: 1.55;
}

/* Оглавление */
.toc {
  position: sticky;
  top: calc(var(--header-h) + var(--safe-top) + 20px);
  align-self: start;
  padding: 18px 20px;
  border-radius: var(--r-lg);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px) saturate(var(--glass-saturate));
  backdrop-filter: blur(20px) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
  max-height: calc(100dvh - var(--header-h) - 60px);
  overflow-y: auto;
}
.toc .toc-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-4); font-weight: 700; margin-bottom: 12px; }
.toc a {
  display: block;
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 13.4px;
  color: var(--text-3);
  border-left: 2px solid transparent;
  transition: all var(--dur-fast) ease;
}
.toc a:hover { color: var(--text); background: var(--fill-2); }
.toc a.is-active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft); font-weight: 600; }

.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 36px; align-items: start; }
@media (max-width: 1100px) { .article-layout { grid-template-columns: 1fr; } .toc { display: none; } }

/* Навигация назад/вперёд */
.article-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 42px; }
@media (max-width: 620px) { .article-nav { grid-template-columns: 1fr; } }
.article-nav a {
  padding: 16px 20px;
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
  color: inherit;
  transition: transform var(--dur) var(--ease-out), border-color var(--dur) ease;
}
.article-nav a:hover { transform: translateY(-2px); border-color: var(--accent); }
.article-nav .an-label { font-size: 11.5px; color: var(--text-4); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.article-nav .an-title { font-size: 14.8px; font-weight: 600; margin-top: 5px; }
.article-nav .is-next { text-align: right; }

/* ======================================================================
   ТЕСТЫ
   ====================================================================== */
.test-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.test-card {
  padding: 22px;
  border-radius: var(--r-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
  display: flex; flex-direction: column; gap: 11px;
  color: inherit; text-decoration: none;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) ease;
}
.test-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.test-card .tc-top { display: flex; align-items: flex-start; gap: 12px; }
.test-card .tc-icon {
  width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center; font-size: 21px;
  background: var(--accent-soft); flex: none;
}
.test-card .tc-title { font-size: 16.5px; font-weight: 660; letter-spacing: -.02em; }
.test-card .tc-desc { font-size: 13.3px; color: var(--text-3); line-height: 1.5; flex: 1; }
.test-card .tc-foot { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-4); }

/* Прохождение теста */
.quiz-shell { max-width: 720px; margin: 0 auto; }
.quiz-head {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 20px;
  border-radius: var(--r-lg);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px) saturate(var(--glass-saturate));
  backdrop-filter: blur(20px) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
  margin-bottom: 20px;
  position: sticky;
  top: calc(var(--header-h) + var(--safe-top) + 10px);
  z-index: 20;
}
.quiz-timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 16px; }
.quiz-timer.is-low { color: var(--red); animation: pulse-soft 1s ease-in-out infinite; }
@keyframes pulse-soft { 50% { opacity: .5; } }

.question-card {
  padding: 26px;
  border-radius: var(--r-xl);
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
  box-shadow: var(--shadow-sm);
  animation: page-in .38s var(--ease-out) both;
}
.question-text { font-size: 19px; font-weight: 620; line-height: 1.4; letter-spacing: -.02em; margin-bottom: 20px; }

/*
 * Переходы перечислены явно, а не через `all`: с `all` в анимацию попадал
 * и transform из :active, из-за чего снятие выбора выглядело дёрганым.
 *
 * Все цветовые свойства идут ОДНОЙ длительностью и одним ускорением —
 * и у самой кнопки, и у кружка-маркера. Раньше кайма и заливка гасли
 * вразнобой: синяя рамка ещё светилась, когда фон уже стал серым,
 * и переключение читалось как рывок.
 */
.option {
  display: flex; align-items: center; gap: 13px;
  width: 100%;
  padding: 15px 18px;
  border-radius: var(--r-md);
  background: var(--fill-2);
  border: 2px solid transparent;
  text-align: left;
  font-size: 15px;
  margin-bottom: 10px;
  transition:
    background-color .24s var(--ease-out),
    border-color .24s var(--ease-out),
    color .24s var(--ease-out),
    transform .12s var(--ease-out);
}
.option:hover { background: var(--fill); }
.option:active { transform: scale(.99); }
.option .opt-marker {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--text-4);
  display: grid; place-items: center;
  flex: none; font-size: 12px; color: transparent;
  transition:
    background-color .24s var(--ease-out),
    border-color .24s var(--ease-out),
    color .24s var(--ease-out);
}
.option.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.option.is-selected .opt-marker { background: var(--accent); border-color: var(--accent); color: #fff; }
.option.is-correct { border-color: var(--green); background: color-mix(in srgb, var(--green) 13%, transparent); }
.option.is-correct .opt-marker { background: var(--green); border-color: var(--green); color: #fff; }
.option.is-wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 13%, transparent); }
.option.is-wrong .opt-marker { background: var(--red); border-color: var(--red); color: #fff; }
.option.is-multiple .opt-marker { border-radius: 8px; }

.quiz-dots { display: flex; gap: 5px; flex-wrap: wrap; }
.quiz-dots i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--fill); display: block;
  transition: all var(--dur) var(--ease-out);
}
.quiz-dots i.done { background: var(--accent); }
.quiz-dots i.current { background: var(--accent); transform: scale(1.5); }

/* Результат */
.result-hero { text-align: center; padding: 34px 24px; }
.result-ring { position: relative; width: 168px; height: 168px; margin: 0 auto 22px; }
.result-ring .rr-value {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 40px; font-weight: 780; letter-spacing: -.04em;
}
.review-item { padding: 16px 18px; border-radius: var(--r-md); background: var(--fill-2); margin-bottom: 10px; }
.review-item .ri-head { display: flex; align-items: center; gap: 9px; font-weight: 620; font-size: 14.5px; margin-bottom: 6px; }
.review-item .ri-expl { font-size: 13.5px; color: var(--text-3); line-height: 1.55; }

/* ======================================================================
   СИМУЛЯЦИИ (каталог)
   ====================================================================== */
.sim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 15px; }
.sim-card {
  position: relative;
  padding: 20px;
  border-radius: var(--r-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
  color: inherit; text-decoration: none;
  overflow: hidden;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) ease;
  display: flex; flex-direction: column; gap: 9px;
}
.sim-card::after {
  content: "";
  position: absolute; right: -34px; top: -34px;
  width: 128px; height: 128px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), transparent 68%);
  opacity: .5;
  transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur) ease;
}
.sim-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.sim-card:hover::after { transform: scale(1.35); opacity: .8; }
.sim-card .sc-emoji { font-size: 30px; position: relative; }
.sim-card .sc-name { font-size: 16px; font-weight: 660; letter-spacing: -.02em; position: relative; }
.sim-card .sc-desc { font-size: 13px; color: var(--text-3); line-height: 1.5; flex: 1; position: relative; }
.sim-card .sc-foot { display: flex; align-items: center; gap: 8px; position: relative; }
.sim-card .sc-visited { position: absolute; top: 14px; right: 14px; color: var(--green); font-size: 14px; z-index: 1; }

/* ======================================================================
   ПРОФИЛЬ
   ====================================================================== */
.profile-hero {
  display: flex; align-items: center; gap: 22px;
  padding: 28px;
  border-radius: var(--r-xl);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.profile-hero .ph-info { flex: 1; min-width: 220px; }
.profile-hero .ph-name { font-size: 25px; font-weight: 720; letter-spacing: -.03em; }
.profile-hero .ph-email { font-size: 13.5px; color: var(--text-4); }
.profile-hero .ph-bio { font-size: 14px; color: var(--text-2); margin-top: 8px; max-width: 56ch; }

.rank-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 15px;
  border-radius: var(--r-full);
  background: linear-gradient(120deg, var(--accent-soft), color-mix(in srgb, var(--purple) 12%, transparent));
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  font-size: 13.5px; font-weight: 660;
  margin-top: 10px;
}

.xp-bar-wrap { margin-top: 16px; max-width: 420px; }
.xp-bar-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-4); margin-bottom: 6px; }

.achievement-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
.achievement {
  padding: 18px 14px;
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
  text-align: center;
  transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur) ease;
  position: relative;
  overflow: hidden;
}
/*
 * Только сдвиг, без масштабирования: при scale() браузер пересэмплирует
 * текст и он на время анимации становится «мыльным».
 */
.achievement:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.achievement .a-icon { font-size: 33px; margin-bottom: 9px; display: block; }
.achievement .a-title { font-size: 13.4px; font-weight: 640; line-height: 1.3; }
.achievement .a-desc { font-size: 11.5px; color: var(--text-4); margin-top: 5px; line-height: 1.4; }
.achievement.is-locked { opacity: .48; }
.achievement.is-locked .a-icon { filter: grayscale(1); }
.achievement.tier-gold { border-color: color-mix(in srgb, var(--yellow) 45%, transparent); }
.achievement.tier-legendary {
  border-color: color-mix(in srgb, var(--purple) 45%, transparent);
  background: linear-gradient(150deg, var(--bg-elevated), color-mix(in srgb, var(--purple) 8%, var(--bg-elevated)));
}
.achievement.is-unlocked.tier-legendary::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.22) 50%, transparent 70%);
  animation: sheen 3.4s ease-in-out infinite;
}
@keyframes sheen { 0% { transform: translateX(-120%); } 60%, 100% { transform: translateX(120%); } }

/* --------------------------------------------------------------------------
   Календарь активности
   --------------------------------------------------------------------------
   Крупные плитки с числом действий за день, сгруппированные по месяцам.
   Читается без легенды оттенков: видно и дату, и сколько было сделано.
   -------------------------------------------------------------------------- */
/* Календарь занимает свою естественную ширину и стоит по центру карточки */
.activity-month { max-width: 340px; margin: 0 auto; }
.activity-month .am-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
  margin-bottom: 12px;
}
/* Подписи дней недели над сеткой */
.activity-month .am-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.activity-month .am-weekdays span {
  text-align: center;
  font-size: 10.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-4);
}
.activity-month .am-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

/* Ячейки-заглушки до первого числа месяца */
.activity-month .am-day.is-empty {
  background: none;
  border: none;
  pointer-events: none;
}
/* Дни, которые ещё не наступили */
.activity-month .am-day.is-future { opacity: .35; }

.activity-month .am-day {
  position: relative;
  aspect-ratio: 1;
  min-height: 40px;
  border-radius: 12px;
  background: var(--fill-2);
  border: 1px solid transparent;
  display: grid;
  place-items: center;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) ease;
  cursor: default;
}
.activity-month .am-day:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }

/* Число месяца — приглушённая подпись в углу плитки */
.activity-month .am-date {
  position: absolute;
  top: 3px;
  left: 6px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-4);
  line-height: 1;
}
/* Количество действий — крупно по центру */
.activity-month .am-count {
  font-size: 15px;
  font-weight: 720;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.activity-month .am-day.lv-1 { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.activity-month .am-day.lv-2 { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.activity-month .am-day.lv-3 { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.activity-month .am-day.lv-4 { background: var(--accent); }
.activity-month .am-day.lv-3 .am-count,
.activity-month .am-day.lv-4 .am-count { color: #fff; }
.activity-month .am-day.lv-3 .am-date,
.activity-month .am-day.lv-4 .am-date { color: rgba(255, 255, 255, .75); }

.activity-month .am-day.is-today {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

@media (max-width: 560px) {
  .activity-month { max-width: none; }
  .activity-month .am-days,
  .activity-month .am-weekdays { gap: 5px; }
  .activity-month .am-day { min-height: 0; border-radius: 10px; }
  .activity-month .am-count { font-size: 13px; }
}

/* --------------------------------------------------------------------------
   Таблица лидеров
   --------------------------------------------------------------------------
   Приоритет у имени: служебные данные (статус, серия, опыт) намеренно мелкие
   и в одну строку, чтобы на узком экране имя занимало максимум ширины.
   -------------------------------------------------------------------------- */
.leader-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  transition: background var(--dur-fast) ease;
}
.leader-row:hover { background: var(--fill-2); }
.leader-row.is-me { background: var(--accent-soft); }
.leader-row .lr-place { width: 26px; font-weight: 720; font-size: 14.5px; color: var(--text-4); text-align: center; flex: none; }

/* Статус и серия — одной строкой под именем */
.leader-row .lr-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 1px;
  font-size: 11.8px;
  color: var(--text-4);
  overflow: hidden;
}
.leader-row .lr-streak { color: var(--orange); font-weight: 620; }

/* Отметка «это вы» — компактная звёздочка вместо значка */
.leader-row .lr-me { color: var(--accent); font-size: 12px; flex: none; }

.leader-row .lr-xp {
  flex: none;
  font-weight: 700;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.leader-row .lr-xp-unit { font-size: 11px; font-weight: 600; color: var(--text-4); }

@media (max-width: 560px) {
  .leader-row { gap: 9px; padding: 9px 10px; }
  .leader-row .lr-place { width: 20px; font-size: 13px; }
  .leader-row .lr-meta { font-size: 11px; gap: 8px; }
  .leader-row .lr-xp { font-size: 13.5px; }
  /* Аватар на телефоне мельче — имени достаётся больше места */
  .leader-row .avatar { width: 30px !important; height: 30px !important; font-size: 13px !important; }
}
.leader-row .lr-place.top1 { color: #ffd60a; font-size: 19px; }
.leader-row .lr-place.top2 { color: #c7c7cc; font-size: 17px; }
.leader-row .lr-place.top3 { color: #cd7f32; font-size: 17px; }

/* ======================================================================
   НАСТРОЙКИ
   ====================================================================== */
.settings-group {
  border-radius: var(--r-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
  overflow: hidden;
  margin-bottom: 20px;
}
.settings-group-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-4); font-weight: 700;
  padding: 0 6px 9px;
}
/* --------------------------------------------------------------------------
   Заголовок группы настроек: значок в собственной серой плашке + подпись.
   -------------------------------------------------------------------------- */
.settings-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 18px 0;
}
.settings-head .sh-icon {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 19px;
  border-radius: 12px;
  background: var(--fill);
  border: 1px solid var(--separator);
}
.settings-head .sh-text { min-width: 0; }
.settings-head .sr-title { font-size: 15.5px; font-weight: 620; }
.settings-head .sr-desc { margin-top: 3px; }

/* Образец показывает ровно тот размер, каким будет текст параграфа */
.font-preview {
  padding: 18px 20px;
  border-radius: var(--r-md);
  background: var(--fill-2);
  margin-top: 12px;
  line-height: 1.7;
  font-size: calc(16.5px * var(--font-scale, 1));
}
.font-option {
  padding: 13px 16px;
  border-radius: var(--r-sm);
  border: 2px solid transparent;
  background: var(--fill-2);
  text-align: left;
  transition: all var(--dur-fast) var(--ease-out);
  width: 100%;
}
.font-option.is-active { border-color: var(--accent); background: var(--accent-soft); }
.font-option .fo-name { font-size: 14.5px; font-weight: 620; }
.font-option .fo-sample { font-size: 13px; color: var(--text-4); margin-top: 3px; }

.theme-option {
  flex: 1; min-width: 104px;
  padding: 12px 10px 14px;
  border-radius: var(--r-md);
  border: 2px solid transparent;
  background: var(--fill-2);
  text-align: center;
  transition: all var(--dur-fast) var(--ease-out);
}
.theme-option:hover { background: var(--fill); }
.theme-option.is-active { border-color: var(--accent); background: var(--accent-soft); }
/*
 * Подпись образца темы намеренно НЕ подчиняется пользовательскому цвету
 * текста: иначе выбор произвольного оттенка перекрашивал сами кнопки
 * выбора темы и они переставали читаться.
 */
.theme-option .to-label {
  font-size: 12.8px;
  font-weight: 620;
  margin-top: 10px;
  color: var(--text-fixed);
}
.theme-option.is-active .to-label { color: var(--accent); }

/* ----------------------------------------------------------------------
   Мини-макет окна для превью темы.
   Раньше здесь был плоский градиент — «как в системе» выглядел как резкая
   чёрно-белая диагональ. Теперь это маленькая копия интерфейса: боковая
   панель и строки контента, а вариант «как в системе» показывает светлую
   и тёмную половины одного и того же макета.
   ---------------------------------------------------------------------- */
.theme-preview {
  position: relative;
  width: 100%;
  height: 60px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--separator);
  /* Фон под диагональным срезом варианта «как в системе» */
  background: #ffffff;
}
.theme-preview .tp-face {
  position: absolute;
  inset: 0;
  display: flex;
}
.theme-preview .tp-rail { width: 27%; height: 100%; }
.theme-preview .tp-body {
  flex: 1;
  padding: 9px 9px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.theme-preview .tp-line { height: 6px; border-radius: 3px; }
.theme-preview .tp-line.is-accent { width: 58%; background: #0a84ff; }
.theme-preview .tp-line.is-wide { width: 82%; }
.theme-preview .tp-line.is-narrow { width: 52%; }

/* Светлая половина */
.theme-preview .tp-face.is-light { background: #f2f2f7; }
.theme-preview .tp-face.is-light .tp-rail { background: #e3e4ea; }
.theme-preview .tp-face.is-light .tp-line { background: #c9cbd3; }

/* Тёмная половина — именно чёрная, без серого градиента по краям */
.theme-preview .tp-face.is-dark { background: #000000; }
.theme-preview .tp-face.is-dark .tp-rail { background: #1c1c1e; }
.theme-preview .tp-face.is-dark .tp-line { background: #3a3a3c; }

/*
 * «Как в системе»: тёмная половина накрывает светлую, срез идёт по мягкой
 * диагонали — от 62 % сверху к 38 % снизу. Так обе половины остаются
 * узнаваемыми макетами, а не просто чёрно-белым треугольником.
 */
.theme-preview.is-auto .tp-face.is-dark {
  clip-path: polygon(62% 0, 100% 0, 100% 100%, 38% 100%);
}

/* ======================================================================
   АДМИНКА
   ====================================================================== */
.admin-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 20px; scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }

.admin-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.admin-stat {
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
}
.admin-stat .as-value { font-size: 25px; font-weight: 740; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.admin-stat .as-label { font-size: 12px; color: var(--text-4); margin-top: 2px; }
.admin-stat .as-delta { font-size: 11.5px; margin-top: 4px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13.6px; }
.data-table th {
  text-align: left; padding: 11px 13px;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-4); font-weight: 700;
  border-bottom: 1px solid var(--separator);
  white-space: nowrap;
}
.data-table td { padding: 12px 13px; border-bottom: 1px solid var(--separator); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--dur-fast) ease; }
.data-table tbody tr:hover { background: var(--fill-2); }
.table-scroll { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--separator); background: var(--bg-elevated); }

.json-editor {
  width: 100%;
  min-height: 460px;
  font-family: var(--font-mono);
  font-size: 12.8px;
  line-height: 1.65;
  padding: 18px;
  border-radius: var(--r-md);
  background: var(--fill-2);
  border: 1.5px solid transparent;
  color: var(--text);
  resize: vertical;
  tab-size: 2;
}
.json-editor:focus { outline: none; border-color: var(--accent); background: var(--bg-elevated); }
.json-editor.is-invalid { border-color: var(--red); }

/* ----------------------------------------------------------------------
   График динамики в админке
   ----------------------------------------------------------------------
   Полноценный график, а не декоративная полоска: слева шкала значений
   с делениями, по сетке — горизонтали, снизу даты. Ширина колонки
   значений фиксирована, поэтому подписи оси и столбики всегда выровнены
   между собой (сетка из трёх строк с общей левой колонкой).
   ---------------------------------------------------------------------- */
.stat-chart { --sc-gutter: 46px; }
.stat-chart .sc-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.stat-chart .sc-body { display: grid; grid-template-columns: var(--sc-gutter) minmax(0, 1fr); gap: 8px; }
.stat-chart .sc-foot { display: grid; grid-template-columns: var(--sc-gutter) minmax(0, 1fr); gap: 8px; margin-top: 6px; }

.stat-chart .sc-yaxis { position: relative; height: 170px; }
.stat-chart .sc-ylabel {
  position: absolute;
  right: 0;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat-chart .sc-plot {
  position: relative;
  height: 170px;
  border-left: 1px solid var(--separator);
  border-bottom: 1px solid var(--separator);
}
.stat-chart .sc-grid { position: absolute; inset: 0; pointer-events: none; }
.stat-chart .sc-line {
  position: absolute;
  left: 0; right: 0;
  border-top: 1px dashed var(--separator);
}
/* Нулевая линия совпадает с осью и добавляется первой — её не рисуем */
.stat-chart .sc-line:first-child { border-top-color: transparent; }

.stat-chart .sc-bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 0 2px;
}
/* Колонка занимает всю высоту — по ней удобнее целиться подсказкой */
.stat-chart .sc-col {
  flex: 1;
  min-width: 3px;
  height: 100%;
  display: flex;
  align-items: flex-end;
  border-radius: 3px;
  transition: background var(--dur-fast) ease;
}
.stat-chart .sc-col:hover { background: var(--fill-2); }
/*
 * Цвет столбика. --over — доля превышения над шкалой (0 % … 100 %),
 * её проставляет dailyChart() в pages/admin.js. При нуле color-mix
 * возвращает чистый акцент, то есть обычный столбик выглядит как раньше;
 * чем сильнее день выбился за шкалу, тем глубже синий.
 */
.stat-chart .sc-bar {
  --over: 0%;
  --bar-deep: #071f4d;
  width: 100%;
  /* Нулевой день обязан отличаться от дня с одним визитом — линией у оси */
  min-height: 1px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(
    to top,
    color-mix(in srgb, var(--bar-deep) var(--over), var(--accent)),
    color-mix(in srgb, var(--bar-deep) var(--over), color-mix(in srgb, var(--accent) 45%, #64d2ff))
  );
  opacity: .88;
  transform-origin: bottom;
  animation: bar-grow .5s var(--ease-out) both;
}
.stat-chart .sc-col:hover .sc-bar { opacity: 1; }

/*
 * Обрезанный по шкале день. Плоская верхушка и светлая насечка на ней
 * говорят, что столбик продолжается за границей графика: одного лишь
 * потемнения для этого мало — тёмный столбик легко принять за другой ряд.
 */
.stat-chart .sc-bar.is-over {
  border-radius: 2px 2px 0 0;
  box-shadow: inset 0 2px 0 color-mix(in srgb, #ffffff 55%, transparent);
}

.stat-chart .sc-xaxis { display: flex; gap: 2px; padding: 0 2px; }
.stat-chart .sc-xlabel {
  flex: 1;
  min-width: 0;
  font-size: 10.5px;
  color: var(--text-4);
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  /* Подпись шире своей колонки — пусть выходит за её края, но не переносится */
  overflow: visible;
}

@media (max-width: 560px) {
  .stat-chart { --sc-gutter: 34px; }
  .stat-chart .sc-yaxis,
  .stat-chart .sc-plot { height: 140px; }
  .stat-chart .sc-xlabel { font-size: 9.5px; }
}

@keyframes bar-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ======================================================================
   ДОКУМЕНТЫ
   ====================================================================== */
/* Документы сайта — такой же читаемый текст, тоже подчиняется масштабу */
.doc-body { max-width: 76ch; font-size: calc(15.8px * var(--font-scale, 1)); line-height: 1.75; color: var(--text-2); }
.doc-body h2 { font-size: 22px; color: var(--text); margin: 36px 0 12px; letter-spacing: -.025em; }
.doc-body h3 { font-size: 17.5px; color: var(--text); margin: 24px 0 8px; }
.doc-body p + p { margin-top: 14px; }
.doc-body ul, .doc-body ol { margin: 12px 0; padding-left: 1.4em; }
.doc-body li { margin-bottom: 7px; }
.doc-body li::marker { color: var(--accent); }
.doc-meta { font-size: 13px; color: var(--text-4); padding: 12px 16px; border-radius: var(--r-sm); background: var(--fill-2); margin-bottom: 24px; }

/* ======================================================================
   АВТОРИЗАЦИЯ
   ====================================================================== */
.auth-shell { min-height: calc(100dvh - var(--header-h)); display: grid; place-items: center; padding: 24px 16px 60px; }
.auth-card {
  width: min(430px, 100%);
  padding: 34px;
  border-radius: var(--r-2xl);
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(36px) saturate(var(--glass-saturate));
  backdrop-filter: blur(36px) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  animation: page-in .5s var(--ease-out) both;
}
.auth-card .ac-logo { width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 17px; display: grid; place-items: center; background: linear-gradient(140deg, var(--accent), #64d2ff); box-shadow: var(--shadow-accent); }
.auth-card h1 { font-size: 25px; text-align: center; letter-spacing: -.03em; margin-bottom: 7px; }
.auth-card .ac-sub { text-align: center; color: var(--text-3); font-size: 14px; margin-bottom: 26px; }
.auth-card .field + .field { margin-top: 15px; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-3); }

/* Индикатор надёжности пароля */
.pw-strength { display: flex; gap: 4px; margin-top: 7px; }
.pw-strength i { flex: 1; height: 4px; border-radius: 99px; background: var(--fill); transition: background var(--dur) ease; }
.pw-strength i.on-1 { background: var(--red); }
.pw-strength i.on-2 { background: var(--orange); }
.pw-strength i.on-3 { background: var(--yellow); }
.pw-strength i.on-4 { background: var(--green); }
