:root,
[data-theme="light"] {
  --bg-page: #F4EFE6;
  --bg-sheet: #FFFDF8;
  --bg-elevated: #FFFFFF;
  --bg-subtle: #EFE9DC;
  --bg-model: #F8FAFC;
  --bg-stage: #FFFDF9;
  --ink: #18181B;
  --ink-strong: #09090B;
  --ink-secondary: #3F3F46;
  --ink-muted: #52525B;
  --border: #E2DAC7;
  --border-strong: #CBC0A8;
  --accent: #1D4ED8;
  --accent-hover: #1E40AF;
  --accent-soft: #DBEAFE;
  --accent-text: #1E3A8A;
  --rule-gold: #B45309;
  --rule-bg: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  --rule-text: #18181B;
  --amber-soft: #FEF3C7;
  --amber-border: rgba(217, 119, 6, 0.48);
  --amber-ink: #78350F;
  --term-soft: rgba(219, 234, 254, 0.78);
  --term-border: rgba(59, 130, 246, 0.34);
  --formula-bg: #FFFFFF;
  --formula-border: #F59E0B;
  --formula-text: #1E293B;
  --banner-bg: #EFF6FF;
  --banner-border: #93C5FD;
  --banner-title: #1E3A8A;
  --banner-text: #1E293B;
  --coach-bg: linear-gradient(135deg, #FFFBEB 0%, #FFFDF8 100%);
  --badge-bg: #FEF9C3;
  --badge-border: #FDE047;
  --badge-text: #854D0E;
  --green: #047857;
  --green-soft: #D1FAE5;
  --red: #BE123C;
  --red-soft: #FFE4E6;
  --shadow-card: 0 8px 28px rgba(24, 21, 18, 0.06);
  --radius: 14px;
  /* Детская адаптированная типографика: крупные открытые буквы Andika + округлый Nunito + чёткие заголовки/цифры Rubik */
  --font-book: "Andika", "Nunito", "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-heading: "Rubik", "Nunito", "Andika", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-ui: "Nunito", "Rubik", "Andika", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-math: "Rubik", "Nunito", "Andika", sans-serif;
}

[data-theme="dark"] {
  --bg-page: #0B1120;
  --bg-sheet: #151F32;
  --bg-elevated: #1E293B;
  --bg-subtle: #0F172A;
  --bg-model: #0F172A;
  --bg-stage: #1E293B;
  --ink: #F1F5F9;
  --ink-strong: #FDE047;
  --ink-secondary: #CBD5E1;
  --ink-muted: #94A3B8;
  --border: #26354D;
  --border-strong: #3B4F6B;
  --accent: #60A5FA;
  --accent-hover: #3B82F6;
  --accent-soft: rgba(59, 130, 246, 0.22);
  --accent-text: #93C5FD;
  --rule-gold: #FBBF24;
  --rule-bg: linear-gradient(135deg, rgba(245, 158, 11, 0.18) 0%, rgba(217, 119, 6, 0.11) 100%);
  --rule-text: #F8FAFC;
  --amber-soft: rgba(245, 158, 11, 0.22);
  --amber-border: rgba(251, 191, 36, 0.55);
  --amber-ink: #FDE68A;
  --term-soft: rgba(59, 130, 246, 0.22);
  --term-border: rgba(96, 165, 250, 0.42);
  --formula-bg: #0F172A;
  --formula-border: #F59E0B;
  --formula-text: #FDE68A;
  --banner-bg: rgba(37, 99, 235, 0.2);
  --banner-border: rgba(96, 165, 250, 0.45);
  --banner-title: #93C5FD;
  --banner-text: #F1F5F9;
  --coach-bg: linear-gradient(135deg, #1E293B 0%, #151F32 100%);
  --badge-bg: rgba(250, 204, 21, 0.18);
  --badge-border: rgba(250, 204, 21, 0.45);
  --badge-text: #FDE047;
  --green: #34D399;
  --green-soft: rgba(16, 185, 129, 0.22);
  --red: #FB7185;
  --red-soft: rgba(244, 63, 94, 0.22);
  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-page);
  color: var(--ink);
  line-height: 1.7;
  letter-spacing: 0.012em;
  word-spacing: 0.04em;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Верхняя панель: единая типографика веб-приложения (Rubik + Andika/Nunito) */
.topbar {
  background: rgba(255, 253, 248, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--border-strong);
  box-shadow: 0 4px 18px rgba(69, 26, 3, 0.06);
  position: sticky;
  top: 0;
  z-index: 40;
}

[data-theme="dark"] .topbar {
  background: rgba(21, 31, 50, 0.95);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.topbar-inner {
  max-width: 1640px;
  min-height: 56px;
  margin: 0 auto;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar-brand-divider {
  width: 1.5px;
  height: 24px;
  background: var(--border-strong);
  margin: 0 1px;
}

.book-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: radial-gradient(circle at 32% 28%, #F59E0B 0%, #B45309 76%, #78350F 100%);
  border: 2px solid #FEF3C7;
  box-shadow: 0 3px 8px rgba(120, 53, 15, 0.24);
  color: #FFFBEB;
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.book-title {
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink-strong);
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
  flex-wrap: nowrap;
  min-width: 0;
}

/* Единая сегментированная капсула навигации по параграфам */
.book-pager-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: inset 0 1px 2px rgba(24, 21, 18, 0.05);
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.topbar-arrow-btn {
  min-width: 40px;
  height: 36px;
  padding: 0 11px;
  border-radius: 10px;
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  justify-content: center;
}

.direct-jump-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  padding: 0 10px;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 800;
  color: var(--amber-ink);
}

.direct-jump-prefix {
  color: #B45309;
  font-weight: 800;
}

[data-theme="dark"] .direct-jump-prefix {
  color: #FBBF24;
}

.direct-jump-inline input {
  width: 48px;
  border: none;
  background: transparent;
  font-family: var(--font-heading);
  font-size: 15.5px;
  font-weight: 800;
  color: var(--ink-strong);
  text-align: center;
}

.direct-jump-inline input:focus {
  outline: none;
}

.search-wrap {
  position: relative;
  width: 220px;
  max-width: 240px;
  min-width: 110px;
  flex: 1 1 auto;
}

.catalog-search-wrap {
  width: 320px;
  max-width: 340px;
  min-width: 140px;
  flex: 1 1 auto;
}

.search-wrap input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 38px;
  border-radius: 12px;
  border: 1.5px solid var(--border-strong);
  background-color: var(--bg-elevated);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378350F' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--font-book);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

[data-theme="dark"] .search-wrap input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23FBBF24' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
}

.search-wrap input::placeholder {
  color: var(--ink-muted);
  font-weight: 400;
}

.search-wrap input:focus {
  outline: none;
  border-color: #D97706;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 420px;
  max-width: 92vw;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-sheet);
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  padding: 6px;
  z-index: 100;
}

.search-hit {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  border: none;
  background: transparent;
  border-bottom: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.search-hit:hover {
  background: var(--amber-soft);
}

.search-hit-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.search-hit-sub {
  font-family: var(--font-book);
  font-size: 13.5px;
  color: var(--ink-secondary);
  margin-top: 2px;
}

.search-hit-with-portrait {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.search-hit-body {
  min-width: 0;
  flex: 1;
}

.search-hit-portrait {
  width: 36px;
  height: 45px;
  object-fit: contain;
  object-position: bottom center;
  flex-shrink: 0;
  background: transparent;
  filter: drop-shadow(0 2px 5px rgba(15, 23, 42, 0.22));
}

.jump-select {
  height: 36px;
  padding: 0 32px 0 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border-strong);
  background-color: var(--bg-elevated);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2378350F' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-strong);
  max-width: 310px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

[data-theme="dark"] .jump-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23FBBF24' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

.jump-select:hover,
.jump-select:focus {
  outline: none;
  border-color: #D97706;
}

.nav-btn-group {
  display: flex;
  gap: 6px;
}

.nav-btn, .icon-btn {
  height: 44px;
  padding: 0 15px;
  border-radius: 12px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-elevated);
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.005em;
  color: var(--ink-strong);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.nav-btn:hover, .icon-btn:hover {
  background: var(--amber-soft);
  border-color: #D97706;
  color: var(--amber-ink);
  transform: translateY(-1px);
}

.topbar-icon-btn,
.theme-toggle-btn,
.font-size-toggle-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  max-width: 40px;
  padding: 0;
  border-radius: 12px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-elevated);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar-icon-btn .btn-theme-icon,
.theme-toggle-btn .btn-theme-icon,
.font-size-toggle-btn .btn-theme-icon {
  width: 20px;
  height: 20px;
  margin: 0;
  display: block;
}

.primary-nav-btn {
  background: linear-gradient(180deg, #FFFBEB 0%, #FEF3C7 100%);
  color: #78350F;
  border: 2px solid rgba(180, 83, 9, 0.45);
  box-shadow: 0 2px 6px rgba(180, 83, 9, 0.12);
  font-weight: 800;
}

.primary-nav-btn:hover {
  background: linear-gradient(180deg, #FEF3C7 0%, #FDE68A 100%);
  border-color: #B45309;
  color: #451A03;
  box-shadow: 0 4px 10px rgba(180, 83, 9, 0.2);
}

[data-theme="dark"] .primary-nav-btn {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(251, 191, 36, 0.55);
  color: #FDE68A;
}

[data-theme="dark"] .primary-nav-btn:hover {
  background: rgba(245, 158, 11, 0.3);
  border-color: #FBBF24;
  color: #FEF3C7;
}

/* ДВУХКОЛОНОЧНЫЙ ЭКРАН ВЕБ-ПРИЛОЖЕНИЯ (Слева — параграф, Справа — единая большая анимация и модель) */
.spread-stage {
  max-width: 1640px;
  margin: 0 auto;
  padding: 26px 28px 60px;
}

.book-spread {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.06fr);
  gap: 28px;
  align-items: start;
}

.book-sheet {
  width: 100%;
  background: var(--bg-sheet);
  border: 1.5px solid var(--border-strong);
  border-radius: 18px;
  padding: 40px 46px;
  box-shadow: var(--shadow-card);
}

.spread-right-page {
  position: sticky;
  top: 76px;
}

.right-panel-card {
  background: var(--bg-sheet);
  border: 1.5px solid var(--border-strong);
  border-radius: 18px;
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
}

.right-mode-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.mode-tab {
  padding: 7px 13px;
  border-radius: 9px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-elevated);
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink-secondary);
  cursor: pointer;
}

.mode-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.mode-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.sheet-meta {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-secondary);
  margin-bottom: 12px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.sheet-title {
  font-family: var(--font-heading);
  font-size: 29px;
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: 0.012em;
  color: var(--ink);
  margin: 4px 0 14px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

/* 1. Блок текста параграфа (Единый эталонный шрифт и стиль § 1 для всех параграфов § 1–§ 214) */
.lesson-text-block {
  font-family: var(--font-book);
  font-size: 20.5px;
  line-height: 1.68;
  letter-spacing: 0.018em;
  word-spacing: 0.05em;
  color: var(--ink);
  font-kerning: normal;
  font-variant-numeric: lining-nums tabular-nums;
}

.lesson-text-block p {
  margin-bottom: 13px;
  text-indent: 1.15em;
  text-align: left;
}

.lesson-text-block strong {
  font-weight: 700;
  color: var(--ink-strong);
}

.lesson-table-row {
  font-family: var(--font-book);
  font-size: 20px;
  font-weight: 700;
  padding: 10px 18px;
  margin: 8px 0;
  background: var(--rule-bg);
  border: 2px solid var(--amber-border);
  border-left: 5px solid var(--rule-gold);
  border-radius: 10px;
  color: var(--ink-strong);
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.08);
}

.lesson-rule-box {
  margin: 22px 0;
  padding: 20px 24px;
  background: var(--rule-bg);
  border-left: 5px solid var(--rule-gold);
  border-radius: 6px 14px 14px 6px;
  font-family: var(--font-book);
  font-size: 19.8px;
  line-height: 1.8;
  letter-spacing: 0.014em;
  word-spacing: 0.05em;
  color: var(--rule-text);
  box-shadow: 0 2px 10px rgba(180, 83, 9, 0.08);
}

.lesson-rule-title {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rule-gold);
  margin-bottom: 6px;
}

.lesson-formula {
  margin-top: 10px;
  margin-right: 6px;
  font-family: var(--font-math);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.03em;
  color: var(--formula-text);
  background: var(--formula-bg);
  border: 1.5px solid var(--formula-border);
  padding: 7px 15px;
  border-radius: 10px;
  display: inline-block;
}

/* 2. Правая колонка: Единая крупная анимация и интерактивная модель */
.right-block {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.right-block:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.section-subtitle {
  font-family: var(--font-ui);
  font-size: 17.5px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* Верхняя панель шагов единой анимации */
.unified-anim-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.step-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.step-pill {
  padding: 6px 13px;
  border-radius: 99px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-elevated);
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.step-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.step-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(29, 78, 216, 0.25);
}

.anim-caption-banner {
  background: var(--banner-bg);
  border: 1.5px solid var(--banner-border);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 10px;
}

.anim-caption-title {
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 800;
  color: var(--banner-title);
  margin-bottom: 3px;
}

.anim-caption-text {
  font-family: var(--font-book);
  font-size: 15.5px;
  color: var(--banner-text);
  line-height: 1.55;
  letter-spacing: 0.012em;
}

/* ЕДИНАЯ КРУПНАЯ АНИМАЦИОННАЯ СЦЕНА (Big Single Animation per Paragraph) */
.interactive-model-box {
  padding: 12px;
  background: var(--bg-model);
  border: 1.5px solid var(--border-strong);
  border-radius: 16px;
}

.live-stage-canvas {
  position: relative;
  background: var(--bg-stage);
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
  padding: 6px;
  margin-bottom: 12px;
  overflow: hidden;
}

.stage-svg-layer {
  width: 100%;
  margin-bottom: 8px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 2px 10px rgba(15, 23, 42, 0.04);
}

.stage-svg-layer svg {
  width: 100%;
  height: auto;
  min-height: 360px;
  display: block;
  font-family: var(--font-ui);
}

.stage-svg-layer svg text {
  font-family: var(--font-ui);
  letter-spacing: 0.012em;
}

/* Плавные CSS/SVG-анимации внутри единой большой сцены */
@keyframes charFloatBreathe {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-4.5px); }
}

@keyframes charEyeBlink {
  0%, 92%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(0.12); }
}

@keyframes beamDashFlow {
  0% { stroke-dashoffset: 18; }
  100% { stroke-dashoffset: 0; }
}

@keyframes targetPulseRing {
  0%, 100% { transform: scale(1); opacity: 0.35; }
  50% { transform: scale(1.38); opacity: 0.65; }
}

@keyframes opTileFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-2.5px); }
}

.svg-char-actor {
  cursor: pointer;
  transition: filter 0.18s ease;
}

.svg-char-actor:hover {
  filter: drop-shadow(0 6px 14px rgba(29, 78, 216, 0.32));
}

.char-body-anim {
  animation: charFloatBreathe 2.8s ease-in-out infinite;
}

.char-eyes-anim {
  transform-box: fill-box;
  transform-origin: center;
  animation: charEyeBlink 4.2s ease-in-out infinite;
}

.char-pointer-beam {
  animation: beamDashFlow 0.9s linear infinite;
}

.char-target-pulse {
  transform-box: fill-box;
  transform-origin: center;
  animation: targetPulseRing 1.6s ease-in-out infinite;
}

.op-tile-anim {
  animation: opTileFloat 3.2s ease-in-out infinite;
}

.stage-char-actor {
  position: relative;
  display: block;
  background: var(--coach-bg);
  border: 1.5px solid var(--char-accent, var(--accent));
  border-radius: 12px;
  padding: 11px 14px;
}

.char-stage-bubble {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.start-pointer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--badge-border);
  border-radius: 99px;
  padding: 4px 11px;
  font-size: 13px;
  font-weight: 800;
  width: fit-content;
}

.start-pointer-badge.interacted {
  display: none;
}

@keyframes pointerNudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}

.pointer-hand {
  display: inline-block;
  animation: pointerNudge 1.1s infinite ease-in-out;
}

.char-coach-text {
  font-family: var(--font-book);
  font-size: 15.5px;
  line-height: 1.55;
  letter-spacing: 0.012em;
  color: var(--ink);
}

.char-stage-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.char-do-action-btn {
  padding: 7px 13px;
  border-radius: 9px;
  border: none;
  background: var(--char-accent, var(--accent));
  color: #FFFFFF;
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(29, 78, 216, 0.2);
  transition: transform 0.12s ease, opacity 0.15s ease;
}

.char-do-action-btn:hover {
  transform: translateY(-1px);
  opacity: 0.94;
}

.preset-chips-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.preset-chip {
  padding: 6px 11px;
  border-radius: 99px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-elevated);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.sliders-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.slider-header-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.step-nudge-btns {
  display: inline-flex;
  gap: 4px;
}

.nudge-btn {
  padding: 3px 9px;
  border-radius: 7px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-elevated);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
}

.nudge-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.live-math-summary {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-family: var(--font-book);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink);
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.slider-group input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.model-output {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--ink);
}

/* 3. Мини-игра к параграфу */
.minigame-card {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 16px;
}

.minigame-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.game-tab {
  padding: 6px 13px;
  border-radius: 9px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-page);
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink-secondary);
  cursor: pointer;
}

.game-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.game-prompt {
  font-family: var(--font-book);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
  line-height: 1.55;
  letter-spacing: 0.012em;
}

.blitz-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.blitz-btn {
  padding: 11px 12px;
  border-radius: 11px;
  border: 2px solid var(--border-strong);
  background: var(--bg-sheet);
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
}

.blitz-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.blitz-btn.correct {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green);
}

.blitz-btn.wrong {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red);
}

.task-answer-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

.task-input {
  padding: 8px 12px;
  border-radius: 9px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-sheet);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
  width: 170px;
}

.btn-primary {
  padding: 8px 15px;
  border-radius: 9px;
  border: none;
  background: var(--accent);
  color: #FFFFFF;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  padding: 8px 13px;
  border-radius: 9px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-page);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

.game-feedback {
  margin-top: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  font-family: var(--font-book);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.55;
  display: none;
}

.game-feedback.ok {
  display: block;
  background: var(--green-soft);
  color: var(--green);
  border: 1.5px solid var(--green);
}

.game-feedback.err {
  display: block;
  background: var(--red-soft);
  color: var(--red);
  border: 1.5px solid var(--red);
}

/* Нижняя навигация между параграфами */
.sheet-footer-nav {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1.5px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sheet-footer-nav .footer-arrow-btn {
  min-width: 56px;
  min-height: 44px;
  padding: 6px 14px;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 11px;
  cursor: pointer;
}

.sheet-footer-nav .footer-labeled-btn.is-next-cta {
  background: linear-gradient(180deg, rgba(254, 243, 199, 0.92) 0%, rgba(253, 230, 138, 0.85) 100%);
  border-color: #D97706;
  color: #78350F;
}

[data-theme="dark"] .sheet-footer-nav .footer-labeled-btn.is-next-cta {
  background: linear-gradient(180deg, rgba(120, 53, 15, 0.55) 0%, rgba(69, 26, 3, 0.65) 100%);
  border-color: #F59E0B;
  color: #FEF3C7;
}

.footer-btn-text {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.footer-center-links {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.footer-quick-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--ink-secondary);
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.footer-quick-pill:hover {
  border-color: var(--accent);
  color: var(--ink);
  transform: translateY(-1px);
}

.sheet-meta-div-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--term-border);
  transition: filter 0.15s ease;
}

.sheet-meta-div-link:hover {
  filter: brightness(0.95);
}

.sheet-meta-sep {
  opacity: 0.6;
  margin: 0 2px;
}

.topbar-brand-home-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.primary-nav-btn.is-active-nav {
  background: linear-gradient(180deg, #FEF3C7 0%, #FDE68A 100%);
  border-color: #D97706;
  color: #78350F;
}

[data-theme="dark"] .primary-nav-btn.is-active-nav {
  background: rgba(120, 53, 15, 0.55);
  border-color: #F59E0B;
  color: #FEF3C7;
}

/* Таблица простых чисел */
.primes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 6px;
  max-height: 460px;
  overflow-y: auto;
  padding: 10px;
  background: var(--bg-subtle);
  border-radius: 10px;
}

.prime-cell {
  text-align: center;
  padding: 7px 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: var(--font-math);
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink);
}

.prime-cell.twin {
  background: var(--badge-bg);
  border-color: var(--badge-border);
  color: var(--badge-text);
}

/* ЭКРАН ПОЛНОГО ОГЛАВЛЕНИЯ (catalog.html) */
.catalog-page-main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.catalog-hero {
  background: var(--bg-sheet);
  border: 1.5px solid var(--border-strong);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}

.catalog-main-title {
  font-family: var(--font-ui);
  font-size: 29px;
  font-weight: 900;
  color: var(--ink);
  margin-bottom: 8px;
}

.catalog-main-sub {
  font-family: var(--font-book);
  font-size: 16px;
  color: var(--ink-secondary);
  margin-bottom: 16px;
  line-height: 1.65;
}

.catalog-division-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cat-div-pill {
  padding: 8px 15px;
  border-radius: 99px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-elevated);
  font-family: var(--font-ui);
  font-size: 13.8px;
  font-weight: 800;
  color: var(--ink-secondary);
  cursor: pointer;
}

.cat-div-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cat-div-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.direct-jump-form {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.direct-jump-form input {
  width: 78px;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 800;
}

.catalog-division-section {
  background: var(--bg-sheet);
  border: 1.5px solid var(--border-strong);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-card);
}

