/* Визуальный язык мобильного клиента «Знатокия» (quiz-mobile-client/styles/colors.ts):
   белые экраны, жирные чёрные заголовки Helvetica Neue, серые карточки без рамок,
   акцентный синий, градиент иконки. Тёмная тема повторяет чёрные экраны входа. */
:root {
  --bg: #ffffff; /* SCREEN_BG */
  --card: #f1f1f1; /* CARD_BG */
  --input: #e9e9ea; /* поле ввода в чате поддержки */
  --title: #111111; /* TITLE */
  --text: #212121; /* TEXT_PRIMARY */
  --muted: #616161; /* GREY_700 */
  --section: #6f6f6f; /* серые заголовки разделов (GREY_500, затемнён для контраста) */
  --divider: #e3e3e3; /* DIVIDER_DARK */
  --button: #000000; /* TAB_BG */
  --button-text: #ffffff;
  --link: #0a78c2; /* ACCENT_BLUE, затемнён до контраста AA на белом */
  --accent: #1aa7ff; /* ACCENT_BLUE */
  --danger: #d32f2f; /* RED_300 */
  --danger-bg: #fdeaea;
  --notice-bg: #e6f4fe; /* фон адаптивной иконки Android */
  --brand-from: #05ee78; /* градиент иконки приложения */
  --brand-to: #0096ff;
  --radius: 15px;
  --radius-control: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; /* BG_DARK */
    --card: rgba(255, 255, 255, 0.12);
    --input: rgba(255, 255, 255, 0.15);
    --title: #ffffff;
    --text: #ececec;
    --muted: #b3bac2; /* GREY_300 */
    --section: #a3a3a3;
    --divider: rgba(255, 255, 255, 0.16);
    --button: #ffffff; /* BUTTON_DEFAULT_BG */
    --button-text: #000000;
    --link: #1aa7ff;
    --danger: #ff6b6b;
    --danger-bg: rgba(211, 47, 47, 0.22);
    --notice-bg: rgba(26, 167, 255, 0.18);
  }
}

/* Язык. С JS — по html[data-lang]; без JS — русский по умолчанию, английский по ссылке #en. */
html[data-lang='ru'] [data-l='en'],
html[data-lang='en'] [data-l='ru'],
html:not([data-lang]) #en:not(:target) ~ * [data-l='en'],
html:not([data-lang]) #en:target ~ * [data-l='ru'] {
  display: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 'Helvetica Neue', Helvetica, Arial, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 17px;
}

.lang-anchor {
  position: absolute;
  top: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 16px;
  top: 8px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 8px;
}

a {
  color: var(--link);
  text-underline-offset: 2px;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

h3[tabindex]:focus,
h2[tabindex]:focus {
  outline: none;
}

/* Шапка: иконка приложения + сегментный переключатель языка, как на экране входа. */
.site-header {
  border-bottom: 1px solid var(--divider);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--title);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand img {
  display: block;
  border-radius: 10px; /* у иконки белая подложка — на чёрном фоне выглядит как иконка приложения */
}

.lang-switch {
  display: flex;
  padding: 4px;
  border-radius: 14px;
  background: var(--card);
}

.lang-switch a {
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--muted);
}

.lang-switch a:hover {
  color: var(--title);
}

html[data-lang='ru'] .lang-switch a[data-set-lang='ru'],
html[data-lang='en'] .lang-switch a[data-set-lang='en'] {
  background: var(--bg);
  color: var(--title);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* Раскладка: на телефоне одна колонка, форма идёт сразу после «Как удалить». */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 48px;
  padding-top: 28px;
  padding-bottom: 56px;
}

@media (min-width: 920px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 380px;
    align-items: start;
  }

  .layout > section {
    grid-column: 1;
  }

  .layout > aside {
    grid-column: 2;
    grid-row: 1 / span 12;
    position: sticky;
    top: 24px;
    margin-top: 0;
  }
}

/* Полоса с градиентом иконки — единственный цветной акцент в шапке страницы. */
.hero::before {
  content: '';
  display: block;
  width: 56px;
  height: 6px;
  margin-bottom: 18px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brand-from), var(--brand-to));
}

h1 {
  margin: 0 0 8px;
  color: var(--title);
  font-size: clamp(28px, 6vw, 40px); /* FONT.hero */
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

/* Серые заголовки разделов, как на экране настроек. */
h2 {
  margin: 36px 0 14px;
  color: var(--section);
  font-size: 24px;
  font-weight: 400;
  line-height: 29px;
}

h3 {
  margin: 0 0 4px;
  color: var(--title);
  font-size: 18px;
  font-weight: 700;
}

p {
  margin: 0 0 12px;
}

strong {
  color: var(--title);
}

ul {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  border-radius: var(--radius);
  background: var(--card);
}

/* Списки — строки настроек с тонким разделителем. */
ul > li {
  margin: 0 0 0 17px;
  padding: 13px 17px 13px 0;
  border-bottom: 1px solid var(--divider);
}

ul > li:last-child,
html[data-lang='ru'] ul > li[data-l='ru']:has(+ li[data-l='en']),
html:not([data-lang]) ul > li[data-l='ru']:has(+ li[data-l='en']) {
  border-bottom: 0;
}

.developer {
  color: var(--muted);
  font-weight: 500;
}

.lead {
  font-size: 18px;
}

.methods {
  list-style: none;
  counter-reset: method;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.methods > li {
  counter-increment: method;
  position: relative;
  margin: 0;
  padding: 17px 17px 17px 64px;
  background: var(--card);
  border-radius: var(--radius);
}

.methods > li::before {
  content: counter(method);
  position: absolute;
  left: 17px;
  top: 17px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-from), var(--brand-to));
  color: #ffffff;
  font-weight: 700;
  display: grid;
  place-items: center;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
}

