/*
Сторінка тесту швидкості: те, чого немає в спільному оформленні .hi.

Обкладинка тут без фото: тест сам є картинкою. Замість знімка тьмяне чорнило
з двома м'якими плямами кольору, щоб біла картка з віджетом читалась як
головний об'єкт сторінки.
*/

/* ---------- обкладинка ---------- */

.st .st-hero {
  /* Потоки даних, що сходяться в дугу спідометра за віджетом. Згенеровано
     на canvas; ліва частина свідомо темна, щоб текст читався без плашки */
  background: #0d1a1e url('/static/img/speedtest/hero-desktop.jpg') 70% 50% / cover no-repeat;
}

.st .st-hero::before { display: none; }

.st .st-hero > .container {
  padding-top: 44px;
  padding-bottom: 44px;
}

.st .st-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  gap: 32px 48px;
  align-items: center;
}

.st .st-hero h1 { max-width: none; }

.st .st-hero .hi-stats { margin-bottom: 0; }
.st .st-hero .hi-stats li { min-width: 150px; }

/* ---------- картка з віджетом ---------- */

.st .st-widget {
  background: #fff;
  border-radius: 18px;
  padding: 18px 18px 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  color: var(--ink);
}

/* Віджет nPerf малює свій iframe; поки він вантажиться, картка тримає висоту,
   щоб сторінка не стрибала */
.st .st-widget__frame {
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.st .st-widget__frame iframe { max-width: 100%; }

.st .st-widget__note {
  margin: 12px 4px 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-faint);
}

.st .st-demo {
  margin-top: 12px;
  width: 100%;
}

/* ---------- результат ---------- */

.st .st-result__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px 28px;
}

