/* ============================================================
   Material 3 Expressive — визуал Google Play 2026
   Светлая/тёмная тема, pill-кнопки, тональные контейнеры
   ============================================================ */
*,*::before,*::after{box-sizing:border-box}

:root{
  color-scheme: light dark;   /* системная тема: скроллбары, нативные контролы */

  /* поверхности */
  --surface:#fff;
  --surface-dim:#f6f4f9;
  --surface-container:#f2f0f5;
  --surface-container-high:#eae7ef;
  --outline:#e3e1e8;

  /* текст */
  --fg:#1b1b21;
  --fg-2:#46464f;
  --fg-3:#75757f;

  /* акцент — Play берёт его из иконки приложения (dynamic color).
     Меняется одной строкой в js/config.js → accent */
  --primary:#6750a4;
  --on-primary:#fff;
  --primary-container:#e9ddff;
  --on-primary-container:#22005d;

  /* роли кнопок — задаются в панели, здесь только значения по умолчанию */
  --btn-install-bg:var(--primary);
  --btn-install-fg:var(--on-primary);
  --btn-outline-fg:var(--primary);
  --btn-outline-border:var(--outline);
  --btn-pill-fg:var(--fg-2);
  --btn-pill-border:var(--outline);
  --verified:#0b57d0;

  /* формы */
  --r-xs:8px; --r-s:12px; --r-m:16px; --r-l:20px; --r-xl:28px; --r-full:999px;

  --ease:cubic-bezier(.2,0,0,1);
  --ease-spring:cubic-bezier(.34,1.56,.64,1);
}

@media (prefers-color-scheme: dark){
  :root{
    --surface:#131316;
    --surface-dim:#131316;
    --surface-container:#1f1f24;
    --surface-container-high:#2a2a30;
    --outline:#2e2e35;
    --fg:#e5e1e9;
    --fg-2:#c7c5d0;
    --fg-3:#918f9a;
    --primary:#cfbcff;
    --on-primary:#381e72;
    --primary-container:#4f378a;
    --on-primary-container:#e9ddff;
    --verified:#a8c7fa;
  }
}

/* Принудительная тема — только для превью в панели: там схему переключает
   кнопка, а не система, поэтому класс должен побеждать media-query. */
:root.force-dark{
    --surface:#131316;
    --surface-dim:#131316;
    --surface-container:#1f1f24;
    --surface-container-high:#2a2a30;
    --outline:#2e2e35;
    --fg:#e5e1e9;
    --fg-2:#c7c5d0;
    --fg-3:#918f9a;
    --primary:#cfbcff;
    --on-primary:#381e72;
    --primary-container:#4f378a;
    --on-primary-container:#e9ddff;
    --verified:#a8c7fa;
}
:root.force-light{
    --surface:#fff;
    --surface-dim:#f6f4f9;
    --surface-container:#f2f0f5;
    --surface-container-high:#eae7ef;
    --outline:#e3e1e8;
    --fg:#1b1b21;
    --fg-2:#46464f;
    --fg-3:#75757f;
    --primary:#6750a4;
    --on-primary:#fff;
    --primary-container:#e9ddff;
    --on-primary-container:#22005d;
    --verified:#0b57d0;
}


html{-webkit-text-size-adjust:100%}
body{
  margin:0;background:var(--surface);color:var(--fg);
  font:400 14px/1.45 "Google Sans Text",Roboto,-apple-system,"Segoe UI",Arial,sans-serif;
  -webkit-font-smoothing:antialiased;overflow-x:hidden;
  padding-bottom:calc(84px + env(safe-area-inset-bottom));
}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;-webkit-tap-highlight-color:transparent}
svg{fill:currentColor}
.ic-12{width:12px;height:12px}.ic-14{width:14px;height:14px}.ic-16{width:16px;height:16px}
.ic-18{width:18px;height:18px}.ic-20{width:20px;height:20px}.ic-22{width:22px;height:22px}