.catalog-division-heading {
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 900;
  color: var(--rule-gold);
  padding-bottom: 10px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.catalog-chapter-block {
  margin-bottom: 18px;
}

.catalog-chapter-block:last-child {
  margin-bottom: 0;
}

.catalog-chapter-heading {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 800;
  color: var(--ink-secondary);
  margin-bottom: 10px;
}

.catalog-sec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.catalog-sec-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px;
  align-items: center;
  gap: 10px;
  min-height: 122px;
  padding: 12px 10px 12px 15px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--bg-elevated);
  text-decoration: none;
  color: var(--ink);
  overflow: hidden;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.14s ease, box-shadow 0.16s ease;
}

.catalog-sec-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.catalog-sec-card.current {
  border: 2px solid var(--accent);
  background: var(--accent-soft);
}

.catalog-sec-body {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  gap: 5px;
  min-width: 0;
  z-index: 1;
}

.catalog-sec-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
}

.catalog-sec-num {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-weight: 900;
  font-size: 13px;
  color: var(--accent);
}

.catalog-sec-card:hover .catalog-sec-num,
.catalog-sec-card.current .catalog-sec-num {
  background: var(--accent);
  color: #FFFFFF;
}

.catalog-sec-title {
  font-family: var(--font-book);
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.38;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.catalog-sec-cue {
  font-family: var(--font-ui);
  font-size: 12.2px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink-muted);
  margin-top: auto;
  padding-top: 2px;
}

.catalog-sec-portrait-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 112px;
  pointer-events: none;
  user-select: none;
}

.catalog-sec-portrait {
  display: block;
  width: 96px;
  height: 112px;
  object-fit: contain;
  object-position: center center;
  background: transparent;
  filter: drop-shadow(0 4px 8px rgba(15, 23, 42, 0.2));
  transform-origin: center center;
  transition: transform 0.18s ease, filter 0.18s ease;
}

html[data-theme="dark"] .catalog-sec-portrait {
  filter: drop-shadow(0 5px 11px rgba(2, 6, 23, 0.6));
}

.catalog-sec-card:hover .catalog-sec-portrait {
  transform: scale(1.06);
}

@media (max-width: 480px) {
  .catalog-sec-card {
    grid-template-columns: minmax(0, 1fr) 82px;
    min-height: 108px;
    padding: 11px 6px 0 13px;
  }

  .catalog-sec-portrait-wrap {
    width: 82px;
  }

  .catalog-sec-portrait {
    width: 80px;
    height: 100px;
  }
}

.catalog-empty {
  padding: 36px;
  text-align: center;
  background: var(--bg-sheet);
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
  color: var(--ink-secondary);
  font-size: 16px;
}

/* Адаптивность */
@media (max-width: 1080px) {
  .book-spread {
    grid-template-columns: 1fr;
  }

  .spread-right-page {
    position: static;
  }
}

@media (max-width: 680px) {
  .spread-stage {
    padding: 14px 10px 40px;
  }

  .book-sheet, .right-panel-card {
    padding: 20px 16px;
  }

  .sheet-title {
    font-size: 24px;
  }

  .lesson-text-block {
    font-size: 18px;
  }
}

/* ============================================================================
   ЭТАЛОННЫЙ ИНТЕРАКТИВНЫЙ ЭКРАН § 1:
   Слева — крупный ясный текст + авторская иллюстрация с героями (Фима и Олло)
   Справа — 100% визуальное объяснение главной мысли параграфа БЕЗ ОПОРЫ НА ТЕКСТ
   ============================================================================ */
.sec1-bespoke-left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 26px 32px 22px;
}

.sec1-large-title {
  font-family: var(--font-heading);
  font-size: 29px;
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: 0.012em;
  color: var(--ink);
  margin: 4px 0 14px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.sec1-large-text {
  font-family: var(--font-book);
  font-size: 20.5px;
  line-height: 1.68;
  letter-spacing: 0.018em;
  word-spacing: 0.05em;
  color: var(--ink);
}

.sec1-large-text p {
  margin-bottom: 13px;
  text-indent: 1.15em;
}

.sec1-key-term {
  font-weight: 700;
  color: var(--accent-text);
  background: var(--term-soft);
  padding: 1px 5px;
  border-radius: 6px;
  border-bottom: 1.5px solid var(--term-border);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.sec1-key-rule {
  font-weight: 700;
  color: var(--amber-ink);
  background: var(--amber-soft);
  padding: 1px 6px;
  border-radius: 6px;
  border-bottom: 2px solid var(--amber-border);
  box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.22);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.sec1-left-illustration-frame {
  margin: 12px 0 14px;
  border-radius: 16px;
  overflow: hidden;
  border: 2.5px solid var(--border-strong);
  background: #FFFDF7;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  position: relative;
}

.sec1-left-illustration-img {
  width: 100%;
  height: auto;
  display: block;
}

.sec1-pure-visual-right {
  background: var(--bg-sheet);
  border: 2px solid var(--border-strong);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow-book);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sec1-visual-plate-card {
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--border-strong);
  background: #FFFDF7;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
}

.sec1-visual-plate-img {
  width: 100%;
  height: auto;
  display: block;
}

.sec1-interactive-visual-stage {
  border-radius: 18px;
  overflow: hidden;
  border: 2.5px solid var(--border-strong);
  background: #FFFDF7;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.09);
}

/* ЖИВАЯ СЦЕНА § 1 НА ОСНОВЕ ИЛЛЮСТРАЦИЙ QWEN-IMAGE 2.1 UC BF16 */
.sec1-storybook-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9.2;
  background-image: url("https://cdn.mathka.org/assets/sec1_visioneer/sec1_anim_backdrop_winner.png?v=92");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  user-select: none;
}

/* Верхний ряд: 4 живописные карточки ступеней (1 → 2 → 3 → 4) */
.sec1-painted-step-row {
  position: absolute;
  top: 10px;
  left: 14px;
  right: 14px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  z-index: 4;
}

.sec1-painted-step-card {
  position: relative;
  height: 78px;
  border-radius: 15px;
  background: rgba(255, 252, 242, 0.92);
  border: 2.5px solid rgba(180, 83, 9, 0.28);
  box-shadow: 0 4px 12px rgba(69, 26, 3, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.sec1-painted-step-card:hover {
  transform: translateY(-2px);
  border-color: #D97706;
}

.sec1-painted-step-card.is-active {
  background: linear-gradient(180deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 3px solid #B45309;
  box-shadow: 0 6px 18px rgba(180, 83, 9, 0.24), inset 0 0 0 1.5px rgba(255, 255, 255, 0.8);
  transform: translateY(-2px) scale(1.02);
}

.sec1-mini-platter-group {
  position: relative;
  flex: 1;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sec1-mini-tray-img {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 92%;
  max-width: 104px;
  height: 36px;
  object-fit: fill;
  opacity: 0.96;
  pointer-events: none;
  z-index: 1;
}

.sec1-mini-tray-rim-img {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 92%;
  max-width: 104px;
  height: 36px;
  object-fit: fill;
  pointer-events: none;
  z-index: 3;
}

.sec1-mini-apples-wrap {
  position: absolute;
  left: 50%;
  bottom: 11px;
  transform: translateX(-50%);
  width: 96px;
  height: 34px;
  z-index: 2;
  pointer-events: none;
}

.sec1-mini-apple-img {
  position: absolute;
  left: calc(50% + var(--mini-x, 0px));
  bottom: calc(0px - var(--mini-y, 0px));
  width: 25px;
  height: 25px;
  object-fit: contain;
  transform: translateX(-50%) rotate(var(--mini-rot, 0deg));
  filter: drop-shadow(0 2px 2px rgba(69, 26, 3, 0.36));
}

.sec1-mini-apple-img.is-new-mini-unit {
  animation: sec1MiniAppleDrop 0.48s cubic-bezier(0.22, 1.35, 0.36, 1) both;
}

.sec1-painted-step-card[data-sec1-count="4"] .sec1-mini-apple-img {
  width: 22px;
  height: 22px;
}

.sec1-wood-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #F59E0B 0%, #B45309 75%, #78350F 100%);
  border: 2px solid #FEF3C7;
  box-shadow: 0 3px 6px rgba(69, 26, 3, 0.26);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 900;
  color: #FFFBEB;
  flex-shrink: 0;
}

.sec1-painted-step-card.is-active .sec1-wood-badge {
  background: radial-gradient(circle at 32% 30%, #DC2626 0%, #991B1B 80%, #7F1D1D 100%);
  transform: scale(1.08);
}

/* Дуга перехода +1 яблоко между ступенями */
.sec1-step-bridge-wrap {
  position: absolute;
  right: -14px;
  top: -8px;
  z-index: 6;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sec1-step-bridge-apple {
  width: 21px;
  height: 21px;
  filter: drop-shadow(0 2px 3px rgba(69, 26, 3, 0.28));
}

.sec1-step-bridge-wrap .sec1-step-bridge-apple {
  position: static;
}

.sec1-step-bridge-plus {
  position: absolute;
  bottom: -4px;
  right: -5px;
  background: #DC2626;
  color: #FFFBEB;
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  padding: 1.5px 3.5px;
  border-radius: 6px;
  border: 1.5px solid #FEF3C7;
  box-shadow: 0 1px 3px rgba(69, 26, 3, 0.3);
}

.sec1-step-bridge-wrap.is-just-joined {
  animation: sec1BridgePulse 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sec2-bridge-stone {
  position: absolute;
  right: -13px;
  top: -7px;
  z-index: 6;
  pointer-events: none;
}

.sec1-painted-actor {
  position: absolute;
  bottom: 10px;
  z-index: 6;
  pointer-events: none;
  filter: drop-shadow(0 10px 14px rgba(69, 26, 3, 0.26));
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.sec1-ollo-actor {
  left: 12px;
  bottom: 8px;
  height: 67%;
  width: auto;
  transform-origin: 50% 92%;
  animation: sec1OlloBreathe 3.6s ease-in-out infinite;
}

.sec1-fima-actor {
  right: 14px;
  bottom: 8px;
  height: 68%;
  width: auto;
  transform-origin: 50% 92%;
  animation: sec1FimaBreathe 3.8s ease-in-out infinite;
}

.sec1-ollo-actor.is-celebrating {
  animation: sec1OlloCelebrate 0.62s cubic-bezier(0.22, 1, 0.36, 1), sec1OlloBreathe 3.6s ease-in-out 0.62s infinite;
}

.sec1-fima-actor.is-celebrating {
  animation: sec1FimaCelebrate 0.62s cubic-bezier(0.22, 1, 0.36, 1), sec1FimaBreathe 3.8s ease-in-out 0.62s infinite;
}

/* Центральное деревянное блюдо и собрание живописных яблок-единиц */
.sec1-platter-center-zone {
  position: absolute;
  left: 50.4%;
  bottom: 14%;
  transform: translateX(-50%);
  width: 48%;
  height: 56%;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  cursor: pointer;
}

.sec1-bowl-front-rim-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  z-index: 5;
  pointer-events: none;
}

.sec1-golden-collection-halo {
  position: absolute;
  bottom: 24%;
  width: 76%;
  height: 36%;
  border-radius: 50%;
  border: none;
  background: radial-gradient(ellipse at center, rgba(254, 240, 138, 0.42) 0%, rgba(254, 243, 199, 0) 72%);
  pointer-events: none;
  transition: all 0.3s ease;
}

.sec1-golden-collection-halo.is-pulsing {
  animation: sec1HaloGlow 0.65s ease-out;
}

.sec1-bowl-ripple-ring {
  position: absolute;
  bottom: 27%;
  left: 50%;
  width: 150px;
  height: 44px;
  border-radius: 50%;
  border: 2.5px solid rgba(245, 158, 11, 0.58);
  transform: translateX(-50%) scale(0.5);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  animation: sec1BowlRipple 0.72s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.sec1-platter-apples-row {
  position: absolute;
  left: 50%;
  bottom: 28%;
  transform: translateX(-50%);
  width: 280px;
  height: 112px;
  z-index: 4;
  pointer-events: none;
}

.sec1-platter-apple-unit {
  position: absolute;
  left: calc(50% + var(--apple-x, 0px));
  bottom: var(--apple-lift, 4px);
  width: 82px;
  height: 82px;
  margin-left: -41px;
  transform-origin: 50% 88%;
  transform: rotate(var(--apple-tilt, 0deg)) scale(var(--apple-scale, 1));
}

.sec1-platter-apple-unit.is-settled-in-bowl {
  animation: sec1AppleSettle 0.38s cubic-bezier(0.25, 1, 0.5, 1) both;
}

.sec1-platter-apple-unit.is-dropping-in {
  animation: sec1NewAppleDropIn 0.58s cubic-bezier(0.22, 1.38, 0.36, 1) both;
}

.sec1-platter-apple-unit::after {
  content: "";
  position: absolute;
  bottom: 1px;
  left: 12%;
  width: 76%;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(69, 26, 3, 0.54) 0%, rgba(120, 53, 15, 0.25) 48%, rgba(69, 26, 3, 0) 76%);
  z-index: -1;
}

.sec1-platter-apples-row[data-count="1"] .sec1-platter-apple-unit {
  width: 90px;
  height: 90px;
  margin-left: -45px;
}

.sec1-platter-apples-row[data-count="4"] .sec1-platter-apple-unit {
  width: 74px;
  height: 74px;
  margin-left: -37px;
}

.sec1-platter-apple-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 8px rgba(69, 26, 3, 0.32));
}

.sec1-plus-one-spark {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FEF08A 0%, #F59E0B 100%);
  border: 2px solid #FFFBEB;
  color: #78350F;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.1;
  box-shadow: 0 4px 10px rgba(180, 83, 9, 0.38);
  z-index: 8;
  pointer-events: none;
  animation: sec1PlusOneFloat 0.95s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.sec1-unit-one-tag {
  position: absolute;
  bottom: 14%;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FEF9C3 0%, #FDE047 65%, #CA8A04 100%);
  border: 2px solid #78350F;
  box-shadow: 0 2px 5px rgba(69, 26, 3, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 900;
  color: #451A03;
}

.sec1-platter-total-medallion {
  position: absolute;
  bottom: -6%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 64px;
  height: 44px;
  padding: 0 18px;
  border-radius: 22px;
  background: radial-gradient(circle at 35% 25%, #F59E0B 0%, #B45309 75%, #78350F 100%);
  border: 3px solid #FEF3C7;
  box-shadow: 0 6px 14px rgba(69, 26, 3, 0.34);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 900;
  color: #FFFBEB;
  z-index: 6;
}

.sec1-pill-apple-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(69, 26, 3, 0.25));
  margin: 0 -2px;
}

@keyframes sec1OlloBreathe {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(1.2deg); }
}

@keyframes sec1FimaBreathe {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(-1.2deg); }
}

@keyframes sec1OlloCelebrate {
  0% { transform: scale(1) rotate(0deg); }
  40% { transform: translateY(-7px) scale(1.04) rotate(3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes sec1FimaCelebrate {
  0% { transform: scale(1) rotate(0deg); }
  40% { transform: translateY(-7px) scale(1.04) rotate(-3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes sec1ApplePopIn {
  0% { opacity: 1; transform: translateY(-6px) scale(0.92); }
  65% { opacity: 1; transform: translateY(1px) scale(1.03); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes sec1AppleSettle {
  0% {
    transform: translateY(-3px) rotate(var(--apple-tilt, 0deg)) scale(calc(var(--apple-scale, 1) * 0.96));
  }
  60% {
    transform: translateY(1px) rotate(var(--apple-tilt, 0deg)) scale(calc(var(--apple-scale, 1) * 1.02));
  }
  100% {
    transform: translateY(0) rotate(var(--apple-tilt, 0deg)) scale(var(--apple-scale, 1));
  }
}

@keyframes sec1NewAppleDropIn {
  0% {
    opacity: 0;
    transform: translateY(-54px) rotate(calc(var(--apple-tilt, 0deg) - 10deg)) scale(calc(var(--apple-scale, 1) * 0.78));
  }
  58% {
    opacity: 1;
    transform: translateY(4px) rotate(calc(var(--apple-tilt, 0deg) + 3deg)) scale(calc(var(--apple-scale, 1) * 1.06));
  }
  78% {
    transform: translateY(-3px) rotate(calc(var(--apple-tilt, 0deg) - 1deg)) scale(calc(var(--apple-scale, 1) * 0.98));
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(var(--apple-tilt, 0deg)) scale(var(--apple-scale, 1));
  }
}

@keyframes sec1MiniAppleDrop {
  0% {
    transform: translateX(-50%) translateY(-12px) rotate(var(--mini-rot, 0deg)) scale(0.75);
  }
  65% {
    transform: translateX(-50%) translateY(1px) rotate(var(--mini-rot, 0deg)) scale(1.08);
  }
  100% {
    transform: translateX(-50%) translateY(0) rotate(var(--mini-rot, 0deg)) scale(1);
  }
}

@keyframes sec1BowlRipple {
  0% {
    opacity: 0.85;
    transform: translateX(-50%) scale(0.42);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(1.38);
  }
}

@keyframes sec1HaloGlow {
  0% { transform: scale(0.88); opacity: 0.5; }
  50% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 0.85; }
}

@keyframes sec1PlusOneFloat {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(10px) scale(0.75);
  }
  28% {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px) scale(1.08);
  }
  75% {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-16px) scale(0.92);
  }
}

@keyframes sec1BridgePulse {
  0% { transform: scale(1); }
  45% { transform: translateY(-3px) scale(1.22); }
  100% { transform: scale(1); }
}

.sec1-icon-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 4px 2px;
}

.sec1-icon-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 68px;
  height: 52px;
  padding: 0 16px;
  border-radius: 14px;
  border: 2.5px solid var(--border-strong);
  background: var(--bg-elevated);
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.sec1-icon-pill:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.sec1-icon-pill.active {
  border-color: #D97706;
  background: #FEF3C7;
  color: #92400E;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.22);
  transform: scale(1.05);
}

html[data-theme="dark"] .sec1-icon-pill.active {
  border-color: #F59E0B;
  background: rgba(245, 158, 11, 0.24);
  color: #FDE68A;
}

/* ============================================================================
   § 2. Натуральный ряд — Живописная сцена ступеней 1, 2, 3, 4, 5, 6, 7...
   (Hard Gates H13, H14, H15, H16: эталонный шрифт § 1, интерактивная схема ряда,
    560x640 спрайты Дани и Тамбы на y=597 и полновысотное центральное табло)
   ============================================================================ */
.sec1-storybook-stage.sec2-storybook-stage {
  background-image: url("https://cdn.mathka.org/assets/sec2_visioneer/sec2_anim_backdrop_winner.png?v=92");
  background-position: center bottom;
}

/* Left-Page High-Visibility Inline Schematic for § 2 (Hard Gate H14) */
.sec2-series-diagram {
  margin: 14px 0 18px;
}

.sec2-schematic-grid {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 6px;
  margin: 6px 0 8px;
}

.sec2-schematic-card {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 7px 6px;
  border-radius: 13px;
  background: #FFFFFF;
  border: 2px solid #D97706;
  box-shadow: 0 3px 9px rgba(180, 83, 9, 0.10);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.sec2-schematic-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(180, 83, 9, 0.20);
}

.sec2-schematic-card.is-five {
  border-color: #E11D48;
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF1F2 100%);
}

.sec2-schematic-card.is-infinite {
  border-color: #2563EB;
  background: linear-gradient(180deg, #FFFFFF 0%, #EFF6FF 100%);
}

html[data-theme="dark"] .sec2-schematic-card {
  background: rgba(30, 41, 59, 0.94);
  border-color: rgba(245, 158, 11, 0.65);
}

html[data-theme="dark"] .sec2-schematic-card.is-five {
  background: linear-gradient(180deg, rgba(136, 19, 55, 0.42) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-color: #FB7185;
}

html[data-theme="dark"] .sec2-schematic-card.is-infinite {
  background: linear-gradient(180deg, rgba(30, 58, 138, 0.45) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-color: #60A5FA;
}

.sec4-stroke-top-tag.is-coral-tag {
  background: #FFE4E6;
  color: #9F1239;
  border-color: #F43F5E;
}

html[data-theme="dark"] .sec4-stroke-top-tag.is-coral-tag {
  background: rgba(244, 63, 94, 0.25);
  color: #FDA4AF;
  border-color: #FB7185;
}

.sec2-schem-stones-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px;
  min-height: 24px;
  margin: 4px 0 2px;
}

.sec2-schem-stone {
  width: 24px;
  height: 15px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(69, 26, 3, 0.28));
}

.sec2-schem-stone.is-coral {
  filter: drop-shadow(0 0 4px rgba(244, 63, 94, 0.6)) drop-shadow(0 1px 2px rgba(69, 26, 3, 0.3));
}

.sec2-schem-num {
  font-family: var(--font-heading);
  font-size: 21px;
  font-weight: 900;
  color: var(--ink-strong);
  line-height: 1.05;
}

.sec2-schem-num.is-coral-num {
  color: #BE123C;
}

html[data-theme="dark"] .sec2-schem-num.is-coral-num {
  color: #FDA4AF;
}

.sec2-schem-hop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 0 2px;
  cursor: pointer;
}

.sec2-schem-hop-chip {
  font-family: var(--font-heading);
  font-size: 11.5px;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 999px;
  background: #FEF3C7;
  border: 1.5px solid #D97706;
  color: #92400E;
  white-space: nowrap;
}

.sec2-schem-hop-chip.is-coral {
  background: #FFE4E6;
  border-color: #E11D48;
  color: #9F1239;
}

html[data-theme="dark"] .sec2-schem-hop-chip {
  background: rgba(245, 158, 11, 0.22);
  border-color: #FBBF24;
  color: #FDE047;
}

html[data-theme="dark"] .sec2-schem-hop-chip.is-coral {
  background: rgba(244, 63, 94, 0.25);
  border-color: #FB7185;
  color: #FDA4AF;
}

.sec2-schem-hop-arrow {
  font-size: 16px;
  font-weight: 900;
  color: #D97706;
  line-height: 1;
}

.sec2-schem-hop-arrow.is-coral {
  color: #E11D48;
}

.sec2-schem-mid-num {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-secondary);
}

/* Top 4 Step Cards on § 2 Stage */
.sec1-painted-step-card.sec2-painted-step-card {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 6px;
}

.sec2-storybook-stage .sec1-wood-badge {
  width: auto;
  min-width: 34px;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  white-space: nowrap;
  font-size: 13px;
  letter-spacing: -0.01em;
}

.sec2-card-top-stone {
  width: 20px;
  height: 13px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(69, 26, 3, 0.32));
}

/* Central Full-Height Stage Board for § 2 (Hard Gate H16) */
.sec2-podium-zone.sec6-stage-center-zone {
  position: absolute;
  top: 21%;
  bottom: 3.5%;
  left: 50%;
  transform: translateX(-50%);
  width: 55%;
  height: auto;
  z-index: 5;
  display: flex;
  flex-direction: column;
}

.sec2-stage-board {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
  padding: 7px 9px;
  box-sizing: border-box;
}

.sec2-board-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(254, 243, 199, 0.55) 100%);
  border: 1.5px solid rgba(217, 119, 6, 0.35);
  border-radius: 13px;
  padding: 6px 8px;
  box-sizing: border-box;
}

html[data-theme="dark"] .sec2-board-body {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.90) 100%);
  border-color: rgba(245, 158, 11, 0.45);
}

