:root {
  color-scheme: dark;
  --bg: #0f1720;
  --bg-deep: #070c12;
  --bg-alt: #16212c;
  --card: #1c2b38;
  --accent: #2bff9e;
  --accent-dark: #17c876;
  --accent-glow: rgba(43, 255, 158, 0.22);
  --text: #e8eef2;
  --text-muted: #9fb0bd;
  --border: #2a3b48;
  --danger-bg: #3a2a1a;
  --danger-text: #ffb238;
  --negative: #ff6b6b;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --radius: 12px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
/* Якорь не должен уезжать под липкую шапку */
[id] { scroll-margin-top: 80px; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

a { color: var(--accent); text-decoration: none; }

.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #06251a; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn-primary:disabled:hover { background: var(--accent); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}
.logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.logo-accent { color: var(--accent); }
.logo-icon { height: 31px; width: auto; }
.nav { display: flex; gap: 24px; }
.nav a { color: var(--text-muted); font-weight: 500; }
.nav a:hover { color: var(--text); }
.cart-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
}
.cart-count {
  background: var(--accent);
  color: #06251a;
  border-radius: 999px;
  padding: 2px 8px;
  font-weight: 700;
  margin-left: 6px;
}
.cart-count[hidden] { display: none; }

.hero {
  position: relative;
  padding: clamp(48px, 8vw, 88px) 0;
  background:
    radial-gradient(70% 90% at 78% 45%, var(--accent-glow) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-alt) 100%);
  overflow: hidden;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  align-items: center;
}
.hero-text h1 {
  font-size: clamp(28px, 6.5vw, 52px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}
.subtitle { color: var(--text-muted); font-size: clamp(15px, 2.4vw, 18px); }
.cta-row { display: flex; gap: 14px; margin: 28px 0 0; flex-wrap: wrap; }

.hero-trust {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin: 28px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
}
.hero-trust li { display: flex; align-items: center; gap: 8px; }
.hero-trust li::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.disclaimer {
  background: var(--danger-bg);
  color: var(--danger-text);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
}
.product-placeholder {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 15px;
}
.product-placeholder.small { aspect-ratio: 4/3; max-width: 280px; }

picture { display: contents; }
picture source { display: none; }

.product-photo {
  width: 100%;
  max-width: 320px;
  height: auto;
  border-radius: var(--radius);
  display: block;
}
.hero-image .product-photo {
  max-width: 420px;
  margin-left: auto;
  filter: drop-shadow(0 24px 48px rgba(0, 0, 0, 0.5))
          drop-shadow(0 0 32px var(--accent-glow));
}
.product-photo.small { max-width: 196px; }

.wide-photo {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
  margin: 16px 0;
  border: 1px solid var(--border);
}

.stats { padding: 40px 0; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.stat-value { font-size: 28px; font-weight: 800; color: var(--accent); }
.stat-label { color: var(--text-muted); margin-top: 6px; font-size: 14px; }

.section { padding: clamp(48px, 8vw, 88px) 0; }
.section-alt { background: var(--bg-alt); }
.section h2 {
  font-size: clamp(24px, 4.5vw, 34px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 24px;
}
.section-lead { color: var(--text-muted); margin-bottom: 24px; }

.problems-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.problems-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 16px;
}
.problem-icon { font-size: 20px; }
.problems-list strong { color: var(--accent); }

/* Продукт — ключевой блок, выделен акцентной рамкой */
.product-card {
  background: var(--card);
  border: 1px solid var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow), var(--shadow);
  border-radius: var(--radius);
  padding: 24px;
  display: grid;
  grid-template-columns: 196px 1fr;
  gap: 24px;
}
.product-info h3 { margin-top: 0; }
.price-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 20px 0 8px; }
.price { font-size: 24px; font-weight: 800; }
.qty-control {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
}
.qty-control button {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text);
  /* 44px — минимальный комфортный тач-таргет */
  width: 44px;
  height: 44px;
  border-radius: 50%;
  line-height: 1;
}
.qty-control button:hover:not(:disabled) { background: var(--bg-alt); }
.qty-control button:disabled { opacity: 0.35; cursor: default; }
#qtyValue, .qty-value { min-width: 24px; text-align: center; font-weight: 700; }