.methods .btn {
  margin-top: 2px;
}

.callout,
.warning {
  padding: 14px 17px;
  border-radius: var(--radius);
  background: var(--notice-bg);
}

.warning {
  background: var(--danger-bg);
}

/* Карточка формы */
.card {
  margin-top: 20px;
  padding: 22px 20px;
  background: var(--card);
  border-radius: 20px;
  scroll-margin-top: 16px;
}

.card h2 {
  margin: 0 0 12px;
  color: var(--title);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
}

.field {
  margin-bottom: 12px;
}

label {
  display: block;
  margin: 0 0 6px 4px;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
}

input,
textarea {
  width: 100%;
  padding: 14px 16px;
  font: inherit;
  color: var(--title);
  background: var(--bg);
  border: 0;
  border-radius: var(--radius-control);
}

@media (prefers-color-scheme: dark) {
  input,
  textarea {
    background: var(--input);
  }
}

textarea {
  display: block;
  resize: vertical;
}

.hint {
  color: var(--muted);
  font-size: 14px;
}

.field .hint {
  margin: 6px 0 0 4px;
}

.social-hint {
  margin: 16px 0 0;
}

.phrase {
  padding: 14px 12px;
  color: var(--title);
  font: 600 16px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: center;
  overflow-wrap: anywhere;
  background: var(--bg);
  border-radius: var(--radius-control);
  /* Фразу нужно набрать руками — это защита от случайного удаления. */
  -webkit-user-select: none;
  user-select: none;
}

@media (prefers-color-scheme: dark) {
  .phrase {
    background: var(--input);
  }
}

.notice,
.error {
  padding: 12px 14px;
  border-radius: var(--radius-control);
  font-size: 15px;
}

.notice {
  background: var(--notice-bg);
}

.error {
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 500;
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--divider);
  font-size: 14px;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

/* Опасное действие визуально отделено от безопасного. */
.danger-zone {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--divider);
}

/* Кнопки клиента: радиус 12, полужирный текст, нажатие — прозрачность 0.8. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 22px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  border: 0;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: opacity 0.12s;
}

.btn:active:not([disabled]) {
  opacity: 0.8;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: default;
}

.btn-block,
.card form > .btn {
  width: 100%;
}

.btn-primary {
  background: var(--button);
  color: var(--button-text);
}

.btn-secondary {
  background: var(--bg);
  color: var(--title);
}

.card .btn-secondary {
  box-shadow: inset 0 0 0 1px var(--divider);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

@media (prefers-color-scheme: dark) {
  .btn-secondary {
    background: var(--input);
  }

  .btn-danger {
    background: #d32f2f;
  }
}

.btn-danger-outline {
  width: 100%;
  background: transparent;
  color: var(--danger);
  box-shadow: inset 0 0 0 1.5px var(--danger);
}

/* Текстовая кнопка, как «Готово» в настройках. */
.btn-link {
  min-height: 0;
  padding: 4px;
  background: none;
  color: var(--link);
  font-weight: 500;
}

.site-footer {
  padding: 20px 0 36px;
  border-top: 1px solid var(--divider);
  color: var(--muted);
  font-size: 14px;
}

/* ---- Главная ---- */
/* Поля по бокам — цвета краёв видео, чтобы на широких экранах оно не обрывалось. */
.banner {
  background: linear-gradient(90deg, #f0cb6e 50%, #52e6ce 50%);
}

.banner video {
  display: block;
  width: 100%;
  max-width: 1200px;
  height: auto;
  margin: 0 auto;
}

.download {
  text-align: center;
  padding: 40px 0 48px;
}

.download .lead {
  color: var(--muted);
  margin-bottom: 32px;
}

.stores {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px;
}

.store {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  padding: 8px 16px 8px 12px;
  background: var(--button);
  color: var(--button-text);
  text-decoration: none;
  text-align: left;
  line-height: 1.15;
  border-radius: 10px;
}

.badge svg {
  width: 28px;
  height: 28px;
  flex: none;
  fill: currentColor;
}

.badge small {
  display: block;
  font-size: 11px;
  opacity: 0.85;
}

.badge b {
  display: block;
  font-size: 18px;
  font-weight: 600;
}

/* QR всегда на белом — иначе не сканируется в тёмной теме. */
.qr {
  width: 160px;
  height: 160px;
  padding: 8px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.qr svg {
  display: block;
  width: 100%;
  height: 100%;
}

html[data-platform='ios'] .store[data-platform='android'],
html[data-platform='android'] .store[data-platform='ios'] {
  display: none;
}

.qr-hint {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 600px) {
  .qr,
  .qr-hint {
    display: none; /* на телефоне QR сканировать нечем */
  }
}

/* Общий футер */
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-bottom: 12px;
}

.site-footer a {
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.site-footer p {
  margin: 0;
}

/* Строка прайса: название слева, цена справа. */
.price-list > li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.price-list > li > span:last-child {
  color: var(--title);
  font-weight: 700;
  white-space: nowrap;
}

h3:has(+ p + .price-list, + .price-list) {
  margin-top: 20px;
}

/* ---- Ссылки на тему /t/, приглашения /r/, 404 ---- */
.link-page {
  max-width: 640px;
  padding-top: 36px;
  padding-bottom: 48px;
  text-align: center;
}

.link-page .lead {
  color: var(--muted);
}

.link-cover {
  display: block;
  margin: 0 auto 20px;
  border-radius: 28px;
  object-fit: cover;
}

.link-avatar {
  border-radius: 50%;
}

.link-page .stores {
  margin: 28px 0;
}

.news {
  margin-top: 24px;
}

.badge img {
  flex: none;
  border-radius: 7px;
}

.link-open {
  margin-top: -12px;
}