.sec2-podium-steps-row {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  margin-bottom: 0;
  width: 100%;
  height: 100%;
}

.sec2-step1-showcase {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 10px;
  width: 100%;
  height: 100%;
  align-items: stretch;
}

.sec2-step-column.is-hero-step1,
.sec2-step1-law-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 12px;
  background: #FFFFFF;
  border: 2px solid #F59E0B;
  box-shadow: 0 3px 8px rgba(180, 83, 9, 0.10);
}

.sec2-step1-law-card {
  border-color: #2563EB;
  background: linear-gradient(180deg, #FFFFFF 0%, #EFF6FF 100%);
}

html[data-theme="dark"] .sec2-step-column.is-hero-step1 {
  background: rgba(30, 41, 59, 0.95);
  border-color: #FBBF24;
}

html[data-theme="dark"] .sec2-step1-law-card {
  background: linear-gradient(180deg, rgba(30, 58, 138, 0.45) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-color: #60A5FA;
}

.sec2-step1-giant-one {
  font-family: var(--font-heading);
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
  color: #1D4ED8;
  text-shadow: 0 2px 0 rgba(30, 58, 138, 0.15);
}

html[data-theme="dark"] .sec2-step1-giant-one {
  color: #93C5FD;
}

.sec2-step-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  animation: sec1ApplePopIn 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.sec2-col-top-chip {
  font-family: var(--font-heading);
  font-size: 11.5px;
  font-weight: 900;
  padding: 1px 7px;
  margin-bottom: 4px;
  border-radius: 999px;
  background: #FEF3C7;
  border: 1.5px solid #D97706;
  color: #92400E;
  white-space: nowrap;
}

html[data-theme="dark"] .sec2-col-top-chip {
  background: rgba(245, 158, 11, 0.22);
  border-color: #FBBF24;
  color: #FDE047;
}

.sec2-hop-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: center;
  gap: 2px;
  animation: sec2HopBounce 1.5s ease-in-out infinite;
}

.sec2-hop-arc-badge {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  border: 2px solid #D97706;
  color: #92400E;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(180, 83, 9, 0.2);
}

html[data-theme="dark"] .sec2-hop-arc-badge {
  background: rgba(245, 158, 11, 0.28);
  border-color: #FBBF24;
  color: #FEF08A;
}

.sec2-hop-arc-arrow {
  font-size: 20px;
  font-weight: 900;
  color: #D97706;
  line-height: 1;
}

@keyframes sec2HopBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.07); }
}

.sec2-step-apples-stack {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: -3px;
  z-index: 3;
}

.sec2-stack-stone-img {
  width: 48px;
  height: 22px;
  object-fit: contain;
  margin-top: -6px;
  filter: drop-shadow(0 2px 4px rgba(69, 26, 3, 0.34));
}

.sec2-stack-stone-img.is-large {
  width: 82px;
  height: 38px;
  margin-top: 0;
}

.sec2-stack-stone-img.is-medium {
  width: 58px;
  height: 26px;
  margin-top: -6px;
}

.sec2-stack-stone-img.is-added-unit {
  filter: drop-shadow(0 0 7px rgba(251, 113, 133, 0.85)) drop-shadow(0 3px 5px rgba(69, 26, 3, 0.4));
  transform: scale(1.05);
}

/* Живописная каменная плита основания ступени на тропинке */
.sec2-painted-slab-base {
  position: relative;
  width: 72px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.sec2-podium-steps-row[data-sec2-mode="1"] .sec2-painted-slab-base {
  width: 108px;
  height: 40px;
}

.sec2-podium-steps-row[data-sec2-mode="2"] .sec2-painted-slab-base {
  width: 76px;
  height: 34px;
}

.sec2-slab-base-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  filter: drop-shadow(0 4px 6px rgba(69, 26, 3, 0.32));
}

.sec2-painted-slab-base.is-highlighted .sec2-slab-base-img {
  filter: drop-shadow(0 0 9px rgba(245, 158, 11, 0.75)) drop-shadow(0 4px 6px rgba(69, 26, 3, 0.36));
}

.sec2-slab-num-badge {
  position: relative;
  z-index: 3;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 11px;
  background: radial-gradient(circle at 32% 30%, #F59E0B 0%, #B45309 75%, #78350F 100%);
  border: 1.8px solid #FEF3C7;
  box-shadow: 0 2px 5px rgba(69, 26, 3, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 13.5px;
  font-weight: 900;
  color: #FFFBEB;
  margin-top: 2px;
}

.sec2-painted-slab-base.is-highlighted .sec2-slab-num-badge {
  background: radial-gradient(circle at 32% 30%, #DC2626 0%, #991B1B 80%, #7F1D1D 100%);
  transform: scale(1.08);
}

.sec2-mini-stones-stack {
  position: absolute;
  bottom: 9px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  z-index: 2;
}

.sec2-mini-stone-img {
  width: 28px;
  height: 13px;
  object-fit: contain;
  margin-top: -4px;
  filter: drop-shadow(0 1px 2px rgba(69, 26, 3, 0.32));
}

.sec2-mini-slab-img {
  width: 84%;
  max-width: 84px;
  height: 21px;
  object-fit: fill;
}

.sec2-bridge-stone {
  width: 20px;
  height: 14px;
  object-fit: contain;
}

.sec2-pill-stone-icon {
  width: 24px;
  height: 18px;
  object-fit: contain;
  margin: 0 -2px;
}

/* Standardized 560x640 Actors on Left & Right Stage Flanks (Hard Gate H15) */
.sec2-danya-actor {
  left: 1%;
  bottom: 6px;
  height: 67%;
  max-width: 22%;
  object-fit: contain;
  z-index: 6;
}

.sec2-tamba-actor {
  right: 1%;
  bottom: 6px;
  height: 68%;
  max-width: 22%;
  object-fit: contain;
  z-index: 6;
}

.sec2-step-column.is-step2-card {
  flex: 1 1 0;
  height: 100%;
  justify-content: space-between;
  padding: 5px 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid rgba(217, 119, 6, 0.45);
  box-sizing: border-box;
}

html[data-theme="dark"] .sec2-step-column.is-step2-card {
  background: rgba(30, 41, 59, 0.88);
  border-color: rgba(251, 191, 36, 0.45);
}

/* Mode 3: Comparison 3 vs 5 */
.sec2-step-column.is-compare-col {
  flex: 1 1 0;
  justify-content: space-between;
  height: 100%;
  padding: 4px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid rgba(217, 119, 6, 0.45);
  box-sizing: border-box;
}

html[data-theme="dark"] .sec2-step-column.is-compare-col {
  background: rgba(30, 41, 59, 0.88);
  border-color: rgba(251, 191, 36, 0.45);
}

.sec2-compare-sub-pill {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 8px;
  background: #FEF3C7;
  border: 1.5px solid #F59E0B;
  color: #78350F;
  white-space: nowrap;
}

.sec2-compare-sub-pill.is-greater {
  background: #FFE4E6;
  border-color: #E11D48;
  color: #9F1239;
}

html[data-theme="dark"] .sec2-compare-sub-pill {
  background: rgba(245, 158, 11, 0.22);
  border-color: #FBBF24;
  color: #FEF08A;
}

html[data-theme="dark"] .sec2-compare-sub-pill.is-greater {
  background: rgba(244, 63, 94, 0.25);
  border-color: #FB7185;
  color: #FDA4AF;
}

.sec2-compare-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: center;
  padding: 0 4px;
  animation: sec2HopBounce 1.5s ease-in-out infinite;
}

.sec2-compare-badge {
  background: #FFE4E6;
  border: 2px solid #E11D48;
  border-radius: 999px;
  padding: 3px 10px;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 900;
  color: #9F1239;
  white-space: nowrap;
  box-shadow: 0 3px 6px rgba(190, 18, 60, 0.2);
}

html[data-theme="dark"] .sec2-compare-badge {
  background: rgba(244, 63, 94, 0.28);
  border-color: #FB7185;
  color: #FFE4E6;
}

.sec2-compare-hop-icon {
  font-size: 22px;
  font-weight: 900;
  color: #E11D48;
  line-height: 1;
}

/* Mode 4: Infinite Trail 1..7 → ∞ */
.sec2-mode4-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
}

.sec2-mode4-top-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 10px;
  background: #FEF3C7;
  border: 1.5px solid #D97706;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 800;
  color: #78350F;
  white-space: nowrap;
}

html[data-theme="dark"] .sec2-mode4-top-banner {
  background: rgba(245, 158, 11, 0.22);
  border-color: #FBBF24;
  color: #FEF08A;
}

.sec2-mode4-hops {
  font-weight: 900;
  color: #B45309;
}

html[data-theme="dark"] .sec2-mode4-hops {
  color: #FDE047;
}

.sec2-podium-steps-row[data-sec2-mode="4"] {
  gap: 4px;
  align-items: flex-end;
  padding-bottom: 2px;
  flex: 1;
}

.sec2-podium-steps-row[data-sec2-mode="4"] .sec2-painted-slab-base {
  width: 38px;
  height: 24px;
}

.sec2-podium-steps-row[data-sec2-mode="4"] .sec2-slab-num-badge {
  min-width: 19px;
  height: 19px;
  padding: 0 3px;
  font-size: 12px;
  margin-top: 1px;
}

.sec2-podium-steps-row[data-sec2-mode="4"] .sec2-stack-stone-img {
  width: 32px;
  height: 14px;
  margin-top: -4px;
}

.sec2-infinity-portal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: center;
  padding: 6px 8px;
  border-radius: 12px;
  background: linear-gradient(180deg, #EFF6FF 0%, #DBEAFE 100%);
  border: 2px solid #2563EB;
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.18);
  animation: sec2HopBounce 1.6s ease-in-out infinite;
}

html[data-theme="dark"] .sec2-infinity-portal {
  background: linear-gradient(180deg, rgba(30, 58, 138, 0.55) 0%, rgba(23, 37, 84, 0.9) 100%);
  border-color: #60A5FA;
}

.sec2-inf-plus {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 900;
  color: #D97706;
}

html[data-theme="dark"] .sec2-inf-plus {
  color: #FDE047;
}

.sec2-inf-symbol {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 900;
  color: #1D4ED8;
  white-space: nowrap;
}

html[data-theme="dark"] .sec2-inf-symbol {
  color: #93C5FD;
}

/* ============================================================================
   ЭТАЛОННЫЙ ИНТЕРАКТИВНЫЙ ЭКРАН § 3 («Счёт»)
   (Единый эталонный шрифт § 1 + нативные BF16-спрайты Алисы c32_alisa, филина Аккура c09_akkur и 8 дубовых парт в классе)
   ============================================================================ */
.sec3-storybook-stage {
  background-image: url("https://cdn.mathka.org/assets/sec3_visioneer/sec3_anim_backdrop_winner.png?v=92");
  background-position: center bottom;
}

.sec3-alisa-actor {
  left: 1%;
  bottom: 6px;
  height: 68%;
  max-width: 24%;
  object-fit: contain;
  object-position: left bottom;
}

.sec3-akkur-actor {
  right: 0.8%;
  bottom: 8px;
  height: 62%;
  max-width: 25%;
  object-fit: contain;
  object-position: right bottom;
}

.sec3-classroom-zone {
  left: 49.5%;
  width: 47%;
  height: 64%;
  bottom: 10%;
}

.sec3-desks-grid {
  position: absolute;
  bottom: 22%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 4;
}

.sec3-desks-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
}

.sec3-desks-back-row {
  transform: scale(0.91);
  transform-origin: center bottom;
}

.sec3-desk-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: sec3DeskCellAppear 0.48s cubic-bezier(0.22, 1.28, 0.36, 1);
}

.sec3-desk-sprite-img {
  width: 64px;
  height: 55px;
  object-fit: contain;
  filter: drop-shadow(0 5px 8px rgba(69, 26, 3, 0.3));
  transition: transform 0.2s ease, filter 0.2s ease;
}

.sec3-desk-cell.is-final-eight .sec3-desk-sprite-img {
  filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.72)) drop-shadow(0 5px 8px rgba(69, 26, 3, 0.34));
  transform: translateY(-2px) scale(1.05);
}

.sec3-desk-num-badge {
  position: relative;
  margin-bottom: -8px;
  z-index: 3;
  min-width: 27px;
  height: 27px;
  padding: 0 6px;
  border-radius: 999px;
  background: radial-gradient(circle at 32% 30%, #F59E0B 0%, #B45309 78%, #78350F 100%);
  border: 2px solid #FFFBEB;
  box-shadow: 0 3px 7px rgba(69, 26, 3, 0.36);
  color: #FFFFFF;
  font-family: var(--font-heading);
  font-size: 14.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  animation: sec3BadgePopIn 0.48s cubic-bezier(0.22, 1.35, 0.36, 1);
}

.sec3-desk-num-badge.is-eight-winner {
  background: radial-gradient(circle at 32% 30%, #DC2626 0%, #991B1B 80%, #7F1D1D 100%);
  border-color: #FEF08A;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.45), 0 4px 10px rgba(127, 29, 29, 0.45);
  transform: scale(1.12);
}

.sec3-desk-check-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #10B981;
  color: #FFFFFF;
  font-size: 10.5px;
  font-weight: 900;
  margin-left: 1px;
}

@keyframes sec3DeskCellAppear {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  45% {
    opacity: 1;
    transform: translateY(-4px) scale(1.06);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sec3BadgePopIn {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  45% {
    opacity: 1;
    transform: translateY(-3px) scale(1.22);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sec3-mini-desks-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 4px;
}

.sec3-mini-desk-img {
  width: 38px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(69, 26, 3, 0.25));
}

.sec3-mini-mode-chip {
  font-family: var(--font-heading);
  font-size: 13.5px;
  font-weight: 800;
  color: #78350F;
  background: rgba(254, 243, 199, 0.92);
  border: 1.5px solid rgba(180, 83, 9, 0.35);
  border-radius: 8px;
  padding: 2px 6px;
  white-space: nowrap;
}

.sec3-step-bridge-eq {
  position: absolute;
  right: -13px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(180deg, #FDE68A 0%, #F59E0B 100%);
  border: 1.5px solid #92400E;
  color: #78350F;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8;
  box-shadow: 0 2px 5px rgba(69, 26, 3, 0.22);
}

.sec3-total-medallion {
  font-size: 16.5px;
  padding: 0 18px;
  min-width: 220px;
  white-space: nowrap;
}

.sec3-pill-desk-icon {
  width: 24px;
  height: 20px;
  object-fit: contain;
}

/* ============================================================================
   СТАРТОВЫЙ ЭКРАН ИНТЕРАКТИВНОГО ВЕБ-ПРИЛОЖЕНИЯ («Арифметика для детей» / «Arithmetic for Kids»)
   ============================================================================ */
.landing-hero-header {
  margin: 4px 0 14px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.landing-en-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  margin-bottom: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.96) 0%, rgba(253, 230, 138, 0.92) 100%);
  border: 1.5px solid rgba(180, 83, 9, 0.36);
  color: #92400E;
  font-family: var(--font-heading);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

[data-theme="dark"] .landing-en-badge {
  background: rgba(120, 53, 15, 0.38);
  border-color: rgba(245, 158, 11, 0.45);
  color: #FDE68A;
}

.landing-hero-title {
  font-family: var(--font-heading);
  font-size: 38px !important;
  font-weight: 800;
  line-height: 1.15 !important;
  letter-spacing: 0.008em;
  margin: 0 !important;
  padding-bottom: 0 !important;
  border-bottom: none !important;
  color: var(--ink-primary) !important;
}

[data-theme="dark"] .landing-hero-title {
  color: #FFFBEB !important;
}

.landing-primary-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.landing-start-btn {
  flex: 1 1 280px;
  min-height: 50px;
  padding: 0 22px;
  border-radius: 14px;
  border: 2px solid #92400E;
  background: linear-gradient(180deg, #F59E0B 0%, #D97706 55%, #B45309 100%);
  color: #FFFFFF;
  font-family: var(--font-heading);
  font-size: 17.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(180, 83, 9, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.landing-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 9px 18px rgba(180, 83, 9, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.landing-catalog-btn {
  min-height: 50px;
  padding: 0 18px;
  border-radius: 14px;
  border: 2px solid rgba(180, 83, 9, 0.36);
  background: linear-gradient(180deg, #FFFDF7 0%, #FEF3C7 100%);
  color: #78350F;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.landing-catalog-btn:hover {
  transform: translateY(-1px);
  border-color: #B45309;
}

[data-theme="dark"] .landing-catalog-btn {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(245, 158, 11, 0.45);
  color: #FDE68A;
}

.landing-navigator-header {
  padding: 4px 2px 12px;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.landing-navigator-top-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.landing-card-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-size: 12.5px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.landing-navigator-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.24;
  margin: 0;
}

.landing-quick-filter-box {
  flex: 0 1 255px;
  min-width: 210px;
}

.landing-quick-filter-input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border-radius: 10px;
  border: 1.5px solid var(--border-strong);
  background-color: var(--bg-elevated);
  background-image: url("assets/icons/light/icon_search.svg");
  background-repeat: no-repeat;
  background-position: 10px center;
  background-size: 16px 16px;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 700;
}

[data-theme="dark"] .landing-quick-filter-input {
  background-image: url("assets/icons/dark/icon_search.svg");
}

.landing-quick-filter-input:focus {
  outline: none;
  border-color: var(--accent);
}

.landing-div-filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.landing-div-filter-pill {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--ink-secondary);
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.landing-div-filter-pill:hover {
  border-color: var(--pill-accent, var(--accent));
  color: var(--ink);
}

.landing-div-filter-pill.active {
  background: var(--pill-accent, var(--accent));
  border-color: var(--pill-accent, var(--accent));
  color: #FFFFFF;
}

.landing-instant-results {
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 12px;
  border: 1.5px solid var(--accent);
  background: var(--bg-elevated);
}

.landing-instant-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.landing-instant-hit {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-sheet);
  color: var(--ink);
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.landing-instant-hit:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.landing-instant-hit-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.landing-instant-hit-portrait {
  width: 34px;
  height: 42px;
  object-fit: contain;
  object-position: bottom center;
  flex-shrink: 0;
  background: transparent;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.22));
}

.landing-instant-empty {
  font-size: 13.5px;
  color: var(--ink-secondary);
  padding: 4px 6px;
}

.landing-divisions-grid.is-single-div {
  grid-template-columns: minmax(0, 1fr);
}

.landing-div-roman-btn {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.landing-div-top-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.landing-div-all-link {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  white-space: nowrap;
  flex-shrink: 0;
}

.landing-div-all-link:hover {
  text-decoration: underline;
}

.landing-div-title-btn {
  border: none;
  background: none;
  padding: 0;
  text-align: left;
  font-family: var(--font-heading);
  font-size: 15.5px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.24;
  cursor: pointer;
}

.landing-div-title-btn:hover {
  color: var(--accent);
}

.landing-featured-lessons-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.landing-featured-lesson-card {
  text-align: left;
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.55) 0%, var(--bg-sheet) 100%);
  border: 1.5px solid var(--amber-border);
  border-radius: 13px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.landing-featured-lesson-card:hover {
  transform: translateY(-2px);
  border-color: #D97706;
  box-shadow: 0 6px 16px rgba(180, 83, 9, 0.14);
}

[data-theme="dark"] .landing-featured-lesson-card {
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.28) 0%, rgba(30, 41, 59, 0.92) 100%);
  border-color: rgba(245, 158, 11, 0.45);
}

.landing-featured-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.landing-featured-badge {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 900;
  color: #FFFFFF;
  background: linear-gradient(180deg, #F59E0B 0%, #B45309 100%);
  padding: 2px 9px;
  border-radius: 999px;
}

.landing-featured-unit-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  margin-left: auto;
}

.landing-featured-actor-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.2));
}

.landing-featured-title {
  font-family: var(--font-heading);
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.24;
}

.landing-featured-sub {
  font-family: var(--font-book);
  font-size: 12.5px;
  color: var(--ink-secondary);
  line-height: 1.32;
}