/* В корзине степпер лежит на карточке — отделяем его фоном */
.qty-control-sm { gap: 0; background: var(--bg-alt); }
.fine-print { color: var(--text-muted); font-size: 13px; }

/* Калькулятор — ключевой блок, выделен акцентной рамкой */
.calc-card {
  background: var(--card);
  border: 1px solid var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow), var(--shadow);
  border-radius: var(--radius);
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.calc-inputs { display: flex; flex-direction: column; gap: 14px; }
.calc-inputs label {
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.calc-inputs input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
/* Убираем стрелки-спиннеры у числовых полей */
.calc-inputs input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.calc-inputs input[type="number"]::-webkit-outer-spin-button,
.calc-inputs input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.calc-results {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
}
.calc-headline { text-align: center; }
.calc-headline-label {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 4px;
}
.calc-headline-value {
  font-size: clamp(32px, 9vw, 48px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.calc-headline-value.is-negative { color: var(--negative); }
.calc-headline-note {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 6px;
  min-height: 1.4em;
}
.calc-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.calc-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.calc-row span:last-child {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.how-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.how-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #06251a;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  margin-bottom: 12px;
}

.tests-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.test-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.test-card h4 { margin-top: 0; }

.results-section h3 { font-size: 18px; margin: 28px 0 12px; }

.metric-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.metric-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  min-height: 40px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.metric-btn.is-active { background: var(--accent); color: #06251a; }

.bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 52px;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.bar-label { color: var(--text-muted); }
.bar-track {
  height: 10px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
  /* Максимум по метрике: 18% экономии, 80% выбросов */
  width: calc(var(--fuel) / 18 * 100%);
  transform-origin: left;
  transition: transform 0.7s ease, width 0.35s ease;
}
/* Схлопнуты только если скрипт жив — без JS полосы просто видны */
.bars.is-animatable .bar-fill { transform: scaleX(0); }
.bars.is-animatable.is-revealed .bar-fill { transform: scaleX(1); }
.bars.metric-emis .bar-fill { width: calc(var(--emis) / 80 * 100%); }
.bars.metric-emis .no-emis .bar-fill { width: 0; }

.bar-value {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.bar-value .v-emis { display: none; }
.bars.metric-emis .v-fuel { display: none; }
.bars.metric-emis .v-emis { display: inline; }
.bars.metric-emis .no-emis .bar-value { color: var(--text-muted); font-weight: 400; }

.faq-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
}
.faq-item summary { cursor: pointer; font-weight: 600; }
.faq-item p { color: var(--text-muted); margin-bottom: 0; }

.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 40px 0 20px;
  margin-top: 40px;
}
.footer-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}
.footer-inner h4 { margin-bottom: 8px; }
.footer-inner p { color: var(--text-muted); font-size: 14px; margin: 4px 0; }
.copyright {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 30px;
}

.cart-overlay, .modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 20;
}
.cart-overlay.open, .modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.cart-drawer {
  position: fixed;
  top: 0; right: 0;
  width: 380px;
  max-width: 90vw;
  height: 100%;
  background: var(--bg-alt);
  border-left: 1px solid var(--border);
  z-index: 21;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}
.cart-drawer.open { transform: translateX(0); }
.cart-drawer-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px; border-bottom: 1px solid var(--border);
}
.cart-drawer-header button {
  background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text);
  width: 44px; height: 44px; border-radius: 50%;
}
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-empty {
  margin: auto;
  text-align: center;
  padding: 20px;
}
.cart-empty-icon {
  font-size: 40px;
  line-height: 1;
  opacity: 0.5;
  margin-bottom: 12px;
}
.cart-empty-title { font-weight: 700; margin: 0 0 6px; }
.cart-empty-text { color: var(--text-muted); font-size: 13px; margin: 0 0 18px; }

