:root {
  --cobalt: #2F3BFF;
  --cobalt-deep: #1C25C9;
  --ink: #12142B;
  --paper: #FFFFFF;
  --mist: #EEF0FF;
  --signal: #FFD84A;
  --signal-deep: #F5C518;
  --muted: #5A5E7A;
  --line: #DCDFF5;
  --page: #FFFFFF;
  --danger-bg: #FFE3E0;
  --danger: #A3160C;

  --display: "Unbounded", system-ui, sans-serif;
  --body: "Onest", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ECEEFF;
    --paper: #171A3A;
    --mist: #1F2350;
    --muted: #A3A7CC;
    --line: #2E3368;
    --page: #10122A;
    --cobalt: #3341FF;
    --cobalt-deep: #2029D6;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 17px/1.55 var(--body);
}

h1, h2 { font-family: var(--display); line-height: 1.05; }

:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Hero ---------- */

.hero { background: var(--cobalt); color: #fff; }

.hero-inner {
  max-width: 980px; margin: 0 auto;
  padding: 22px 16px 40px;
}

.logo {
  font-family: var(--display); font-weight: 800; font-size: 19px;
  color: #fff; text-decoration: none;
}

.hero h1 {
  font-weight: 800;
  font-size: clamp(40px, 8.5vw, 92px);
  letter-spacing: -0.02em;
  margin: 56px 0 32px;
}

.search {
  display: flex;
  background: #fff;
  border-radius: 20px;
  padding: 6px;
  box-shadow: 0 0 0 6px var(--cobalt-deep);
}

.search input {
  flex: 1; min-width: 0;
  border: 0; background: transparent;
  padding: 16px 16px;
  font: 500 18px var(--body); color: #12142B;
}
.search input::placeholder { color: #8A8DA8; }
.search input:focus { outline: none; }
.search:focus-within { box-shadow: 0 0 0 6px var(--signal); }

.btn-signal {
  border: 0; border-radius: 14px;
  background: var(--signal); color: #12142B;
  font: 700 17px var(--display);
  padding: 0 28px; min-height: 56px;
  cursor: pointer;
}
.btn-signal:hover:not(:disabled) { background: var(--signal-deep); }
.btn-signal:disabled { background: #E4E5EF; color: #8A8DA8; cursor: default; }

.error {
  margin: 16px 0 0; padding: 12px 16px;
  background: var(--danger-bg); color: var(--danger);
  border-radius: 12px; font-weight: 500;
}

.platforms {
  list-style: none; padding: 0; margin: 22px 0 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.platforms li {
  padding: 6px 14px; border-radius: 999px;
  font-size: 15px; font-weight: 500;
  color: rgba(255, 255, 255, .78);
  border: 1.5px solid rgba(255, 255, 255, .28);
  transition: background .2s, color .2s, border-color .2s;
}
.platforms li.on { background: #fff; color: var(--cobalt); border-color: #fff; }

/* ---------- Result ---------- */

main { max-width: 980px; margin: 0 auto; padding: 0 16px; }

.result { margin-top: 40px; }

.result-head {
  display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start;
}
.thumb {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: 14px; background: var(--mist);
}
.source { margin: 0 0 6px; color: var(--cobalt); font-weight: 600; font-size: 15px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .source { color: #9AA2FF; }
}
.result h2 {
  font-family: var(--body); font-weight: 600; font-size: 22px; line-height: 1.3;
  margin: 0 0 6px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.byline { margin: 0; color: var(--muted); font-size: 15px; display: flex; gap: 14px; flex-wrap: wrap; }

.options { list-style: none; padding: 0; margin: 28px 0 0; border-top: 2px solid var(--ink); }

.option {
  display: grid; grid-template-columns: minmax(150px, 220px) 1fr auto;
  align-items: center; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.option .q {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(34px, 6vw, 52px); line-height: 1; letter-spacing: -0.03em;
}
.option .q small { font-size: .42em; font-weight: 700; letter-spacing: 0; margin-left: 2px; color: var(--muted); }
.option .q.word { font-size: clamp(26px, 4.5vw, 36px); }
.option .info { color: var(--muted); font-size: 15px; }
.option .info b { color: var(--ink); font-weight: 600; margin-right: 10px; }
.option .btn-signal { min-height: 48px; padding: 0 22px; font-size: 15px; }

/* ---------- Steps & FAQ ---------- */

.steps, .faq { margin-top: 72px; max-width: 680px; }
.steps h2, .faq h2 { font-size: 28px; margin: 0 0 20px; }

.steps ol { list-style: none; counter-reset: step; padding: 0; margin: 0; }
.steps li {
  counter-increment: step;
  position: relative; padding: 0 0 18px 56px; min-height: 40px;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: -2px;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--mist); color: var(--cobalt);
  font: 700 16px var(--display);
}

.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; list-style: none;
  padding: 16px 32px 16px 0; position: relative;
  font-weight: 600;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 4px; top: 12px;
  font: 500 24px var(--display); color: var(--cobalt);
}
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 0 18px; color: var(--muted); }

.footer {
  max-width: 980px; margin: 80px auto 0; padding: 24px 16px 40px;
  color: var(--muted); font-size: 14px; border-top: 1px solid var(--line);
}
.footer p { margin: 0; }

/* ---------- Ad modal ---------- */

.modal {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(10, 12, 40, .72);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal[hidden] { display: none; }

.modal-box {
  width: 100%; max-width: 680px;
  background: var(--paper); border-radius: 22px; padding: 18px;
  animation: pop .22s ease-out;
}
@keyframes pop { from { transform: translateY(12px); opacity: 0; } }

.modal-head { margin: 2px 4px 14px; color: var(--muted); font-size: 15px; }

.ad-slot {
  min-height: 320px; border-radius: 14px; overflow: hidden;
  background: #0E1030; color: #9EA2C8;
  display: flex; align-items: center; justify-content: center; text-align: center;
}

.progress { height: 8px; border-radius: 99px; background: var(--mist); margin: 16px 0 0; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--signal); border-radius: 99px; transition: width 1s linear; }

.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; }
.ad-status { font-weight: 500; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero h1 { margin: 40px 0 24px; }
  .search { flex-direction: column; gap: 6px; }
  .search .btn-signal { width: 100%; }
  .result-head { grid-template-columns: 1fr; }
  .option { grid-template-columns: 1fr auto; row-gap: 2px; }
  .option .info { grid-column: 1; grid-row: 2; }
  .option .btn-signal { grid-column: 2; grid-row: 1 / span 2; }
  .modal-foot { flex-direction: column; align-items: stretch; }
  .ad-slot { min-height: 240px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- SEO-страницы ---------- */

.hero h1 { margin-bottom: 14px; }
.lead { margin: 0 0 28px; font-size: 19px; color: rgba(255, 255, 255, .86); max-width: 40ch; }
.lead-link { color: #fff; }

.platforms li { padding: 0; }
.platforms li a { display: block; padding: 6px 14px; color: inherit; text-decoration: none; border-radius: inherit; }
.platforms li:hover:not(.on) { border-color: rgba(255, 255, 255, .7); color: #fff; }

.footer-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 18px; font-size: 15px; }
.footer-nav a { color: var(--ink); text-decoration: none; }
.footer-nav a:hover { text-decoration: underline; }
.footer-nav [aria-current] { color: var(--muted); }

/* ---------- Языки, капча, сноски ---------- */

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.langs { position: relative; }
.langs summary {
  list-style: none; cursor: pointer;
  padding: 6px 12px; border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, .35);
  font: 600 14px var(--display); color: #fff;
}
.langs summary::-webkit-details-marker { display: none; }
.langs[open] summary { background: #fff; color: var(--cobalt); border-color: #fff; }
.langs ul {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 5;
  list-style: none; margin: 0; padding: 6px; min-width: 200px;
  background: var(--paper); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(10, 12, 40, .25);
}
.langs a { display: block; padding: 9px 12px; border-radius: 9px; color: var(--ink); text-decoration: none; }
.langs a:hover { background: var(--mist); }
.langs a[aria-current] { font-weight: 600; color: var(--cobalt); }

/* Виджет капчи работает в фоне, на странице его не видно */
.captcha {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.legal { margin-top: 12px !important; font-size: 13px; }

/* ---------- Очередь в окне рекламы ---------- */

.modal-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-close {
  flex: none; width: 36px; height: 36px; margin: -4px -4px 0 0;
  border: 0; border-radius: 50%; background: transparent;
  font: 400 26px/1 var(--body); color: var(--muted); cursor: pointer;
}
.modal-close:hover { background: var(--mist); color: var(--ink); }
.ad-texts { display: flex; flex-direction: column; gap: 2px; }
.job-status { font-size: 14px; color: var(--muted); }

/* ---------- Блоки страниц: преимущества, плитки, статьи ---------- */

.features, .tiles-section, .article { margin-top: 72px; }
.features h2, .tiles-section h2 { font-size: 28px; margin: 0 0 20px; }
.section-lead { margin: -8px 0 20px; color: var(--muted); max-width: 60ch; }

.features-list {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px;
  border-top: 2px solid var(--ink);
}
.features-list li { padding: 20px 0; border-bottom: 1px solid var(--line); }
.features-list h3 {
  font: 700 20px/1.2 var(--display); margin: 0 0 8px; letter-spacing: -0.01em;
}
.features-list p { margin: 0; color: var(--muted); }

.tiles {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px;
}
.tiles-wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tiles a {
  display: flex; flex-direction: column; gap: 4px; height: 100%;
  padding: 16px 18px; border-radius: 16px;
  background: var(--mist); color: var(--ink); text-decoration: none;
  transition: background .15s, color .15s;
}
.tiles b { font: 700 18px/1.2 var(--display); }
.tiles span { font-size: 14px; color: var(--muted); transition: color .15s; }
.tiles a:hover, .tiles a[aria-current] { background: var(--cobalt); color: #fff; }
.tiles a:hover span, .tiles a[aria-current] span { color: rgba(255, 255, 255, .8); }

.article { max-width: 680px; }
.article section + section { margin-top: 40px; }
.article h2 { font-size: 24px; margin: 0 0 14px; }
.article p { margin: 0 0 12px; }
.article ol { padding: 0; margin: 0; list-style: none; }
.article ol.numbered { counter-reset: step; }
.article ol.numbered li {
  counter-increment: step; position: relative;
  padding: 0 0 16px 52px; min-height: 38px;
}
.article ol.numbered li::before {
  content: counter(step);
  position: absolute; left: 0; top: -4px;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--mist); color: var(--cobalt);
  font: 700 15px var(--display);
}
.article ol.plain { padding-left: 22px; list-style: disc; }
.article ol.plain li { margin-bottom: 6px; }

/* ---------- Футер из колонок ---------- */

.footer-cols {
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px;
  margin-bottom: 28px;
}
.footer-cols h2 { font: 700 15px var(--display); color: var(--ink); margin: 0 0 12px; }
.footer-cols ul { list-style: none; padding: 0; margin: 0; }
.footer-cols nav:first-child ul { columns: 2; column-gap: 24px; }
.footer-cols li { margin-bottom: 8px; break-inside: avoid; }
.footer-cols a { color: var(--ink); text-decoration: none; }
.footer-cols a:hover { text-decoration: underline; }
.footer-cols [aria-current] { color: var(--muted); }

@media (max-width: 640px) {
  .features-list { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles-wide { grid-template-columns: 1fr; }
  .tiles b { font-size: 16px; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
  .footer-cols nav:first-child { grid-column: 1 / -1; }
}

/* Длинные слова в заголовках («конфиденциальности») переносим, а не обрезаем */
.hero h1 { overflow-wrap: break-word; }
.hero-legal h1 { font-size: clamp(32px, 6.5vw, 68px); hyphens: auto; }
.hero-guide h1 { font-size: clamp(26px, 7vw, 80px); }

@media (max-width: 640px) {
  .tiles a { padding: 14px 12px; }
  .tiles b { font-size: 14.5px; hyphens: auto; overflow-wrap: break-word; }
}

/* Превью ролика в окне, когда у сети нет баннера */
.ad-preview { position: relative; width: 100%; height: 100%; min-height: inherit; display: flex; align-items: flex-end; }
.ad-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.ad-preview p {
  position: relative; margin: 0; padding: 20px; width: 100%;
  color: #fff; font: 600 18px/1.3 var(--body); text-align: left;
  background: linear-gradient(transparent, rgba(10, 12, 40, .85));
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* Донаты */
.donate { margin: 0 0 12px !important; color: var(--ink); }
.donate a, .donate-hint a { color: var(--cobalt); font-weight: 600; }
.donate-hint { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--mist); font-size: 15px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .donate a, :root:not([data-theme="light"]) .donate-hint a { color: #9AA2FF; }
}

/* Баннер на главной. Высота зарезервирована, чтобы страница не прыгала при загрузке рекламы */
.ad-banner { margin: 40px auto 0; max-width: 728px; text-align: center; }
.ad-label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.ad-banner-slot {
  min-height: 90px; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; overflow: hidden;
}
@media (max-width: 640px) { .ad-banner-slot { min-height: 250px; } }

/* Пока сеть не прислала баннер (модерация, нет рекламы для страны), пустой блок с подписью не показываем */
.ad-banner:has(div[id^="container-"]:empty) { display: none; }