.landing-featured-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 800;
  color: var(--amber-ink);
  letter-spacing: 0.02em;
}

[data-theme="dark"] .landing-featured-cta {
  color: #FDE047;
}

.landing-divisions-card {
  padding: 18px 20px 20px;
  border-radius: 18px;
  border: 2px solid var(--border-strong);
  background: var(--bg-sheet);
  box-shadow: var(--shadow-card);
}

.landing-divisions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.landing-div-card {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-top: 4px solid var(--div-accent, #D97706);
  border-radius: 13px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.landing-div-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: nowrap;
}

.landing-div-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex-wrap: nowrap;
}

.landing-div-roman {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 800;
  color: #FFFFFF;
  background: var(--div-accent, #D97706);
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.landing-div-range {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-secondary);
  white-space: nowrap;
}

.landing-div-avatar {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.18));
}

.landing-div-title {
  font-family: var(--font-heading);
  font-size: 15.5px;
  font-weight: 800;
  color: var(--ink-primary);
  line-height: 1.24;
}

.landing-div-desc {
  font-family: var(--font-book);
  font-size: 13px;
  line-height: 1.38;
  color: var(--ink-secondary);
}

.landing-div-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
}

.landing-sec-chip {
  border: 1px solid rgba(180, 83, 9, 0.3);
  background: rgba(254, 243, 199, 0.65);
  color: #78350F;
  font-family: var(--font-heading);
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.landing-sec-chip:hover {
  background: #FDE68A;
  transform: translateY(-1px);
}

[data-theme="dark"] .landing-sec-chip {
  background: rgba(120, 53, 15, 0.35);
  border-color: rgba(245, 158, 11, 0.4);
  color: #FDE68A;
}

.landing-primes-banner {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(180, 83, 9, 0.35);
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.7) 0%, rgba(255, 251, 235, 0.9) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

[data-theme="dark"] .landing-primes-banner {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(245, 158, 11, 0.4);
}

.landing-primes-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--ink-secondary);
}

.landing-primes-info strong {
  font-family: var(--font-heading);
  font-size: 15px;
  color: var(--ink-primary);
}

.landing-primes-btn {
  padding: 6px 14px;
  border-radius: 9px;
  border: 1.5px solid #B45309;
  background: linear-gradient(180deg, #F59E0B 0%, #D97706 100%);
  color: #FFFFFF;
  font-family: var(--font-heading);
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
}

/* ============================================================================
   СИСТЕМА ИКОНОК ДЛЯ СВЕТЛОЙ И ТЁМНОЙ ТЕМЫ (Light & Dark Theme Icon Suite)
   ============================================================================ */
.theme-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  user-select: none;
  pointer-events: none;
}

.btn-theme-icon {
  width: 18px;
  height: 18px;
}

.arrow-theme-icon {
  width: 19px;
  height: 19px;
}

.badge-theme-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
}

.div-theme-icon {
  width: 24px;
  height: 24px;
}

.pill-theme-icon {
  width: 17px;
  height: 17px;
}

.primary-nav-btn,
.landing-catalog-btn,
.cat-div-pill,
.catalog-division-heading {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.search-wrap input {
  background-image: url("assets/icons/light/icon_search.svg") !important;
  background-repeat: no-repeat !important;
  background-position: 12px center !important;
  background-size: 17px 17px !important;
}

[data-theme="dark"] .search-wrap input {
  background-image: url("assets/icons/dark/icon_search.svg") !important;
}

[data-theme="dark"] .book-mark {
  background: linear-gradient(145deg, #1E293B 0%, #0F172A 100%);
  color: #FDE047;
  border-color: #F59E0B;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.28), inset 0 1px 0 rgba(254, 240, 138, 0.35);
}

[data-theme="dark"] .sec1-interactive-visual-stage {
  background: #0F172A;
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.55);
}

[data-theme="dark"] .sec1-painted-step-card {
  background: rgba(15, 23, 42, 0.88);
  border-color: rgba(245, 158, 11, 0.42);
}

[data-theme="dark"] .sec1-painted-step-card.is-active {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.96) 0%, rgba(69, 26, 3, 0.88) 100%);
  border-color: #F59E0B;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.32), inset 0 0 0 1px rgba(254, 240, 138, 0.35);
}

[data-theme="dark"] .sec3-mini-mode-chip {
  background: rgba(30, 41, 59, 0.94);
  border-color: rgba(245, 158, 11, 0.45);
  color: #FEF3C7;
}

[data-theme="dark"] .sec1-icon-pill {
  background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
  border-color: rgba(245, 158, 11, 0.38);
  color: #F8FAFC;
}

[data-theme="dark"] .sec1-icon-pill.active,
[data-theme="dark"] .sec1-icon-pill.is-active {
  background: linear-gradient(180deg, rgba(120, 53, 15, 0.85) 0%, rgba(69, 26, 3, 0.92) 100%);
  border-color: #FBBF24;
  color: #FEF08A;
}

/* ============================================================================
   ИНКЛЮЗИВНЫЙ UX ДЛЯ ДЕТЕЙ И БАБУШЕК/ДЕДУШЕК (Kids & Grandparents UX)
   ============================================================================ */

/* 1. Режим крупного шрифта (data-font-size="large") */
html[data-font-size="large"] {
  --font-scale: 1.18;
}

html[data-font-size="large"] .sec1-large-text,
html[data-font-size="large"] .lesson-text-block,
html[data-font-size="large"] .landing-intro-text {
  font-size: 24.5px !important;
  line-height: 1.76 !important;
}

html[data-font-size="large"] .sec1-large-title,
html[data-font-size="large"] .landing-hero-title,
html[data-font-size="large"] .catalog-main-title {
  font-size: 34px !important;
}

html[data-font-size="large"] .sheet-meta {
  font-size: 16px !important;
}

html[data-font-size="large"] .sec1-key-term,
html[data-font-size="large"] .sec1-key-rule {
  font-size: 1.05em !important;
  padding: 4px 10px !important;
}

html[data-font-size="large"] .nav-btn,
html[data-font-size="large"] .primary-nav-btn {
  font-size: 16.5px !important;
  height: 48px !important;
  padding: 0 16px !important;
}

html[data-font-size="large"] .footer-btn-text {
  font-size: 18px !important;
}

html[data-font-size="large"] .sec1-companion-speech,
html[data-font-size="large"] .sec1-companion-bubble p {
  font-size: 23.5px !important;
  line-height: 1.56 !important;
}

html[data-font-size="large"] .companion-speaker-name {
  font-size: 19px !important;
}

html[data-font-size="large"] .companion-step-badge,
html[data-font-size="large"] .sec1-step-counter-badge {
  font-size: 17.5px !important;
  padding: 5px 16px !important;
}

html[data-font-size="large"] .catalog-sec-grid {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
}

html[data-font-size="large"] .catalog-sec-card {
  grid-template-columns: minmax(0, 1fr) 108px !important;
  min-height: 138px !important;
}

html[data-font-size="large"] .catalog-sec-title {
  font-size: 18.5px !important;
  line-height: 1.38 !important;
}

html[data-font-size="large"] .catalog-sec-cue {
  font-size: 14px !important;
}

html[data-font-size="large"] .catalog-sec-num {
  font-size: 16.5px !important;
}

html[data-font-size="large"] .catalog-sec-portrait-wrap {
  width: 108px !important;
}

html[data-font-size="large"] .catalog-sec-portrait {
  width: 104px !important;
  height: 130px !important;
}

/* 2. Кнопка переключения шрифта в шапке (.font-size-toggle-btn) */
.font-size-toggle-btn {
  background: var(--bg-elevated);
}

.font-size-toggle-btn.is-large-active {
  background: var(--amber-soft);
  border-color: #D97706;
  color: var(--amber-ink);
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.2);
}

/* 3. Говорящий персонаж-наставник над интерактивной сценой (.sec1-companion-helper) */
.sec1-companion-helper {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 2.5px solid #F59E0B;
  border-left: 7px solid #D97706;
  border-radius: 18px;
  padding: 15px 20px;
  margin-bottom: 14px;
  box-shadow: 0 6px 18px rgba(180, 83, 9, 0.11), inset 0 1px 0 rgba(255, 255, 255, 0.78);
  position: relative;
  transition: all 0.2s ease;
}

[data-theme="dark"] .sec1-companion-helper {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16) 0%, rgba(30, 41, 59, 0.96) 100%);
  border-color: rgba(245, 158, 11, 0.55);
  border-left-color: #F59E0B;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.companion-avatar-wrap {
  width: 108px;
  height: 108px;
  min-width: 108px;
  max-width: 108px;
  flex-shrink: 0;
  border-radius: 0 !important;
  background: transparent !important;
  border: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible !important;
  box-shadow: none !important;
}

[data-theme="dark"] .companion-avatar-wrap {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.companion-avatar-icon,
.sec1-companion-avatar,
img.sec1-companion-avatar {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  object-position: center center !important;
  transform: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  border: none !important;
  filter: drop-shadow(0 5px 12px rgba(180, 83, 9, 0.24)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.14));
}

[data-theme="dark"] .companion-avatar-icon,
[data-theme="dark"] .sec1-companion-avatar,
[data-theme="dark"] img.sec1-companion-avatar {
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.65)) drop-shadow(0 2px 6px rgba(245, 158, 11, 0.35));
}

.companion-content-wrap,
.sec1-companion-bubble {
  flex: 1;
  min-width: 0;
}

.companion-speaker-row,
.sec1-companion-header-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.companion-speaker-name {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  color: #9A3412;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  line-height: 1.2;
}

[data-theme="dark"] .companion-speaker-name {
  color: #FDE047;
}

.companion-step-badge,
.sec1-step-counter-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 800;
  background: #FEF08A;
  color: #78350F;
  border: 2px solid #F59E0B;
  border-radius: 999px;
  padding: 5px 15px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(180, 83, 9, 0.12);
}

[data-theme="dark"] .companion-step-badge,
[data-theme="dark"] .sec1-step-counter-badge {
  background: rgba(245, 158, 11, 0.24);
  color: #FEF08A;
  border-color: rgba(251, 191, 36, 0.55);
}

.sec1-companion-speech,
.sec1-companion-bubble p {
  margin: 0;
  font-family: var(--font-book);
  font-size: 21.5px;
  line-height: 1.48;
  letter-spacing: 0.015em;
  color: var(--ink-strong);
  font-weight: 700;
}

/* 4. Крупные тактильные кнопки перехода по шагам (.sec1-stepper-btn) */
.sec1-stepper-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 16px;
  border-radius: 14px;
  border: 2px solid var(--border-strong);
  background: var(--bg-elevated);
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.sec1-stepper-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  background: var(--amber-soft);
  border-color: #D97706;
  color: var(--amber-ink);
  box-shadow: 0 6px 14px rgba(217, 119, 6, 0.2);
}

.sec1-stepper-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.sec1-stepper-next {
  background: linear-gradient(180deg, #FFFBEB 0%, #FEF3C7 100%);
  border-color: #D97706;
  color: #78350F;
}

[data-theme="dark"] .sec1-stepper-btn {
  background: #1E293B;
  border-color: var(--border-strong);
  color: #F1F5F9;
}

[data-theme="dark"] .sec1-stepper-next {
  background: linear-gradient(180deg, rgba(120, 53, 15, 0.7) 0%, rgba(69, 26, 3, 0.8) 100%);
  border-color: #F59E0B;
  color: #FEF3C7;
}

/* 5. Карточка совместного семейного чтения на главном экране */
.landing-family-welcome-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: linear-gradient(135deg, #FEF3C7 0%, #FFFBEB 100%);
  border: 2px solid #F59E0B;
  border-radius: 16px;
  padding: 14px 18px;
  margin: 14px 0 16px;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.14);
}

[data-theme="dark"] .landing-family-welcome-card {
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.4) 0%, rgba(30, 41, 59, 0.85) 100%);
  border-color: rgba(245, 158, 11, 0.55);
}

.family-welcome-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}

.family-welcome-badge {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 800;
  color: #92400E;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}

[data-theme="dark"] .family-welcome-badge {
  color: #FDE047;
}

.family-welcome-text {
  font-family: var(--font-book);
  font-size: 16.5px;
  line-height: 1.5;
  color: var(--ink-strong);
}

/* 6. Блок «Как устроен урок» (3 простых шага для ребенка и старших) */
.landing-how-it-works-card {
  background: var(--bg-elevated);
  border: 2px solid var(--border-strong);
  border-radius: 16px;
  padding: 14px 18px;
  margin: 14px 0;
}

.how-it-works-title {
  font-family: var(--font-heading);
  font-size: 16.5px;
  font-weight: 800;
  color: var(--ink-strong);
  margin-bottom: 10px;
}

.how-it-works-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.how-step-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.how-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #FFFFFF;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.how-step-desc {
  font-family: var(--font-book);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
}

/* 7. Полка быстрого старта в каталоге (.catalog-quick-start-shelf) */
.catalog-quick-start-shelf {
  background: linear-gradient(135deg, #FEF3C7 0%, #FFFDF8 100%);
  border: 2px solid #D97706;
  border-radius: 18px;
  padding: 18px 22px;
  margin-bottom: 24px;
  box-shadow: 0 6px 20px rgba(180, 83, 9, 0.1);
}

[data-theme="dark"] .catalog-quick-start-shelf {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-color: rgba(245, 158, 11, 0.55);
}

.quick-start-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.quick-start-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  color: #78350F;
  display: flex;
  align-items: center;
  gap: 8px;
}

[data-theme="dark"] .quick-start-title {
  color: #FDE047;
}

.quick-start-sub {
  font-family: var(--font-book);
  font-size: 15px;
  color: var(--ink-secondary);
}

.quick-start-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.quick-start-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 2px solid var(--border-strong);
  border-radius: 14px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.quick-start-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
}

.quick-start-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.quick-start-badge {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 800;
  background: var(--amber-soft);
  color: var(--amber-ink);
  padding: 2px 10px;
  border-radius: 8px;
  border: 1px solid var(--amber-border);
}

.quick-start-actor-thumb {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.quick-start-portrait-thumb {
  width: 58px;
  height: 72px;
  margin: -6px -4px -8px 0;
  filter: drop-shadow(0 3px 7px rgba(15, 23, 42, 0.22));
}

.quick-start-card-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 4px;
}

.quick-start-card-sub {
  font-family: var(--font-book);
  font-size: 14.5px;
  color: var(--ink-muted);
  line-height: 1.35;
  margin-bottom: 12px;
  flex: 1;
}

.quick-start-card-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent);
  color: #FFFFFF;
  font-family: var(--font-heading);
  font-size: 14.5px;
  font-weight: 700;
}

/* ============================================================================
   ЭТАЛОННЫЙ ИНТЕРАКТИВНЫЙ ЭКРАН § 4 («Названия чисел до тысячи»)
   (Единый эталонный шрифт § 1 + нативные v2.0 спрайты Хомячка Буси c08_monya и Мастера Несто c11_nesto)
   ============================================================================ */