/* ── верхняя панель ─────────────────────────────────────── */
.topbar{
  position:sticky;top:0;z-index:10;display:flex;align-items:center;gap:4px;
  padding:8px 8px 8px 4px;background:var(--surface);
  padding-top:calc(8px + env(safe-area-inset-top));
}
.topbar-spacer{flex:1}
.icon-btn{
  width:40px;height:40px;border-radius:var(--r-full);display:grid;place-items:center;
  color:var(--fg-2);transition:background .18s var(--ease);
}
.icon-btn svg{width:22px;height:22px}
.icon-btn.sm{width:32px;height:32px}
.icon-btn.sm svg{width:18px;height:18px}
.icon-btn:active{background:var(--surface-container-high)}
.avatar{
  width:32px;height:32px;margin-left:6px;border-radius:var(--r-full);
  background:linear-gradient(135deg,#7c3aed,#ec4899);color:#fff;
  display:grid;place-items:center;font-size:14px;font-weight:500;flex:0 0 auto;
}

.page{max-width:600px;margin:0 auto;padding:8px 20px 28px}

/* ── карточка приложения ────────────────────────────────── */
.app-head{display:flex;gap:18px;align-items:center;margin-bottom:22px}
.app-icon{
  width:88px;height:88px;border-radius:22px;flex:0 0 auto;
  box-shadow:0 1px 2px rgba(0,0,0,.14),0 4px 14px rgba(0,0,0,.08);
}
.app-name{
  font-size:24px;font-weight:500;line-height:1.2;margin:0 0 4px;letter-spacing:-.2px;
  display:flex;align-items:center;gap:6px;flex-wrap:wrap;
}
.verified{display:inline-flex;align-items:center;color:var(--verified);flex:0 0 auto}
.verified[hidden]{display:none}
.verified svg{width:19px;height:19px;fill:currentColor}
.app-dev{color:var(--primary);font-size:14px;font-weight:500}
.app-ads{color:var(--fg-3);font-size:12px;margin-top:3px}

/* ── метрики ────────────────────────────────────────────── */
.stats{display:flex;align-items:stretch;justify-content:space-between;margin-bottom:20px}
.stat{flex:1;text-align:center;display:flex;flex-direction:column;justify-content:center;gap:3px}
.stat-v{font-size:14px;font-weight:600;display:flex;align-items:center;justify-content:center;gap:4px;min-height:18px}
.stat-l{font-size:11px;color:var(--fg-3);line-height:1.3}
.divider{width:1px;background:var(--outline);margin:4px 0}
.pegi{
  border:1.5px solid var(--fg-2);border-radius:4px;padding:0 4px;
  font-size:11px;line-height:15px;font-weight:600;
}

/* ── установка ──────────────────────────────────────────── */
.install-block{margin-bottom:26px}
.btn-install{
  width:100%;height:48px;border-radius:var(--r-full);
  background:var(--btn-install-bg);color:var(--btn-install-fg);
  font-size:15px;font-weight:600;letter-spacing:.1px;
  transition:transform .16s var(--ease-spring),filter .18s var(--ease),border-radius .2s var(--ease);
}
.btn-install:active{transform:scale(.96);border-radius:var(--r-m);filter:brightness(.94)}
.btn-install:disabled{background:var(--surface-container-high);color:var(--fg-3);transform:none;cursor:default}

.btn-outline{
  width:100%;height:44px;border-radius:var(--r-full);margin-top:6px;
  border:1px solid var(--btn-outline-border);color:var(--btn-outline-fg);font-weight:600;font-size:14px;
  transition:background .18s var(--ease),transform .16s var(--ease-spring);
}
.btn-outline:active{background:var(--surface-container);transform:scale(.97)}

.progress-wrap{margin-top:16px}
.progress-head{display:flex;justify-content:space-between;font-size:12px;color:var(--fg-2);margin-bottom:8px;font-weight:500}
.progress{height:6px;background:var(--surface-container-high);border-radius:var(--r-full);overflow:hidden}
.progress-bar{height:100%;width:0;background:var(--primary);border-radius:var(--r-full);transition:width .3s var(--ease)}

.install-hint{font-size:13px;color:var(--fg-2);margin:14px 0 0;line-height:1.55}

.row-actions{display:flex;gap:8px;margin-top:14px}
.text-btn{
  flex:1;display:flex;align-items:center;justify-content:center;gap:8px;
  height:40px;padding:0 8px;border-radius:var(--r-full);
  font-size:12.5px;font-weight:500;color:var(--fg-2);white-space:nowrap;
  transition:background .18s var(--ease)}
.text-btn svg{flex:0 0 auto}
.text-btn:active{background:var(--surface-container)}

.compat{
  display:flex;align-items:center;gap:8px;margin-top:14px;
  font-size:12px;color:var(--fg-3);
}

/* ── скриншоты ──────────────────────────────────────────── */
.shots{
  display:flex;gap:12px;overflow-x:auto;scroll-snap-type:x mandatory;
  margin:0 -20px 26px;padding:0 20px;scroll-padding-left:20px;
  scrollbar-width:none;-webkit-overflow-scrolling:touch;
}
.shots::-webkit-scrollbar{display:none}
.shots img{
  height:268px;width:auto;border-radius:var(--r-m);flex:0 0 auto;scroll-snap-align:start;
  background:var(--surface-container);object-fit:cover;
}
.shots img.ph{width:150px}

/* ── блоки ──────────────────────────────────────────────── */
.block{margin-bottom:26px}
.block-head{
  display:flex;align-items:center;justify-content:space-between;width:100%;
  padding:4px 0;margin-bottom:12px;
}
.block-head h2{font-size:18px;font-weight:500;margin:0;letter-spacing:-.1px}
.chev{color:var(--fg-2);flex:0 0 auto}
.desc{color:var(--fg-2);margin:0;white-space:pre-line;line-height:1.55}
.desc.muted{color:var(--fg-3);font-size:13px}
.updated{font-size:12px;color:var(--fg-3);margin-top:14px}

.chips{display:flex;gap:8px;flex-wrap:wrap;margin-top:16px}
.chip{
  font-size:12px;color:var(--fg-2);background:var(--surface-container);
  border-radius:var(--r-xs);padding:7px 14px;
}

/* ── безопасность данных ────────────────────────────────── */
.safety{
  border:1px solid var(--outline);border-radius:var(--r-s);
  padding:16px;margin-top:14px;display:grid;gap:16px;
}
.safety-row{display:flex;gap:14px;align-items:flex-start;color:var(--fg-2)}
.safety-row b{display:block;font-size:13px;font-weight:500;color:var(--fg);margin-bottom:2px}
.safety-row span{font-size:12px;color:var(--fg-3);line-height:1.4}

/* ── сегменты ───────────────────────────────────────────── */
.seg{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none;margin-bottom:20px}
.seg::-webkit-scrollbar{display:none}
.seg-btn{
  flex:0 0 auto;height:32px;padding:0 16px;border-radius:var(--r-xs);
  border:1px solid var(--btn-pill-border);font-size:13px;font-weight:500;color:var(--btn-pill-fg);
  transition:background .18s var(--ease),color .18s var(--ease);
}
.seg-btn.is-on{background:var(--primary-container);color:var(--on-primary-container);border-color:transparent}

/* ── рейтинги ───────────────────────────────────────────── */
.rate-row{display:flex;gap:26px;align-items:center;margin-bottom:24px}
.rate-num{font-size:52px;font-weight:400;line-height:1;letter-spacing:-2px}
.rate-stars{display:flex;gap:2px;color:var(--primary);margin-top:6px}
.rate-stars .half{opacity:.45}
.rate-cnt{font-size:11px;color:var(--fg-3);margin-top:6px}
.rate-bars{flex:1}
.rb{display:flex;align-items:center;gap:10px;margin-bottom:5px}
.rb span{font-size:11px;color:var(--fg-3);width:6px}
.rb i{flex:1;height:9px;background:var(--surface-container-high);border-radius:var(--r-full);overflow:hidden}
.rb b{display:block;height:100%;background:var(--primary);border-radius:var(--r-full)}

/* ── отзывы ─────────────────────────────────────────────── */
.review{margin-bottom:24px}
.rv-head{display:flex;align-items:center;gap:12px;margin-bottom:10px}
.rv-who{flex:1}
.rv-ava{
  width:34px;height:34px;border-radius:var(--r-full);color:#fff;flex:0 0 auto;
  display:grid;place-items:center;font-weight:500;font-size:15px;
}
.rv-name{font-size:14px;font-weight:500}
.rv-meta{display:flex;align-items:center;gap:8px;font-size:11px;color:var(--fg-3);margin-bottom:8px}
.rv-stars{display:flex;gap:1px;color:var(--primary)}
.rv-stars .dim{opacity:.28}
.review p{margin:0;color:var(--fg-2);line-height:1.55}
.rv-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:12px;font-size:11px;color:var(--fg-3)}
.rv-btns{display:flex;gap:8px;flex:0 0 auto}
.pill-sm{
  height:32px;padding:0 18px;border-radius:var(--r-full);
  border:1px solid var(--btn-pill-border);font-size:13px;font-weight:500;color:var(--btn-pill-fg);
}
.pill-sm:active{background:var(--surface-container)}

