/* Мобильный переключатель темы и тёмная палитра. На экранах шире 767px файл ничего не меняет. */
.mobile-theme-toggle {
  display: none;
}

@media (max-width: 767px) {
  .mobile-theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    width: 64px;
    height: 34px;
    margin-left: auto;
    padding: 0 7px;
    overflow: hidden;
    border: 1px solid rgba(86, 61, 164, 0.24);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: #6f52d6;
    box-shadow: 0 5px 16px rgba(91, 62, 165, 0.12);
    cursor: pointer;
    isolation: isolate;
  }

  .mobile-theme-toggle:focus-visible {
    outline: 3px solid rgba(138, 111, 254, 0.34);
    outline-offset: 2px;
  }

  .mobile-theme-toggle__sun,
  .mobile-theme-toggle__moon {
    position: relative;
    z-index: 2;
    width: 18px;
    font: 700 17px/1 Arial, sans-serif;
    text-align: center;
    transition: color 180ms ease, opacity 180ms ease;
  }

  .mobile-theme-toggle__moon { color: #8f7ebd; }

  .mobile-theme-toggle__thumb {
    position: absolute;
    z-index: 1;
    top: 3px;
    left: 3px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 3px 10px rgba(46, 26, 101, 0.22);
    transition: transform 200ms ease, background-color 200ms ease;
  }

  .site-footer .mobile-theme-toggle {
    position: absolute;
    right: 18px;
    bottom: 18px;
    z-index: 3;
    margin: 0;
  }

  html[data-mobile-theme="dark"] {
    color-scheme: dark;
    background: #100a1b;

    --navy: #f6f0ff;
    --navy-soft: #c9b8ff;
    --violet: #aa8dff;
    --violet-ring: #bda8ff;
    --violet-light: #8068cf;
    --pink: #ed92ed;
    --pink-light: #7a476f;
    --blue: #91b7ff;
    --blue-light: #38517d;
    --primary: #aa8dff;
    --primary-dark: #8d6df0;
    --ink: #f6f0ff;
    --text: #f3edff;
    --muted: #c3b7dd;
    --bg: #100a1b;
    --card-bg: #211632;
    --card-bg-light: #2b1f40;
    --glass: rgba(31, 21, 48, 0.9);
    --glass-light: rgba(27, 18, 43, 0.9);
    --glass-border: rgba(213, 196, 255, 0.2);
    --border: #4d3b68;

    --hero-ink: #f8f3ff;
    --hero-nav: #f4edff;
    --hero-subtitle: #cbb9ff;
    --hero-copy: #f0e9ff;
    --hero-header-surface: rgba(26, 17, 42, 0.9);
    --hero-header-border: rgba(211, 191, 255, 0.2);
    --hero-header-shadow: 0 20px 55px rgba(0, 0, 0, 0.28);

    --vv-ink: #f8f3ff;
    --vv-lavender: #cdbbff;
    --vv-copy: #f0e9ff;
    --vv-glass: rgba(31, 21, 48, 0.9);
    --vv-border: rgba(213, 196, 255, 0.2);

    --quiz-text: #f6f0ff;
    --quiz-muted: #c3b7dd;
    --quiz-accent: #b397ff;
    --quiz-surface: rgba(31, 21, 48, 0.9);
    --quiz-border: rgba(213, 196, 255, 0.2);
    --quiz-shadow: rgba(0, 0, 0, 0.32);
    --quiz-glow: rgba(170, 141, 255, 0.22);
  }

  html[data-mobile-theme="dark"] .mobile-theme-toggle {
    border-color: rgba(216, 200, 255, 0.24);
    background: rgba(28, 18, 45, 0.94);
    color: #ffdc7a;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  }

  html[data-mobile-theme="dark"] .mobile-theme-toggle__sun { color: #a99dbf; opacity: 0.7; }
  html[data-mobile-theme="dark"] .mobile-theme-toggle__moon { color: #efe7ff; opacity: 1; }
  html[data-mobile-theme="dark"] .mobile-theme-toggle__thumb {
    background: #7456c7;
    transform: translateX(30px);
  }

  html[data-mobile-theme="dark"] body {
    color: var(--text);
    background-color: #100a1b;
    background-image:
      linear-gradient(rgba(14, 9, 25, 0.86), rgba(14, 9, 25, 0.9)),
      url("/images/quiz/background-source.png");
  }

  html[data-mobile-theme="dark"] body.hero-redesign-enabled {
    background-color: #100a1b !important;
    background-image:
      linear-gradient(rgba(14, 9, 25, 0.78), rgba(14, 9, 25, 0.9)),
      var(--vv-exact-background) !important;
  }

  html[data-mobile-theme="dark"] .hero-music-composite { display: none; }
  html[data-mobile-theme="dark"] .hero-bokeh { opacity: 0.22; filter: brightness(0.7); }
  html[data-mobile-theme="dark"] .hero-sparkles { opacity: 0.56; }
  html[data-mobile-theme="dark"] .hero-logo-halo { opacity: 0.65; }

  html[data-mobile-theme="dark"] .header-glass,
  html[data-mobile-theme="dark"] .hero-header,
  html[data-mobile-theme="dark"] .game-card,
  html[data-mobile-theme="dark"] .footer-inner,
  html[data-mobile-theme="dark"] .accordion-item,
  html[data-mobile-theme="dark"] .quiz-perks,
  html[data-mobile-theme="dark"] .event-detail,
  html[data-mobile-theme="dark"] .event-registration {
    border-color: var(--glass-border) !important;
    background: var(--glass-light) !important;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.24), inset 0 1px rgba(255, 255, 255, 0.04);
  }

  html[data-mobile-theme="dark"] .header-glass.nav-open .main-nav {
    border-top-color: rgba(213, 196, 255, 0.16);
  }

  html[data-mobile-theme="dark"] .accordion-item,
  html[data-mobile-theme="dark"] .accordion-item:hover,
  html[data-mobile-theme="dark"] .accordion-item:focus-within,
  html[data-mobile-theme="dark"] .accordion-item:has(.accordion-trigger[aria-expanded="true"]) {
    border-color: rgba(171, 139, 255, 0.52) !important;
    background: linear-gradient(145deg, rgba(48, 34, 71, 0.96), rgba(38, 26, 58, 0.96)) !important;
  }

  html[data-mobile-theme="dark"] .mobile-back-link {
    border-color: rgba(216, 200, 255, 0.2);
    background: rgba(170, 141, 255, 0.12);
    color: var(--navy);
  }

  html[data-mobile-theme="dark"] .public-admin-link,
  html[data-mobile-theme="dark"] .hero-admin-link,
  html[data-mobile-theme="dark"] .game-card-admin-edit {
    border-color: rgba(198, 176, 255, 0.3);
    background: rgba(61, 43, 91, 0.8);
    color: #d8c8ff;
  }

  html[data-mobile-theme="dark"] .game-card-admin-edit:hover,
  html[data-mobile-theme="dark"] .public-admin-link:hover,
  html[data-mobile-theme="dark"] .hero-admin-link:hover {
    background: rgba(75, 54, 108, 0.95);
  }

  html[data-mobile-theme="dark"] .game-card { box-shadow: 0 16px 38px rgba(0, 0, 0, 0.24); }
  html[data-mobile-theme="dark"] .game-card-image-area { background: #251936; }
  html[data-mobile-theme="dark"] .game-card-body {
    border-top-color: rgba(190, 168, 255, 0.22);
    background: linear-gradient(180deg, rgba(45, 32, 65, 0.98), rgba(36, 25, 54, 0.98));
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
  }
  html[data-mobile-theme="dark"] .btn-disabled { background: #393047; color: #978ca9; }

  html[data-mobile-theme="dark"] .alert-success {
    border-color: #2d6749;
    background: #173a2a;
    color: #a9e5c3;
  }

  html[data-mobile-theme="dark"] .popup-overlay { background: rgba(6, 3, 12, 0.72); }
  html[data-mobile-theme="dark"] .popup,
  html[data-mobile-theme="dark"] .quiz-perk-popup {
    border: 1px solid rgba(213, 196, 255, 0.2);
    background: #201531;
    color: var(--text);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.46);
  }

  html[data-mobile-theme="dark"] .quiz-perk-popup__close { background: rgba(170, 141, 255, 0.14); color: var(--quiz-text); }
  html[data-mobile-theme="dark"] .quiz-perk-backdrop { background: rgba(6, 3, 12, 0.58); }

  html[data-mobile-theme="dark"] .reg-form input,
  html[data-mobile-theme="dark"] .reg-form select,
  html[data-mobile-theme="dark"] .reg-form textarea,
  html[data-mobile-theme="dark"] .event-registration__form input,
  html[data-mobile-theme="dark"] .event-registration__form select,
  html[data-mobile-theme="dark"] .event-registration__form textarea {
    border-color: var(--border);
    background: #2a1e3e;
    color: var(--text);
  }

  html[data-mobile-theme="dark"] .reg-form input::placeholder,
  html[data-mobile-theme="dark"] .reg-form textarea::placeholder,
  html[data-mobile-theme="dark"] .event-registration__form input::placeholder,
  html[data-mobile-theme="dark"] .event-registration__form textarea::placeholder {
    color: #9d91b4;
  }

  html[data-mobile-theme="dark"] .phone-input-shell { border-color: var(--border); background: #2a1e3e; }
  html[data-mobile-theme="dark"] .phone-prefix { border-right-color: var(--border); background: #34264b; color: var(--text); }
  html[data-mobile-theme="dark"] .birthday-details { border-color: rgba(170, 141, 255, 0.28); background: rgba(53, 38, 78, 0.8); }
  html[data-mobile-theme="dark"] .birthday-window-note { border-color: rgba(170, 141, 255, 0.24); background: #34264b; color: #c9bddd; }

  html[data-mobile-theme="dark"] .event-breadcrumbs { color: #b4a8ce; }
  html[data-mobile-theme="dark"] .event-breadcrumbs a,
  html[data-mobile-theme="dark"] .game-card-title-link:hover,
  html[data-mobile-theme="dark"] .game-card-title-link:focus-visible { color: #bea8ff; }
  html[data-mobile-theme="dark"] .event-detail__eyebrow { color: #bea8ff; }
  html[data-mobile-theme="dark"] .event-detail h1,
  html[data-mobile-theme="dark"] .event-registration h2 { color: #f6f0ff; }
  html[data-mobile-theme="dark"] .event-detail__description,
  html[data-mobile-theme="dark"] .event-registration__intro p { color: #c5b9db; }
  html[data-mobile-theme="dark"] .event-detail__image img { background: #291d3c; }
  html[data-mobile-theme="dark"] .event-detail__meta div { background: #2c2040; }
  html[data-mobile-theme="dark"] .event-detail__meta dt { color: #a99dbf; }
  html[data-mobile-theme="dark"] .event-detail__meta dd { color: #eee7ff; }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .mobile-theme-toggle__sun,
  .mobile-theme-toggle__moon,
  .mobile-theme-toggle__thumb { transition: none; }
}

@media (max-width: 767px) {
  html[data-mobile-theme="dark"] .registration-privacy-note {
    border-color: rgba(170, 141, 255, 0.28);
    background: rgba(45, 32, 66, 0.88);
    color: #ddd4ef;
  }

  html[data-mobile-theme="dark"] .registration-privacy-note a { color: #c4afff; }
  html[data-mobile-theme="dark"] .birthday-privacy-note { color: #aea2c4; }

  html[data-mobile-theme="dark"] body.legal-page-body,
  html[data-mobile-theme="dark"] .legal-page { background: #100a1b; }
  html[data-mobile-theme="dark"] .legal-document {
    border-color: rgba(170, 141, 255, 0.24);
    background: #21162f;
    color: #d8cfe8;
    box-shadow: none;
  }
  html[data-mobile-theme="dark"] .legal-document__header { border-bottom-color: rgba(170, 141, 255, 0.2); }
  html[data-mobile-theme="dark"] .legal-document h1,
  html[data-mobile-theme="dark"] .legal-document h2 { color: #f6f0ff; }
  html[data-mobile-theme="dark"] .legal-document__subtitle,
  html[data-mobile-theme="dark"] .legal-document__version { color: #b6aacd; }
  html[data-mobile-theme="dark"] .legal-document a { color: #c4afff; }
  html[data-mobile-theme="dark"] .legal-summary { border-color: rgba(170, 141, 255, 0.26); background: #2d2042; }
  html[data-mobile-theme="dark"] .legal-summary strong { color: #eee7ff; }
  html[data-mobile-theme="dark"] .legal-table-wrap { border-color: rgba(170, 141, 255, 0.22); }
  html[data-mobile-theme="dark"] .legal-table { background: #261a38; }
  html[data-mobile-theme="dark"] .legal-table th { background: #34244b; color: #f0eaff; }
  html[data-mobile-theme="dark"] .legal-table td { border-color: rgba(170, 141, 255, 0.14); color: #d8cfe8; }
  html[data-mobile-theme="dark"] .footer-legal { border-top-color: rgba(170, 141, 255, 0.18); color: #a99dbf; }
  html[data-mobile-theme="dark"] .footer-legal-links a { color: #c4afff; }
}