.sec4-strokes-diagram {
  background: linear-gradient(180deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 2.5px solid #D97706;
  border-radius: 16px;
  padding: 13px 14px 13px;
  margin: 10px 0 18px;
  box-shadow: 0 8px 20px rgba(180, 83, 9, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.sec4-strokes-diagram:hover {
  transform: translateY(-2px);
  border-color: #B45309;
  box-shadow: 0 12px 26px rgba(180, 83, 9, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .sec4-strokes-diagram {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.98) 0%, rgba(15, 23, 42, 0.98) 100%);
  border-color: #F59E0B;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(251, 191, 36, 0.2);
}

.sec4-strokes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 7px;
  border-bottom: 1.5px dashed rgba(180, 83, 9, 0.35);
}

[data-theme="dark"] .sec4-strokes-header {
  border-bottom-color: rgba(245, 158, 11, 0.35);
}

.sec4-strokes-header-title {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #92400E;
  white-space: nowrap;
}

[data-theme="dark"] .sec4-strokes-header-title {
  color: #FDE68A;
}

.sec4-strokes-header-hint {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  color: #B45309;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(217, 119, 6, 0.45);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
  flex-shrink: 0;
}

[data-theme="dark"] .sec4-strokes-header-hint {
  color: #FBBF24;
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(245, 158, 11, 0.45);
}

.sec4-strokes-groups-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.sec4-stroke-bundle {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
  border: 2px solid #D97706;
  border-radius: 13px;
  padding: 7px 5px 8px;
  min-width: 0;
  box-shadow: 0 4px 10px rgba(146, 64, 14, 0.1);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.sec4-stroke-bundle:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(146, 64, 14, 0.18);
}

[data-theme="dark"] .sec4-stroke-bundle {
  background: #0F172A;
  border-color: rgba(245, 158, 11, 0.65);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.sec4-stroke-bundle.is-remainder {
  flex: 0 0 74px;
  background: #FFF5F5;
  border: 2px dashed #DC2626;
}

[data-theme="dark"] .sec4-stroke-bundle.is-remainder {
  background: rgba(69, 10, 10, 0.42);
  border-color: #F87171;
}

.sec4-stroke-top-tag {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 800;
  color: #92400E;
  background: #FEF3C7;
  border: 1px solid rgba(217, 119, 6, 0.45);
  border-radius: 999px;
  padding: 1px 7px;
  margin-bottom: 6px;
  white-space: nowrap;
}

[data-theme="dark"] .sec4-stroke-top-tag {
  color: #FDE68A;
  background: rgba(120, 53, 15, 0.55);
  border-color: rgba(251, 191, 36, 0.4);
}

.sec4-stroke-bundle.is-remainder .sec4-stroke-top-tag {
  color: #991B1B;
  background: #FEE2E2;
  border-color: rgba(220, 38, 38, 0.45);
}

[data-theme="dark"] .sec4-stroke-bundle.is-remainder .sec4-stroke-top-tag {
  color: #FECACA;
  background: rgba(153, 27, 27, 0.55);
  border-color: rgba(248, 113, 113, 0.45);
}

.sec4-stroke-ticks {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3.5px;
  height: 40px;
  width: 100%;
  padding: 2px 2px;
}

.sec4-stroke-tick {
  display: inline-block;
  width: 5px;
  height: 36px;
  border-radius: 3px;
  background: linear-gradient(180deg, #B45309 0%, #78350F 100%);
  border: 1px solid #451A03;
  box-shadow: inset 0 1px 0 rgba(253, 230, 138, 0.55), 0 2px 3px rgba(69, 26, 3, 0.22);
  flex-shrink: 0;
}

/* Визуальная пауза 5 + 5 внутри десятка, чтобы все 10 чёрточек легко считывались глазами */
.sec4-stroke-tick.is-fifth-split {
  margin-right: 4.5px;
}

[data-theme="dark"] .sec4-stroke-tick {
  background: linear-gradient(180deg, #FDE047 0%, #F59E0B 100%);
  border-color: #B45309;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65), 0 2px 4px rgba(0, 0, 0, 0.45);
}

.sec4-stroke-bundle.is-remainder .sec4-stroke-ticks {
  gap: 6px;
}

.sec4-stroke-bundle.is-remainder .sec4-stroke-tick {
  width: 6.5px;
  height: 36px;
  background: linear-gradient(180deg, #EF4444 0%, #B91C1C 100%);
  border-color: #7F1D1D;
  box-shadow: inset 0 1px 0 rgba(254, 202, 202, 0.65), 0 2px 3px rgba(127, 29, 29, 0.25);
}

[data-theme="dark"] .sec4-stroke-bundle.is-remainder .sec4-stroke-tick {
  background: linear-gradient(180deg, #FCA5A5 0%, #EF4444 100%);
  border-color: #991B1B;
}

.sec4-stroke-brace {
  width: 94%;
  height: 15px;
  color: #D97706;
  margin: 2px 0 3px;
  display: block;
  overflow: visible;
}

[data-theme="dark"] .sec4-stroke-brace {
  color: #FBBF24;
}

.sec4-stroke-bundle.is-remainder .sec4-stroke-brace {
  width: 82%;
  color: #DC2626;
}

[data-theme="dark"] .sec4-stroke-bundle.is-remainder .sec4-stroke-brace {
  color: #F87171;
}

.sec4-stroke-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 94%;
  box-sizing: border-box;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 800;
  color: #FFFFFF;
  background: linear-gradient(180deg, #D97706 0%, #B45309 100%);
  border: 1.5px solid #78350F;
  border-radius: 999px;
  padding: 2.5px 4px;
  box-shadow: 0 2px 5px rgba(120, 53, 15, 0.25);
  white-space: nowrap;
}

[data-theme="dark"] .sec4-stroke-label {
  color: #FFFBEB;
  background: linear-gradient(180deg, #D97706 0%, #92400E 100%);
  border-color: #FBBF24;
}

.sec4-stroke-bundle.is-remainder .sec4-stroke-label {
  background: linear-gradient(180deg, #EF4444 0%, #B91C1C 100%);
  border-color: #7F1D1D;
}

[data-theme="dark"] .sec4-stroke-bundle.is-remainder .sec4-stroke-label {
  background: linear-gradient(180deg, #DC2626 0%, #991B1B 100%);
  border-color: #FCA5A5;
}

.sec4-stroke-label-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 0 5px;
  font-size: 12.5px;
  font-weight: 900;
}

.sec4-strokes-summary-pill {
  margin-top: 11px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid rgba(217, 119, 6, 0.55);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  font-family: var(--font-book);
  font-size: 17px;
  color: var(--ink-strong);
  box-shadow: 0 2px 6px rgba(180, 83, 9, 0.1);
}

[data-theme="dark"] .sec4-strokes-summary-pill {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(245, 158, 11, 0.55);
  color: #F8FAFC;
}

.sec4-sum-formula-chip {
  font-family: var(--font-heading);
  font-size: 15.5px;
  font-weight: 800;
  color: #92400E;
  background: #FEF3C7;
  border: 1.5px solid #D97706;
  border-radius: 8px;
  padding: 2px 10px;
  white-space: nowrap;
}

[data-theme="dark"] .sec4-sum-formula-chip {
  color: #FEF08A;
  background: rgba(120, 53, 15, 0.65);
  border-color: #F59E0B;
}

.sec4-sum-verbal-box strong {
  color: #9A3412;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: rgba(217, 119, 6, 0.6);
  text-underline-offset: 3px;
}

[data-theme="dark"] .sec4-sum-verbal-box strong {
  color: #FDE047;
  text-decoration-color: rgba(251, 191, 36, 0.65);
}

.sec4-storybook-stage {
  background-image: url("https://cdn.mathka.org/assets/sec4_visioneer/sec4_anim_backdrop_winner.png?v=92");
  background-position: center bottom;
}

.sec4-wood-badge {
  width: auto !important;
  min-width: 32px;
  height: 30px;
  padding: 0 7px;
  border-radius: 15px;
  font-size: 14px !important;
  white-space: nowrap;
}

.sec4-busi-actor {
  left: 1.0%;
  bottom: 8px;
  height: 58%;
  max-width: 22.5%;
  object-fit: contain;
  object-position: left bottom;
}

.sec4-nesto-actor {
  right: 0.8%;
  bottom: 6px;
  height: 72%;
  max-width: 25%;
  object-fit: contain;
  object-position: right bottom;
}

.sec4-workbench-zone {
  left: 50%;
  width: 50%;
  height: 64%;
  bottom: 11%;
}

.sec4-stage-layout {
  position: absolute;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 4;
}

.sec4-rank-panel {
  background: rgba(255, 251, 235, 0.93);
  border: 2px solid rgba(180, 83, 9, 0.55);
  border-radius: 13px;
  padding: 6px 8px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 0 6px 14px rgba(69, 26, 3, 0.24);
  backdrop-filter: blur(3px);
}

[data-theme="dark"] .sec4-rank-panel {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(245, 158, 11, 0.55);
}

.sec4-rank-panel.is-highlight-panel {
  background: linear-gradient(180deg, #FFFBEB 0%, #FEF3C7 100%);
  border-color: #D97706;
  box-shadow: 0 0 0 2.5px rgba(251, 191, 36, 0.35), 0 6px 14px rgba(69, 26, 3, 0.28);
}

[data-theme="dark"] .sec4-rank-panel.is-highlight-panel {
  background: linear-gradient(180deg, rgba(69, 26, 3, 0.88) 0%, rgba(30, 41, 59, 0.94) 100%);
  border-color: #FBBF24;
}

.sec4-rank-title {
  font-family: var(--font-heading);
  font-size: 12.5px;
  font-weight: 800;
  color: #78350F;
  background: rgba(254, 243, 199, 0.98);
  border: 1.5px solid rgba(180, 83, 9, 0.48);
  border-radius: 999px;
  padding: 1.5px 8px;
  white-space: nowrap;
}

[data-theme="dark"] .sec4-rank-title {
  background: rgba(120, 53, 15, 0.72);
  color: #FEF08A;
  border-color: rgba(251, 191, 36, 0.55);
}

.sec4-pegs-grid-10 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px 5px;
  align-items: end;
}

.sec4-peg-item,
.sec4-bundle-item,
.sec4-casket-item,
.sec4-single-hero-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: sec3DeskCellAppear 0.45s cubic-bezier(0.22, 1.25, 0.36, 1);
}

.sec4-mini-num-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: radial-gradient(circle at 32% 30%, #F59E0B 0%, #B45309 78%, #78350F 100%);
  border: 1.5px solid #FFFBEB;
  color: #FFFFFF;
  font-family: var(--font-heading);
  font-size: 11.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: -3px;
  z-index: 2;
}

.sec4-mini-num-badge.is-ten-badge {
  background: radial-gradient(circle at 32% 30%, #DC2626 0%, #991B1B 80%);
}

.sec4-mini-num-badge.is-hundred-badge {
  font-size: 10px;
  min-width: 24px;
  height: 17px;
  padding: 0 3px;
}

.sec4-peg-sprite {
  width: 22px !important;
  height: 36px !important;
  object-fit: contain;
  filter: drop-shadow(0 3px 4px rgba(69, 26, 3, 0.3));
}

.sec4-peg-sprite.is-med-peg {
  width: 26px !important;
  height: 45px !important;
}

.sec4-peg-sprite.is-compact-peg {
  width: 16px !important;
  height: 28px !important;
}

.sec4-stage-arrow-badge {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #F59E0B 0%, #B45309 100%);
  border: 2px solid #FFFBEB;
  color: #FFFFFF;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(69, 26, 3, 0.32);
}

.sec4-bundle-hero-sprite {
  width: 76px !important;
  height: 62px !important;
  object-fit: contain;
  filter: drop-shadow(0 5px 10px rgba(69, 26, 3, 0.34));
}

.sec4-hero-caption-chip {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 800;
  color: #78350F;
  background: #FEF3C7;
  border: 1px solid #D97706;
  border-radius: 999px;
  padding: 1px 7px;
  margin-top: 2px;
  white-space: nowrap;
}

[data-theme="dark"] .sec4-hero-caption-chip {
  background: rgba(120, 53, 15, 0.75);
  color: #FEF08A;
  border-color: #F59E0B;
}

.sec4-bundles-row-4 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
}

.sec4-bundle-sprite {
  width: 52px !important;
  height: 42px !important;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(69, 26, 3, 0.28));
}

.sec4-bundle-sprite.is-compact-bundle {
  width: 34px !important;
  height: 28px !important;
}

.sec4-pegs-row-3 {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.sec4-layout-step3 {
  gap: 5px;
}

.sec4-caskets-row {
  display: flex;
  align-items: flex-end;
  gap: 4px;
}

.sec4-casket-sprite {
  width: 40px !important;
  height: 40px !important;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(69, 26, 3, 0.3));
}

.sec4-casket-sprite.is-mini-casket {
  width: 26px !important;
  height: 26px !important;
}

.sec4-tens-compact-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
  max-width: 110px;
}

.sec4-units-compact-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  max-width: 72px;
}

.sec4-hundreds-grid-10 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px 4px;
}

.sec4-thousand-hero-sprite {
  width: 78px !important;
  height: 72px !important;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(69, 26, 3, 0.38));
}

.sec4-total-medallion {
  font-size: 16px !important;
  padding: 0 16px;
  min-width: 210px;
  white-space: nowrap;
}

.sec4-storybook-stage .sec1-painted-step-row {
  gap: 5px;
  padding: 0 6px;
  max-width: 100%;
  box-sizing: border-box;
  justify-content: center;
}

.sec4-painted-step-card {
  padding: 4px 6px !important;
  gap: 4px !important;
  min-width: 0;
  flex: 0 1 auto;
}

.sec4-painted-step-card .sec3-mini-desk-img {
  width: 25px !important;
  height: 22px !important;
}

.sec4-painted-step-card .sec3-mini-mode-chip {
  font-size: 11px !important;
  padding: 1px 4px !important;
  white-space: nowrap;
}

.sec4-painted-step-card .sec1-step-card-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  font-size: 11px;
}

/* =========================================================================
   § 5–§ 214 GOLDEN BENCHMARK EXTENSIONS (Hard Gates H11, H13, H14 & 99.6%+ Gate)
   ========================================================================= */

.left-illustration-caption {
  padding: 10px 16px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-secondary);
  background: var(--bg-elevated);
  border-top: 1.5px solid var(--border);
  text-align: center;
}

.left-illustration-caption strong {
  color: var(--accent);
}

/* § 5: Наглядная плашка словообразования числительных */
.sec5-contractions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.sec5-contraction-card {
  background: var(--bg-sheet);
  border: 2px solid #D97706;
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 3px 8px rgba(180, 83, 9, 0.08);
}

[data-theme="dark"] .sec5-contraction-card {
  background: rgba(30, 41, 59, 0.94);
  border-color: rgba(245, 158, 11, 0.65);
}

.sec5-card-head {
  font-family: var(--font-heading);
  font-size: 13.5px;
  font-weight: 800;
  color: #92400E;
  margin-bottom: 6px;
  border-bottom: 1.5px dashed rgba(217, 119, 6, 0.35);
  padding-bottom: 4px;
}

[data-theme="dark"] .sec5-card-head {
  color: #FDE68A;
}

.sec5-card-row {
  display: flex;
  flex-direction: column;
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.38;
  margin-top: 5px;
  color: var(--ink-secondary);
}

.sec5-card-row strong {
  color: var(--ink-strong);
  font-weight: 800;
}

/* § 6: Наглядная таблица первых трёх мест справа (без кавычек-повторов «»») */
.sec6-place-grid,
.sec6-place-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.sec6-place-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-sheet);
  border: 2px solid #D97706;
  border-radius: 14px;
  padding: 10px 8px;
  box-shadow: 0 4px 10px rgba(180, 83, 9, 0.09);
}

[data-theme="dark"] .sec6-place-card {
  background: rgba(30, 41, 59, 0.94);
  border-color: rgba(245, 158, 11, 0.65);
}

.sec6-place-rank {
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink-secondary);
  margin-bottom: 4px;
}

.sec6-place-digit,
.sec6-place-big-digit {
  font-family: var(--font-heading);
  font-size: 30px;
  font-weight: 900;
  line-height: 1.15;
  color: var(--accent);
  margin: 4px 0;
  text-align: center;
}

.sec6-place-mini-sprite {
  width: 28px;
  height: 28px;
  object-fit: contain;
  margin: 2px 0;
}

/* § 18: Семь знаков римской нумерации I, V, X, L, C, D, M */
.sec18-roman-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.sec18-roman-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-sheet);
  border: 2px solid #D97706;
  border-radius: 12px;
  padding: 10px 6px;
}

[data-theme="dark"] .sec18-roman-cell {
  background: rgba(30, 41, 59, 0.94);
  border-color: rgba(245, 158, 11, 0.65);
}

.sec18-roman-cell .roman-sym {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 900;
  color: #B45309;
}

[data-theme="dark"] .sec18-roman-cell .roman-sym {
  color: #FDE047;
}

.sec18-roman-cell .roman-val {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-strong);
  margin-top: 2px;
}

/* Вкладка «🐐 Ошибка Рожика» в блоке «Проверь себя» */
.game-tab-rozhik {
  border-color: rgba(217, 119, 6, 0.55);
}

.rozhik-challenge-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rozhik-mistake-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 2px solid #F59E0B;
}

[data-theme="dark"] .rozhik-mistake-banner {
  background: linear-gradient(180deg, rgba(120, 53, 15, 0.45) 0%, rgba(69, 26, 3, 0.55) 100%);
  border-color: rgba(251, 191, 36, 0.65);
}

.rozhik-avatar {
  width: 82px;
  height: 82px;
  border-radius: 0;
  object-fit: contain;
  border: none;
  background: transparent;
  filter: drop-shadow(0 4px 10px rgba(180, 83, 9, 0.25)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.14));
  flex-shrink: 0;
}

[data-theme="dark"] .rozhik-avatar {
  filter: drop-shadow(0 5px 12px rgba(0, 0, 0, 0.65)) drop-shadow(0 2px 5px rgba(245, 158, 11, 0.35));
}

.rozhik-mistake-title {
  font-family: var(--font-heading);
  font-size: 14.5px;
  font-weight: 800;
  color: #92400E;
  margin-bottom: 3px;
}

[data-theme="dark"] .rozhik-mistake-title {
  color: #FDE68A;
}

.rozhik-mistake-text {
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.42;
  color: var(--ink-strong);
}

.rozhik-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rozhik-option-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--ink-strong);
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.rozhik-option-btn:hover {
  border-color: var(--accent);
}

.rozhik-option-btn.correct {
  border-color: #059669;
  background: rgba(16, 185, 129, 0.15);
}

.rozhik-option-btn.wrong {
  border-color: #DC2626;
  background: rgba(239, 68, 68, 0.14);
}

.rozhik-opt-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Крупный шрифт для заголовков и правил во всех параграфах § 5–§ 214 */
html[data-font-size="large"] .sheet-title {
  font-size: 33px !important;
}

/* ============================================================================
   ЖИВОПИСНАЯ СЦЕНА § 5–§ 214 (PAINTED STORYBOOK STAGE PARITY WITH § 1–§ 4)
   ============================================================================ */
.sec5-universal-storybook-stage {
  background-size: 100% 100%;
  background-position: center bottom;
  background-repeat: no-repeat;
}

.sec5-universal-storybook-stage .sec1-painted-step-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  left: 10px;
  right: 10px;
  top: 8px;
  padding: 0;
}

.sec5-universal-storybook-stage .sec1-painted-step-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  height: auto;
  min-height: 60px;
  padding: 5px 8px 6px !important;
  gap: 4px !important;
  box-sizing: border-box;
}

.sec5-card-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
}

.sec5-card-step-num {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #D97706;
  color: #FFFFFF;
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sec1-painted-step-card.is-active .sec5-card-step-num {
  background: #B91C1C;
  box-shadow: 0 0 0 2px #FEF08A;
}

.sec5-universal-storybook-stage .sec3-mini-desks-preview {
  min-width: 0;
  flex: 0 1 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-left: 0;
}

.sec5-universal-storybook-stage .sec3-mini-desk-img {
  width: 21px !important;
  height: 20px !important;
  flex-shrink: 0;
}

.sec5-universal-storybook-stage .sec3-mini-mode-chip {
  font-size: 12px !important;
  line-height: 1.15 !important;
  padding: 2px 4px !important;
  width: 100%;
  max-width: none !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  text-align: center;
  box-sizing: border-box;
}

.sec5-universal-storybook-stage .sec4-wood-badge {
  font-size: 11px !important;
  height: 22px !important;
  min-width: 26px !important;
  max-width: 96px;
  padding: 0 6px !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.sec5-universal-storybook-stage .sec3-step-bridge-eq {
  top: -7px;
  right: -8px;
  transform: none;
  width: 18px;
  height: 18px;
  font-size: 11px;
}

/* Центральная рабочая зона на сцене: строгая сетка 2 карточек без наложений */
.sec5-universal-storybook-stage .sec4-workbench-zone {
  width: 58%;
  max-width: 470px;
  height: 62%;
  bottom: 10%;
}

.sec5-storybook-workbench {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  padding: 0 4px;
  box-sizing: border-box;
}

.sec5-universal-storybook-stage .sec4-rank-panel {
  width: 100%;
  min-width: 0 !important;
  max-width: 100% !important;
  padding: 6px 8px 7px;
  box-sizing: border-box;
  overflow: hidden;
}

.sec5-universal-storybook-stage .sec4-rank-title {
  white-space: normal !important;
  max-width: 100%;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.18;
  border-radius: 9px;
  padding: 2.5px 6px;
  box-sizing: border-box;
}

.sec5-universal-storybook-stage .sec4-hero-caption-chip {
  white-space: normal !important;
  max-width: 100%;
  text-align: center;
  font-size: 11px;
  line-height: 1.18;
  border-radius: 9px;
  padding: 2px 6px;
  box-sizing: border-box;
}

.sec5-sprites-flex-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 4px 6px;
  max-width: 100%;
  min-height: 44px;
}

.sec5-stage-sprite-item {
  cursor: pointer;
  transition: transform 0.16s ease;
}

.sec5-stage-sprite-item:hover {
  transform: translateY(-2px) scale(1.06);
}

.sec5-stage-big-eq {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 900;
  color: #B45309;
  background: rgba(254, 243, 199, 0.96);
  border: 1.5px solid rgba(217, 119, 6, 0.55);
  border-radius: 8px;
  padding: 2.5px 7px;
  margin-top: 2px;
  text-align: center;
  line-height: 1.18;
  max-width: 100%;
  white-space: normal;
  box-sizing: border-box;
}

[data-theme="dark"] .sec5-stage-big-eq {
  background: rgba(120, 53, 15, 0.78);
  color: #FEF08A;
  border-color: rgba(251, 191, 36, 0.65);
}

.sec5-universal-storybook-stage .sec4-bundle-hero-sprite {
  width: 48px !important;
  height: 40px !important;
}

.sec5-universal-storybook-stage .sec4-total-medallion {
  font-size: 12.5px !important;
  line-height: 1.2;
  height: auto !important;
  min-height: 34px;
  padding: 4px 12px !important;
  min-width: 180px;
  width: max-content;
  max-width: 96%;
  white-space: normal !important;
  text-align: center;
  bottom: -7%;
}

/* ============================================================================
   ДВУХЪЯРУСНАЯ ЭРГОНОМИЧНАЯ ПАНЕЛЬ ШАГОВ И НАВИГАЦИИ (#sec1IconBar)
   Ярус 1: 4 широкие карточки шагов (по 25% ширины, 2 строки, ноль обрезки «...»)
   Ярус 2: 3 крупные кнопки управления («◀ Назад» • «▶ Автопоказ» • «Вперёд ▶»)
   ============================================================================ */
.sec1-icon-bar,
.sec1-icon-bar.step-pills {
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
  padding: 4px 0 2px;
  width: 100%;
  box-sizing: border-box;
}

.sec1-icon-bar .sec1-icon-pill[data-sec1-set] {
  grid-row: 1;
  grid-column: span 3;
  min-width: 0;
  min-height: 54px;
  height: 54px !important;
  padding: 6px 10px !important;
  border-radius: 13px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 13.5px !important;
  font-weight: 800;
  line-height: 1.2;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  text-align: center;
  box-sizing: border-box;
}

.sec1-icon-bar.step-pills .sec1-icon-pill[data-sec1-set] {
  min-height: 58px;
  height: auto !important;
  padding: 7px 8px !important;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px !important;
}

.step-pill-header-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.step-pill-num-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(217, 119, 6, 0.16);
  border: 1.5px solid rgba(217, 119, 6, 0.45);
  color: #92400E;
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.sec1-icon-pill.active .step-pill-num-badge {
  background: #D97706;
  border-color: #B45309;
  color: #FFFFFF;
}

html[data-theme="dark"] .step-pill-num-badge {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(251, 191, 36, 0.5);
  color: #FDE68A;
}

html[data-theme="dark"] .sec1-icon-pill.active .step-pill-num-badge {
  background: #F59E0B;
  border-color: #FBBF24;
  color: #1E293B;
}

.step-pill-label-text,
.sec1-icon-bar.step-pills .sec1-icon-pill span.step-pill-label-text {
  display: block;
  width: 100%;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.2;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  word-break: break-word;
}

.sec1-icon-bar .sec1-pill-apple-icon,
.sec1-icon-bar.step-pills .sec1-pill-apple-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Ярус 2: Крупные кнопки «◀ Назад», «▶ Автопоказ» и «Вперёд ▶» */
.sec1-icon-bar .sec1-stepper-prev,
.sec1-icon-bar.step-pills .sec1-stepper-prev {
  grid-row: 2;
  grid-column: 1 / 5;
  min-height: 46px;
  height: 46px !important;
  padding: 0 12px !important;
  font-size: 15px !important;
  font-weight: 800;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sec1-icon-bar #animPlayBtn,
.sec1-icon-bar #sec1AutoPlayBtn,
.sec1-icon-bar.step-pills #animPlayBtn {
  grid-row: 2;
  grid-column: 5 / 9;
  min-height: 46px;
  height: 46px !important;
  padding: 0 12px !important;
  font-size: 15px !important;
  font-weight: 800;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.sec1-icon-bar #animPlayBtn::after,
.sec1-icon-bar #sec1AutoPlayBtn::after {
  content: " Автопоказ";
  font-family: var(--font-heading);
  font-size: 14.5px;
  font-weight: 800;
}

.sec1-icon-bar #animPlayBtn.active::after,
.sec1-icon-bar #sec1AutoPlayBtn.active::after {
  content: " Пауза";
}

.sec1-icon-bar .sec1-stepper-next,
.sec1-icon-bar.step-pills .sec1-stepper-next {
  grid-row: 2;
  grid-column: 9 / 13;
  min-height: 46px;
  height: 46px !important;
  padding: 0 12px !important;
  font-size: 15px !important;
  font-weight: 800;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #FEF3C7 0%, #FDE68A 100%);
  border: 2.5px solid #D97706;
  color: #92400E;
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.18);
}

html[data-theme="dark"] .sec1-icon-bar .sec1-stepper-next {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.28) 0%, rgba(180, 83, 9, 0.35) 100%);
  border-color: #F59E0B;
  color: #FEF08A;
}

.storybook-bottom-workbench-card {
  margin-top: 14px;
}

/* ==========================================================================
   § 5 & § 6: HIGH-VISIBILITY INTERACTIVE STAGE BOARDS (.sec6-stage-board)
   ========================================================================== */
.sec6-stage-center-zone {
  position: absolute !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: 58% !important;
  max-width: 58% !important;
  top: 21% !important;
  bottom: 3.5% !important;
  height: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 5 !important;
}

.sec6-stage-board {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  padding: 9px 11px;
  background: linear-gradient(180deg, rgba(255, 253, 245, 0.97) 0%, rgba(254, 243, 199, 0.96) 100%);
  border: 2.5px solid #D97706;
  border-radius: 16px;
  box-shadow: 0 10px 26px rgba(69, 26, 3, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  box-sizing: border-box;
  backdrop-filter: blur(4px);
}

[data-theme="dark"] .sec6-stage-board {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96) 0%, rgba(30, 41, 59, 0.96) 100%);
  border-color: #F59E0B;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sec6-board-header {
  display: block;
  padding: 4px 8px;
  border-radius: 10px;
  background: linear-gradient(135deg, #FEF08A 0%, #FDE047 100%);
  border: 2px solid #D97706;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.18;
  color: #78350F;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-align: center;
  white-space: normal;
  box-shadow: 0 2px 6px rgba(180, 83, 9, 0.14);
}