/* ── похожие ────────────────────────────────────────────── */
.similar{display:flex;gap:16px;overflow-x:auto;scrollbar-width:none;margin:0 -20px;padding:0 20px}
.similar::-webkit-scrollbar{display:none}
.sim{width:96px;flex:0 0 auto}
.sim-ic{width:96px;height:96px;border-radius:22px;margin-bottom:8px}
.sim-n{font-size:12px;line-height:1.3;margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sim-r{font-size:11px;color:var(--fg-3)}

.foot{border-top:1px solid var(--outline);padding-top:18px;font-size:12px;color:var(--fg-3);line-height:1.9}

/* ── нижняя навигация ───────────────────────────────────── */
.bottom-nav{
  position:fixed;left:0;right:0;bottom:0;z-index:10;display:flex;
  background:var(--surface-container);border-top:1px solid transparent;
  padding:10px 4px calc(14px + env(safe-area-inset-bottom));
}
.nav-item{
  flex:1;display:flex;flex-direction:column;align-items:center;gap:5px;
  font-size:11px;font-weight:500;color:var(--fg-3);
}
.nav-pill{
  width:56px;height:30px;border-radius:var(--r-full);display:grid;place-items:center;
  transition:background .2s var(--ease);
}
.nav-item.is-on{color:var(--on-primary-container)}
.nav-item.is-on .nav-pill{background:var(--primary-container)}

/* ── оверлей ────────────────────────────────────────────── */
.overlay{
  position:fixed;inset:0;z-index:30;display:flex;align-items:flex-end;justify-content:center;
  background:rgba(0,0,0,.5);backdrop-filter:blur(2px);
}
.overlay[hidden]{display:none}
.overlay-card{
  background:var(--surface-container);width:100%;max-width:600px;
  border-radius:var(--r-xl) var(--r-xl) 0 0;padding:32px 24px calc(32px + env(safe-area-inset-bottom));
  text-align:center;animation:sheet .34s var(--ease-spring);
}
@keyframes sheet{from{transform:translateY(100%)}to{transform:translateY(0)}}
.ov-icon{width:72px;height:72px;border-radius:18px;margin-bottom:16px}
.ov-title{font-size:20px;font-weight:500;margin-bottom:8px}
.ov-sub{font-size:13px;color:var(--fg-3);margin-bottom:24px;line-height:1.5}

/* ── режим установленного приложения ────────────────────── */
body.standalone-loading{
  display:flex;align-items:center;justify-content:center;min-height:100vh;padding:0;
}
body.standalone-loading .page,
body.standalone-loading .topbar,
body.standalone-loading .bottom-nav{display:none}

.splash{
  position:fixed;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:28px;background:var(--surface);z-index:50;
}
.splash img{width:96px;height:96px;border-radius:24px;animation:breathe 1.8s var(--ease) infinite}
@keyframes breathe{0%,100%{transform:scale(1)}50%{transform:scale(1.06)}}
.spinner{
  width:28px;height:28px;border:3px solid var(--surface-container-high);
  border-top-color:var(--primary);border-radius:var(--r-full);animation:spin .8s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg)}}

.offer-frame{position:fixed;inset:0;width:100%;height:100%;border:0;z-index:40}

/* ── заставка при открытии витрины ── */
.page-loader{
  position:fixed;inset:0;z-index:60;display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:24px;background:var(--surface);
  transition:opacity .25s var(--ease);
}
.page-loader[hidden]{display:none}
.page-loader.fade{opacity:0;pointer-events:none}
.page-loader img{width:88px;height:88px;border-radius:22px}

@media (prefers-reduced-motion: reduce){
  *{animation-duration:.01ms!important;transition-duration:.01ms!important}
}
