/* =========================================================================
   Дизайн-система: чистый премиум-коммерс.
   Все цвета берутся из токенов темы (theme.css). Тёмные цвета здесь не зашиваем.
   ========================================================================= */

:root {
    --safe-top: var(--tg-safe-area-inset-top, env(safe-area-inset-top, 0px));
    --safe-bottom: var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
}

html { font-size: 16px; }

body {
    -webkit-tap-highlight-color: transparent;
    font-family: var(--font-sans);
    background: rgb(var(--rgb-bg));
    color: rgb(var(--rgb-ink));
    overflow-x: hidden;
    line-height: 1.45;
}

h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -0.01em; }

/* Шрифт иконок лежит у нас (Apache 2.0): не зависит от Google и открывается мгновенно. */
@font-face {
    font-family: 'Material Symbols Outlined';
    font-style: normal; font-weight: 100 700; font-display: block;
    src: url(/static/fonts/material-symbols-outlined.woff2) format('woff2');
}
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined'; font-weight: normal; font-style: normal;
    line-height: 1; letter-spacing: normal; text-transform: none; display: inline-block;
    white-space: nowrap; word-wrap: normal; direction: ltr;
    -webkit-font-feature-settings: 'liga'; font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased;
}
:where(.material-symbols-outlined) { font-size: 24px; }
.material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.fill-icon { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

.hidden-tab { display: none !important; }
.scrollbar-none { scrollbar-width: none; }
.scrollbar-none::-webkit-scrollbar { display: none; }

/* Микро-шрифты из JS-шаблонов поднимаем до читаемого минимума. */
.text-\[9px\], .text-\[10px\] { font-size: 11px !important; }

/* ---------- Каркас ---------- */
.app-header {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: calc(var(--safe-top) + 10px) 16px 10px;
    background: rgb(var(--rgb-surface) / .88);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgb(var(--rgb-line));
}

.brand-mark {
    width: 38px; height: 38px; flex: none; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
    background: rgb(var(--rgb-primary)); color: rgb(var(--rgb-on-primary));
    font-family: var(--font-display); font-weight: 800; font-size: 18px;
}

#bottom-navigation {
    position: fixed; left: 0; bottom: 0; width: 100%; z-index: 250;
    display: flex; justify-content: space-around; align-items: stretch;
    padding: 6px 6px calc(6px + var(--safe-bottom));
    background: rgb(var(--rgb-surface) / .94);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgb(var(--rgb-line));
    transition: transform .3s;
}
.nav-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 4px 2px; font-size: 11px; font-weight: 600;
    color: rgb(var(--rgb-faint)); transition: color .2s;
}
.nav-btn .material-symbols-outlined {
    font-size: 24px; padding: 3px 18px; border-radius: 999px; transition: background .2s;
}
.nav-btn[data-active="true"] { color: rgb(var(--rgb-primary)); }
.nav-btn[data-active="true"] .material-symbols-outlined { background: rgb(var(--rgb-primary) / .12); }

/* ---------- Поверхности ---------- */
.card {
    background: rgb(var(--rgb-surface));
    border: 1px solid rgb(var(--rgb-line));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}
.card-flat {
    background: rgb(var(--rgb-surface-2));
    border-radius: var(--radius-md);
    padding: 12px;
}
.section-title { display: flex; align-items: center; justify-content: space-between; }
.section-title h3 { font-size: 17px; font-weight: 700; }
.link-all { font-size: 13px; font-weight: 600; color: rgb(var(--rgb-primary)); }