[data-theme="dark"] .sec6-board-header {
  background: linear-gradient(135deg, rgba(180, 83, 9, 0.55) 0%, rgba(120, 53, 15, 0.7) 100%);
  border-color: #FBBF24;
  color: #FEF08A;
}

/* Step 1: 9 Significant Digits + Digit 0 */
.sec6-step1-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 8px;
  flex: 1;
  align-items: stretch;
}

.sec6-step1-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px 9px;
  border-radius: 13px;
  background: #FFFFFF;
  border: 2px solid #F59E0B;
  box-shadow: 0 3px 10px rgba(180, 83, 9, 0.10);
  text-align: center;
}

.sec6-step1-card.is-zero-card {
  background: linear-gradient(180deg, #FFF1F2 0%, #FFE4E6 100%);
  border-color: #E11D48;
}

[data-theme="dark"] .sec6-step1-card {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(245, 158, 11, 0.6);
}

[data-theme="dark"] .sec6-step1-card.is-zero-card {
  background: linear-gradient(180deg, rgba(136, 19, 55, 0.45) 0%, rgba(76, 5, 25, 0.6) 100%);
  border-color: #FB7185;
}

.sec6-card-top-tag {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  padding: 2px 6px;
  max-width: 98%;
  box-sizing: border-box;
  border-radius: 999px;
  background: #FEF3C7;
  color: #92400E;
  border: 1.5px solid #F59E0B;
  white-space: normal;
  text-align: center;
}

.is-zero-card .sec6-card-top-tag {
  background: #FFE4E6;
  color: #9F1239;
  border-color: #F43F5E;
}

[data-theme="dark"] .sec6-card-top-tag {
  background: rgba(245, 158, 11, 0.22);
  color: #FDE047;
  border-color: rgba(251, 191, 36, 0.5);
}

[data-theme="dark"] .is-zero-card .sec6-card-top-tag {
  background: rgba(244, 63, 94, 0.25);
  color: #FDA4AF;
  border-color: #FB7185;
}

.sec6-digits-tile-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 190px;
  margin: 4px auto;
}

.sec6-digit-tile {
  width: 31px;
  height: 35px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: linear-gradient(180deg, #EFF6FF 0%, #DBEAFE 100%);
  border: 2px solid #2563EB;
  box-shadow: 0 2px 0 #1D4ED8;
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 900;
  color: #1E3A8A;
  line-height: 1;
}

[data-theme="dark"] .sec6-digit-tile {
  background: linear-gradient(180deg, #1E3A8A 0%, #172554 100%);
  border-color: #60A5FA;
  box-shadow: 0 2px 0 #3B82F6;
  color: #EFF6FF;
}

.sec6-zero-hero-tile {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(180deg, #FFFFFF 0%, #FFE4E6 100%);
  border: 2.5px solid #E11D48;
  box-shadow: 0 3px 0 #BE123C;
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 900;
  color: #BE123C;
  line-height: 1;
  margin: 2px 0;
}

[data-theme="dark"] .sec6-zero-hero-tile {
  background: linear-gradient(180deg, #881337 0%, #4C0519 100%);
  border-color: #FB7185;
  box-shadow: 0 3px 0 #E11D48;
  color: #FFE4E6;
}

.sec6-card-bottom-label {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-strong);
  line-height: 1.2;
}

/* Steps 2, 3, 4: 3-Column High-Contrast Place Grid */
.sec6-three-cols-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  flex: 1;
  align-items: stretch;
}

.sec6-stage-col-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 7px 6px;
  border-radius: 13px;
  background: #FFFFFF;
  border: 2px solid #D97706;
  box-shadow: 0 3px 10px rgba(180, 83, 9, 0.10);
  text-align: center;
}

.sec6-stage-col-card.is-col-hundreds {
  border-color: #2563EB;
  background: linear-gradient(180deg, #FFFFFF 0%, #EFF6FF 100%);
}

.sec6-stage-col-card.is-col-tens {
  border-color: #D97706;
  background: linear-gradient(180deg, #FFFFFF 0%, #FFFBEB 100%);
}

.sec6-stage-col-card.is-col-units {
  border-color: #059669;
  background: linear-gradient(180deg, #FFFFFF 0%, #ECFDF5 100%);
}

[data-theme="dark"] .sec6-stage-col-card {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(245, 158, 11, 0.6);
}

[data-theme="dark"] .sec6-stage-col-card.is-col-hundreds {
  background: linear-gradient(180deg, rgba(30, 58, 138, 0.45) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-color: #60A5FA;
}

[data-theme="dark"] .sec6-stage-col-card.is-col-tens {
  background: linear-gradient(180deg, rgba(146, 64, 14, 0.42) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-color: #FBBF24;
}

[data-theme="dark"] .sec6-stage-col-card.is-col-units {
  background: linear-gradient(180deg, rgba(6, 95, 70, 0.45) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-color: #34D399;
}

.sec6-col-sprite-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 2px 0;
}

.sec6-col-mini-sprite {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.18));
}

.sec6-col-giant-digit {
  font-family: var(--font-heading);
  font-size: 30px;
  font-weight: 900;
  line-height: 1.05;
  color: var(--ink-strong);
  letter-spacing: 0.02em;
}

.is-col-hundreds .sec6-col-giant-digit {
  color: #1D4ED8;
}

.is-col-tens .sec6-col-giant-digit {
  color: #B45309;
}

.is-col-units .sec6-col-giant-digit {
  color: #047857;
}

[data-theme="dark"] .is-col-hundreds .sec6-col-giant-digit {
  color: #93C5FD;
}

[data-theme="dark"] .is-col-tens .sec6-col-giant-digit {
  color: #FDE047;
}

[data-theme="dark"] .is-col-units .sec6-col-giant-digit {
  color: #6EE7B7;
}

.sec6-zero-highlight {
  display: inline-block;
  padding: 0 5px;
  margin: 0 1px;
  border-radius: 7px;
  background: #FFE4E6;
  border: 2px solid #E11D48;
  color: #BE123C;
}

[data-theme="dark"] .sec6-zero-highlight {
  background: rgba(225, 29, 72, 0.32);
  border-color: #FB7185;
  color: #FFE4E6;
}

.sec6-zero-strike {
  display: inline-block;
  padding: 0 4px;
  margin-right: 2px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.22);
  color: #64748B;
  text-decoration: line-through;
  text-decoration-color: #EF4444;
  text-decoration-thickness: 2.5px;
}

[data-theme="dark"] .sec6-zero-strike {
  background: rgba(148, 163, 184, 0.18);
  color: #94A3B8;
  text-decoration-color: #FB7185;
}

.sec6-col-bottom-pill {
  width: 96%;
  padding: 3px 4px;
  border-radius: 8px;
  background: #FEF3C7;
  border: 1.5px solid #F59E0B;
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  color: #78350F;
  white-space: normal;
  box-sizing: border-box;
  text-align: center;
}

.sec6-col-bottom-pill.is-warn-pill {
  background: #FFE4E6;
  border-color: #F43F5E;
  color: #9F1239;
  font-size: 13px;
}

[data-theme="dark"] .sec6-col-bottom-pill {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(251, 191, 36, 0.5);
  color: #FEF08A;
}

[data-theme="dark"] .sec6-col-bottom-pill.is-warn-pill {
  background: rgba(244, 63, 94, 0.25);
  border-color: #FB7185;
  color: #FDA4AF;
}

.sec6-col-sub-note {
  font-family: var(--font-heading);
  font-size: 11.5px;
  font-weight: 800;
  color: var(--ink-secondary);
  white-space: nowrap;
}

.sec6-board-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  background: #EFF6FF;
  border: 2px solid #3B82F6;
  box-sizing: border-box;
  width: 100%;
}

[data-theme="dark"] .sec6-board-footer {
  background: rgba(30, 58, 138, 0.45);
  border-color: #60A5FA;
}

.sec6-board-eq {
  font-family: var(--font-heading);
  font-size: 12px;
  line-height: 1.15;
  font-weight: 900;
  color: #1E3A8A;
  white-space: normal;
  word-break: break-word;
}

[data-theme="dark"] .sec6-board-eq {
  color: #DBEAFE;
}

.sec6-board-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 2.5px 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, #D97706 0%, #B45309 100%);
  border: 2px solid #FEF3C7;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 900;
  color: #FFFFFF;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

/* ============================================================================
   ПОВЫШЕННАЯ НАГЛЯДНОСТЬ И ЧИТАЕМОСТЬ СХЕМ § 1–§ 10 ДЛЯ ДЕТЕЙ И СТАРШЕГО ПОКОЛЕНИЯ
   (Kids & Seniors High-Visibility Schematic Upgrade — Zero Overflow, Large Fonts)
   ============================================================================ */
.sec4-strokes-diagram {
  padding: 15px 16px 15px;
  margin: 14px 0 20px;
  box-sizing: border-box;
  max-width: 100%;
  overflow: hidden;
}

.sec4-strokes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 12px;
  padding-bottom: 9px;
  max-width: 100%;
  box-sizing: border-box;
}

.sec4-strokes-header-title {
  font-size: 14.5px;
  line-height: 1.28;
  font-weight: 900;
  letter-spacing: 0.02em;
  white-space: normal;
  flex: 1 1 240px;
  min-width: 0;
}

.sec4-strokes-header-hint {
  font-size: 12.5px;
  font-weight: 800;
  padding: 3px 11px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Укрупнённые верхние и нижние бейджи в карточках схем */
.sec6-place-card .sec4-stroke-top-tag,
.sec5-contraction-card .sec4-stroke-top-tag,
.sec2-schematic-card .sec4-stroke-top-tag {
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.22;
  padding: 3px 9px;
  margin-bottom: 7px;
  white-space: normal;
  text-align: center;
  max-width: 100%;
  box-sizing: border-box;
}

.sec6-place-card .sec4-stroke-label,
.sec2-schematic-card .sec6-col-bottom-pill {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  padding: 4px 8px;
  width: 96%;
  white-space: normal;
  text-align: center;
  box-sizing: border-box;
}

.sec6-place-card,
.sec5-contraction-card,
.sec2-schematic-card {
  justify-content: space-between;
  box-sizing: border-box;
  min-width: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.sec6-place-card[data-schem-step],
.sec5-contraction-card[data-schem-step],
.sec2-schematic-card[data-sec2-jump-step],
.sec10-law-card[data-schem-step] {
  cursor: pointer;
}

.sec6-place-card[data-schem-step]:hover,
.sec5-contraction-card[data-schem-step]:hover,
.sec2-schematic-card[data-sec2-jump-step]:hover,
.sec10-law-card[data-schem-step]:hover {
  transform: translateY(-2px);
  border-color: #B45309;
  box-shadow: 0 6px 16px rgba(180, 83, 9, 0.22);
}

/* Тематическая цветовая подсветка карточек в схемах */
.sec6-place-card.is-hundreds {
  border-color: #2563EB;
  background: linear-gradient(180deg, #FFFFFF 0%, #EFF6FF 100%);
}

.sec6-place-card.is-tens {
  border-color: #D97706;
  background: linear-gradient(180deg, #FFFFFF 0%, #FFFBEB 100%);
}

.sec6-place-card.is-units {
  border-color: #059669;
  background: linear-gradient(180deg, #FFFFFF 0%, #ECFDF5 100%);
}

.sec6-place-card.is-warn-card {
  border: 2px dashed #E11D48;
  background: linear-gradient(180deg, #FFF1F2 0%, #FFE4E6 100%);
}

[data-theme="dark"] .sec6-place-card.is-hundreds {
  background: linear-gradient(180deg, rgba(30, 58, 138, 0.42) 0%, rgba(15, 23, 42, 0.96) 100%);
  border-color: #60A5FA;
}

[data-theme="dark"] .sec6-place-card.is-tens {
  background: linear-gradient(180deg, rgba(146, 64, 14, 0.38) 0%, rgba(15, 23, 42, 0.96) 100%);
  border-color: #FBBF24;
}

[data-theme="dark"] .sec6-place-card.is-units {
  background: linear-gradient(180deg, rgba(6, 95, 70, 0.42) 0%, rgba(15, 23, 42, 0.96) 100%);
  border-color: #34D399;
}

[data-theme="dark"] .sec6-place-card.is-warn-card {
  background: linear-gradient(180deg, rgba(136, 19, 55, 0.48) 0%, rgba(15, 23, 42, 0.96) 100%);
  border-color: #FB7185;
}

/* Ясные двустрочные блоки «Было → Стало» без вылезания за границы карточек (§ 5–§ 10) */
.sec5-clear-pair {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 9px;
  margin-top: 6px;
  border-radius: 10px;
  background: rgba(254, 243, 199, 0.55);
  border: 1.5px solid rgba(217, 119, 6, 0.35);
  width: 100%;
  box-sizing: border-box;
  text-align: left;
}

[data-theme="dark"] .sec5-clear-pair {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(245, 158, 11, 0.38);
}

.sec5-pair-old {
  font-family: var(--font-book);
  font-size: 14px;
  line-height: 1.3;
  color: var(--ink-secondary);
  font-weight: 600;
}

.sec5-pair-new {
  font-family: var(--font-heading);
  font-size: 15.5px;
  line-height: 1.3;
  font-weight: 800;
  color: #9A3412;
}

[data-theme="dark"] .sec5-pair-new {
  color: #FDE047;
}

/* § 2: Наглядная лента каменной тропинки 1 → 2 → 3 → 4 → 5 → 6 → 7 → … */
.sec2-number-ribbon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 12px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid rgba(217, 119, 6, 0.5);
}

[data-theme="dark"] .sec2-number-ribbon {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(245, 158, 11, 0.5);
}

.sec2-ribbon-stone {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 44px;
  padding: 5px 8px;
  border-radius: 10px;
  background: #FEF3C7;
  border: 2px solid #D97706;
  font-family: var(--font-heading);
  color: #78350F;
}

.sec2-ribbon-digit {
  font-size: 16px;
  font-weight: 900;
  line-height: 1.05;
}

.sec2-ribbon-sub {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  opacity: 0.92;
  white-space: nowrap;
}

.sec2-ribbon-stone.is-early,
.sec2-ribbon-stone.is-three-stone {
  background: #DBEAFE;
  border-color: #2563EB;
  color: #1E3A8A;
}

.sec2-ribbon-stone.is-later,
.sec2-ribbon-stone.is-five-stone {
  background: #FFE4E6;
  border-color: #E11D48;
  color: #9F1239;
}

[data-theme="dark"] .sec2-ribbon-stone {
  background: rgba(120, 53, 15, 0.65);
  border-color: #F59E0B;
  color: #FEF08A;
}

[data-theme="dark"] .sec2-ribbon-stone.is-early,
[data-theme="dark"] .sec2-ribbon-stone.is-three-stone {
  background: rgba(30, 58, 138, 0.7);
  border-color: #60A5FA;
  color: #DBEAFE;
}

[data-theme="dark"] .sec2-ribbon-stone.is-later,
[data-theme="dark"] .sec2-ribbon-stone.is-five-stone {
  background: rgba(136, 19, 55, 0.7);
  border-color: #FB7185;
  color: #FFE4E6;
}

.sec2-ribbon-hop {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 12px;
  line-height: 1.05;
  font-weight: 800;
  color: #B45309;
}

.sec2-ribbon-hop-plus {
  font-size: 10.5px;
  opacity: 0.9;
}

[data-theme="dark"] .sec2-ribbon-hop {
  color: #FBBF24;
}

.sec2-schem-stones-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.sec2-schem-stone {
  width: 24px;
  height: 20px;
  object-fit: contain;
}

/* § 9 & § 10: Широкие поясняющие карточки правил и разрядов */
.sec10-two-laws-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.sec10-law-card {
  background: var(--bg-sheet);
  border: 2px solid #D97706;
  border-radius: 14px;
  padding: 11px 13px;
  box-shadow: 0 3px 10px rgba(180, 83, 9, 0.09);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

[data-theme="dark"] .sec10-law-card {
  background: rgba(30, 41, 59, 0.94);
  border-color: rgba(245, 158, 11, 0.65);
}

.sec10-law-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 900;
  color: #92400E;
  padding-bottom: 5px;
  border-bottom: 1.5px dashed rgba(217, 119, 6, 0.4);
}

[data-theme="dark"] .sec10-law-title {
  color: #FDE047;
  border-bottom-color: rgba(251, 191, 36, 0.4);
}

.sec10-law-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-book);
  font-size: 14.5px;
  line-height: 1.38;
  color: var(--ink-strong);
}

.sec10-law-item strong {
  color: #9A3412;
  font-weight: 800;
}

[data-theme="dark"] .sec10-law-item strong {
  color: #FDE047;
}

.sec10-places-sublist {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  margin: 4px 0 4px;
}

.sec10-place-row-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 4.5px 8px;
  border-radius: 8px;
  background: rgba(254, 243, 199, 0.65);
  border: 1px solid rgba(217, 119, 6, 0.4);
  font-family: var(--font-ui);
  font-size: 12.5px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--ink-strong);
  width: 100%;
  box-sizing: border-box;
}

[data-theme="dark"] .sec10-place-row-pill {
  background: rgba(15, 23, 42, 0.78);
  border-color: rgba(251, 191, 36, 0.35);
}

.sec10-place-row-pill strong,
.sec10-place-row-pill .place-num {
  font-family: var(--font-heading);
  font-weight: 900;
  color: #B45309;
  white-space: nowrap;
}

[data-theme="dark"] .sec10-place-row-pill strong,
[data-theme="dark"] .sec10-place-row-pill .place-num {
  color: #FDE047;
}

/* Автоматическое масштабирование схем в режиме «Крупный шрифт» (data-font-size="large") */
html[data-font-size="large"] .sec4-strokes-header-title {
  font-size: 16.5px !important;
}

html[data-font-size="large"] .sec4-strokes-header-hint {
  font-size: 14px !important;
}

html[data-font-size="large"] .sec6-place-card .sec4-stroke-top-tag,
html[data-font-size="large"] .sec5-contraction-card .sec4-stroke-top-tag,
html[data-font-size="large"] .sec4-stroke-top-tag {
  font-size: 14px !important;
}

html[data-font-size="large"] .sec6-place-card .sec4-stroke-label,
html[data-font-size="large"] .sec4-stroke-label {
  font-size: 14.5px !important;
}

html[data-font-size="large"] .sec5-pair-old {
  font-size: 15.5px !important;
}

html[data-font-size="large"] .sec5-pair-new,
html[data-font-size="large"] .sec10-law-item {
  font-size: 17px !important;
}

html[data-font-size="large"] .sec10-law-title {
  font-size: 16px !important;
}

html[data-font-size="large"] .sec4-strokes-summary-pill {
  font-size: 19px !important;
}

html[data-font-size="large"] .sec4-sum-formula-chip {
  font-size: 17px !important;
}

.sec18-roman-cell[data-schem-step] {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.sec18-roman-cell[data-schem-step]:hover {
  transform: translateY(-2px);
  border-color: #B45309;
  box-shadow: 0 6px 14px rgba(180, 83, 9, 0.2);
}

.sec18-roman-cell .sec4-stroke-brace {
  width: 84%;
  height: 11px;
  margin: 2px 0;
  color: #D97706;
}

.sec6-stage-col-card[data-stage-action] {
  cursor: pointer;
}

/* ==========================================================================
   Contextual Paragraph Math Typography, Semantic Blocks & Domain Stages
   ========================================================================== */

/* 1. True Stacked Fractions, Mixed Numbers & Periodic Decimals */
.math-frac {
  display: inline-grid;
  grid-template-rows: auto auto;
  vertical-align: middle;
  text-align: center;
  font-family: var(--font-heading);
  font-size: 0.84em;
  font-weight: 800;
  line-height: 1.06;
  margin: 0 0.18em;
  padding: 1px 4px;
  border-radius: 6px;
  background: rgba(37, 99, 235, 0.06);
  color: var(--ink-strong);
  text-indent: 0;
}

.math-frac > .num {
  border-bottom: 2px solid currentColor;
  padding: 0 0.28em 2px;
}

.math-frac > .den {
  padding: 2px 0.28em 0;
}

.math-mixed {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  vertical-align: middle;
  margin: 0 0.14em;
  text-indent: 0;
}

.math-mixed > .whole {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.02em;
}

.math-period {
  display: inline-block;
  font-family: var(--font-heading);
  font-weight: 800;
  padding: 0 4px;
  margin: 0 1px;
  border-radius: 5px;
  background: rgba(217, 119, 6, 0.15);
  border-top: 2px solid #D97706;
  color: #92400E;
  text-indent: 0;
}

.math-sup,
.math-sub {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.72em;
  line-height: 0;
}

/* 2. Centered Display Equations & Proportional Chains */
.math-display-eq {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  margin: 14px 0;
  padding: 12px 18px;
  border-radius: 14px;
  background: linear-gradient(180deg, #F8FAFC 0%, #EFF6FF 100%);
  border: 2px solid #BFDBFE;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
  font-family: var(--font-heading);
  font-size: 21px;
  font-weight: 800;
  color: #1E3A8A;
  text-indent: 0;
  text-align: center;
}

/* 3. Stacked Column Arithmetic ("столбиком"), Twin Operations & Partial Products */
.math-col-group {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  margin: 14px 0;
  text-indent: 0;
}

.math-col-card {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  padding: 12px 18px;
  border-radius: 14px;
  background: linear-gradient(180deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 2px solid #F59E0B;
  box-shadow: 0 4px 12px rgba(180, 83, 9, 0.11);
  text-indent: 0;
}

.math-col-caption {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #92400E;
  margin-bottom: 6px;
  text-align: center;
}

.math-col-table {
  border-collapse: collapse;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.32;
  color: #0F172A;
}

.math-col-table td {
  padding: 2px 4px;
  white-space: pre;
}

.math-col-table td.op-sign {
  color: #D97706;
  font-weight: 900;
  padding-right: 8px;
  text-align: center;
}

.math-col-table td.val-digits {
  text-align: right;
  letter-spacing: 0.08em;
}

.math-col-table tr.rule-line td.op-sign,
.math-col-table tr.rule-line td.val-digits {
  border-bottom: 3px solid #0F172A;
  padding-bottom: 5px;
}

.math-col-table tr.result-row td.val-digits {
  padding-top: 5px;
  color: #1D4ED8;
}

.math-col-table td.row-note {
  font-family: var(--font-book);
  font-size: 15.5px;
  font-weight: 700;
  color: #475569;
  padding-left: 14px;
  text-align: left;
  letter-spacing: normal;
}

/* 4. Russian Long Division ("уголком") & Remainder Chains */
.math-ugolok-card {
  display: inline-block;
  padding: 12px 18px;
  margin: 12px 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #F0FDF4 0%, #DCFCE7 100%);
  border: 2px solid #22C55E;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.1);
  text-indent: 0;
}

.math-ugolok {
  border-collapse: collapse;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.28;
  color: #0F172A;
}

.math-ugolok td {
  padding: 2px 10px;
  vertical-align: top;
}

.math-ugolok td.ug-dividend {
  text-align: right;
  letter-spacing: 0.06em;
  border-right: 3px solid #15803D;
}

.math-ugolok td.ug-divisor {
  text-align: left;
  color: #15803D;
  border-bottom: 3px solid #15803D;
}

.math-ugolok td.ug-quotient {
  text-align: left;
  color: #1D4ED8;
  font-size: 21px;
  padding-top: 5px;
}

.math-ugolok td.ug-sub {
  text-align: right;
  border-right: 3px solid #15803D;
  color: #B45309;
}

.math-ugolok td.ug-sub span {
  display: inline-block;
  border-bottom: 2px solid #0F172A;
  padding-bottom: 2px;
}

.math-ugolok td.ug-rem {
  text-align: right;
  border-right: 3px solid #15803D;
  color: #DC2626;
  font-weight: 900;
}

.math-rem-chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #F0F9FF 0%, #E0F2FE 100%);
  border: 2px solid #38BDF8;
  text-indent: 0;
}

.math-rem-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1.5px solid #93C5FD;
  font-family: var(--font-heading);
  font-size: 16.5px;
  font-weight: 800;
  color: #0F172A;
}

.math-rem-badge {
  padding: 2px 7px;
  border-radius: 7px;
  background: #FEF3C7;
  border: 1.5px solid #F59E0B;
  color: #92400E;
  font-size: 15px;
}

/* 5. Prime Factorization Vertical Bar Ladders ("420 | 2") */
.math-prime-ladders-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 18px;
  margin: 14px 0;
  text-indent: 0;
}

.math-prime-ladder-card {
  display: inline-flex;
  flex-direction: column;
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, #FAF5FF 0%, #F3E8FF 100%);
  border: 2px solid #A855F7;
  box-shadow: 0 4px 12px rgba(126, 34, 206, 0.1);
  text-indent: 0;
}

.math-prime-ladder {
  border-collapse: collapse;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 19.5px;
  font-weight: 800;
  line-height: 1.26;
}

.math-prime-ladder td.pl-left {
  text-align: right;
  padding: 2px 12px 2px 4px;
  border-right: 3px solid #7E22CE;
  color: #0F172A;
}

.math-prime-ladder td.pl-right {
  text-align: left;
  padding: 2px 4px 2px 12px;
  color: #7E22CE;
}

/* 6. Distinct Pedagogical Semantic Callout Cards */
.lesson-rule-box.is-definition {
  border-left: 5px solid #2563EB;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.09) 0%, rgba(239, 246, 255, 0.72) 100%);
}

.lesson-rule-box.is-definition .lesson-rule-title {
  color: #1D4ED8;
}

.lesson-rule-box.is-theorem {
  border-left: 5px solid #7C3AED;
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.09) 0%, rgba(245, 243, 255, 0.75) 100%);
}

