/* ========================= ТЕМА И БАЗА (палитра выровнена, бренды сохранены) ========================= */
:root {
    --bg: #0f1420;
    --bg-2: #0b101a;
    --panel: #131a28;
    --panel-2: #0e1522;
    --text: #eaf0f7;
    --muted: #a9b6c9;
    --muted-2: #8f9ab0;
    --brand: #7c5cff;
    --brand-2: #9a8aff;
    --accent: #00d4ff;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 12px 32px rgba(0,0,0,.35);
    --container: 1180px;

    /* модульная шкала отступов */
    --s1: 6px;
    --s2: 10px;
    --s3: 14px;
    --s4: 18px;
    --s5: 24px;
    --s6: 32px;
    --s7: 44px;
    --s8: 64px;
}

* { box-sizing: border-box; }

:focus-visible{
    outline: 2px solid color-mix(in oklab, var(--accent) 70%, white 30%);
    outline-offset: 2px;
    border-radius: 8px;
}

html,body{
    margin:0;
    padding:0;
    background: linear-gradient(180deg,var(--bg),var(--bg-2) 60%,#09101c);
    color: var(--text);
    font-family: Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
    line-height:1.55;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

/* чтобы якоря не прятались под фикс-хедером */
:where(.section,.hero){ scroll-margin-top: 90px; }

img{ max-width:100%; display:block; }

a{
    color: var(--accent);
    text-decoration: none;
}
a:hover, a:focus-visible{ text-decoration: none; }

strong,b{ color:#fff; }

.container{
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 clamp(16px, 3vw, 28px);
}

.section{ padding: var(--s8) 0; }
@media (max-width:768px){ .section{ padding: var(--s7) 0; } }

/* типографика */
h1{
    /* было clamp(30px,4.2vw,46px) — на мобиле слишком крупно */
    font-size: clamp(26px, 5.2vw, 46px);
    line-height:1.1;
    margin:0 0 var(--s4);
    text-wrap: balance;         /* аккуратные переносы */
}
h2{
    font-size: clamp(22px,3.2vw,34px);
    line-height:1.2;
    margin:0 0 var(--s4);
}
h3{
    font-size: clamp(18px,2.3vw,22px);
    margin:0 0 var(--s2);
}
.lead{
    opacity:.98;
    font-size: clamp(16px,1.9vw,18px);
    margin-bottom: var(--s4);
    text-wrap: pretty;
}
.bullets{ margin:0 0 var(--s5) 0; padding-left:18px; }
.bullets li{ margin:6px 0; }

.accent{
    background: linear-gradient(135deg,var(--brand),var(--accent));
    -webkit-background-clip:text;
    background-clip:text;
    color:transparent;
}

/* ========================= HEADER / NAV ========================= */
.header{
    position: sticky; top:0; z-index:40;
    background: linear-gradient(180deg, rgba(16,22,36,.72), rgba(16,22,36,.58)),
                radial-gradient(120% 100% at 0% 0%, rgba(124,92,255,.10), transparent 60%) no-repeat;
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.header__inner{
    display:flex; align-items:center; justify-content:space-between;
    height:66px; gap:12px;
}
.logo{
    display:flex; gap:10px; align-items:center;
    font-weight:800; color:var(--text); letter-spacing:.2px;
}
.logo img{ filter: drop-shadow(0 2px 10px rgba(0,212,255,.15)); }

/* Навбар: «пилюли», без подчёркиваний вообще */
.nav{ display:flex; gap:8px; align-items:center; }
.nav a.nav__link{
    color:var(--text); opacity:.92;
    padding:10px 12px;
    border-radius:999px;
    position:relative; isolation:isolate;
    border:1px solid transparent;
    transition: background .18s ease, border-color .18s ease, opacity .18s ease;
    text-decoration: none;
}
.nav a.nav__link:hover,
.nav a.nav__link:focus-visible{
    background: rgba(255,255,255,.04);
    border-color: rgba(255,255,255,.10);
    opacity:1;
    text-decoration: none;
}
/* убрал декоративную линию-подчеркивание */
.nav a.nav__link::after{ content:none; }

.nav__cta{ margin-left:4px; }

/* Бургер */
.menuToggle{ display:none; background:transparent; border:0; padding:6px; margin: -10px 0 0 8px; }
.menuToggle__bar{
    display:block; width:24px; height:2px; background:#e8ecf1; margin:5px 0; border-radius:2px;
    transition: transform .2s ease, opacity .2s;
}
#menuToggle[aria-expanded="true"] .menuToggle__bar:nth-child(1){ transform: translateY(7px) rotate(45deg); }
#menuToggle[aria-expanded="true"] .menuToggle__bar:nth-child(2){ opacity:0; }
#menuToggle[aria-expanded="true"] .menuToggle__bar:nth-child(3){ transform: translateY(-7px) rotate(-45deg); }

@media (max-width:900px){
    .nav{
        position: fixed;
        inset: 66px 0 auto 0;
        background: rgba(11,17,28,.96);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid rgba(255,255,255,.08);
        display:flex; flex-direction:column; gap:6px;
        padding:14px 16px;
        transform: translateY(-120%);
        transition: transform .22s ease;
        max-height: calc(100dvh - 66px);   /* чтобы меню не обрезалось */
        overflow: auto;
    }
    .nav a{ padding:12px 14px; border-radius:12px; }
    .nav.nav--open{ transform: translateY(0); }
    .menuToggle{ display:inline-block; }
}


/* ========================= BUTTONS ========================= */
.btn{
    display:inline-flex; align-items:center; justify-content:center; gap:.5rem;
    padding:.9rem 1.1rem;
    border-radius:12px;
    background: var(--panel-2);
    border:1px solid rgba(255,255,255,.12);
    color:var(--text);
    box-shadow: var(--shadow);
    cursor:pointer;
    transition: transform .12s ease, opacity .2s, box-shadow .2s ease, background .2s ease, border-color .2s ease;
    min-height: 44px;                 /* чтобы не «сплющивались» */
    white-space: nowrap;              /* не ломать слова на 2 строки */
}
.btn:hover{ transform: translateY(-1px); }
.btn--primary{
    background: linear-gradient(135deg,var(--brand),var(--accent));
    border:0; color:#000; font-weight:800; letter-spacing:.2px;
}
.btn--primary:hover{ box-shadow: 0 8px 28px rgba(0,212,255,.25), 0 4px 12px rgba(124,92,255,.25); }
.btn--ghost{ background: rgba(255,255,255,.03); border:1px solid rgba(255,255,255,.18); }
.btn:disabled{ opacity:.55; cursor:not-allowed; }

.read-btn.disabled {
  pointer-events: none;
  opacity: 0.5;
}

/* ========================= HERO ========================= */
.hero{
    position:relative;
    padding: 56px 0 36px; /* +2px низ, чтобы грид не лип к следующему блоку */
    overflow:hidden;
}
.hero__grid{
    display:grid;
    grid-template-columns: 1.05fr .95fr;
    gap: var(--s6);
    align-items: start;               /* не «повисает» правая колонка */
}
@media (max-width:980px){ .hero__grid{ grid-template-columns:1fr; } }

/* левый столбец читаемее и ровнее */
.hero__text{ max-width: 680px; }
@media (max-width:640px){ .hero__text{ max-width: 100%; } }

.hero__meta{
    display:flex; gap:12px; flex-wrap:wrap; margin-top: var(--s4);
}
.metaItem{
    display:flex; align-items:center; gap:8px;
    padding:8px 10px; border-radius: var(--radius-sm);
    background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
    border:1px solid rgba(255,255,255,.08);
    color: var(--muted);
    font-size: 14px;                  /* чипы стали компактнее */
    line-height: 1.35;
}
.metaItem svg{ width:18px; height:18px; fill:var(--accent); opacity:.95; }

/* Блок загрузки */
.hero__uploader{
    background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
    border:1px solid rgba(255,255,255,.10);
    border-radius: var(--radius);
    padding: var(--s5);
    box-shadow: var(--shadow);
    align-self: start;
}
.stack > * + *{ margin-top: var(--s4); }

/* ========================= DROPZONE / VIEWPORT ========================= */
.dropzone{
    position:relative;
    border: 1.8px dashed rgba(255,255,255,.26);
    border-radius:12px;
    min-height: 300px;                /* слегка поднял, чтобы текст не прилипал */
    display:flex; align-items:center; justify-content:center;
    cursor:pointer;
    background: rgba(255,255,255,.04);
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.dropzone:hover{ border-color: rgba(255,255,255,.55); background: rgba(255,255,255,.06); }
.dropzone:focus-within{ border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,212,255,.15); }
.dropzone input{ position:absolute; inset:0; opacity:0; cursor:pointer; z-index:3; }

.viewport{
    position:relative; display:flex; align-items:center; justify-content:center; width:100%; z-index:1;
}
.placeholder{ text-align:center; padding: var(--s6) var(--s4); max-width: 90%; }
.icon{ width:46px; height:46px; fill:var(--accent); opacity:.98; margin:0 auto var(--s3); }

.image{
    display:block; max-width:100%; height:auto;
    max-height: 60vh; object-fit:contain;
    border-radius:12px; box-shadow: var(--shadow);
}
@media (max-width:640px){ .image{ max-height: 48vh; } }

/* ========================= LOADER ========================= */
.loader{
    position:absolute; inset:0;
    background: rgba(0,0,0,.45);
    display:flex; align-items:center; justify-content:center;
    border-radius:12px; z-index:4;
}
.ringWrap{ position:relative; width:min(220px,60vw); height:min(220px,60vw); }
.ring{ width:100%; height:100%; transform: rotate(-90deg); }
.ring__bg{ fill:none; stroke: rgba(255,255,255,.16); stroke-width:12; }
.ring__fg{
    fill:none; stroke: url(#g); stroke-width:12; stroke-linecap:round;
    stroke-dasharray:339.292; stroke-dashoffset:339.292;
    filter: drop-shadow(0 4px 22px rgba(0,212,255,.28));
}
.ring__center{
    position:absolute; inset:0; display:flex; flex-direction:column;
    align-items:center; justify-content:center; text-align:center;
}
.percent{ font-size: clamp(20px,5vw,28px); font-weight:800; color:#fff; letter-spacing:.2px; }
.loaderText{ margin-top:6px; color:var(--muted); }

.hidden{ display:none !important; }

.actions{ display:flex; gap:12px; flex-wrap:wrap; }
.hint{ margin-top: var(--s2); color:var(--muted); font-size:14px; }
.quota{ margin-top:6px; color:var(--muted); font-size:13px; }
.quota strong{ color:#fff; }

/* Доп. блок доверия */
.trust{
    margin:2px 0 0 0; padding:0; list-style:none; color:var(--muted);
    font-size:13px; display:grid; gap:6px;
}
.trust .dot{
    display:inline-block; width:6px; height:6px; border-radius:50%;
    background:var(--accent); margin-right:8px; vertical-align:1px;
}

/* ========================= HOW / BENEFITS / FAQ ========================= */
.how{ position:relative; }

.stepsGrid{
    display:grid; grid-template-columns: repeat(4,1fr); gap: var(--s4); margin-top: var(--s5);
}
@media (max-width:1100px){ .stepsGrid{ grid-template-columns: repeat(2,1fr); } }
@media (max-width:640px){ .stepsGrid{ grid-template-columns:1fr; } }

.step{
    background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
    border:1px solid rgba(255,255,255,.10);
    border-radius: var(--radius);
    padding: var(--s5);
    display:flex; flex-direction:column;  /* для ровной высоты контента */
}
.step__num{
    width:36px; height:36px; border-radius:10px;
    background: linear-gradient(135deg,var(--brand),var(--accent));
    color:#000; font-weight:800; display:flex; align-items:center; justify-content:center;
    margin-bottom: var(--s3); box-shadow: var(--shadow);
}
.step p{ color: var(--muted); }

.benefits{ position:relative; overflow:hidden; }

.cards{
    display:grid; grid-template-columns: repeat(4,1fr); gap: var(--s4); margin-top: var(--s5);
}
@media (max-width:1100px){ .cards{ grid-template-columns: repeat(2,1fr); } }
@media (max-width:640px){ .cards{ grid-template-columns:1fr; } }

.card{
    background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
    border:1px solid rgba(255,255,255,.10);
    border-radius: var(--radius);
    padding: var(--s5);
    box-shadow: var(--shadow);
    transition: transform .12s ease, border-color .2s ease;
    display:flex; flex-direction:column;
}
.card:hover{ transform: translateY(-2px); border-color: rgba(255,255,255,.16); }
.card__icon{
    width:40px; height:40px; border-radius:10px;
    background: linear-gradient(135deg,var(--brand),var(--accent));
    display:flex; align-items:center; justify-content:center; margin-bottom: var(--s3);
}
.card__icon svg{ width:24px; height:24px; fill:#000; }
.card h3{ margin-bottom: var(--s2); }
.card p{ color: var(--muted); }

/* FAQ: плавное раскрытие */
.faqList{
    display:grid; grid-template-columns:1fr 1fr; gap: var(--s4); margin-top: var(--s5);
}
@media (max-width:980px){ .faqList{ grid-template-columns:1fr; } }

.faqItem{
    background: var(--panel);
    border:1px solid rgba(255,255,255,.10);
    border-radius: var(--radius);
    transition: border-color .2s ease, background .2s ease, grid-template-rows .28s ease;
    overflow:hidden; display:grid; grid-template-rows: auto 0fr; /* магия плавности */
}
.faqItem[open]{ border-color: rgba(255,255,255,.18);
    background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
    grid-template-rows: auto 1fr;
}
.faqItem summary{
    list-style:none; cursor:pointer;
    display:flex; align-items:center; gap:10px;
    padding:16px 18px; font-weight:700; letter-spacing:.2px; user-select:none;
}
.faqItem summary::-webkit-details-marker{ display:none; }
.faqItem summary::after{
    content:""; width:18px; height:18px; flex:0 0 18px; margin-left:auto;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M7 10l5 5 5-5z'/></svg>") no-repeat center/contain;
    background:#ffffff; opacity:.7; transition: transform .22s ease;
}
.faqItem[open] summary::after{ transform: rotate(180deg); }
.faqItem summary:hover{ background: rgba(255,255,255,.03); }
.faqBody{ overflow:hidden; padding:0 18px; color:var(--muted); }
.faqItem[open] .faqBody{ padding:0 18px 16px 18px; }

/* ========================= FOOTER ========================= */
.footer{
    border-top:1px solid rgba(255,255,255,.10);
    padding:18px 0; margin-top:28px;
    background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.02));
}
.footer__inner{
    display:flex; align-items:center; justify-content:space-between;
    gap:12px; flex-wrap:wrap;
}
.footnav{ display:flex; gap:12px; flex-wrap:wrap; }

.shows {display: none;}
.pc {display: block;}
/* ========================= DECORATIVE ========================= */
.decor{ position:absolute; pointer-events:none; }
.decor--top{
    inset:auto -20% 0 auto;
    top:-320px; height:600px; width:1200px; opacity:.55;
    background:
      radial-gradient(60% 60% at 10% 0%, rgba(124,92,255,.26), transparent 60%),
      radial-gradient(60% 60% at 90% 0%, rgba(0,212,255,.18), transparent 60%),
      radial-gradient(30% 30% at 50% 50%, rgba(255,255,255,.06), transparent 60%);
    filter: blur(28px);
}
@media (max-width:980px){
    .decor--top{ opacity:.35; filter: blur(34px); top:-360px; }
}
@media (max-width:640px){
    .decor--top{ display:none; } /* на очень узких — убираем вовсе */
}

.decor--grid{
    inset:auto 0 -120px 0;
    height:320px; width:100%; opacity:.25;
    background-image: url("data:image/svg+xml;utf8,\
 <svg xmlns='http://www.w3.org/2000/svg' width='360' height='180' viewBox='0 0 360 180' fill='none'>\
 <g opacity='0.7'>\
 <rect x='30' y='40' width='40' height='40' rx='6' fill='%23ffffff' opacity='0.06'/>\
 <circle cx='150' cy='60' r='18' fill='%2300d4ff' opacity='0.12'/>\
 <path d='M250 120 l12 -24 l12 24 z' fill='%237c5cff' opacity='0.12'/>\
 </g></svg>");
    background-repeat: repeat-x; background-size: auto 100%;
    filter: blur(2px);
}

/* ========================= MEDIA TWEAKS ========================= */
@media (max-width:420px){
    .actions .btn{ flex:1 1 auto; }
}

/* ========================= MOTION PREFERENCES ========================= */
@media (prefers-reduced-motion: reduce){
    *{ scroll-behavior:auto !important; animation:none !important; transition:none !important; }
}
/* Бургер: по умолчанию скрыт, виден только на мобиле/планшете */
.menuToggle{
    display: none !important;       /* <-- прячем на десктопе */
    width: 44px;
    height: 44px;
    padding: 0;
    align-items: center;
    justify-content: center;
}

.menuToggle__bar{
    width: 24px;
    height: 2px;
    margin: 4px 0;                  /* визуальный центр */
    background: #e8ecf1;
    border-radius: 2px;
}

/* Показываем бургер и мобильное меню только до 900px */
@media (max-width:900px){
    .menuToggle{ display: flex !important; }
    /* навигация как оверлей уже настроена в твоём CSS */
}
/* --- Бургер: абсолютные линии, идеальный центр, только до 900px --- */
.menuToggle{
    display: none !important;
    position: relative;
    width: 44px;
    height: 44px;
    padding: 0;
    align-items: center;
    justify-content: center;
}
@media (max-width:900px){
    .menuToggle{ display: flex !important; }
}

/* три линии по центру кнопки */
.menuToggle__bar{
    position: absolute;
    left: 10px;
    right: 10px;
    height: 2px;
    background: #e8ecf1;
    border-radius: 2px;
    top: 50%;
    transform-origin: center;
    transition: transform .2s ease, opacity .2s ease;
}

/* закрытое состояние: верх/середина/низ */
.menuToggle__bar:nth-child(1){ transform: translateY(-8px); }
.menuToggle__bar:nth-child(2){ transform: translateY(0); }
.menuToggle__bar:nth-child(3){ transform: translateY(8px); }

/* открытое состояние: ровный X по центру */
#menuToggle[aria-expanded="true"] .menuToggle__bar:nth-child(1){
    transform: translateY(0) rotate(45deg);
}
#menuToggle[aria-expanded="true"] .menuToggle__bar:nth-child(2){
    transform: translateY(0) scaleX(0.5);
    opacity: 0;
}
#menuToggle[aria-expanded="true"] .menuToggle__bar:nth-child(3){
    transform: translateY(0) rotate(-45deg);
}
/* ПК: кнопки всегда в один ряд */
@media (min-width: 1024px){
  .hero__uploader .actions{
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
  .hero__uploader .actions .btn{
    flex: 0 0 auto;       /* ширина по контенту, не сжимаем */
    white-space: nowrap;  /* на всякий */
  }
}

/* Чуть больше зазор между дропзоной и кнопками, чтобы не «липли» визуально */
.hero__uploader .dropzone + .actions{ margin-top: var(--s5); }

/* Текст лимита не прилипает к кнопкам */
.quota{ margin-top: 10px; }
/* 421–567 px: 1 кнопка сверху (на всю ширину) + 2 в ряд снизу */
@media (min-width: 421px) and (max-width: 567px){
  .hero__uploader .actions{
    display: grid;                  /* вместо flex */
    grid-template-columns: 1fr 1fr; /* две колонки для нижнего ряда */
    gap: 12px;
    align-items: stretch;
    justify-items: stretch;
  }
  .hero__uploader .actions .btn{
    width: 100%;                    /* чтобы тянулись по колонке */
  }
  #processBtn{
    grid-column: 1 / -1;            /* «Обработать фото» — отдельной строкой на всю ширину */
  }
  /* немного воздуха над счётчиком */
  .hero__uploader .actions + .quota{ margin-top: 10px; }
}

/* ПК (1024+): все три в один ряд — оставляем как ранее */
@media (min-width: 1024px){
  .hero__uploader .actions{
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 12px;
  }
  .hero__uploader .actions .btn{
    flex: 0 0 auto;
    white-space: nowrap;
  }
}
/* ---- мобильное меню: не перекрывать хедер, учитывать safe-area, не просвечивать кликами ---- */
@media (max-width: 900px){
  .header{ padding-top: env(safe-area-inset-top, 0); }
  .header__inner{ height: calc(66px + env(safe-area-inset-top, 0)); }
  .shows {display: block;}
  .pc {display: none;}
  .nav{
    position: fixed;
    left: 0;
    right: 0;
    top: calc(66px + env(safe-area-inset-top, 0)); /* вместо inset: 66px ... */
    background: rgba(11,17,28,.96);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    z-index: 30;                /* ниже, чем header (у него 40) */
    transform: translateY(-120%);
    transition: transform .22s ease, visibility .22s ease;
    visibility: hidden;         /* скрыто по умолчанию */
    pointer-events: none;       /* чтобы не ловило клики */
    max-height: calc(100dvh - (66px + env(safe-area-inset-top, 0)));
    overflow: auto;
    padding: 14px 16px;
  }
  .nav.nav--open{
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
  }

  /* внутри меню все ссылки — на всю ширину, чтобы не выскакивала кнопка в хедер */
  .nav a{ display: block; width: 100%; }

  /* сам бургер поверх меню, всегда кликабелен */
  #menuToggle{ z-index: 40; }

  /* логотип не разъезжается, не уходит под бургер */
  .logo{
    max-width: calc(100% - 60px);   /* место под кнопку бургера справа */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* подстрахуем: если браузер не знает env(), просто оставим высоту 66px */
@supports not (padding: max(0px)){
  .header__inner{ height: 66px; }
  .nav{ top: 66px; }
}
/* 568–980 px: три кнопки тянутся по ширине карточки, ровно под дропзоной */
@media (min-width: 568px) and (max-width: 980px){
  .hero__uploader .actions{
    display: grid;                         /* вместо flex */
    grid-template-columns: repeat(3, 1fr); /* три равные колонки */
    gap: 12px;
    justify-items: stretch;
    align-items: stretch;
    width: 100%;
  }
  .hero__uploader .actions .btn{
    width: 100%;
    justify-content: center;               /* текст по центру */
  }
  .hero__uploader .dropzone + .actions{
    margin-top: var(--s5);                 /* воздух от рамки */
  }
}
/* 981–1023 px: 1 сверху (full), 2 снизу в ряд */
@media (min-width: 981px) and (max-width: 1023px){
  .hero__uploader .actions{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: stretch;
    justify-items: stretch;
    width: 100%;
  }
  .hero__uploader .actions .btn{
    width: 100%;
    justify-content: center;
  }
  #processBtn{
    grid-column: 1 / -1;   /* «Обработать фото» — на всю строку сверху */
  }
  .hero__uploader .actions + .quota{ margin-top: 10px; }
}
/* ------------------------------------------------------------------
   Глобальная защита от переполнений и мелких экранов
------------------------------------------------------------------ */
html, body { overflow-x: hidden; }
* { word-break: break-word; overflow-wrap: anywhere; }

/* чуть компактнее контейнеры на очень узких */
@media (max-width: 360px){
  .container{ padding-left: 12px; padding-right: 12px; }
}

/* 320 ↓ — уже есть правки, здесь только подстрахуем шапку/логотип */
@media (max-width: 360px){
  .logo span{ font-size: 14px; }
}

/* 280 ↓ — ужимаем типографику, чипы и кнопки в столбик */
@media (max-width: 280px){
  h1{ font-size: clamp(20px, 7vw, 26px); }
  .lead{ font-size: 13px; }
  .metaItem{ font-size: 12px; }
  .hero{ padding-top: 44px; }
  .viewport{ padding: 6px; }
  .dropzone{ min-height: 180px; }
  .hero__uploader .actions{
    display: grid; grid-template-columns: 1fr; gap: 10px;
  }
  .hero__uploader .actions .btn{ width: 100%; }
}

/* 240 ↓ — уменьшаем поля, кнопки и второстепенные подписи */
@media (max-width: 240px){
  .container{ padding-left: 10px; padding-right: 10px; }
  h1{ font-size: 18px; }
  .lead{ font-size: 12px; }
  .btn{ min-height: 36px; padding: 8px 10px; font-size: 12px; }
  .dropzone{ min-height: 150px; border-radius: 10px; }
  .placeholder p{ font-size: 12px; }
  .placeholder small{ display: none; } /* JPEG/PNG/WebP скрываем */
  .bullets{ padding-left: 16px; }
}

/* 200 ↓ — скрываем описательные блоки, чтобы всё помещалось */
@media (max-width: 200px){
  .header__inner{ height: 52px; }
  .menuToggle{ width: 36px; height: 36px; }
  .menuToggle__bar{ left: 6px; right: 6px; }
  h1{ font-size: 16px; }
  .lead, .bullets, .hero__meta{ display: none; } /* оставляем только главное */
  .hero{ padding: 28px 0; }
  .dropzone{ min-height: 120px; }
  .card, .step, .faqItem{ padding: 12px; }
}

/* 160 ↓ — ещё компактнее кнопки/подписи/футер */
@media (max-width: 160px){
  .btn{ font-size: 11px; padding: 6px 8px; min-height: 32px; }
  .footer__inner{ flex-direction: column; align-items: flex-start; }
  .footnav{ gap: 8px; }
}

/* 120 ↓ — уменьшаем базовый кегль и размеры иконок */
@media (max-width: 120px){
  html{ font-size: 10px; }
  .logo img{ width: 22px; height: 22px; }
  .placeholder p{ font-size: 11px; }
  .header__inner{ gap: 6px; }
}

/* 90 ↓ — ещё компактнее шапка/кнопки/дропзона */
@media (max-width: 90px){
  html{ font-size: 9px; }
  .menuToggle{ width: 30px; height: 30px; }
  .logo img{ width: 18px; height: 18px; }
  .dropzone{ min-height: 100px; }
}

/* 59 ↓ — «микро»-режим: всё помещается, без горизонтального скролла */
@media (max-width: 59px){
  html{ font-size: 8px; }
  .container{ padding-left: 6px; padding-right: 6px; }
  .header__inner{ height: 44px; }
  .logo img{ width: 16px; height: 16px; }
  .logo span{ display: none; }            /* оставляем только значок */
  .hero{ padding-top: 24px; }
  .dropzone{ min-height: 90px; border-radius: 8px; }
  .placeholder p{ font-size: 10px; }
  .hero__uploader .actions{ gap: 6px; }
  .btn{ padding: 6px; min-height: 28px; }
  .cards, .stepsGrid, .faqList{ gap: 8px; }
  .card, .step, .faqItem{ padding: 10px; border-radius: 10px; }
  .footer{ padding: 12px 0; }
}
/* Телеграм-бот: на десктопе делаем тоньше, не меняя стиль */
@media (min-width: 901px){
  .nav .nav__cta{
    padding: 10px 14px !important;   /* было ~14–18px вертикали */
    min-height: 34px !important;    /* было 44px */
    font-size: 14px;                /* чуть компактнее текст */
    /* всё остальное (цвет, бордер, закругление, тени) — как у .btn--ghost */
  }
}
/* === Обработка: блокируем клики и даём мягкий blur под лоадером === */
/* Работает во всех современных браузерах (используем :has) */

.dropzone:has(.loader:not(.hidden)) {
  pointer-events: none;        /* ничего не кликается в зоне загрузки */
  cursor: progress;
}

/* Блюрим содержимое под лоадером (фото/плейсхолдер) */
.dropzone:has(.loader:not(.hidden)) .image,
.dropzone:has(.loader:not(.hidden)) .placeholder {
  filter: blur(4px) brightness(.75);
  transform: scale(1.01);
  transition: filter .2s ease, transform .2s ease;
}

/* Сам лоадер: лёгкий гаусс-блюр задника через backdrop-filter */
.loader {
  background: rgba(0,0,0,.48);
  -webkit-backdrop-filter: blur(4px) saturate(110%);
  backdrop-filter: blur(4px) saturate(110%);
}

/* Пока лоадер виден — кнопки под ним неактивны */
.stack .dropzone:has(.loader:not(.hidden)) ~ .actions .btn {
  pointer-events: none;
  opacity: .55;
  filter: grayscale(.1) saturate(.8);
  cursor: not-allowed;
}
/* Чистый вид при обработке: без ореолов и засветов */
.dropzone,
.viewport,
.loader{
    border-radius: 12px;
    overflow: hidden;                 /* обрезаем размытие по краям */
}

/* блюрим фон под лоадером, но без масштаба и без тени */
.dropzone:has(.loader:not(.hidden)) .image,
.dropzone:has(.loader:not(.hidden)) .placeholder{
    filter: blur(3px) brightness(.80); /* мягче и темнее */
    transform: none;                   /* убираем scale, который давал «свечение» */
    box-shadow: none;                  /* тень картинки не нужна под лоадером */
}

/* сам оверлей — чуть темнее и с минимальным blur, без лишнего свечения */
.dropzone:has(.loader:not(.hidden)) .loader{
    background: rgba(0,0,0,.52);
    -webkit-backdrop-filter: blur(1.5px);
    backdrop-filter: blur(1.5px);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); /* подрезает возможный подсвет по краю */
}


/* --- Когда поверх дропзоны есть оверлей (лоадер) --- */
/* не глушим всю .dropzone, а только фон и input, чтобы CTA была кликабельна */
.dropzone:has(.loader:not(.hidden)) { pointer-events: auto; }
.dropzone:has(.loader:not(.hidden)) input,
.dropzone:has(.loader:not(.hidden)) .image,
.dropzone:has(.loader:not(.hidden)) .placeholder { pointer-events: none; }

/* делаем CTA внутри оверлея кликабельной */
.dropzone:has(.loader:not(.hidden)) .loader { pointer-events: auto; }

/* аккуратный фон под оверлеем (без «ореола») */
.dropzone:has(.loader:not(.hidden)) .image,
.dropzone:has(.loader:not(.hidden)) .placeholder{
    filter: blur(3px) brightness(.82);
    transform: none;
    box-shadow: none;
}
.dropzone, .viewport, .loader{ border-radius:12px; overflow:hidden; }
.dropzone:has(.loader:not(.hidden)) .loader{
    background: rgba(0,0,0,.54);
    -webkit-backdrop-filter: blur(1.5px);
    backdrop-filter: blur(1.5px);
}

/* --- Режим «квота исчерпана»: если в оверлее есть любая кнопка/ссылка — это наш CTA --- */
.loader:has(:is(a,button)){
    display: grid;
    place-items: center;
    padding: 8px;
}
.loader:has(:is(a,button)) .ring,
.loader:has(:is(a,button)) .percent{ opacity:0; visibility:hidden; }
.loader:has(:is(a,button)) .loaderText{
    margin: 10px 0 12px;
    color: #eaf0f7;
    text-shadow: 0 1px 2px rgba(0,0,0,.35);
}

/* CTA в оверлее — адаптивная «пилюля» */
.loader :is(a,button){
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;

    /* адаптивные размеры */
    padding: clamp(10px, 1.6vw, 14px) clamp(14px, 3.6vw, 22px);
    min-height: 40px;
    border-radius: 14px;

    /* ширина = по контенту, но не вылезает из контейнера */
    width: fit-content;
    max-width: 100%;
    overflow: hidden;            /* подстраховка на экстремально узких экранах */
    text-overflow: ellipsis;

    /* текст — не переносится и смотрится чище */
    white-space: nowrap;
    font-size: clamp(13px, 1.1vw + .2rem, 16px); /* чуть меньше, чем было */
    font-weight: 700;                             
    letter-spacing: .1px;
    line-height: 1.15;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    color: #0b0f19;

    /* визуал */
    border: 0;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    box-shadow: 0 8px 28px rgba(0,212,255,.25), 0 4px 12px rgba(124,92,255,.25);
    cursor: pointer;

    /* отступ от текста сверху, если он есть над кнопкой */
    margin-top: clamp(8px, 1.4vw, 12px);
}
.loader :is(a,button) svg{ flex: 0 0 auto; }

.loader :is(a,button):hover{ filter: brightness(1.03); }
.loader :is(a,button):active{ transform: translateY(1px); }
.loader :is(a,button):focus-visible{
    outline: none;
    box-shadow:
        0 0 0 3px rgba(0,212,255,.35),
        0 8px 28px rgba(0,212,255,.25),
        0 4px 12px rgba(124,92,255,.25);
}

/* экстра-узкие устройства (страховка) */
@media (max-width: 430px) and (min-width: 361px){
    .loader :is(a,button){
        font-size: 14px;
        padding: 10px 16px;
        min-height: 40px;
        border-radius: 13px;
    }
}

/* Экстра-узкие устройства: ≤360px (как у тебя было) */
@media (max-width: 360px){
    .loader :is(a,button){
        font-size: 12px;
        padding: 10px 14px;
        min-height: 38px;
    }
}


.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  background: rgba(10, 14, 26, 0.9);
  backdrop-filter: blur(12px);
}

.modal:not(.hidden) {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

/* Контейнер модального окна */
.modal-content {
  position: relative;
  width: 95%;
  max-width: 520px;
  max-height: 85vh;
  background: linear-gradient(145deg, #1a1d29 0%, #242938 100%);
  border-radius: 20px;
  border: 1px solid rgba(124, 92, 255, 0.3);
  box-shadow: 
    0 25px 80px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(124, 92, 255, 0.1);
  overflow: hidden;
  transform: scale(0.9) translateY(30px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal:not(.hidden) .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  background: #272c3d;
  padding: 24px 28px 20px;
  position: relative;
  text-align: center;
}

.modal-header::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  position: relative;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 18px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 12px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 34px;
    backdrop-filter: blur(10px);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}


.modal-body {
  padding: 28px;
  max-height: 60vh;
  overflow-y: auto;
}


.modal-description {
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 28px;
  font-size: 1rem;
  line-height: 1.5;
}

.tariff-list {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

.tariff-item {
  background: linear-gradient(145deg, #242938 0%, #2a3042 100%);
  border: 2px solid rgba(124, 92, 255, 0.2);
  border-radius: 16px;
  padding: 20px 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.tariff-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #7c5cff, #00d4ff);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.tariff-item:hover {
  border-color: rgba(124, 92, 255, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(124, 92, 255, 0.25);
}

.tariff-item:hover::before {
  opacity: 0.08;
}

.tariff-item.selected {
  border-color: #7c5cff;
  box-shadow: 0 5px 29px rgba(124, 92, 255, 0.1);
  transform: translateY(-2px);
}

.tariff-item.selected::before {
  opacity: 0.15;
}

.tariff-item > * {
  position: relative;
  z-index: 1;
}

/* Содержимое тарифа */
.tariff-info {
  flex: 1;
}

.tariff-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tariff-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px 0;
}

.tariff-description {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

.tariff-pricing {
  text-align: right;
}

.tariff-price {
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, #7c5cff, #00d4ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 2px 0;
}

.tariff-credits {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}


.payment-info {
  text-align: center;
  padding: 16px 20px;
  background: rgba(0, 212, 255, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(0, 212, 255, 0.2);
}

.payment-secure {
  color: #00d4ff;
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0;
}

/* Экран подтверждения платежа */
.payment-summary {
  text-align: center;
}

.payment-summary h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 20px 0;
}

.payment-details {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  padding: 20px;
  margin: 20px 0 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.payment-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
}

.payment-row:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.payment-row:last-child {
  padding-top: 16px;
  font-weight: 700;
  font-size: 1.1rem;
  color: #00d4ff;
}

.payment-actions {
  display: flex;
  gap: 12px;
}


/* Экран загрузки */
.payment-loading {
  text-align: center;
  padding: 40px 24px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(124, 92, 255, 0.3);
  border-top: 3px solid #7c5cff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.payment-loading p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
  margin: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Адаптивность */
@media (max-width: 768px) {
  .modal-content {
    width: 92%;
    margin: 1%;
    max-height: 90vh;
  }
  
  .modal-header {
    padding: 18px 20px 16px;
  }
  
  .modal-header h2 {
    font-size: 1.2rem;
  }
  
  .modal-body {
    padding: 20px 18px;
  }

  .modal-description {
    display: none;
  }
  
  
  .tariff-title {
    font-size: 1rem;
    line-height: 1.2;
  }
  
  .tariff-price {
    font-size: 1.3rem;
  }
  
  .tariff-description {
    font-size: 10px;
  }

  
  .payment-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .btn {
    padding: 14px 18px;
  }
  
  /* Уменьшить отступы в деталях платежа */
  .payment-details {
    padding: 16px;
    margin: 16px 0 20px;
  }
  
  .payment-row {
    padding: 8px 0;
    font-size: 0.9rem;
  }
  
  .payment-info {
    padding: 12px 16px;
  }
  
  .payment-secure {
    font-size: 0.85rem;
  }
}

/* Скрытие скроллбара но сохранение функциональности */
.modal-body::-webkit-scrollbar {
  width: 4px;
}

.modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(124, 92, 255, 0.4);
  border-radius: 2px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 92, 255, 0.6);
}


/* fix close button spacing */
.modal-header{
    position: relative;
    padding-right: 48px; /* ≈ размер кнопки (32) + отступ (16) */
}

.modal-close{
    position: absolute;
    top: 50%;
    right: 16px;          /* поставь то же значение, что и общий правый padding */
    transform: translateY(-50%);
    margin: 0;            /* на всякий случай убираем сдвиг */
    padding: 0;
}

/* keep press effect intact */
.modal-close{
    transform: none;   /* убираем translateY из прошлой правки */
    translate: 0 -50%; /* вертикальное выравнивание без перезаписи transform */
}

/* === Mobile: simplify tariff hover === */
@media (hover: none), (max-width: 900px){
  .tariff-item{
    transition: none !important;
    transform: none !important;
    box-shadow: none !important;
  }
  /* отключаем «плёнку» и любые hover-реакции */
  .tariff-item::before{ display: none !important; }
  .tariff-item:hover{
    transform: none !important;
    box-shadow: none !important;
    border-color: rgba(124,92,255,0.2) !important;
  }

  /* при тапе — только синяя полоска справа + акцентная рамка */
  .tariff-item:active{
    border-color: #7c5cff !important;
  }
  .tariff-item:active::after{
    content: "";
    position: absolute;
    top: 8px; bottom: 8px; right: 8px;  /* внутренняя синяя полоска */
    width: 4px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 1;
  }
}

/* === Lock background scroll while modal is open (CSS-only) === */

/* 1) Запираем прокрутку корня и body, когда .modal видима */
html:has(.modal:not(.hidden)),
body:has(.modal:not(.hidden)){
  overflow: hidden !important;
  height: 100% !important;
  overscroll-behavior: none !important;
}

/* 2) Фон не кликается и не скроллится жестами (тач) */
body:has(.modal:not(.hidden)) > :not(.modal){
  pointer-events: none !important;
  touch-action: none !important;
}

/* 3) Скролл разрешён только внутри модалки */
.modal .modal-body{
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* 4) iOS Safari fallback: полностью «пришиваем» body, чтобы он не прокручивался
   (да, позиция фикс — без сохранения оффсета, но надёжно глушит фон) */
@supports (-webkit-touch-callout: none){
  body:has(.modal:not(.hidden)){
    position: fixed !important;
    width: 100% !important;
  }
}