.cart-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: cart-item-in 0.2s ease;
}
@keyframes cart-item-in {
  from { opacity: 0; transform: translateY(-4px); }
}
.cart-item-thumb {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--bg-deep);
  padding: 4px;
}
.cart-item-body { min-width: 0; }
.cart-item-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}
.cart-item-unit { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.cart-item-controls {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cart-item-sum { font-weight: 800; font-size: 16px; white-space: nowrap; }
.cart-item-remove {
  background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px;
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  margin: -2px -2px 0 0;
}
.cart-item-remove:hover { background: var(--bg-alt); color: var(--negative); }

.cart-footer { padding: 20px; border-top: 1px solid var(--border); background: var(--bg-alt); }
.cart-summary-row {
  display: flex; justify-content: space-between;
  color: var(--text-muted); font-size: 13px; margin-bottom: 10px;
}
.cart-total-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-weight: 700; font-size: 18px; margin-bottom: 16px;
}
#cartTotal { font-size: 24px; font-weight: 800; color: var(--accent); }

.modal-overlay { display: flex; align-items: center; justify-content: center; }
.modal {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 420px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-close {
  position: absolute; top: 10px; right: 10px;
  background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text);
  width: 44px; height: 44px; border-radius: 50%;
}
.modal label {
  display: block;
  margin-bottom: 14px;
  font-size: 14px;
  color: var(--text-muted);
}
.modal input {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.payment-notice {
  background: var(--danger-bg);
  color: var(--danger-text);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}
.checkout-notice {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 16px;
}
.label-optional {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 12px;
}
.pay-methods { margin-bottom: 16px; }
.pay-methods-title {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.pay-options {
  display: flex;
  flex-direction: row;
  gap: 8px;
}
.pay-option {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.pay-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.pay-option .pay-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
.pay-option .pay-label {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.pay-option:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg));
}
.checkout-error {
  color: #ff6b6b;
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
}
.modal-total-row {
  display: flex; justify-content: space-between; font-weight: 700; font-size: 17px; margin: 16px 0;
}
.hidden { display: none; }

/* Липкая CTA-панель — только на мобиле, показывается скриптом после hero */
.sticky-cta {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 19;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
.sticky-cta.visible { transform: translateY(0); }
.sticky-cta-price {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  font-weight: 800;
  font-size: 18px;
}
.sticky-cta-price small {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 12px;
}
.sticky-cta .btn { padding: 12px 26px; }

/* Появление при скролле; базовое состояние — видимое, класс вешает скрипт */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (max-width: 768px) {
  .nav { display: none; }
  .hero { padding: 28px 0 40px; }
  .hero-inner { grid-template-columns: 1fr; gap: 24px; }
  .hero-image { order: -1; }
  /* Пакет не должен выдавливать заголовок и кнопки за первый экран */
  .hero-image .product-photo { margin: 0 auto; max-width: 200px; }
  .cta-row { margin-top: 22px; }
  .cta-row .btn { flex: 1; text-align: center; }
  .hero-trust { margin-top: 22px; padding-top: 16px; gap: 6px 14px; font-size: 12px; }
  .stats-grid { grid-template-columns: 1fr; }
  .product-card { grid-template-columns: 1fr; }
  .how-grid { grid-template-columns: 1fr; }
  .calc-card { grid-template-columns: 1fr; }
  .tests-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }

  .sticky-cta { display: flex; }
  /* Панель не должна перекрывать футер */
  body.has-sticky-cta { padding-bottom: 84px; }
  /* Панель уходит под корзину и модалку */
  body.is-locked .sticky-cta { transform: translateY(100%); }

  .metric-switch { display: flex; width: 100%; }
  .metric-btn { flex: 1; padding: 8px 10px; }
  .bar-row { grid-template-columns: 96px 1fr 44px; gap: 8px; font-size: 13px; }

  /* 16px — иначе iOS Safari зумит страницу при фокусе на поле */
  .calc-inputs input, .modal input { font-size: 16px; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .problems-list li { font-size: 15px; padding: 12px 14px; }
  .bar-row { grid-template-columns: 84px 1fr 40px; font-size: 12px; }
  .modal { padding: 22px 18px; }
  .price-row { gap: 12px; }
  .price-row .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.is-visible { opacity: 1; transform: none; transition: none; }
  .bars.is-animatable .bar-fill { transform: scaleX(1); transition: none; }
  .btn:active { transform: none; }
  * { scroll-behavior: auto !important; }
}