.lesson-rule-box.is-theorem .lesson-rule-title {
  color: #6D28D9;
}

.lesson-note-box {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: 12px;
  border-left: 5px solid #0D9488;
  background: linear-gradient(90deg, rgba(13, 148, 136, 0.08) 0%, rgba(240, 253, 250, 0.75) 100%);
  text-indent: 0;
}

.lesson-note-title {
  font-family: var(--font-heading);
  font-size: 14.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0F766E;
  margin-bottom: 4px;
}

.lesson-example-card {
  margin: 13px 0;
  padding: 13px 16px;
  border-radius: 14px;
  border: 2px solid #CBD5E1;
  border-left: 5px solid #059669;
  background: linear-gradient(180deg, #FFFFFF 0%, #F0FDF4 100%);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.05);
  text-indent: 0;
}

.lesson-example-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.example-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: #DCFCE7;
  border: 1.5px solid #22C55E;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 800;
  color: #166534;
}

.lesson-proof-card {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1.5px dashed #94A3B8;
  border-left: 5px solid #475569;
  background: rgba(248, 250, 252, 0.88);
  text-indent: 0;
}

.lesson-proof-title {
  font-family: var(--font-heading);
  font-size: 14.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #334155;
  margin-bottom: 4px;
}

.lesson-numbered-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 9px 0;
  padding: 8px 12px;
  border-radius: 11px;
  background: rgba(241, 245, 249, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.35);
  text-indent: 0;
}

.lesson-numbered-item .item-marker {
  flex: 0 0 auto;
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border-radius: 8px;
  background: #DBEAFE;
  border: 1.5px solid #60A5FA;
  font-family: var(--font-heading);
  font-size: 15.5px;
  font-weight: 800;
  color: #1E3A8A;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

/* 7. Contextual H14 Inline Visual Band & Domain Stage Manipulative Band */
.h14-ctx-visual-band {
  width: 100%;
  margin: 4px 0 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid rgba(217, 119, 6, 0.32);
  box-sizing: border-box;
  overflow: hidden;
}

.h14-ctx-svg {
  display: block;
  width: 100%;
  max-height: 116px;
  height: auto;
}

.stage-ctx-visual-band {
  width: 100%;
  margin: 2px 0 4px;
  padding: 4px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  border: 1.5px solid rgba(59, 130, 246, 0.28);
  box-sizing: border-box;
  overflow: hidden;
  animation: stageBandPulse 0.36s ease-out;
}

@keyframes stageBandPulse {
  0% {
    opacity: 1;
    transform: translateY(2px) scale(0.992);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.stage-ctx-svg {
  display: block;
  width: 100%;
  max-height: 78px;
  height: auto;
}

/* 8. Unified Right-Column Live Interactive Controls ("Двигай числа и смотри результат" + "Проверь себя") */
.unified-interactive-dock {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.live-controls-panel {
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--bg-sheet, #FFFFFF);
  border: 2px solid var(--border, #CBD5E1);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.live-controls-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.live-controls-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  color: var(--ink-strong);
  margin: 0;
}

.live-result-readout {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FEF3C7 0%, #FDE68A 100%);
  border: 1.5px solid #D97706;
  font-family: var(--font-heading);
  font-size: 15.5px;
  font-weight: 800;
  color: #92400E;
}

.live-sliders-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin-bottom: 10px;
}

.live-sliders-grid.is-single-slider {
  grid-template-columns: minmax(0, 1fr);
}

.live-slider-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(241, 245, 249, 0.85);
  border: 1.5px solid rgba(148, 163, 184, 0.45);
}

.live-slider-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-family: var(--font-heading);
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink-strong);
}

.live-slider-val-pill {
  min-width: 34px;
  padding: 2px 8px;
  border-radius: 8px;
  background: #DBEAFE;
  border: 1.5px solid #3B82F6;
  color: #1E3A8A;
  text-align: center;
  font-size: 15.5px;
  font-weight: 900;
}

.live-range-input {
  width: 100%;
  height: 28px;
  accent-color: #2563EB;
  cursor: pointer;
}

.live-preset-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.live-preset-chip {
  min-height: 40px;
  padding: 6px 13px;
  border-radius: 11px;
  border: 1.5px solid #CBD5E1;
  background: #F8FAFC;
  font-family: var(--font-heading);
  font-size: 14.5px;
  font-weight: 800;
  color: #1E293B;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.live-preset-chip:hover {
  transform: translateY(-1px);
  border-color: #2563EB;
  background: #EFF6FF;
}

.live-preset-chip.is-canon-chip {
  background: linear-gradient(180deg, #EFF6FF 0%, #DBEAFE 100%);
  border-color: #3B82F6;
  color: #1E3A8A;
}

/* 9. Dark Theme Support for All Contextual Math & Interactive Components */
[data-theme="dark"] .math-frac {
  background: rgba(96, 165, 250, 0.16);
  color: #F8FAFC;
}

[data-theme="dark"] .math-period {
  background: rgba(251, 191, 36, 0.2);
  border-top-color: #FBBF24;
  color: #FDE68A;
}

[data-theme="dark"] .math-display-eq {
  background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
  border-color: #3B82F6;
  color: #BFDBFE;
}

[data-theme="dark"] .math-col-card {
  background: linear-gradient(180deg, #292112 0%, #1F190E 100%);
  border-color: #D97706;
}

[data-theme="dark"] .math-col-caption {
  color: #FCD34D;
}

[data-theme="dark"] .math-col-table {
  color: #F8FAFC;
}

[data-theme="dark"] .math-col-table td.op-sign {
  color: #FBBF24;
}

[data-theme="dark"] .math-col-table tr.rule-line td.op-sign,
[data-theme="dark"] .math-col-table tr.rule-line td.val-digits {
  border-bottom-color: #E2E8F0;
}

[data-theme="dark"] .math-col-table tr.result-row td.val-digits {
  color: #93C5FD;
}

[data-theme="dark"] .math-col-table td.row-note {
  color: #CBD5E1;
}

[data-theme="dark"] .math-ugolok-card {
  background: linear-gradient(180deg, #12291E 0%, #0D1F17 100%);
  border-color: #22C55E;
}

[data-theme="dark"] .math-ugolok {
  color: #F8FAFC;
}

[data-theme="dark"] .math-ugolok td.ug-dividend,
[data-theme="dark"] .math-ugolok td.ug-sub,
[data-theme="dark"] .math-ugolok td.ug-rem {
  border-right-color: #4ADE80;
}

[data-theme="dark"] .math-ugolok td.ug-divisor {
  color: #86EFAC;
  border-bottom-color: #4ADE80;
}

[data-theme="dark"] .math-ugolok td.ug-quotient {
  color: #93C5FD;
}

[data-theme="dark"] .math-ugolok td.ug-sub {
  color: #FCD34D;
}

[data-theme="dark"] .math-ugolok td.ug-sub span {
  border-bottom-color: #E2E8F0;
}

[data-theme="dark"] .math-ugolok td.ug-rem {
  color: #FCA5A5;
}

[data-theme="dark"] .math-rem-chain {
  background: linear-gradient(180deg, #0F2336 0%, #0C1A29 100%);
  border-color: #0284C7;
}

[data-theme="dark"] .math-rem-step {
  background: #1E293B;
  border-color: #38BDF8;
  color: #F8FAFC;
}

[data-theme="dark"] .math-rem-badge {
  background: rgba(245, 158, 11, 0.22);
  border-color: #F59E0B;
  color: #FDE68A;
}

[data-theme="dark"] .math-prime-ladder-card {
  background: linear-gradient(180deg, #241634 0%, #190F26 100%);
  border-color: #A855F7;
}

[data-theme="dark"] .math-prime-ladder td.pl-left {
  color: #F8FAFC;
  border-right-color: #C084FC;
}

[data-theme="dark"] .math-prime-ladder td.pl-right {
  color: #E9D5FF;
}

[data-theme="dark"] .lesson-rule-box.is-definition {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.18) 0%, rgba(30, 41, 59, 0.85) 100%);
  border-left-color: #60A5FA;
}

[data-theme="dark"] .lesson-rule-box.is-definition .lesson-rule-title {
  color: #93C5FD;
}

[data-theme="dark"] .lesson-rule-box.is-theorem {
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.18) 0%, rgba(30, 41, 59, 0.85) 100%);
  border-left-color: #C084FC;
}

[data-theme="dark"] .lesson-rule-box.is-theorem .lesson-rule-title {
  color: #D8B4FE;
}

[data-theme="dark"] .lesson-note-box {
  background: linear-gradient(90deg, rgba(20, 184, 166, 0.18) 0%, rgba(15, 23, 42, 0.85) 100%);
  border-left-color: #2DD4BF;
}

[data-theme="dark"] .lesson-note-title {
  color: #5EEAD4;
}

[data-theme="dark"] .lesson-example-card {
  background: linear-gradient(180deg, #1E293B 0%, #13251E 100%);
  border-color: #334155;
  border-left-color: #34D399;
}

[data-theme="dark"] .example-badge {
  background: rgba(34, 197, 94, 0.22);
  border-color: #4ADE80;
  color: #BBF7D0;
}

[data-theme="dark"] .lesson-proof-card {
  background: rgba(15, 23, 42, 0.78);
  border-color: #475569;
  border-left-color: #94A3B8;
}

[data-theme="dark"] .lesson-proof-title {
  color: #CBD5E1;
}

[data-theme="dark"] .lesson-numbered-item {
  background: rgba(30, 41, 59, 0.72);
  border-color: rgba(100, 116, 139, 0.45);
}

[data-theme="dark"] .lesson-numbered-item .item-marker {
  background: rgba(59, 130, 246, 0.22);
  border-color: #60A5FA;
  color: #BFDBFE;
}

[data-theme="dark"] .h14-ctx-visual-band,
[data-theme="dark"] .stage-ctx-visual-band {
  background: rgba(15, 23, 42, 0.88);
  border-color: rgba(251, 191, 36, 0.35);
}

.sec6-stage-board.has-ctx-visual-band {
  gap: 3px;
  padding: 5px 8px;
}

.sec6-stage-board.has-ctx-visual-band .sec6-board-header {
  padding: 2px 7px;
  font-size: 11px;
  line-height: 1.12;
}

.sec6-stage-board.has-ctx-visual-band .stage-ctx-visual-band {
  padding: 2px 5px;
  flex: 0 0 auto;
}

.stage-svg-layer .sec6-stage-board svg,
.sec6-stage-board.has-ctx-visual-band .stage-ctx-visual-band svg {
  min-height: 0 !important;
  height: 36px !important;
  max-height: 38px !important;
  width: 100% !important;
  display: block !important;
}

.sec6-stage-board.has-ctx-visual-band .sec6-three-cols-grid {
  gap: 5px;
  min-height: 0;
  flex: 1 1 auto;
}

.sec6-stage-board.has-ctx-visual-band .sec6-stage-col-card {
  padding: 3px 4px;
  min-height: 0;
  gap: 2px;
}

.sec6-stage-board.has-ctx-visual-band .sec6-mini-unit-img {
  width: 22px;
  height: 22px;
}

.sec6-stage-board.has-ctx-visual-band .sec6-big-eq {
  font-size: 15px;
  line-height: 1.08;
}

.sec6-stage-board.has-ctx-visual-band .sec6-board-footer {
  padding: 3px 8px;
}

.sec6-stage-board.has-ctx-visual-band .sec6-board-eq {
  font-size: 11px;
  line-height: 1.12;
}

[data-theme="dark"] .live-controls-panel {
  background: #1E293B;
  border-color: #334155;
}

[data-theme="dark"] .live-result-readout {
  background: rgba(217, 119, 6, 0.22);
  border-color: #F59E0B;
  color: #FDE68A;
}

[data-theme="dark"] .live-slider-box {
  background: rgba(15, 23, 42, 0.78);
  border-color: #334155;
}

[data-theme="dark"] .live-slider-val-pill {
  background: rgba(59, 130, 246, 0.24);
  border-color: #60A5FA;
  color: #BFDBFE;
}

[data-theme="dark"] .live-preset-chip {
  background: #0F172A;
  border-color: #475569;
  color: #E2E8F0;
}

[data-theme="dark"] .live-preset-chip:hover,
[data-theme="dark"] .live-preset-chip.is-canon-chip {
  background: rgba(37, 99, 235, 0.26);
  border-color: #60A5FA;
  color: #DBEAFE;
}

/* 10. Large Font Mode Scaling ("html[data-font-size='large']") */
html[data-font-size="large"] .math-col-table,
html[data-font-size="large"] .math-ugolok,
html[data-font-size="large"] .math-prime-ladder,
html[data-font-size="large"] .math-display-eq {
  font-size: 24px !important;
}

html[data-font-size="large"] .live-controls-title {
  font-size: 20px !important;
}

html[data-font-size="large"] .live-preset-chip,
html[data-font-size="large"] .live-slider-label-row {
  font-size: 16.5px !important;
}

@media (max-width: 720px) {
  .live-sliders-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* 11. Long-word column safety & Dark-Mode Inline Contextual SVG Contrast */
.sec6-col-sprite-row {
  max-width: 100%;
  min-width: 0;
  padding: 0 2px;
}

.sec6-col-giant-digit {
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
  text-align: center;
  line-height: 1.12;
}

[data-theme="dark"] .h14-ctx-svg rect[fill="#FFFFFF" i],
[data-theme="dark"] .h14-ctx-svg rect[fill="#F8FAFC" i],
[data-theme="dark"] .h14-ctx-svg rect[fill="#F1F5F9" i],
[data-theme="dark"] .stage-ctx-svg rect[fill="#FFFFFF" i],
[data-theme="dark"] .stage-ctx-svg rect[fill="#F8FAFC" i],
[data-theme="dark"] .stage-ctx-svg rect[fill="#F1F5F9" i] {
  fill: rgba(15, 23, 42, 0.85) !important;
}

[data-theme="dark"] .h14-ctx-svg rect[fill="#FFFBEB" i],
[data-theme="dark"] .h14-ctx-svg rect[fill="#FEF3C7" i],
[data-theme="dark"] .stage-ctx-svg rect[fill="#FFFBEB" i],
[data-theme="dark"] .stage-ctx-svg rect[fill="#FEF3C7" i] {
  fill: rgba(120, 53, 15, 0.45) !important;
}

[data-theme="dark"] .h14-ctx-svg rect[fill="#EFF6FF" i],
[data-theme="dark"] .h14-ctx-svg rect[fill="#DBEAFE" i],
[data-theme="dark"] .stage-ctx-svg rect[fill="#EFF6FF" i],
[data-theme="dark"] .stage-ctx-svg rect[fill="#DBEAFE" i] {
  fill: rgba(30, 58, 138, 0.45) !important;
}

[data-theme="dark"] .h14-ctx-svg rect[fill="#DCFCE7" i],
[data-theme="dark"] .h14-ctx-svg rect[fill="#F0FDFA" i],
[data-theme="dark"] .h14-ctx-svg rect[fill="#CCFBF1" i],
[data-theme="dark"] .stage-ctx-svg rect[fill="#DCFCE7" i],
[data-theme="dark"] .stage-ctx-svg rect[fill="#F0FDFA" i],
[data-theme="dark"] .stage-ctx-svg rect[fill="#CCFBF1" i] {
  fill: rgba(20, 83, 45, 0.45) !important;
}

[data-theme="dark"] .h14-ctx-svg rect[fill="#FAF5FF" i],
[data-theme="dark"] .h14-ctx-svg rect[fill="#FDF2F8" i],
[data-theme="dark"] .stage-ctx-svg rect[fill="#FAF5FF" i],
[data-theme="dark"] .stage-ctx-svg rect[fill="#FDF2F8" i] {
  fill: rgba(88, 28, 135, 0.42) !important;
}

[data-theme="dark"] .h14-ctx-svg text[fill="#92400E" i],
[data-theme="dark"] .h14-ctx-svg text[fill="#B45309" i],
[data-theme="dark"] .h14-ctx-svg text[fill="#D97706" i],
[data-theme="dark"] .stage-ctx-svg text[fill="#92400E" i],
[data-theme="dark"] .stage-ctx-svg text[fill="#B45309" i],
[data-theme="dark"] .stage-ctx-svg text[fill="#D97706" i] {
  fill: #FDE68A !important;
}

[data-theme="dark"] .h14-ctx-svg text[fill="#1E3A8A" i],
[data-theme="dark"] .h14-ctx-svg text[fill="#1D4ED8" i],
[data-theme="dark"] .stage-ctx-svg text[fill="#1E3A8A" i],
[data-theme="dark"] .stage-ctx-svg text[fill="#1D4ED8" i] {
  fill: #BFDBFE !important;
}

[data-theme="dark"] .h14-ctx-svg text[fill="#166534" i],
[data-theme="dark"] .h14-ctx-svg text[fill="#15803D" i],
[data-theme="dark"] .h14-ctx-svg text[fill="#059669" i],
[data-theme="dark"] .h14-ctx-svg text[fill="#0F766E" i],
[data-theme="dark"] .h14-ctx-svg text[fill="#115E59" i],
[data-theme="dark"] .stage-ctx-svg text[fill="#166534" i],
[data-theme="dark"] .stage-ctx-svg text[fill="#15803D" i],
[data-theme="dark"] .stage-ctx-svg text[fill="#059669" i],
[data-theme="dark"] .stage-ctx-svg text[fill="#0F766E" i],
[data-theme="dark"] .stage-ctx-svg text[fill="#115E59" i] {
  fill: #A7F3D0 !important;
}

[data-theme="dark"] .h14-ctx-svg text[fill="#6B21A8" i],
[data-theme="dark"] .h14-ctx-svg text[fill="#7E22CE" i],
[data-theme="dark"] .h14-ctx-svg text[fill="#9D174D" i],
[data-theme="dark"] .h14-ctx-svg text[fill="#BE185D" i],
[data-theme="dark"] .h14-ctx-svg text[fill="#DC2626" i],
[data-theme="dark"] .stage-ctx-svg text[fill="#6B21A8" i],
[data-theme="dark"] .stage-ctx-svg text[fill="#7E22CE" i],
[data-theme="dark"] .stage-ctx-svg text[fill="#9D174D" i],
[data-theme="dark"] .stage-ctx-svg text[fill="#BE185D" i],
[data-theme="dark"] .stage-ctx-svg text[fill="#DC2626" i] {
  fill: #E9D5FF !important;
}

/* 11. Topbar Icon-Only Buttons in Dark & Large-Font Modes + § 1–10 Live Stage Pill */
html[data-font-size="large"] .topbar-icon-btn,
html[data-font-size="large"] .theme-toggle-btn,
html[data-font-size="large"] .font-size-toggle-btn {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  padding: 0 !important;
}

[data-theme="dark"] .topbar-icon-btn,
[data-theme="dark"] .theme-toggle-btn,
[data-theme="dark"] .font-size-toggle-btn,
[data-theme="dark"] .topbar-arrow-btn {
  background: #1E293B;
  border-color: #3B4F6B;
  color: #FDE047;
}

[data-theme="dark"] .topbar-icon-btn:hover,
[data-theme="dark"] .topbar-icon-btn:focus-visible,
[data-theme="dark"] .theme-toggle-btn:hover,
[data-theme="dark"] .theme-toggle-btn:focus-visible,
[data-theme="dark"] .font-size-toggle-btn:hover,
[data-theme="dark"] .font-size-toggle-btn:focus-visible,
[data-theme="dark"] .topbar-arrow-btn:hover,
[data-theme="dark"] .topbar-arrow-btn:focus-visible {
  background: rgba(245, 158, 11, 0.24);
  border-color: #FBBF24;
  color: #FEF3C7;
}

.sec10-live-stage-pill {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 9;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(255, 251, 235, 0.96);
  border: 2px solid #D97706;
  box-shadow: 0 4px 12px rgba(24, 21, 18, 0.16);
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 900;
  color: #78350F;
  pointer-events: none;
  white-space: nowrap;
}

[data-theme="dark"] .sec10-live-stage-pill {
  background: rgba(15, 23, 42, 0.94);
  border-color: #FBBF24;
  color: #FDE68A;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

/* ============================================================================
   12. Интерактивные сноски (*), кликабельные ссылки § N и панель «Связанные параграфы»
   (Hard Gates S-H4 & S-H5 — Dual-Generation Accessible UX)
   ============================================================================ */

/* Интерактивный маркер сноски (*) в тексте параграфа */
a.sec-footnote-sup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-indent: 0;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  margin-left: 2px;
  vertical-align: super;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  color: #B45309;
  background: #FEF3C7;
  border: 1.5px solid #F59E0B;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(180, 83, 9, 0.14);
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

a.sec-footnote-sup:hover,
a.sec-footnote-sup:focus-visible {
  background: #FDE68A;
  color: #78350F;
  transform: translateY(-1px) scale(1.08);
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.28);
  outline: none;
}

[data-theme="dark"] a.sec-footnote-sup {
  background: rgba(245, 158, 11, 0.22);
  border-color: #FBBF24;
  color: #FDE68A;
}

[data-theme="dark"] a.sec-footnote-sup:hover,
[data-theme="dark"] a.sec-footnote-sup:focus-visible {
  background: rgba(245, 158, 11, 0.38);
  color: #FFFBEB;
}

/* Карточка примечания (*) внизу текста параграфа */
.lesson-footnote-box {
  margin-top: 16px;
  margin-bottom: 14px;
  padding: 13px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 1.5px solid #F59E0B;
  border-left: 5px solid #D97706;
  box-shadow: 0 3px 12px rgba(180, 83, 9, 0.08);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

[data-theme="dark"] .lesson-footnote-box {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14) 0%, rgba(30, 41, 59, 0.94) 100%);
  border-color: rgba(245, 158, 11, 0.5);
  border-left-color: #FBBF24;
}

.lesson-footnote-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.lesson-footnote-head-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.lesson-footnote-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  padding: 3px 8px 0;
  border-radius: 999px;
  background: #D97706;
  color: #FFFFFF;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.lesson-footnote-label {
  font-family: var(--font-heading);
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #92400E;
}

[data-theme="dark"] .lesson-footnote-label {
  color: #FDE68A;
}

a.lesson-footnote-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid #F59E0B;
  color: #92400E;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

a.lesson-footnote-back:hover,
a.lesson-footnote-back:focus-visible {
  background: #FEF3C7;
  transform: translateY(-1px);
  outline: none;
}

[data-theme="dark"] a.lesson-footnote-back {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(251, 191, 36, 0.55);
  color: #FDE68A;
}

.lesson-footnote-body {
  font-family: var(--font-book);
  font-size: 17.5px;
  line-height: 1.58;
  color: var(--ink-primary);
}

html[data-font-size="large"] .lesson-footnote-body {
  font-size: 20.5px !important;
  line-height: 1.66 !important;
}

@keyframes fnFlashPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.65);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(245, 158, 11, 0.18);
  }
  100% {
    box-shadow: 0 3px 12px rgba(180, 83, 9, 0.08);
  }
}

