/* Выбор темы в профиле */
.profile-theme-panel { margin-top: 16px; }
.profile-theme-panel h3 { margin: 0 0 10px; padding-left: 6px; font-size: 16px; color: #fff; }
.theme-selector {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 360px);
  gap: 2px;
  padding: 3px;
  border: 1px solid #2a2a2a;
  border-radius: 13px;
  background: #141414;
}
.theme-option {
  min-width: 0;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #aaa;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.theme-option.active { border-color: rgba(230,193,88,.34); color: var(--accent); background: #222; box-shadow: 0 1px 4px rgba(0,0,0,.14); }
.theme-option-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background-color: currentColor;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.theme-option-icon-sun {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.42 1.42M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.42-1.42M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.42 1.42M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.42-1.42M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E");
}
.theme-option-icon-moon {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E");
}
.theme-toggle {
  width: min(100%, 240px);
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  background: #171717;
  color: #9da2a8;
  display: flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle-track {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 42px;
  border-radius: 999px;
  background: #d7dde3;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  transition: background .18s ease;
}
.theme-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.28);
  transition: transform .18s ease;
}
.theme-toggle.is-dark .theme-toggle-track { background: var(--accent); }
.theme-toggle.is-dark .theme-toggle-thumb { transform: translateX(18px); background: #202124; }
.theme-toggle.is-dark .theme-option-icon-moon,
.theme-toggle:not(.is-dark) .theme-option-icon-sun { color: var(--accent); }
.theme-toggle-label { min-width: 58px; margin-left: 2px; color: inherit; font-size: 12px; font-weight: 700; text-align: left; }
html[data-theme="light"] .theme-toggle { background: #fff; border-color: #d5dbe1; color: #61758b; }
html[data-theme="light"] .theme-toggle-track { background: #c9d4de; }
.theme-toggle-header {
  position: relative;
  width: 66px;
  min-width: 66px;
  height: 34px;
  min-height: 34px;
  padding: 3px 7px;
  border-radius: 999px;
  justify-content: space-between;
  gap: 8px;
  overflow: hidden;
  background: #171717;
}
.theme-toggle-header::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2d2d30;
  box-shadow: 0 1px 4px rgba(0,0,0,.28);
  transition: transform .18s ease, background-color .18s ease;
  pointer-events: none;
}
.theme-toggle-header.is-dark::before { transform: translateX(32px); background: rgba(230,193,88,.16); }
.theme-toggle-header .theme-option-icon {
  position: relative;
  z-index: 1;
  display: block !important;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  color: #74777d;
}
.theme-toggle-header:not(.is-dark) .theme-option-icon-sun,
.theme-toggle-header.is-dark .theme-option-icon-moon { color: var(--accent); }
html[data-theme="light"] .theme-toggle-header { background: #e8edf1; border-color: #cbd5de; }
html[data-theme="light"] .theme-toggle-header::before { background: #fff; box-shadow: 0 1px 4px rgba(24,63,102,.18); }
.theme-option-preview { position: relative; width: 22px; height: 14px; flex: 0 0 22px; overflow: hidden; border: 1px solid rgba(255,255,255,.16); border-radius: 4px; background: #111; }
.theme-option-preview::after { content: ""; position: absolute; right: 3px; bottom: 3px; width: 8px; height: 3px; border-radius: 2px; background: #e6c158; }
.theme-preview-light { background: #f3f5f7; border-color: #cbd5df; }
.theme-preview-light::before { content: ""; position: absolute; inset: 3px; border-radius: 3px; background: #fff; }
.theme-preview-system { background: linear-gradient(90deg, #111 0 50%, #f3f5f7 50%); }

/* Светлая фирменная тема: нейтральный фон, серо-голубые поверхности и синий акцент. */
html[data-theme="light"] {
  --bg: #f7f8f9;
  --card: #eceff2;
  --muted: #68798a;
  --line: #d5dbe1;
  --btn: #e7ebef;
  --accent: #2d659b;
  --good: #249c62;
  --bad: #d5544c;
  --inactive: #dce6ee;
  --future: #cad6e1;
  --empty-border: rgba(23,59,99,.16);
  --action-bg: #326a9f;
  --action-border: #326a9f;
  --action-text: #fff;
  --action-hover: #285b8b;
  --favorite-active-icon: #fff;
  --level-1: #b8cfe2;
  --level-2: #91b3d0;
  --level-3: #779fc2;
  --level-4: #4678a5;
  --level-5: #173b63;
  --level-label: #365d80;
}

html[data-theme="light"],
html[data-theme="light"] body { background: #f7f8f9; color: #173b63; color-scheme: light; }
html[data-theme="light"] body { background: #f7f8f9; }
html[data-theme="light"] .app-wrapper { background: #f7f8f9; }
html[data-theme="light"] .header { background: rgba(241,243,245,.98); border-color: #d5dbe1; color: #173b63; }
html[data-theme="light"] .logo { color: #173b63; }
html[data-theme="light"] .logo .logo-accent { color: #2d659b !important; }
html[data-theme="light"] .logo-img { filter: brightness(0) saturate(100%) invert(34%) sepia(33%) saturate(1430%) hue-rotate(169deg) brightness(90%) contrast(91%); }
html[data-theme="light"] .logo-mark {
  background: transparent;
  border-color: rgba(45,101,155,.48);
  box-shadow: none;
}
html[data-theme="light"] .container { background: #f7f8f9; scrollbar-color: #9aa8b5 #eef0f2; }
html[data-theme="light"] *::-webkit-scrollbar-track { background: #e8edf2; }
html[data-theme="light"] *::-webkit-scrollbar-thumb { background: #8fa9c1; }

html[data-theme="light"] .bottom-nav,
html[data-theme="light"] .test-controls { background: rgba(241,243,245,.98); border-color: #d5dbe1; }
html[data-theme="light"] .nav-btn { color: #61758b; }
html[data-theme="light"] .nav-btn.active,
html[data-theme="light"] .nav-btn:hover { color: #2d659b; }

html[data-theme="light"] .app-loading-overlay,
html[data-theme="light"] .stats-loading { background: rgba(243,245,247,.98); color: #61758b; }
html[data-theme="light"] .app-loading-spinner,
html[data-theme="light"] .stats-loading-spinner { background: rgba(255,255,255,.55); border-color: rgba(45,101,155,.28); }
html[data-theme="light"] .app-loading-spinner::before,
html[data-theme="light"] .stats-loading-spinner::before { background: linear-gradient(134deg, #1d4770 9%, #2d659b 31%, #9bc8eb 48%, #4f86b8 64%, #214f7c 88%); background-size: 260% 260%; }
html[data-theme="light"] .app-loading-spinner::after,
html[data-theme="light"] .stats-loading-spinner::after { background: conic-gradient(from 0deg, transparent 0deg, transparent 145deg, rgba(45,101,155,.025) 180deg, rgba(45,101,155,.10) 225deg, rgba(45,101,155,.28) 270deg, rgba(45,101,155,.68) 320deg, #79afe0 354deg, #b9dcf6 360deg); filter: drop-shadow(0 0 4px rgba(45,101,155,.42)); }

html[data-theme="light"] .card,
html[data-theme="light"] .test-card,
html[data-theme="light"] .profile-card,
html[data-theme="light"] .sub-card,
html[data-theme="light"] .sub-card.active-card,
html[data-theme="light"] .sub-card.free-card,
html[data-theme="light"] .sub-card.full-access-card,
html[data-theme="light"] .stats-section,
html[data-theme="light"] .result-card,
html[data-theme="light"] .question-container,
html[data-theme="light"] .test-confirm-dialog,
html[data-theme="light"] .modal-content {
  background: #eceff2;
  border-color: #d5dbe1;
  color: #173b63;
  box-shadow: 0 8px 28px rgba(23,59,99,.07);
}

html[data-theme="light"] .test-card:hover { background: #e5e9ed; border-color: #7da1c1; }
html[data-theme="light"] .test-card.locked { background: #e9ecef; }
html[data-theme="light"] .test-icon { background: #e2e7ec; border-color: rgba(45,101,155,.28); }

html[data-theme="light"] .theme-card,
html[data-theme="light"] .difficulty-card {
  background: #eceff2;
  border-color: #d5dbe1;
  color: #173b63;
  box-shadow: 0 3px 12px rgba(34,55,76,.035);
}
html[data-theme="light"] .theme-card:hover,
html[data-theme="light"] .difficulty-card:hover {
  background: #e5e9ed;
  border-color: #7da1c1;
  transform: translateX(2px);
}
html[data-theme="light"] .theme-icon {
  background: #e2e7ec;
  border: 1px solid rgba(45,101,155,.28);
}
html[data-theme="light"] .theme-title,
html[data-theme="light"] .difficulty-title { color: #173b63; }
html[data-theme="light"] .theme-count,
html[data-theme="light"] .difficulty-count { color: #68798a; }

html[data-theme="light"] .tests-main-screen > .test-card .test-icon,
html[data-theme="light"] .tests-main-screen > .test-card.locked .test-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #e2e7ec;
  border-color: rgba(45,101,155,.28);
}
html[data-theme="light"] .test-title,
html[data-theme="light"] .profile-info h3,
html[data-theme="light"] .profile-subscriptions-panel h3,
html[data-theme="light"] .profile-theme-panel h3,
html[data-theme="light"] .stats-screen h3,
html[data-theme="light"] .result-title,
html[data-theme="light"] .test-confirm-title,
html[data-theme="light"] .modal-header h3 { color: #173b63; }
html[data-theme="light"] .test-subtitle,
html[data-theme="light"] .profile-info .subtle,
html[data-theme="light"] .subscription-card-description,
html[data-theme="light"] .test-confirm-message,
html[data-theme="light"] .modal-body p { color: #61758b; }

html[data-theme="light"] .stats-cards .stat-card,
html[data-theme="light"] .stat-card { background: #eceff2; border-color: #d5dbe1; color: #173b63; }
html[data-theme="light"] .stat-number,
html[data-theme="light"] .stats-item-value { color: #173b63; }
html[data-theme="light"] .stat-label,
html[data-theme="light"] .stats-item-label { color: #61758b; }
html[data-theme="light"] .stats-item-hint { color: #76899c; }
html[data-theme="light"] .progress-bar-container { background: #cfd9e2; }

html[data-theme="light"] .button { background: #e7ebef; color: #173b63; border-color: #d1d8df; }
html[data-theme="light"] .button.primary,
html[data-theme="light"] .bottom-nav .controls-wrap #backBtn { background: var(--action-bg) !important; border-color: var(--action-border) !important; color: var(--action-text) !important; }
html[data-theme="light"] .button.ghost { background: transparent; border-color: rgba(45,101,155,.55); color: #214f7c; }
html[data-theme="light"] .controls-wrap .button { background: #e7ebef; color: #173b63; border-color: #d1d8df; }

html[data-theme="light"] .answer-option,
html[data-theme="light"] #testArea .button:not(.primary):not(.ghost),
html[data-theme="light"] .answer-btn { background: #fafbfc; color: #173b63; border-color: #d2dbe3; }
html[data-theme="light"] .badge { background: #e4edf5; color: #173b63; border-color: #b9cadb; }
html[data-theme="light"] .question-text,
html[data-theme="light"] .ans-text { color: #173b63; }
html[data-theme="light"] .button.selected { background: #d8e8f5 !important; border-color: #2d659b !important; color: #173b63 !important; }
html[data-theme="light"] .button.correct-permanent { background: rgba(36,156,98,.14) !important; border-color: #249c62 !important; color: #173b63 !important; }
html[data-theme="light"] .button.wrong-permanent { background: rgba(213,84,76,.13) !important; border-color: #d5544c !important; color: #173b63 !important; }

html[data-theme="light"] .result-stat .stat-value { color: #173b63; }
html[data-theme="light"] .result-stat-correct .stat-value { color: #249c62; }
html[data-theme="light"] .result-stat-wrong .stat-value { color: #d5544c; }
html[data-theme="light"] .result-stat-total .stat-value { color: #2d659b; }
html[data-theme="light"] .result-stat:not(:last-child)::after { background: rgba(23,59,99,.12); }
html[data-theme="light"] .result-buttons .button { background: #f5f9fc; color: #173b63; border-color: rgba(45,101,155,.45); }
html[data-theme="light"] .result-buttons .button.primary { background: #2d659b; color: #fff; }

html[data-theme="light"] .test-confirm-overlay,
html[data-theme="light"] .modal-overlay { background: rgba(39,65,91,.42); }
html[data-theme="light"] .test-confirm-btn { background: #dce5ed; color: #173b63; border-color: #cbd5df; }
html[data-theme="light"] .test-confirm-accept { background: #2d659b; color: #fff; border-color: #2d659b; }

html[data-theme="light"] .electric-home { color: #173b63; }
html[data-theme="light"] .eh-intro { background: #eceff2; border-color: #d5dbe1; }
html[data-theme="light"] .eh-visual { background: #e2e6ea; border-color: #d5dbe1; }
html[data-theme="light"] .eh-copy p,
html[data-theme="light"] .eh-feature p,
html[data-theme="light"] .eh-donut p,
html[data-theme="light"] .eh-levels { color: #61758b; }
html[data-theme="light"] .eh-feature-grid { border-color: rgba(23,59,99,.15); }
html[data-theme="light"] .eh-feature { border-color: rgba(23,59,99,.13); }
html[data-theme="light"] .eh-number { color: #214f7c; border-color: rgba(45,101,155,.38); background: #d8e8f5; }
html[data-theme="light"] .eh-donut { background: rgba(255,255,255,.48); border-color: rgba(45,101,155,.30); }
html[data-theme="light"] .eh-start { background: #2d659b; color: #fff; }

html[data-theme="light"] .profile-stats-btn { color: #214f7c; background: #d8e8f5; border-color: rgba(45,101,155,.45); }
html[data-theme="light"] .sub-card-icon { background: #e3edf5; }
html[data-theme="light"] .access-action-btn,
html[data-theme="light"] .sub-card-btn { background: #2d659b; color: #fff; }
html[data-theme="light"] .theme-selector { background: #e8ebee; border-color: #d5dbe1; }
html[data-theme="light"] .theme-option { background: transparent; color: #68798a; border-color: transparent; }
html[data-theme="light"] .theme-option.active { color: #214f7c; border-color: #b6c9da; background: #fff; box-shadow: 0 2px 8px rgba(31,55,79,.09); }
html[data-theme="light"] .theme-option-preview::after { background: #2d659b; }

@media (hover: hover) {
  html[data-theme="light"] .button:hover:not(:disabled),
  html[data-theme="light"] .controls-wrap .button:hover:not(:disabled),
  html[data-theme="light"] .result-buttons .button:hover:not(:disabled) {
    background: #dde3e8 !important;
    border-color: #91abc2 !important;
    color: #173b63 !important;
    opacity: 1;
  }
  html[data-theme="light"] .button.primary:hover:not(:disabled),
  html[data-theme="light"] .controls-wrap .button.primary:hover:not(:disabled),
  html[data-theme="light"] .bottom-nav .controls-wrap #backBtn:hover {
    background: var(--action-hover) !important;
    border-color: var(--action-hover) !important;
    color: var(--action-text) !important;
  }
  html[data-theme="light"] .nav-btn:hover { background: transparent !important; color: #2d659b !important; }
  html[data-theme="light"] .theme-option:hover { background: rgba(255,255,255,.58); color: #214f7c; }
}

@media (max-width: 560px) {
  .theme-selector { gap: 2px; padding: 3px; }
  .theme-option { min-height: 40px; padding: 6px 3px; gap: 4px; font-size: 11px; }
  .theme-option-icon { width: 18px; height: 18px; flex-basis: 18px; }
}

/* Полный аудит контраста светлой темы. Текст использует фирменные оттенки синего. */
html[data-theme="light"] {
  --light-text: #183f66;
  --light-text-strong: #12385f;
  --light-text-muted: #55718c;
  --light-surface: #f2f3f4;
  --light-answer: #f7f8fa;
}
html[data-theme="light"] body,
html[data-theme="light"] .card,
html[data-theme="light"] .test-card,
html[data-theme="light"] .theme-card,
html[data-theme="light"] .difficulty-card,
html[data-theme="light"] .profile-card,
html[data-theme="light"] .sub-card { color: var(--light-text); }
html[data-theme="light"] .question-title,
html[data-theme="light"] #testArea .question-title,
html[data-theme="light"] .test-title,
html[data-theme="light"] .theme-title,
html[data-theme="light"] .difficulty-title,
html[data-theme="light"] .sub-card-info h4,
html[data-theme="light"] .subscription-card-main h4,
html[data-theme="light"] .profile-info h3 { color: var(--light-text-strong) !important; }

html[data-theme="light"] .question-title {
  background: #edf3f8;
  border-color: #cbd9e5;
  border-left-color: #326a9f;
}
html[data-theme="light"] .test-subtitle,
html[data-theme="light"] .theme-count,
html[data-theme="light"] .difficulty-count,
html[data-theme="light"] .sub-card-info p,
html[data-theme="light"] .subscription-card-description,
html[data-theme="light"] .stats-item-hint { color: var(--light-text-muted) !important; }

html[data-theme="light"] #answers .button,
html[data-theme="light"] #answers .answer-multiple,
html[data-theme="light"] .answer-option,
html[data-theme="light"] .answer-btn {
  background: var(--light-answer) !important;
  color: var(--light-text-strong) !important;
  border-color: #d5dce3 !important;
}
html[data-theme="light"] #answers .ans-text,
html[data-theme="light"] #answers .answer-multiple .ans-text { color: var(--light-text-strong) !important; }
html[data-theme="light"] #answers .badge { color: #194d7c; background: #e9eff5; border-color: #bdcedd; }
html[data-theme="light"] #answers .button.correct-permanent,
html[data-theme="light"] #answers .answer-multiple.correct-permanent {
  background: rgba(36,156,98,.14) !important;
  border-color: #249c62 !important;
  color: var(--light-text-strong) !important;
}
html[data-theme="light"] #answers .button.wrong-permanent,
html[data-theme="light"] #answers .answer-multiple.wrong-permanent {
  background: rgba(213,84,76,.13) !important;
  border-color: #d5544c !important;
  color: var(--light-text-strong) !important;
}

html[data-theme="light"] .pill,
html[data-theme="light"] #timer { color: #365d80 !important; background: #e9edf1 !important; border-color: #d4dbe2 !important; }
html[data-theme="light"] .progress-bar { background: #dbe2e8; }
html[data-theme="light"] .progress { background: #326a9f; }
html[data-theme="light"] .progress-bar::after {
  background-image: repeating-linear-gradient(
    90deg,
    transparent,
    transparent calc(100% / var(--total) - 2px),
    rgba(24,63,102,.56) calc(100% / var(--total) - 2px),
    rgba(24,63,102,.56) calc(100% / var(--total))
  );
}
html[data-theme="light"] .progress-bar-container { background: #d7e0e7; }
html[data-theme="light"] .progress-bar-fill { background: #326a9f !important; }
html[data-theme="light"] .stats-item-value { color: var(--light-text-strong); }

html[data-theme="light"] .single-subscription-card,
html[data-theme="light"] .single-subscription-card.needs-access-card,
html[data-theme="light"] .single-subscription-card.full-access-card,
html[data-theme="light"] .sub-card.active-card,
html[data-theme="light"] .sub-card.free-card,
html[data-theme="light"] .sub-card.full-access-card {
  background: var(--light-surface) !important;
  border-color: #dedfe2 !important;
}
html[data-theme="light"] .subscription-card-description { border-color: #d8dde2; }
html[data-theme="light"] .sub-card-icon.subscription-icon { background: #e8eef4; color: #326a9f; }

/* На сенсорных устройствах не допускаем залипания desktop-hover и чёрных карточек. */
@media (hover: none), (pointer: coarse) {
  html[data-theme="light"] .test-card:hover,
  html[data-theme="light"] .test-card:active,
  html[data-theme="light"] .theme-card:hover,
  html[data-theme="light"] .theme-card:active,
  html[data-theme="light"] .difficulty-card:hover,
  html[data-theme="light"] .difficulty-card:active,
  html[data-theme="light"] .sub-card:hover,
  html[data-theme="light"] .sub-card:active {
    background: var(--light-surface) !important;
    border-color: #dedfe2 !important;
    color: var(--light-text) !important;
    transform: none !important;
  }
  html[data-theme="light"] #answers .button:hover:not(.correct-permanent):not(.wrong-permanent):not(.selected),
  html[data-theme="light"] #answers .button:active:not(.correct-permanent):not(.wrong-permanent):not(.selected),
  html[data-theme="light"] #answers .answer-multiple:hover:not(.correct-permanent):not(.wrong-permanent):not(.multiple-selected),
  html[data-theme="light"] #answers .answer-multiple:active:not(.correct-permanent):not(.wrong-permanent):not(.multiple-selected),
  html[data-theme="light"] .controls-wrap .button:hover,
  html[data-theme="light"] .controls-wrap .button:active {
    background: var(--light-answer) !important;
    color: var(--light-text-strong) !important;
    border-color: #d5dce3 !important;
    transform: none !important;
  }
  html[data-theme="light"] .nav-btn:hover,
  html[data-theme="light"] .nav-btn:active { background: transparent !important; color: #647b91 !important; }
  html[data-theme="light"] .nav-btn.active:hover,
  html[data-theme="light"] .nav-btn.active:active { color: #326a9f !important; }
  html[data-theme="light"] .theme-option:hover,
  html[data-theme="light"] .theme-option:active { background: transparent !important; color: #55718c !important; }
  html[data-theme="light"] .theme-option.active:hover,
  html[data-theme="light"] .theme-option.active:active { background: #fff !important; color: #214f7c !important; }
  html[data-theme="light"] .controls-wrap #backBtn:hover,
  html[data-theme="light"] .controls-wrap #backBtn:active,
  html[data-theme="light"] .controls-wrap .button.primary:hover,
  html[data-theme="light"] .controls-wrap .button.primary:active {
    background: var(--action-bg) !important;
    border-color: var(--action-border) !important;
    color: var(--action-text) !important;
  }
}

/* Выбранные варианты multiple должны быть заметны и не перекрываться общим фоном ответов. */
html[data-theme="light"] #answers .answer-multiple.multiple-selected {
  background: #d9e8f5 !important;
  border-color: #2d659b !important;
  color: #173b63 !important;
  box-shadow: inset 0 0 0 1px #2d659b, 0 3px 10px rgba(45,101,155,.12) !important;
}

html[data-theme="light"] #answers .answer-multiple.multiple-selected .badge {
  background: #2d659b !important;
  border-color: #2d659b !important;
  color: #fff !important;
}

@media (hover: none), (pointer: coarse) {
  html[data-theme="light"] #answers .answer-multiple.multiple-selected:hover,
  html[data-theme="light"] #answers .answer-multiple.multiple-selected:active {
    background: #d9e8f5 !important;
    border-color: #2d659b !important;
    box-shadow: inset 0 0 0 1px #2d659b, 0 3px 10px rgba(45,101,155,.12) !important;
  }
}

html[data-theme="light"] #testControls .button.ghost,
html[data-theme="light"] #testControls .button.ghost:hover,
html[data-theme="light"] #testControls .button.ghost:active,
html[data-theme="light"] #testControls .button.ghost:focus {
  color: #245b8c !important;
}

/* Главная и статистика: синие тексты и явно отделённые информационные блоки. */
html[data-theme="light"] .electric-home,
html[data-theme="light"] .eh-intro h1,
html[data-theme="light"] .eh-feature h3,
html[data-theme="light"] .eh-section-heading h2,
html[data-theme="light"] .eh-copy h2 { color: #173f67 !important; }
html[data-theme="light"] .eh-copy p,
html[data-theme="light"] .eh-feature p,
html[data-theme="light"] .eh-donut p,
html[data-theme="light"] .eh-note,
html[data-theme="light"] .eh-section-heading > span { color: #526f8a !important; }
html[data-theme="light"] .eh-intro h1 span { color: inherit !important; }

html[data-theme="light"] .stats-cards .stat-card {
  background: #e7eef5;
  border: 1px solid #c8d7e4;
  box-shadow: 0 5px 15px rgba(24,63,102,.07);
}
html[data-theme="light"] .stats-cards .stat-number { color: #174b7a; }
html[data-theme="light"] .stats-cards .stat-label { color: #58728a; }
html[data-theme="light"] .stats-section {
  background: #eef2f6;
  border: 1px solid #d2dce5;
  box-shadow: 0 7px 20px rgba(24,63,102,.055);
}
html[data-theme="light"] .stats-section .stats-item {
  padding-bottom: 15px;
  border-bottom: 1px solid #d7e0e8;
}
html[data-theme="light"] .stats-section .stats-item:last-of-type {
  padding-bottom: 0;
  border-bottom: 0;
}
html[data-theme="light"] .stats-item-label { color: #173f67; }
html[data-theme="light"] .stats-item-value { color: #123f69; }
html[data-theme="light"] .stats-item-hint { color: #526f8a !important; }

html[data-theme="light"] .stats-view-switch {
  background: #e8edf2;
  border-color: #c5d2de;
}
html[data-theme="light"] .stats-view-mode { color: #58718a; }
html[data-theme="light"] .stats-view-mode.active {
  color: #fff;
  background: #326fa7;
  box-shadow: 0 3px 9px rgba(45,101,155,.18);
}
html[data-theme="light"] .stats-summary-card {
  background: #d8e8f5;
  border-color: #8ab6da;
  box-shadow: 0 6px 16px rgba(45,101,155,.10);
}
html[data-theme="light"] .stats-summary-value { color: #174b7a; }
html[data-theme="light"] .stats-summary-label { color: #173f67; }
html[data-theme="light"] .stats-summary-hint { color: #526f8a; }
html[data-theme="light"] .stats-summary-metrics > span + span { border-left-color: #8ab6da; }
html[data-theme="light"] .stats-summary-metrics strong { color: #174b7a; }
html[data-theme="light"] .stats-summary-metrics small { color: #526f8a; }

/* Акцентные счётчики повторяют оформление кнопки «Статистика» в профиле. */
html[data-theme="light"] .stats-cards .stat-card {
  background: #d8e8f5 !important;
  border: 1px solid #8ab6da !important;
  box-shadow: 0 6px 16px rgba(45,101,155,.10);
}
html[data-theme="light"] .profile-stats-btn { background: #d8e8f5 !important; border-color: #8ab6da !important; }

/* Разбор ошибок в светлой теме. */
html[data-theme="light"] .mistakes-review-screen h3,
html[data-theme="light"] .mistakes-review-screen .question-title {
  color: #173f67 !important;
}
html[data-theme="light"] .results-review-tabs { background: #edf2f6; border-color: #c8d6e2; }
html[data-theme="light"] .results-review-tab.review-errors-tab { color: #d5544c; }
html[data-theme="light"] .results-review-tab.review-correct-tab { color: #249c62; }
html[data-theme="light"] .results-review-tab.review-errors-tab.active { background: rgba(213,84,76,.13); color: #b53e38; box-shadow: inset 0 0 0 1px #d5544c; }
html[data-theme="light"] .results-review-tab.review-correct-tab.active { background: rgba(36,156,98,.14); color: #197847; box-shadow: inset 0 0 0 1px #249c62; }
html[data-theme="light"] .results-review-heading { background: var(--bg); }
html[data-theme="light"] .results-review-tab span { background: rgba(23,63,103,.09); color: inherit; }
html[data-theme="light"] .results-review-tab.active span { background: rgba(255,255,255,.42); }
html[data-theme="light"] .mistakes-review-screen .comment {
  background: #edf2f6;
  border-color: #ccd9e4;
  border-left-color: #326a9f;
  color: #244f78 !important;
  box-shadow: 0 4px 14px rgba(24,63,102,.08);
}
html[data-theme="light"] .mistakes-review-screen .comment .icon-comment { background-color: #326a9f !important; }
html[data-theme="light"] .review-ntd-link { background: #eaf3fa; border-color: #78add6; color: #173f67; }
html[data-theme="light"] .review-ntd-link:hover { background: #deedf8; border-color: #326a9f; }
html[data-theme="light"] .review-ntd-icon { background: rgba(50,106,159,.12); border-color: #78add6; color: #326a9f; }
html[data-theme="light"] .review-ntd-reference { color: #326a9f !important; }
html[data-theme="light"] .review-ntd-open { background: #326a9f; color: #fff !important; }
html[data-theme="light"] .mistakes-review-screen .review-correct-pill {
  color: #197847 !important;
  border-color: #249c62 !important;
  background: rgba(36,156,98,.14) !important;
}
html[data-theme="light"] .mistakes-review-screen .review-error-pill {
  color: #b53e38 !important;
  border-color: #d5544c !important;
  background: rgba(213,84,76,.13) !important;
}
html[data-theme="light"] .card [data-fav-btn] { background: #edf2f6; border-color: #c8d6e2; }
html[data-theme="light"] .card [data-fav-btn] .icon-favorite-on { background-color: #326a9f !important; }
html[data-theme="light"] .card [data-fav-btn] .icon-favorite-off { background-color: #71879b !important; }

/* Плитки показателей результата. */
html[data-theme="light"] .result-card .result-stat { background: #e8edf2; border-color: #d2dbe3; }
@media (hover: none), (pointer: coarse) {
  html[data-theme="light"] .card [data-fav-btn]:hover,
  html[data-theme="light"] .card [data-fav-btn]:active { background: #edf2f6 !important; }
}
html[data-theme="light"] .stats-cards .stat-number { color: #174b7a; }
html[data-theme="light"] .stats-cards .stat-label { color: #466985; }

/* Финальная настройка светлой темы: нейтральные поверхности и высокий контраст. */
html[data-theme="light"] {
  --bg: #fafafa;
  --card: #f2f3f4;
  --muted: #5f6872;
  --line: #dedfe2;
  --btn: #eceef0;
  --accent: #326a9f;
}
html[data-theme="light"],
html[data-theme="light"] body,
html[data-theme="light"] .app-wrapper,
html[data-theme="light"] .container { background: #fafafa; color: #202124; }
html[data-theme="light"] .header,
html[data-theme="light"] .bottom-nav,
html[data-theme="light"] .test-controls { background: rgba(247,247,248,.98); border-color: #dedfe2; }
html[data-theme="light"] .logo { color: #202124; }
html[data-theme="light"] .logo .logo-accent {
  color: #326a9f !important;
  background: none !important;
  background-image: none !important;
  -webkit-background-clip: initial !important;
  background-clip: initial !important;
  -webkit-text-fill-color: #326a9f !important;
}
html[data-theme="light"] .card,
html[data-theme="light"] .test-card,
html[data-theme="light"] .theme-card,
html[data-theme="light"] .difficulty-card,
html[data-theme="light"] .profile-card,
html[data-theme="light"] .sub-card,
html[data-theme="light"] .stats-section,
html[data-theme="light"] .result-card,
html[data-theme="light"] .question-container,
html[data-theme="light"] .modal-content,
html[data-theme="light"] .eh-intro,
html[data-theme="light"] .stats-cards .stat-card,
html[data-theme="light"] .stat-card {
  background: #f2f3f4;
  border-color: #dedfe2;
  color: #202124;
  box-shadow: 0 8px 28px rgba(32,33,36,.05);
}
html[data-theme="light"] .test-card:hover,
html[data-theme="light"] .theme-card:hover,
html[data-theme="light"] .difficulty-card:hover { background: #e9ebed; border-color: #9ab2c9; }
html[data-theme="light"] .button,
html[data-theme="light"] .controls-wrap .button { background: #eceef0; color: #202124; border-color: #d8dade; }
html[data-theme="light"] .answer-option,
html[data-theme="light"] #testArea .button:not(.primary):not(.ghost),
html[data-theme="light"] .answer-btn { background: #fff; color: #202124; border-color: #d8dde2; }
html[data-theme="light"] #testArea .question-text,
html[data-theme="light"] .question-text,
html[data-theme="light"] .ans-text { color: #202124 !important; }
html[data-theme="light"] .timer,
html[data-theme="light"] .question-counter { color: #39434d !important; background: #eceef0; border-color: #d8dade; }

html[data-theme="light"] .electric-home,
html[data-theme="light"] .eh-intro h1,
html[data-theme="light"] .eh-feature h3,
html[data-theme="light"] .eh-section-heading h2 { color: #202124; }
html[data-theme="light"] .eh-intro h1 span { color: inherit; }
html[data-theme="light"] .eh-copy p,
html[data-theme="light"] .eh-feature p,
html[data-theme="light"] .eh-donut p { color: #505a64; }
html[data-theme="light"] .eh-levels { font-weight: 700; }

/* Фон и рамка иконок режимов полностью совпадают с нумерацией главной. */
html[data-theme="light"] .eh-number,
html[data-theme="light"] .tests-main-screen.view-tiles > .test-card .test-icon,
html[data-theme="light"] .tests-main-screen.view-tiles > .test-card.locked .test-icon {
  width: 62px;
  height: 62px;
  flex: 0 0 62px;
  border-radius: 14px;
  color: #244f78;
  background: #e8edf2;
  border: 1px solid rgba(50,106,159,.30);
  box-shadow: none;
}
html[data-theme="light"] .theme-icon { background: #e8edf2; border-color: rgba(50,106,159,.30); }
html[data-theme="light"] .difficulty-emoji { border-color: rgba(23,59,99,.18); }
html[data-theme="light"] .theme-selector { background: #edeef0; border-color: #dedfe2; }
html[data-theme="light"] .theme-option.active { background: #fff; border-color: #bdcad6; }

@media (hover: hover) {
  html[data-theme="light"] .button:hover:not(:disabled),
  html[data-theme="light"] .controls-wrap .button:hover:not(:disabled),
  html[data-theme="light"] .result-buttons .button:hover:not(:disabled) {
    background: #e3e6e9 !important;
    color: #202124 !important;
    border-color: #98acbe !important;
  }
}

@media (max-width: 560px) {
  html[data-theme="light"] .tests-main-screen.view-tiles > .test-card .test-icon,
  html[data-theme="light"] .tests-main-screen.view-tiles > .test-card.locked .test-icon {
    width: 66px;
    height: 66px;
    flex-basis: 66px;
    border-radius: 14px;
  }
}

/* Переключатель темы повторяет палитру и состояния переключателя списка/плиток. */
.profile-actions-inline .profile-theme-toggle {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.09);
  color: #8f949b;
}
.profile-actions-inline .profile-theme-toggle::before { background: #e6c158; box-shadow: none; }
.profile-actions-inline .profile-theme-toggle:not(.is-dark) .theme-option-icon-sun,
.profile-actions-inline .profile-theme-toggle.is-dark .theme-option-icon-moon { color: #171717; }
.profile-actions-inline .profile-theme-toggle:not(.is-dark) .theme-option-icon-moon,
.profile-actions-inline .profile-theme-toggle.is-dark .theme-option-icon-sun { color: #8f949b; }
.profile-actions-inline .profile-stats-inline {
  background: #e6c158;
  border-color: #e6c158;
  color: #171717;
}
html[data-theme="light"] .profile-actions-inline .profile-theme-toggle {
  background: #e8edf2 !important;
  border-color: #c5d2de !important;
  color: #58718a;
}
html[data-theme="light"] .profile-actions-inline .profile-theme-toggle::before {
  background: #326fa7;
  box-shadow: 0 3px 9px rgba(45,101,155,.18);
}
html[data-theme="light"] .profile-actions-inline .profile-theme-toggle:not(.is-dark) .theme-option-icon-sun,
html[data-theme="light"] .profile-actions-inline .profile-theme-toggle.is-dark .theme-option-icon-moon { color: #fff; }
html[data-theme="light"] .profile-actions-inline .profile-theme-toggle:not(.is-dark) .theme-option-icon-moon,
html[data-theme="light"] .profile-actions-inline .profile-theme-toggle.is-dark .theme-option-icon-sun { color: #58718a; }
html[data-theme="light"] .profile-actions-inline .profile-stats-inline {
  background: #286da8 !important;
  border-color: #286da8 !important;
  color: #fff !important;
}

/* Поля и состояния промокода в светлой теме. */
html[data-theme="light"] .promo-modal-content {
  background: #f2f3f4;
  border-color: #d5dbe1;
  color: #173b63;
}
html[data-theme="light"] .promo-modal-content .modal-header {
  border-bottom-color: #d5dbe1;
}
html[data-theme="light"] .promo-modal-content .modal-close {
  background: #fff;
  border-color: #c5d2de;
  color: #326fa7;
}
html[data-theme="light"] .promo-code-input {
  background: #fff;
  color: #173b63;
  border-color: #a9bfd2;
  caret-color: #326fa7;
}
html[data-theme="light"] .promo-code-input::placeholder { color: #71879b; }
html[data-theme="light"] .promo-code-input:focus {
  border-color: #326fa7;
  box-shadow: 0 0 0 3px rgba(50,111,167,.13);
}
html[data-theme="light"] .promo-modal-content .modal-subscribe-btn {
  background: #286da8;
  border-color: #286da8;
  color: #fff;
}
html[data-theme="light"] .promo-modal-status { color: #58718a; }
html[data-theme="light"] .promo-modal-status.success { color: #18794e; }
html[data-theme="light"] .promo-modal-status.error { color: #b42318; }

html[data-theme="light"] .profile-support-card {
  background: #f2f3f4;
  border-color: #dedfe2;
  box-shadow: 0 8px 28px rgba(32,33,36,.05);
}
html[data-theme="light"] .profile-support-panel > h3 { color: #173b63; }
html[data-theme="light"] .profile-support-description { color: #61758b; }
html[data-theme="light"] .profile-support-channel {
  background: transparent;
  border-color: transparent;
  color: #326a9f;
}
html[data-theme="light"] .profile-support-icon { background: #e8edf2; border-color: rgba(50,106,159,.30); }
html[data-theme="light"] .profile-support-channel > span:last-child { color: #55718c; }

@media (hover: hover) {
  html[data-theme="light"] .profile-support-channel:not([aria-disabled="true"]):hover .profile-support-icon {
    background: #dbe7f1;
    border-color: #7da1c1;
  }
}

/* В светлой теме итоговый процент использует фирменный синий цвет. */
html[data-theme="light"] .result-percent { color: #2d659b; }
html[data-theme="light"] .result-card .result-stat { background: #e8edf2; border-color: #d2dbe3; }