/* ---------- Кнопки и поля ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 16px; border-radius: var(--radius-md);
    font-size: 14px; font-weight: 700; line-height: 1.2;
    transition: transform .12s, background-color .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: rgb(var(--rgb-primary)); color: rgb(var(--rgb-on-primary)); }
.btn-primary:hover { background: rgb(var(--rgb-primary-hover)); }
.btn-soft { background: rgb(var(--rgb-primary) / .1); color: rgb(var(--rgb-primary)); }
.btn-lg { padding: 15px 18px; font-size: 15px; border-radius: 14px; }

.app-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; line-height: 1.15; }
.app-title.is-long { font-size: 14.5px; }

.chip {
    white-space: nowrap; flex: none;
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px;
    border-radius: 999px; font-size: 13px; font-weight: 600;
    background: rgb(var(--rgb-surface-2)); color: rgb(var(--rgb-ink));
    border: 1px solid rgb(var(--rgb-line));
}

input.field, select.field, textarea.field {
    width: 100%; padding: 12px 14px; font-size: 16px;
    color: rgb(var(--rgb-ink)); background-color: rgb(var(--rgb-surface-2));
    border: 1px solid transparent; border-radius: var(--radius-md);
}
input.field::placeholder, textarea.field::placeholder { color: rgb(var(--rgb-faint)); }
input.field:focus, select.field:focus, textarea.field:focus {
    outline: none; border-color: rgb(var(--rgb-primary));
    box-shadow: 0 0 0 3px rgb(var(--rgb-primary) / .18);
}
.field-label {
    display: flex; flex-direction: column; gap: 6px;
    font-size: 12px; font-weight: 600; color: rgb(var(--rgb-ink-2));
}

/* ---------- Модалки ---------- */
.modal-backdrop {
    position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
    padding: 16px; background: rgb(0 0 0 / .55);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.modal-panel {
    width: 100%; display: flex; flex-direction: column; gap: 16px; padding: 20px;
    background: rgb(var(--rgb-surface)); color: rgb(var(--rgb-ink));
    border: 1px solid rgb(var(--rgb-line)); border-radius: 24px;
    box-shadow: 0 24px 60px rgb(0 0 0 / .35);
}
#modal-full-trends, #modal-full-reviews { background: rgb(var(--rgb-bg)); }

/* ---------- Главная ---------- */
.hero {
    position: relative; overflow: hidden; padding: 20px;
    border-radius: var(--radius-lg); color: rgb(var(--rgb-on-primary));
    background:
        radial-gradient(120% 140% at 100% 0%, rgb(255 255 255 / .24) 0%, transparent 55%),
        linear-gradient(135deg, rgb(var(--rgb-primary)), rgb(var(--rgb-primary-hover)) 90%);
    box-shadow: var(--shadow-card);
}
.hero::after {
    content: ""; position: absolute; right: -44px; bottom: -64px; width: 190px; height: 190px;
    border-radius: 50%; background: rgb(255 255 255 / .12); pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero h2 { text-wrap: balance; }
.hero-badge {
    display: inline-flex; padding: 4px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 700; background: rgb(255 255 255 / .22);
}
.hero-cta {
    margin-top: 16px; display: inline-flex; align-items: center; gap: 6px;
    padding: 11px 16px; border-radius: 12px; font-size: 14px; font-weight: 700;
    background: rgb(var(--rgb-on-primary)); color: rgb(var(--rgb-primary));
    box-shadow: 0 4px 14px rgb(0 0 0 / .15);
}

.highlight-tile {
    display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; text-align: center;
    background: rgb(var(--rgb-surface)); border: 1px solid rgb(var(--rgb-line));
    border-radius: var(--radius-md);
}
.highlight-tile b { font-family: var(--font-display); font-size: 18px; color: rgb(var(--rgb-primary)); }
.highlight-tile b.is-long { font-size: 14px; line-height: 1.2; padding: 2px 0; }
.highlight-tile span { font-size: 11px; color: rgb(var(--rgb-ink-2)); line-height: 1.25; }

.story-item { width: 68px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.story-ring {
    width: 68px; height: 68px; padding: 2.5px; border-radius: 50%;
    background: linear-gradient(135deg, rgb(var(--rgb-primary)), rgb(var(--rgb-primary-hover)));
}
.story-ring > div {
    width: 100%; height: 100%; overflow: hidden; border-radius: 50%;
    border: 2.5px solid rgb(var(--rgb-bg)); background: rgb(var(--rgb-surface-2));
}
.story-item span { max-width: 68px; font-size: 11px; font-weight: 600; color: rgb(var(--rgb-ink-2)); text-align: center;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.product-card {
    display: flex; flex-direction: column; gap: 10px; padding: 8px 8px 12px; cursor: pointer;
    transition: transform .15s;
}
.product-card:active { transform: scale(.97); }
.product-media { aspect-ratio: 1 / 1; overflow: hidden; border-radius: 14px; background: rgb(var(--rgb-surface-2)); }
.product-media img { width: 100%; height: 100%; object-fit: cover; }
.price { font-family: var(--font-display); font-weight: 800; font-size: 16px; }

.news-card { overflow: hidden; }
.news-media { aspect-ratio: 16 / 9; background: rgb(var(--rgb-surface-2)); }
.news-media img { width: 100%; height: 100%; object-fit: cover; }

.stars { color: rgb(var(--rgb-warning)); letter-spacing: 1px; font-size: 13px; }
.avatar { width: 44px; height: 44px; flex: none; overflow: hidden; border-radius: 50%; background: rgb(var(--rgb-surface-2)); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.media-fallback {
    width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    color: rgb(var(--rgb-faint)); background: rgb(var(--rgb-surface-2));
}

/* ---------- Заказ / корзина / профиль ---------- */
.bubble-bot {
    max-width: 82%; padding: 12px 14px; font-size: 14px; line-height: 1.45;
    background: rgb(var(--rgb-surface-2)); border-radius: 18px 18px 18px 6px;
}
.step-tile {
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px;
    background: rgb(var(--rgb-surface)); border: 1px solid rgb(var(--rgb-line)); border-radius: 12px;
}
.step-tile b { font-size: 12px; }
.step-tile span:last-child { font-size: 11px; line-height: 1.25; color: rgb(var(--rgb-ink-2)); }

.segmented { display: flex; padding: 4px; background: rgb(var(--rgb-surface-2)); border-radius: 14px; }
.segmented button { flex: 1; padding: 9px 8px; border-radius: 10px; font-size: 13px; font-weight: 700; color: rgb(var(--rgb-ink-2)); transition: all .2s; }
.segmented button.seg-active { background: rgb(var(--rgb-surface)); color: rgb(var(--rgb-ink)); box-shadow: var(--shadow-card); }

.pay-option {
    display: flex; align-items: center; gap: 12px; padding: 12px; cursor: pointer;
    background: rgb(var(--rgb-surface-2)); border: 1.5px solid transparent; border-radius: var(--radius-md);
}
.pay-option[data-selected="true"] { border-color: rgb(var(--rgb-primary)); background: rgb(var(--rgb-primary) / .08); }

.loyalty-card {
    padding: 16px; border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgb(var(--rgb-primary) / .12), rgb(var(--rgb-primary) / .03));
    border: 1px solid rgb(var(--rgb-primary) / .22);
}
.progress-fill { background: linear-gradient(90deg, rgb(var(--rgb-primary-hover)), rgb(var(--rgb-primary))); }

.menu-row {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer;
    background: rgb(var(--rgb-surface)); border: 1px solid rgb(var(--rgb-line)); border-radius: var(--radius-lg);
    transition: transform .12s;
}
.menu-row:active { transform: scale(.98); }
.menu-icon {
    width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center;
    border-radius: 12px; background: rgb(var(--rgb-primary) / .1); color: rgb(var(--rgb-primary)); font-size: 22px;
}

/* ---------- Сторис ---------- */
#stories-fullscreen-view {
    position: fixed; inset: 0; z-index: 300; display: none; flex-direction: column; background: #000;
    padding-top: calc(2.8rem + var(--safe-top));
}
.story-progress-bar { height: 3px; flex-grow: 1; border-radius: 2px; overflow: hidden; background: rgb(255 255 255 / .25); }
.story-progress-fill { height: 100%; width: 0; background: #fff; transition: width .1s linear; }
.stories-video-container { width: 100%; max-width: 285px; height: 450px; margin: 14px auto; position: relative; overflow: hidden; border-radius: 22px; background: #000; }
.stories-video { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Колесо ---------- */
#wheel-container { position: relative; width: 280px; height: 280px; margin: 0 auto; border-radius: 50%; }
.wheel-glow { box-shadow: 0 0 0 6px rgb(var(--rgb-primary) / .12), 0 14px 40px rgb(var(--rgb-primary) / .22); }
#modal-wheel-canvas { width: 100%; height: 100%; will-change: transform; }
.wheel-pointer { position: absolute; top: -15px; left: 50%; transform: translateX(-50%); z-index: 30; width: 30px; height: 40px;
    filter: drop-shadow(0 3px 6px rgb(0 0 0 / .3)); }
.wheel-center-cap {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 40;
    width: 36px; height: 36px; border-radius: 50%; pointer-events: none;
    background: rgb(var(--rgb-surface)); border: 3px solid rgb(var(--rgb-primary));
    box-shadow: 0 2px 8px rgb(0 0 0 / .25);
}
@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgb(var(--rgb-primary) / .45); }
    70% { box-shadow: 0 0 0 14px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}
.spin-me-attention { animation: pulse-ring 2s infinite; }

/* ---------- Трекинг ---------- */
@keyframes status-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
.animate-status-pop { animation: status-pulse 1.8s ease-in-out infinite; }
.gold-card-update-highlight { border-color: rgb(var(--rgb-primary)) !important; box-shadow: 0 0 0 3px rgb(var(--rgb-primary) / .18); }

.review-fade { transition: opacity .4s ease-in-out; opacity: 1; }
.review-fade-out { opacity: 0; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.animate-fade-in { animation: fade-in .25s ease-out; }

/* Полноэкранные списки под выемку Telegram. */
#modal-full-trends, #modal-full-reviews { padding-top: calc(2.8rem + var(--safe-top)) !important; }