.st .st-result__nums {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 16px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.st .st-num {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.st .st-num__label {
  font-size: 14px;
  color: var(--ink-soft);
}

.st .st-num__value {
  font-size: 40px;
  line-height: 1.05;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.st .st-num--dl .st-num__value {
  font-size: 64px;
  color: var(--accent-dark);
}

.st .st-num__unit {
  font-size: 14px;
  color: var(--ink-faint);
}

.st .st-verdict {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.st .st-verdict p {
  max-width: 720px;
  margin-bottom: 0;
}

.st .st-verdict__badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  border-radius: 100px;
  padding: 4px 12px;
  margin-bottom: 10px;
  background: var(--ink-soft);
}

.st .st-verdict__badge.is-slow { background: #c8392b; }
.st .st-verdict__badge.is-ok { background: #d98b1c; }
.st .st-verdict__badge.is-good { background: var(--power); }
.st .st-verdict__badge.is-great { background: var(--accent); }

.st .st-bars { margin-top: 18px; }

.st .st-bars + .hi-note { margin-top: 6px; }

/* Порівняння з тарифом */

.st .st-plan {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.st .st-plan label {
  display: block;
  margin-bottom: 10px;
  font-weight: 400;
}

.st .st-plan label b {
  display: block;
  font-weight: 600;
  margin-bottom: 2px;
}

.st .st-plan label span {
  font-size: 14px;
  color: var(--ink-soft);
}

.st .st-plan__row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.st .st-plan__row .form-control {
  width: 120px;
  height: 46px;
  font-size: 18px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.st .st-plan__row .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 100, 35, .2);
}

.st .st-plan__unit { color: var(--ink-soft); }

.st .st-plan__pct {
  font-size: 22px;
  font-weight: 700;
  margin-left: 8px;
  color: var(--power);
}

.st .st-plan__pct.is-low { color: #c8392b; }

.st .st-plan .hi-note { margin: 10px 0 0; }

.st .st-result__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 20px;
}

.st .st-result__actions .btn {
  padding: 10px 18px;
  font-size: 15px;
}

/* Заклик під результатом ближчий до картки, ніж звичайний */
.st .st-cta { margin-top: 16px; }

/* ---------- пошук за адресою внизу ---------- */

.st .st-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 24px 40px;
  align-items: center;
  margin: 40px 0 0;
  padding: 36px 40px;
  border-radius: 18px;
  color: #fff;
  background: #0d1a1e url('/static/img/speedtest/hero-desktop.jpg') 85% 55% / cover no-repeat;
}

.st .st-search h2 {
  color: #fff;
  font-size: 28px;
  margin-bottom: 8px;
}

.st .st-search__text p {
  color: rgba(255, 255, 255, .8);
  margin: 0;
}

.st .st-search__row {
  display: flex;
  gap: 10px;
}

.st .st-search__field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.st .st-search__field .twitter-typeahead { width: 100%; }

.st .st-search .check-street__input {
  width: 100%;
  height: 56px;
  font-size: 17px;
  padding: 0 52px 0 18px;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  color: var(--ink);
}

.st .st-search .check-street__input:focus {
  box-shadow: 0 0 0 3px rgba(255, 100, 35, .55), 0 10px 30px rgba(0, 0, 0, .3);
}

.st .st-search .btn-gps {
  right: 12px;
  z-index: 10;
}

.st .st-search .tt-menu { color: var(--ink); }

.st .st-search__btn {
  flex: 0 0 auto;
  height: 56px;
  margin: 0;
  padding: 0 26px;
  border-radius: 10px;
  white-space: nowrap;
}

.st .st-search__more {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 14px;
  font-size: 14px;
  color: rgba(255, 255, 255, .7);
}

.st .st-search__more a {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, .4);
  text-underline-offset: 2px;
}

.st .st-search__more a:hover { text-decoration-color: #fff; }

/* ---------- поле адреси в картці результату ---------- */

/* Той самий ряд, що в темному блоці внизу, але на світлому тлі картки:
   поле з рамкою замість тіні, кнопка без переносу. Сам ряд успадковує
   .st-search__row / .st-search__field */
.st .st-cta--search {
  display: block;
}

.st .st-cta--search .hi-cta__text { margin-bottom: 14px; }

.st .st-cta__search { max-width: 640px; }

.st .st-cta__search .check-street__input {
  width: 100%;
  height: 54px;
  font-size: 17px;
  padding: 0 52px 0 18px;
  border: 2px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: none;
  background: #fff;
  color: var(--ink);
}

.st .st-cta__search .check-street__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 100, 35, .18);
  outline: none;
}

.st .st-cta__search .btn-gps { right: 14px; z-index: 10; }

.st .st-cta__search .st-search__btn { height: 54px; }

.st .st-cta__more {
  margin: 10px 4px 0;
  font-size: 14px;
}

.st .st-cta__more a {
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

@media (max-width: 600px) {
  .st .st-cta__search .st-search__row { flex-direction: column; }
  .st .st-cta__search .st-search__btn { width: 100%; }
}

/* ---------- тарифи під результатом ---------- */

.st .st-offers {
  margin-top: 28px;
}

.st .st-offers h3 {
  font-size: 22px;
  margin-bottom: 4px;
}

.st .st-offers .hi-note {
  margin-bottom: 8px;
  max-width: 760px;
}

/* Сітка та сама, що в блоці популярних тарифів (partials/tariff-switcher) */
.st .st-offers__cards {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -8px;
}

.st .st-offers__cards .card-item {
  flex: 0 0 33.33%;
  max-width: 33.33%;
  padding: 8px;
  display: flex;
}

.st .st-offers__cards .card-tariff {
  width: 100%;
  border-radius: 12px;
}

@media (max-width: 992px) {
  .st .st-offers__cards .card-item { flex: 0 0 50%; max-width: 50%; }
}

@media (max-width: 600px) {
  .st .st-offers__cards .card-item { flex: 0 0 100%; max-width: 100%; }
}

/* ---------- таблиці ---------- */

/* Провайдер у таблиці: логотип веде на сторінку провайдера, назву поруч не
   дублюємо (вона в alt). Дрібне посилання поруч веде на його тест швидкості. Логотипи в базі 3:2
   (222×152, у частини 108×73), тому рамка тієї ж пропорції */
.st .st-isp {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.st .st-isp__logo {
  flex: 0 0 66px;
  display: block;
  line-height: 0;
}

.st .st-isp__logo img {
  display: block;
  width: 66px;
  height: 45px;
  object-fit: contain;
  border-radius: 6px;
}

.st .st-isp__test {
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 2px;
}

.st .st-isp__test:hover { color: var(--accent-dark); }

.st .hi-prices .st-isp__coverage {
  padding: 8px 14px;
  font-size: 14px;
  white-space: nowrap;
}

.st .st-debug {
  font-size: 12px;
  max-height: 420px;
  overflow: auto;
  margin-top: 24px;
}

.st .st-table__note {
  font-size: 14px;
  color: var(--ink-soft);
}

/* ---------- липка кнопка на телефоні ---------- */

.st .st-sticky {
  display: none;
}

/* ---------- адаптив ---------- */

@media (max-width: 991px) {
  .st .st-hero__grid {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .st .st-widget { max-width: 560px; }
}

@media (max-width: 991px) {
  .st .st-search {
    grid-template-columns: 1fr;
    padding: 28px 24px;
  }
}

@media (max-width: 767px) {
  .st .st-hero {
    background-image: url('/static/img/speedtest/hero-mobile.jpg');
    background-position: 50% 100%;
  }

  .st .st-search {
    padding: 24px 18px;
    margin-left: -8px;
    margin-right: -8px;
    background-image: url('/static/img/speedtest/hero-mobile.jpg');
    background-position: 50% 90%;
  }

  .st .st-search h2 { font-size: 23px; }

  .st .st-search__row { flex-direction: column; }

  .st .st-search__btn { width: 100%; }

  .st .st-hero > .container {
    padding-top: 26px;
    padding-bottom: 28px;
  }

  .st .st-hero h1 { font-size: 30px; }

  .st .st-hero .hi-hero__sub {
    font-size: 16px;
    margin-bottom: 18px;
  }

  .st .st-hero .hi-stats { display: none; }

  .st .st-widget {
    padding: 10px 10px 12px;
    border-radius: 14px;
  }

  .st .st-widget__frame { min-height: 320px; }

  .st .st-result__card { padding: 20px 18px; }

  .st .st-result__nums {
    grid-template-columns: 1fr 1fr;
  }

  .st .st-num--dl { grid-column: 1 / -1; }

  .st .st-num--dl .st-num__value { font-size: 56px; }
  .st .st-num__value { font-size: 32px; }

  .st .st-sticky {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(46, 67, 72, .12);
  }

  .st .st-sticky[hidden] { display: none; }

  /* Щоб липка кнопка не закривала останній блок і підвал */
  .st.has-result { padding-bottom: 76px; }

  .st .st-table--isps .hi-range { display: none; }

  .st .st-table--isps .st-isp__coverage { width: 100%; }

  .st .st-sticky .btn {
    width: 100%;
    margin: 0;
  }
}

@media (max-width: 991px) {
  /* Таблиці на планшеті й телефоні: кожен рядок стає карткою. Шість колонок
     не влазять уже на 800 пікселях, а .hi-prices ховає все, що вилізло */
  .st .st-table--isps thead { display: none; }

  .st .st-table--isps table,
  .st .st-table--isps tbody { display: block; width: 100%; }

  .st .st-table--isps tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 10px;
    padding: 14px 16px;
    border-top: 1px solid var(--line);
  }

  .st .st-table--isps tbody tr:first-child { border-top: 0; }

  .st .st-table--isps tbody th,
  .st .st-table--isps tbody td {
    display: block;
    padding: 0;
    border: 0;
  }

  .st .st-table--isps tbody th { grid-column: 1 / -1; width: auto; }

  .st .st-table--isps tbody td:last-child { grid-column: 1 / -1; }

  /* Кількість тестів на телефоні зайва: вона є в описі блоку */
  .st .st-table--isps tbody td[data-label]:nth-of-type(1) { display: none; }

  .st .st-table--isps tbody td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    color: var(--ink-faint);
    font-weight: 400;
  }

  .st .st-table--isps .hi-price { font-size: 18px; }


  /* Таблиця потреб: примітка йде другим рядком під задачею */
  .st .st-table--norm thead { display: none; }
  .st .st-table--norm table,
  .st .st-table--norm tbody { display: block; width: 100%; }

  .st .st-table--norm tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--line);
  }

  .st .st-table--norm tbody tr:first-child { border-top: 0; }

  .st .st-table--norm tbody th,
  .st .st-table--norm tbody td { display: block; padding: 0; border: 0; width: auto; }

  .st .st-table--norm tbody td { text-align: right; }
  .st .st-table--norm .st-table__note { grid-column: 1 / -1; text-align: left; }
  .st .st-table--norm .st-table__note:empty { display: none; }
}