.is-fn-flash {
  animation: fnFlashPulse 1.1s ease-out;
}

/* Кликабельная инлайн-ссылка на параграф (§ N) в тексте */
a.sec-inline-ref-link {
  display: inline-flex;
  align-items: center;
  text-indent: 0;
  padding: 0 6px;
  margin: 0 1px;
  border-radius: 7px;
  background: rgba(37, 99, 235, 0.1);
  border-bottom: 2px solid #2563EB;
  color: #1D4ED8;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.94em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

a.sec-inline-ref-link:hover,
a.sec-inline-ref-link:focus-visible {
  background: rgba(37, 99, 235, 0.2);
  color: #1E3A8A;
  transform: translateY(-1px);
  outline: none;
}

[data-theme="dark"] a.sec-inline-ref-link {
  background: rgba(96, 165, 250, 0.18);
  border-bottom-color: #60A5FA;
  color: #93C5FD;
}

[data-theme="dark"] a.sec-inline-ref-link:hover,
[data-theme="dark"] a.sec-inline-ref-link:focus-visible {
  background: rgba(96, 165, 250, 0.32);
  color: #DBEAFE;
}

/* Панель «Связанные параграфы» над нижними кнопками навигации */
.sec-referrals-panel {
  margin-top: 16px;
  margin-bottom: 12px;
  padding: 13px 15px;
  border-radius: 16px;
  background: var(--bg-soft, #F8FAFC);
  border: 1.5px solid var(--border);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

[data-theme="dark"] .sec-referrals-panel {
  background: rgba(15, 23, 42, 0.72);
  border-color: #334155;
}

.sec-referrals-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.sec-referrals-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-secondary);
}

.sec-referrals-groups {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sec-referrals-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.sec-referrals-group-label {
  font-family: var(--font-heading);
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink-secondary);
  min-width: 118px;
}

a.sec-referral-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--bg-elevated, #FFFFFF);
  border: 1.5px solid var(--border);
  color: var(--ink-primary);
  font-family: var(--font-book);
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

a.sec-referral-chip:hover,
a.sec-referral-chip:focus-visible {
  border-color: #2563EB;
  background: #EFF6FF;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.14);
  outline: none;
}

a.sec-referral-chip.is-explicit {
  border-color: #F59E0B;
  background: #FFFBEB;
}

a.sec-referral-chip.is-explicit:hover,
a.sec-referral-chip.is-explicit:focus-visible {
  border-color: #D97706;
  background: #FEF3C7;
}

[data-theme="dark"] a.sec-referral-chip {
  background: #1E293B;
  border-color: #334155;
  color: #F1F5F9;
}

[data-theme="dark"] a.sec-referral-chip:hover,
[data-theme="dark"] a.sec-referral-chip:focus-visible {
  border-color: #60A5FA;
  background: rgba(37, 99, 235, 0.24);
}

[data-theme="dark"] a.sec-referral-chip.is-explicit {
  border-color: rgba(245, 158, 11, 0.65);
  background: rgba(245, 158, 11, 0.16);
}

.sec-ref-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 7px;
  background: #DBEAFE;
  color: #1E40AF;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

a.sec-referral-chip.is-explicit .sec-ref-num {
  background: #FDE68A;
  color: #92400E;
}

[data-theme="dark"] .sec-ref-num {
  background: rgba(59, 130, 246, 0.28);
  color: #93C5FD;
}

[data-theme="dark"] a.sec-referral-chip.is-explicit .sec-ref-num {
  background: rgba(245, 158, 11, 0.3);
  color: #FDE68A;
}

.sec-ref-name {
  line-height: 1.3;
}

html[data-font-size="large"] a.sec-referral-chip {
  min-height: 48px !important;
  font-size: 16.5px !important;
  padding: 8px 14px !important;
}

html[data-font-size="large"] .sec-referrals-group-label {
  font-size: 14.5px !important;
}

/* ============================================================================
   MULTI-LANGUAGE FLAG + TEXT SELECTOR MENU (.lang-menu-wrap)
   ============================================================================ */
.topbar-controls {
  gap: 8px;
}

.search-wrap {
  min-width: 96px;
}

.catalog-search-wrap {
  min-width: 118px;
}

.lang-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.lang-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 11px;
  border-radius: 11px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--ink-strong);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.lang-menu-btn:hover,
.lang-menu-btn[aria-expanded="true"] {
  border-color: #D97706;
  background: var(--amber-soft);
}

[data-theme="dark"] .lang-menu-btn:hover,
[data-theme="dark"] .lang-menu-btn[aria-expanded="true"] {
  border-color: #F59E0B;
  background: rgba(245, 158, 11, 0.18);
}

.lang-flag-svg {
  width: 20px;
  height: 15px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.18);
  flex-shrink: 0;
  display: inline-block;
}

[data-theme="dark"] .lang-flag-svg {
  box-shadow: 0 0 0 1px rgba(248, 250, 252, 0.25);
}

.lang-btn-text {
  line-height: 1;
}

.lang-btn-chevron {
  font-size: 11px;
  opacity: 0.78;
  line-height: 1;
}

.lang-menu-dropdown {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  min-width: 168px;
  padding: 6px;
  border-radius: 13px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-sheet);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.22);
  z-index: 1250;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.lang-menu-dropdown[hidden] {
  display: none !important;
}

[data-theme="dark"] .lang-menu-dropdown {
  background: #0F172A;
  border-color: rgba(245, 158, 11, 0.48);
  box-shadow: 0 16px 36px rgba(2, 6, 23, 0.68);
}

.lang-menu-option {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 40px;
  padding: 7px 11px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-strong);
  font-family: var(--font-heading);
  font-size: 14.5px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.lang-menu-option:hover {
  background: var(--amber-soft);
}

[data-theme="dark"] .lang-menu-option:hover {
  background: rgba(245, 158, 11, 0.16);
}

.lang-menu-option.is-selected {
  background: rgba(245, 158, 11, 0.18);
  color: var(--amber-ink);
}

[data-theme="dark"] .lang-menu-option.is-selected {
  background: rgba(245, 158, 11, 0.26);
  color: #FDE68A;
}

.lang-opt-label {
  flex: 1;
}

.lang-opt-check {
  font-size: 14px;
  font-weight: 800;
  color: #D97706;
}

[data-theme="dark"] .lang-opt-check {
  color: #FBBF24;
}

@media (max-width: 1320px) {
  .topbar-controls {
    gap: 6px;
  }
  .jump-select {
    max-width: 175px;
  }
  .lang-menu-btn {
    padding: 0 9px;
    font-size: 13.5px;
  }
}

/* ==========================================================================
   3-VERSION ORGANIC UI SYSTEM: DESKTOP / TABLET / MOBILE
   ========================================================================== */

.ui-mode-toggle-btn svg.ui-mode-svg-icon {
  width: 20px;
  height: 20px;
  display: block;
  color: var(--ink-strong);
  transition: transform 0.16s ease, color 0.16s ease;
}

.ui-mode-toggle-btn:hover svg.ui-mode-svg-icon {
  transform: scale(1.08);
  color: var(--amber-ink);
}

html[data-ui-mode-pref="desktop"] .ui-mode-toggle-btn,
html[data-ui-mode-pref="tablet"] .ui-mode-toggle-btn,
html[data-ui-mode-pref="mobile"] .ui-mode-toggle-btn {
  border-color: var(--amber-border);
  box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.28);
}

.tablet-mode-bar,
.mobile-pane-bar,
.mobile-bottom-nav {
  display: none;
}

/* --- VERSION 1: DESKTOP UI (html[data-ui-mode="desktop"]) --- */
html[data-ui-mode="desktop"] .book-spread {
  display: grid;
  grid-template-columns: minmax(430px, 0.94fr) minmax(500px, 1.06fr);
  gap: 24px;
  align-items: start;
}

/* --- VERSION 2: TABLET UI (html[data-ui-mode="tablet"]) --- */
html[data-ui-mode="tablet"] .topbar-inner {
  padding: 6px 12px;
  gap: 8px;
  flex-wrap: nowrap;
}

html[data-ui-mode="tablet"] .topbar-brand {
  gap: 6px;
}

html[data-ui-mode="tablet"] .book-title {
  font-size: 17px;
}

html[data-ui-mode="tablet"] .primary-nav-btn {
  padding: 0 10px;
  height: 38px;
  font-size: 13.5px;
}

html[data-ui-mode="tablet"] .jump-select {
  max-width: 145px;
  min-width: 96px;
}

html[data-ui-mode="tablet"] .search-wrap {
  max-width: 155px;
  min-width: 96px;
}

html[data-ui-mode="tablet"] .tablet-mode-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
  padding: 8px;
  border-radius: 16px;
  background: var(--bg-sheet);
  border: 1.5px solid var(--border);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
  position: sticky;
  top: 64px;
  z-index: 45;
}

.tablet-mode-pill {
  min-height: 48px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  background: var(--bg-soft);
  color: var(--ink-secondary);
  font-family: var(--font-heading);
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tablet-mode-pill:hover {
  color: var(--ink-strong);
  border-color: var(--amber-border);
}

.tablet-mode-pill.is-active {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  color: #92400E;
  border-color: #F59E0B;
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.16);
}

[data-theme="dark"] .tablet-mode-pill.is-active {
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.55) 0%, rgba(146, 64, 14, 0.42) 100%);
  color: #FDE68A;
  border-color: #F59E0B;
}

html[data-ui-mode="tablet"] .book-spread {
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

@media (min-width: 960px) {
  html[data-ui-mode="tablet"] .book-spread[data-tablet-pane="split"] {
    grid-template-columns: minmax(340px, 0.88fr) minmax(420px, 1.12fr);
    gap: 18px;
  }
}

html[data-ui-mode="tablet"] .spread-right-page {
  position: static;
}

html[data-ui-mode="tablet"] .book-spread[data-tablet-pane="theory"] .spread-right-page,
html[data-ui-mode="tablet"] .book-spread[data-tablet-pane="interactive"] .spread-left-page,
html[data-ui-mode="tablet"] .book-spread[data-tablet-pane="game"] .spread-left-page,
html[data-ui-mode="tablet"] .book-spread[data-tablet-pane="game"] .sec1-visual-plate-card,
html[data-ui-mode="tablet"] .book-spread[data-tablet-pane="game"] .live-controls-panel {
  position: absolute !important;
  left: -10000px !important;
  top: 0 !important;
  width: 720px !important;
  max-height: 0 !important;
  overflow: hidden !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

html[data-ui-mode="tablet"] .preset-btn,
html[data-ui-mode="tablet"] .game-tab,
html[data-ui-mode="tablet"] .blitz-opt-btn {
  min-height: 48px;
}

/* --- VERSION 3: MOBILE UI (html[data-ui-mode="mobile"]) --- */
html[data-ui-mode="mobile"] .topbar {
  min-height: 56px;
}

html[data-ui-mode="mobile"] .topbar-inner {
  padding: 4px 8px;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

html[data-ui-mode="mobile"] .topbar-inner::-webkit-scrollbar {
  display: none;
}

html[data-ui-mode="mobile"] .topbar-brand {
  gap: 4px;
  flex-shrink: 0;
}

html[data-ui-mode="mobile"] .book-title,
html[data-ui-mode="mobile"] .topbar-brand-divider,
html[data-ui-mode="mobile"] #homeNavBtn span,
html[data-ui-mode="mobile"] #catalogPageLink span,
html[data-ui-mode="mobile"] #catalogHomeLink span,
html[data-ui-mode="mobile"] #backToBookLink span,
html[data-ui-mode="mobile"] .jump-select,
html[data-ui-mode="mobile"] .direct-jump-form label,
html[data-ui-mode="mobile"] .lang-btn-text {
  display: none !important;
}

html[data-ui-mode="mobile"] .primary-nav-btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
}

html[data-ui-mode="mobile"] .topbar-arrow-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
}

html[data-ui-mode="mobile"] .direct-jump-inline {
  padding: 0 5px;
  height: 34px;
}

html[data-ui-mode="mobile"] #directSecInput {
  width: 40px;
  font-size: 13.5px;
}

html[data-ui-mode="mobile"] .search-wrap {
  min-width: 78px;
  max-width: 118px;
  flex: 1 1 84px;
}

html[data-ui-mode="mobile"] #globalSearch,
html[data-ui-mode="mobile"] #catalogFilterInput {
  height: 36px;
  padding: 0 8px;
  font-size: 13px;
}

html[data-ui-mode="mobile"] .lang-menu-btn {
  height: 38px;
  padding: 0 7px;
  min-width: 42px;
}

html[data-ui-mode="mobile"] .spread-stage {
  padding: 10px 10px 86px;
}

html[data-ui-mode="mobile"] .mobile-pane-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin: 0 0 12px;
  padding: 6px;
  border-radius: 14px;
  background: var(--bg-sheet);
  border: 1.5px solid var(--border);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  position: sticky;
  top: 58px;
  z-index: 44;
}

html[data-ui-mode="mobile"] .mobile-bottom-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-sheet);
  border-top: 1.5px solid var(--border);
  box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.12);
  z-index: 80;
}

.mobile-nav-tab {
  min-height: 44px;
  padding: 6px 4px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  background: var(--bg-soft);
  color: var(--ink-secondary);
  font-family: var(--font-heading);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.14s ease;
}

.mobile-nav-tab.is-active {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  color: #92400E;
  border-color: #F59E0B;
}

[data-theme="dark"] .mobile-nav-tab.is-active {
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.58) 0%, rgba(146, 64, 14, 0.45) 100%);
  color: #FDE68A;
  border-color: #F59E0B;
}

html[data-ui-mode="mobile"] .book-spread {
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

html[data-ui-mode="mobile"] .spread-right-page {
  position: static;
}

html[data-ui-mode="mobile"] .book-sheet,
html[data-ui-mode="mobile"] .right-panel-card {
  padding: 16px 14px;
  border-radius: 16px;
}

html[data-ui-mode="mobile"] .sec1- companion-override,
html[data-ui-mode="mobile"] .spread-right-page .sec1-companion-helper {
  padding: 12px 14px;
  gap: 12px;
}

html[data-ui-mode="mobile"] #sec1IconBar.step-pills .step-pill.sec1-step-text-pill {
  grid-column: span 6;
  min-height: 50px;
}

html[data-ui-mode="mobile"] .live-sliders-grid {
  grid-template-columns: minmax(0, 1fr);
}

html[data-ui-mode="mobile"] .preset-btn,
html[data-ui-mode="mobile"] .game-tab,
html[data-ui-mode="mobile"] .blitz-opt-btn {
  min-height: 48px;
}

html[data-ui-mode="mobile"] .book-spread[data-mobile-pane="theory"] .spread-right-page,
html[data-ui-mode="mobile"] .book-spread[data-mobile-pane="stage"] .spread-left-page,
html[data-ui-mode="mobile"] .book-spread[data-mobile-pane="stage"] .unified-interactive-dock,
html[data-ui-mode="mobile"] .book-spread[data-mobile-pane="model"] .spread-left-page,
html[data-ui-mode="mobile"] .book-spread[data-mobile-pane="model"] .sec1-visual-plate-card,
html[data-ui-mode="mobile"] .book-spread[data-mobile-pane="model"] .live-quiz-panel,
html[data-ui-mode="mobile"] .book-spread[data-mobile-pane="game"] .spread-left-page,
html[data-ui-mode="mobile"] .book-spread[data-mobile-pane="game"] .sec1-visual-plate-card,
html[data-ui-mode="mobile"] .book-spread[data-mobile-pane="game"] .live-controls-panel {
  position: absolute !important;
  left: -10000px !important;
  top: 0 !important;
  width: 720px !important;
  max-height: 0 !important;
  overflow: hidden !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}











/* ===== Site footer: contact e-mail (index.html, catalog.html) ===== */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 10px;
  max-width: 1640px;
  margin: 0 auto;
  padding: 18px 28px 28px;
  border-top: 1px solid var(--border);
  font-family: var(--font-book);
  font-size: 16px;
  color: var(--ink-muted);
}
.site-footer-mail {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 6px;
  color: var(--accent-text);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  border-radius: 8px;
}
.site-footer-mail:hover { color: var(--accent-hover); }
.site-footer-mail:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
