/* =========================================================================
   Дизайн-система «ИИ Госпожа» — тёмный минимализм, БДСМ-эстетика.
   Единая тёмная тема. Все компоненты в Components/UI/ используют эти классы.
   ========================================================================= */

/* --- Self-host шрифты ---------------------------------------------------
   Variable woff2 в wwwroot/fonts/ (НЕ Google CDN — приватность adult-сайта).
   Раздельные субсеты cyrillic/latin через unicode-range: браузер тянет только
   нужный субсет (русский сайт → почти всегда cyrillic). */

/* Manrope — текст (--font-body) */
@font-face {
    font-family: 'Manrope';
    src: url('/fonts/manrope-cyrillic.woff2') format('woff2');
    font-weight: 200 800;
    font-display: swap;
    unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Manrope';
    src: url('/fonts/manrope-latin.woff2') format('woff2');
    font-weight: 200 800;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}

/* Unbounded — заголовки (--font-head) */
@font-face {
    font-family: 'Unbounded';
    src: url('/fonts/unbounded-cyrillic.woff2') format('woff2');
    font-weight: 200 900;
    font-display: swap;
    unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Unbounded';
    src: url('/fonts/unbounded-latin.woff2') format('woff2');
    font-weight: 200 900;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}

:root {
    /* Палитра */
    --bg-void: #0c0c10;
    --bg-surface: #15131c;
    --bg-elevated: #1e1a29;
    --border: rgba(255, 255, 255, .07);
    --border-strong: rgba(255, 255, 255, .14);
    --text: #ececf1;
    --text-muted: #9a93a8;
    --accent: #8e1f3a; /* винно-красный, доминанта */
    --accent-hover: #a8264699;
    --accent-2: #9b59b6; /* фиолетовый, вторичный */
    --accent-glow: #be8be4;
    --gold: #c9a85c; /* VIP/ранг */
    --danger: #c0392b;
    --success: #2e7d52;

    /* Радиусы / тени */
    --radius: 14px;
    --radius-sm: 10px;
    --radius-pill: 999px;
    --shadow: 0 10px 30px rgba(0, 0, 0, .45);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, .35);

    /* Типографика */
    --font-head: 'Unbounded', 'Manrope', system-ui, Segoe UI, sans-serif;
    --font-body: 'Manrope', 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;

    /* Сетка отступов */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;
    --sp-6: 32px;
    --sp-7: 48px;

    /* Размеры оболочки */
    --rail-w: 240px;
    --bottomnav-h: 64px;
    --header-h: 60px;
}

/* --- Сброс / база ------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth; /* якоря лендинга (#scenarios) */
}

html, body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-void);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    font-family: var(--font-head);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.01em;
    margin: 0 0 var(--sp-4);
}

h1 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
}

h2 {
    font-size: clamp(1.4rem, 3vw, 1.9rem);
}

h3 {
    font-size: 1.25rem;
}

p {
    margin: 0 0 var(--sp-4);
}

a {
    color: var(--accent-glow);
    text-decoration: none;
}

    a:hover {
        text-decoration: underline;
    }

img {
    max-width: 100%;
    display: block;
}

/* Обводка фокуса — только для интерактивных элементов (не на заголовках/контейнерах). */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
label:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--accent-glow);
    outline-offset: 2px;
}

/* FocusOnNavigate (Routes.razor) программно фокусирует h1 после навигации — это нужно
   скринридерам, но визуальная рамка браузера на заголовке не нужна. */
h1:focus {
    outline: none;
}

/* --- Утилиты ------------------------------------------------------------ */
.muted { color: var(--text-muted); }
.gold { color: var(--gold); }
.accent { color: var(--accent-glow); }
.text-center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.row { display: flex; gap: var(--sp-3); align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.hidden { display: none !important; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

.grid-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--sp-3);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--sp-4);
}

.stat-tile { height: 100%; }

/* =========================================================================
   КОМПОНЕНТЫ
   ========================================================================= */

/* --- Button ------------------------------------------------------------- */
.btn {
    --btn-bg: var(--bg-elevated);
    --btn-fg: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    min-height: 44px; /* тач-таргет */
    padding: 0 var(--sp-5);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--btn-bg);
    color: var(--btn-fg);
    font-family: var(--font-body);
    font-size: .98rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform .15s ease, filter .15s ease, background .15s ease;
    text-decoration: none;
    user-select: none;
    white-space: nowrap;
}

    .btn:hover:not(:disabled) {
        filter: brightness(1.12);
        text-decoration: none;
    }

    .btn:active:not(:disabled) {
        transform: translateY(1px);
    }

    .btn:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

.btn--primary {
    --btn-bg: var(--accent);
    --btn-fg: #fff;
    border-color: transparent;
    box-shadow: 0 6px 20px rgba(142, 31, 58, .35);
}

.btn--ghost {
    --btn-bg: transparent;
    --btn-fg: var(--text);
}

.btn--danger {
    --btn-bg: var(--danger);
    --btn-fg: #fff;
    border-color: transparent;
}

.btn--gold {
    --btn-bg: transparent;
    --btn-fg: var(--gold);
    border-color: var(--gold);
}

.btn--block { width: 100%; }
.btn--sm { min-height: 36px; padding: 0 var(--sp-4); font-size: .88rem; }

.btn__spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Card --------------------------------------------------------------- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-5);
    box-shadow: var(--shadow-sm);
}

.card--elevated { background: var(--bg-elevated); }
.card--accent { border-color: rgba(142, 31, 58, .5); }
.card__title { margin: 0 0 var(--sp-2); font-size: 1.1rem; }

/* --- Badge -------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 12px;
    border-radius: var(--radius-pill);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .02em;
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text);
    line-height: 1.6;
}

.badge--rank { border-color: var(--accent-2); color: var(--accent-glow); }
.badge--vip { border-color: var(--gold); color: var(--gold); background: rgba(201, 168, 92, .08); }
.badge--streak { border-color: #e8743b; color: #ffb38a; background: rgba(232, 116, 59, .08); }
.badge--success { border-color: #3ba55d; color: #8ce0a6; background: rgba(59, 165, 93, .08); }
.badge--danger { border-color: var(--danger); color: #f0a59b; background: rgba(192, 57, 43, .08); }

/* --- ProgressBar -------------------------------------------------------- */
.progress {
    width: 100%;
    height: 12px;
    background: var(--bg-void);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.progress__fill {
    height: 100%;
    border-radius: inherit;
    transition: width .4s ease;
    background: linear-gradient(90deg, var(--accent-2), var(--accent-glow));
}

.progress--metal .progress__fill {
    background: linear-gradient(90deg, #6b6b76, #b9b9c6 60%, #8a8a96);
}

.progress--fire .progress__fill {
    background: linear-gradient(90deg, #b3340f, #ff7a18 60%, #ffd24a);
    box-shadow: 0 0 12px rgba(255, 122, 24, .5);
}

.progress__label {
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

/* --- StatTile ----------------------------------------------------------- */
.stat-tile {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-4);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-tile__value {
    font-family: var(--font-head);
    font-size: 1.6rem;
    font-weight: 700;
}

.stat-tile__label {
    font-size: .82rem;
    color: var(--text-muted);
}

.stat-tile__icon { font-size: 1.2rem; }

/* --- Avatar ------------------------------------------------------------- */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
}

    .avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar--sm { width: 32px; height: 32px; font-size: .8rem; }
.avatar--lg { width: 72px; height: 72px; font-size: 1.5rem; }

/* --- Modal -------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 4, 8, .72);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
    z-index: 200;
    animation: fade-in .2s ease;
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 440px;
    width: 100%;
    padding: var(--sp-6);
    animation: slide-up .25s ease;
}

.modal__title { margin-top: 0; }
.modal__actions { display: flex; gap: var(--sp-3); justify-content: flex-end; margin-top: var(--sp-5); }

/* --- Toast -------------------------------------------------------------- */
.toast-host {
    position: fixed;
    top: var(--sp-4);
    right: var(--sp-4);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    z-index: 300;
    max-width: min(360px, calc(100vw - 32px));
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: var(--sp-3) var(--sp-4);
    box-shadow: var(--shadow);
    animation: slide-in-right .25s ease;
}

.toast--success { border-left-color: var(--success); }
.toast--danger { border-left-color: var(--danger); }
.toast--gold { border-left-color: var(--gold); }
.toast__title { font-weight: 700; margin-bottom: 2px; }
.toast__body { font-size: .9rem; color: var(--text-muted); }

/* --- EmptyState --------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: var(--sp-7) var(--sp-4);
    color: var(--text-muted);
}

.empty-state__icon { font-size: 2.4rem; margin-bottom: var(--sp-3); opacity: .8; }
.empty-state__title { font-family: var(--font-head); color: var(--text); margin-bottom: var(--sp-2); }

/* --- Loading spinner / skeleton ----------------------------------------- */
.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-strong);
    border-top-color: var(--accent-glow);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin: var(--sp-4) auto;
}

/* --- ChatBubble --------------------------------------------------------- */
.bubble {
    max-width: 78%;
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius);
    word-wrap: break-word;
    line-height: 1.5;
}

.bubble--user {
    background: var(--accent);
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.bubble--ai {
    background: var(--bg-elevated);
    color: var(--text);
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

/* типографика рендера Markdown→HTML ответа ИИ (Этап 5) */
.bubble--ai p:last-child { margin-bottom: 0; }
.bubble--ai strong { color: var(--accent-glow); }
.bubble--ai em { color: var(--gold); font-style: italic; }
.bubble--ai ul, .bubble--ai ol { margin: var(--sp-2) 0; padding-left: 1.3em; }
.bubble--ai code {
    background: rgba(0, 0, 0, .35);
    padding: 1px 5px;
    border-radius: 5px;
    font-size: .88em;
}

/* --- TypingDots --------------------------------------------------------- */
.typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    padding: var(--sp-3) var(--sp-4);
}

.typing__dot {
    width: 7px;
    height: 7px;
    background: var(--accent-glow);
    border-radius: 50%;
    animation: blink 1.4s infinite both;
}

    .typing__dot:nth-child(2) { animation-delay: .2s; }
    .typing__dot:nth-child(3) { animation-delay: .4s; }

@keyframes blink {
    0%, 80%, 100% { transform: scale(.6); opacity: .5; }
    40% { transform: scale(1); opacity: 1; }
}

/* --- CountdownTimer ----------------------------------------------------- */
.countdown {
    display: inline-flex;
    gap: var(--sp-3);
    font-family: var(--font-head);
}

.countdown__unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 56px;
    padding: var(--sp-2) var(--sp-3);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.countdown__num { font-size: 1.6rem; font-weight: 700; }
.countdown__lbl { font-size: .7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

/* --- PaywallCard -------------------------------------------------------- */
.paywall {
    text-align: center;
    border: 1px solid var(--gold);
    background: linear-gradient(160deg, rgba(201, 168, 92, .06), transparent);
}

.paywall__icon { font-size: 2rem; margin-bottom: var(--sp-2); }
.paywall__title { font-family: var(--font-head); color: var(--gold); }

/* =========================================================================
   ОБОЛОЧКА (Header / NavRail / BottomNav)
   ========================================================================= */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.app-header {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--sp-5);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header__logo {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text);
    letter-spacing: .02em;
}

    .app-header__logo .accent { color: var(--accent-glow); }

/* --- Звание и очки покорности в шапке (только десктоп) --------------------- */
.header-rank {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .85rem;
    text-decoration: none;
    transition: border-color .2s, background .2s;
}

    .header-rank:hover { border-color: var(--border-strong); background: var(--bg-elevated); }

.header-rank__title { white-space: nowrap; }

.header-rank__points {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--gold);
    font-weight: 700;
}

@media (max-width: 768px) {
    .header-rank { display: none; }
}

/* --- Колокольчик уведомлений (Этап 13) ------------------------------------ */
.notif { position: relative; display: inline-flex; }

.notif__btn {
    position: relative;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.05rem;
    transition: border-color .2s, background .2s;
}
.notif__btn:hover { border-color: var(--border-strong); background: var(--bg-elevated); }

.notif__badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--bg-surface);
}

.notif__backdrop { position: fixed; inset: 0; z-index: 200; }

.notif__panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(360px, calc(100vw - 32px));
    max-height: min(70vh, 520px);
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: 0 18px 50px rgba(0,0,0,.55);
    z-index: 201;
    overflow: hidden;
}

.notif__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.notif__markall {
    background: transparent;
    border: none;
    color: var(--accent-glow);
    cursor: pointer;
    font-size: .82rem;
}
.notif__markall:hover { text-decoration: underline; }

.notif__list { overflow-y: auto; }

.notif__empty { padding: var(--sp-5); color: var(--text-muted); text-align: center; font-size: .9rem; }

.notif__item {
    display: flex;
    gap: var(--sp-3);
    width: 100%;
    text-align: left;
    padding: var(--sp-3) var(--sp-4);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    color: var(--text);
}
.notif__item:hover { background: var(--bg-elevated); }
.notif__item--unread { background: rgba(142, 31, 58, .10); }

.notif__icon { font-size: 1.05rem; flex-shrink: 0; line-height: 1.4; }
.notif__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif__title { font-weight: 600; font-size: .9rem; }
.notif__text { color: var(--text-muted); font-size: .82rem; line-height: 1.4; }
.notif__time { color: var(--text-muted); font-size: .72rem; margin-top: 2px; }

.app-body { display: flex; flex: 1; min-height: 0; }

/* NavRail — десктоп */
.nav-rail {
    width: var(--rail-w);
    flex-shrink: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: var(--sp-4) var(--sp-3);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-rail__item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-height: 44px;
    padding: 0 var(--sp-4);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 600;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}

    .nav-rail__item:hover { background: var(--bg-elevated); color: var(--text); text-decoration: none; }
    .nav-rail__item.active { background: rgba(142, 31, 58, .18); color: var(--text); }
    .nav-rail__item .icon { font-size: 1.2rem; width: 1.4em; text-align: center; }

.app-content {
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--sp-5);
    min-width: 0;
}

/* BottomNav — мобайл */
.bottom-nav { display: none; }

@media (max-width: 768px) {
    .nav-rail { display: none; }

    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--bottomnav-h);
        background: var(--bg-surface);
        border-top: 1px solid var(--border);
        z-index: 100;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .bottom-nav__item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        min-height: 44px;
        color: var(--text-muted);
        text-decoration: none;
        font-size: .68rem;
    }

        .bottom-nav__item .icon { font-size: 1.3rem; }
        .bottom-nav__item.active { color: var(--accent-glow); }

    .app-content { padding: var(--sp-4); padding-bottom: calc(var(--bottomnav-h) + var(--sp-5)); }
}

/* =========================================================================
   AgeGate
   ========================================================================= */
.age-gate {
    position: fixed;
    inset: 0;
    background: var(--bg-void);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
    z-index: 500;
}

.age-gate__box {
    max-width: 440px;
    text-align: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: var(--sp-7) var(--sp-5);
    box-shadow: var(--shadow);
}

.age-gate__mark { font-size: 2.4rem; color: var(--accent); margin-bottom: var(--sp-3); }

/* =========================================================================
   Анимации (с учётом prefers-reduced-motion)
   ========================================================================= */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes slide-in-right { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

.fade-in { animation: fade-in .3s ease; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* --- Лендинг -------------------------------------------------------------- */
.hero {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-4);
    max-width: 780px;
    padding: var(--sp-7) 0 var(--sp-6);
}

.hero__glow {
    position: absolute;
    top: -120px;
    left: -180px;
    width: 560px;
    height: 560px;
    background: radial-gradient(circle, rgba(142, 31, 58, .22), transparent 65%);
    pointer-events: none;
    z-index: -1;
}

.hero h1 { margin-bottom: 0; font-size: clamp(2.1rem, 5vw, 3.2rem); }
.hero__sub { font-size: 1.15rem; color: var(--text-muted); max-width: 620px; margin: 0; }
.hero__note { font-size: .85rem; margin: 0; }

.land-stats {
    display: flex;
    gap: var(--sp-6);
    flex-wrap: wrap;
    padding: var(--sp-5) 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--sp-6);
}

.land-stats__item { display: flex; flex-direction: column; gap: 2px; }
.land-stats__num { font-family: var(--font-head); font-size: 1.7rem; font-weight: 700; color: var(--text); }
.land-stats__lbl { font-size: .85rem; color: var(--text-muted); }

.land-section { margin-bottom: var(--sp-7); }
.land-section__sub { max-width: 620px; margin-top: calc(-1 * var(--sp-2)); }

.feat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--sp-4);
    margin-top: var(--sp-5);
}

.feat {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-5);
    transition: border-color .2s ease, transform .2s ease;
}

    .feat:hover { border-color: rgba(142, 31, 58, .5); transform: translateY(-2px); }

.feat__icon { font-size: 1.6rem; margin-bottom: var(--sp-3); }
.feat__title { font-family: var(--font-head); font-size: 1.05rem; margin-bottom: var(--sp-2); }
.feat__text { color: var(--text-muted); font-size: .92rem; margin: 0; line-height: 1.55; }

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--sp-4);
    margin-top: var(--sp-5);
}

.step {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-5);
}

.step__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-family: var(--font-head);
    font-weight: 700;
    margin-bottom: var(--sp-3);
}

.step__title { font-family: var(--font-head); font-size: 1rem; margin-bottom: var(--sp-2); }
.step__text { color: var(--text-muted); font-size: .92rem; margin: 0; line-height: 1.55; }

.land-cta {
    text-align: center;
    padding: var(--sp-7) var(--sp-5);
    margin-bottom: var(--sp-6);
    background: linear-gradient(160deg, rgba(142, 31, 58, .14), transparent 70%);
    border: 1px solid rgba(142, 31, 58, .4);
    border-radius: var(--radius);
}

    .land-cta h2 { margin-bottom: var(--sp-2); }
    .land-cta p { max-width: 480px; margin: 0 auto var(--sp-5); }

/* --- Формы / инпуты ----------------------------------------------------- */
.input {
    width: 100%;
    min-height: 44px;
    padding: 0 var(--sp-4);
    background: var(--bg-void);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
}

    .input::placeholder { color: var(--text-muted); }

    .input:focus {
        outline: none;
        border-color: var(--accent-glow);
        box-shadow: 0 0 0 2px rgba(190, 139, 228, .25);
    }

textarea.input { padding: var(--sp-3) var(--sp-4); min-height: 96px; resize: vertical; }

.field-label { font-size: .85rem; color: var(--text-muted); margin-bottom: 4px; display: block; }

/* --- Auth-страницы ------------------------------------------------------ */
.auth-wrap {
    min-height: calc(100vh - var(--header-h) - 4rem);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card { width: 100%; max-width: 400px; }

/* --- Лидерборд ----------------------------------------------------------- */
.lb-list { display: flex; flex-direction: column; gap: 2px; }
.lb-row {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    gap: var(--sp-3);
    align-items: center;
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-sm);
}

    .lb-row:nth-child(odd) { background: var(--bg-void); }
    .lb-row--me { background: rgba(142, 31, 58, .18); border: 1px solid var(--accent); }

.lb-rank { font-family: var(--font-head); font-size: 1.1rem; text-align: center; }
.lb-title { font-weight: 600; }
.lb-points { color: var(--gold); font-weight: 700; white-space: nowrap; }

/* --- Сценарии ------------------------------------------------------------ */
.scen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--sp-5);
}

.scen-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    transition: transform .15s ease, border-color .15s ease;
    color: var(--text);
}

a.scen-card:hover { text-decoration: none; }

    .scen-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }
    .scen-card--active { border-color: var(--accent); }
    .scen-card--locked .scen-card__cover { filter: grayscale(.6) brightness(.6); }

.scen-card__cover {
    aspect-ratio: 3 / 2;
    background-image: linear-gradient(145deg, var(--accent), var(--accent-2));
    background-color: var(--bg-void);
    /* Фото сценария показываем целиком (без обрезки). */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    position: relative;
}

.scen-card__lock {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.scen-card__body { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; }
.scen-card__title { font-family: var(--font-head); font-size: 1.1rem; }
.scen-card__desc { color: var(--text-muted); font-size: .9rem; flex: 1; line-height: 1.55; }
.scen-card__desc p { margin: 0 0 .5em; }
.scen-card__desc p:last-child { margin-bottom: 0; }
.scen-card__foot { margin-top: var(--sp-2); }

/* Отрендеренный markdown в описаниях/заданиях: убираем большие внешние отступы абзацев. */
.md-text > :first-child, .scen-desc > :first-child { margin-top: 0; }
.md-text > :last-child, .scen-desc > :last-child { margin-bottom: 0; }
.md-text p, .scen-desc p { margin: 0 0 .6em; }
.md-text ul, .md-text ol, .scen-desc ul, .scen-desc ol { margin: 0 0 .6em; padding-left: 1.4em; }
.md-text li, .scen-desc li { margin-bottom: .25em; }

.scen-hero { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); align-items: start; }
.scen-hero__cover { aspect-ratio: 3/2; border-radius: var(--radius); background-image: linear-gradient(145deg, var(--accent), var(--accent-2)); background-color: var(--bg-void); background-size: contain; background-repeat: no-repeat; background-position: center; }

@media (max-width: 768px) {
    .scen-hero { grid-template-columns: 1fr; }
}

/* --- Тарифы / платежи ---------------------------------------------------- */
.price-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--sp-4);
}

.price-card {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    position: relative;
}

    .price-card--vip {
        border-color: var(--gold);
        background: linear-gradient(165deg, rgba(201, 168, 92, .07), transparent);
    }

.price-card__name { font-family: var(--font-head); font-size: 1.15rem; }
.price-card__price { font-size: 1.9rem; font-weight: 700; }
.price-card__price small { font-size: .9rem; color: var(--text-muted); font-weight: 400; }
.price-card__feat { color: var(--text-muted); font-size: .9rem; margin: 0; padding-left: 1.1em; }
.price-card__feat li { margin-bottom: 4px; }
.price-card__cta { margin-top: auto; padding-top: var(--sp-3); }

.pay-history-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pay-history { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 380px; }
.pay-history th, .pay-history td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.pay-history th { color: var(--text-muted); font-weight: 600; }

.pay-status { font-size: .78rem; padding: 2px 8px; border-radius: var(--radius-pill); }
.pay-status--paid { color: #7fe0a8; border: 1px solid var(--success); }
.pay-status--pending { color: var(--gold); border: 1px solid var(--gold); }

/* --- Чат с Госпожой ------------------------------------------------------ */
.chat {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - var(--header-h) - 2 * var(--sp-5));
    min-height: 360px;
}

.chat__feed {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-1) var(--sp-4);
    scroll-behavior: smooth;
}

.chat__row { display: flex; flex-direction: column; max-width: 100%; }
.chat__markers { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-2); }

.chat__input {
    display: flex;
    gap: var(--sp-2);
    align-items: flex-end;
    padding-top: var(--sp-3);
    border-top: 1px solid var(--border);
}

    .chat__input textarea {
        flex: 1;
        max-height: 140px;
        min-height: 44px;
        resize: none;
    }

.chat__gift-btn {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-surface);
    color: var(--gold, #d9b24a);
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease, transform .1s ease;
}

    .chat__gift-btn:hover:not(:disabled) { border-color: var(--gold, #d9b24a); transform: translateY(-1px); }
    .chat__gift-btn:disabled { opacity: .5; cursor: default; }

/* --- Подарки/дань ---------------------------------------------------------- */
.gift-picker { display: flex; flex-direction: column; gap: var(--sp-5); }

.gift-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: var(--sp-3);
}

.gift-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--sp-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-surface);
    color: var(--text);
    cursor: pointer;
    transition: border-color .15s ease, transform .1s ease;
}

    .gift-card:hover:not(:disabled) { border-color: var(--gold, #d9b24a); transform: translateY(-2px); }
    .gift-card:disabled { opacity: .5; cursor: default; }
    .gift-card__emoji { font-size: 1.8rem; line-height: 1; }
    .gift-card__name { font-size: .9rem; }
    .gift-card__price { font-size: .8rem; color: var(--gold, #d9b24a); font-weight: 600; }

.gift-amounts { display: flex; flex-direction: column; gap: var(--sp-2); }
.gift-amounts__label { font-size: .85rem; color: var(--text-muted); }
.gift-amounts__tiers { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.gift-amounts__custom { display: flex; gap: var(--sp-2); align-items: center; }
    .gift-amounts__custom .input { flex: 1; }

@media (max-width: 768px) {
    .chat { height: calc(100dvh - var(--header-h) - var(--bottomnav-h) - 2 * var(--sp-4)); }
}

/* --- Иконки (SVG) --------------------------------------------------------- */
.ico { display: inline-block; vertical-align: -.18em; flex-shrink: 0; }
.card__title-ico { margin-right: 6px; color: var(--accent-glow); }
.stat-tile__icon { color: var(--accent-glow); }
.paywall__icon { color: var(--gold); }
.empty-state__icon { color: var(--text-muted); }
.feat__icon { color: var(--accent-glow); }

/* --- Отправитель (шапка чата / задания) ----------------------------------- */
.sender { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.sender__meta { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.sender__name { font-weight: 700; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sender--lg .sender__name { font-family: var(--font-head); font-size: 1.05rem; }
.sender__sub { font-size: .78rem; color: var(--text-muted); display: inline-flex; align-items: center; gap: 5px; }
.sender__sub--online { color: #8ce0a6; }

.sender__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #3ba55d;
    flex-shrink: 0;
}

.chat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding-bottom: var(--sp-3);
    margin-bottom: var(--sp-2);
    border-bottom: 1px solid var(--border);
}

.chat__head-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

    .chat__head-link:hover { color: var(--accent-glow); text-decoration: none; }

/* --- Карточки заданий ------------------------------------------------------ */
.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--sp-4);
}

.task-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    transition: transform .15s ease, border-color .15s ease;
}

    .task-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
    .task-card--locked { opacity: .75; }
    .task-card--locked .task-card__cover { filter: grayscale(.5) brightness(.7); }

.task-card__cover {
    position: relative;
    aspect-ratio: 21 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-void);
    background-image: linear-gradient(150deg, rgba(142, 31, 58, .55), rgba(155, 89, 182, .30));
    background-size: cover;
    background-position: center;
    color: rgba(255, 255, 255, .55);
}

.task-card__reward {
    position: absolute;
    top: var(--sp-2);
    right: var(--sp-2);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: rgba(10, 8, 12, .72);
    border: 1px solid var(--gold);
    color: var(--gold);
    font-size: .8rem;
    font-weight: 700;
    backdrop-filter: blur(3px);
}

.task-card__body { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-4); flex: 1; }
.task-card__title { font-family: var(--font-head); font-size: 1.05rem; }
.task-card__desc { font-size: .9rem; }

/* Свёрнутое описание: max-height + плавное затухание вместо line-clamp —
   line-clamp с абзацами markdown давал наложение обрезанных строк. */
.task-card__desc--clamped {
    position: relative;
    max-height: 10.5em;
    overflow: hidden;
}

    .task-card__desc--clamped::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 3em;
        background: linear-gradient(to bottom, transparent, var(--bg-surface));
        pointer-events: none;
    }

.task-card__expand {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    align-self: flex-start;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--accent-glow);
    font-family: var(--font-body);
    font-size: .85rem;
    font-weight: 600;
}

    .task-card__expand:hover { text-decoration: underline; }
.task-card__meta { gap: var(--sp-2); }
/* Кнопка всегда прижата к низу карточки (сетка выравнивает карточки по высоте ряда). */
.task-card__cta { margin-top: auto; padding-top: var(--sp-3); }

/* --- Результат оплаты ------------------------------------------------------ */
.pay-result-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto var(--sp-3);
}

.pay-result-ico--ok { color: #7fe0a8; border: 2px solid var(--success); }
.pay-result-ico--fail { color: #f0a59b; border: 2px solid var(--danger); }

/* --- Футер ------------------------------------------------------------------ */
.site-footer {
    margin-top: var(--sp-7);
    padding: var(--sp-5) 0 var(--sp-4);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: .85rem;
}

.site-footer__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-4);
    flex-wrap: wrap;
}

.site-footer__brand { font-family: var(--font-head); color: var(--text); }

.site-footer__age {
    display: inline-block;
    padding: 1px 7px;
    margin-left: 6px;
    border: 1px solid var(--accent);
    border-radius: var(--radius-pill);
    color: var(--accent-glow);
    font-size: .72rem;
    font-family: var(--font-body);
    font-weight: 700;
}

.site-footer__links { display: flex; gap: var(--sp-4); flex-wrap: wrap; }
.site-footer__links a { color: var(--text-muted); }
.site-footer__links a:hover { color: var(--accent-glow); }
.site-footer__note { margin: var(--sp-3) 0 0; font-size: .78rem; }

/* --- Legal-страницы ---------------------------------------------------------- */
.legal { max-width: 760px; }
.legal h1 { margin-bottom: var(--sp-3); }
.legal h2 { font-size: 1.15rem; margin-top: var(--sp-6); }
.legal ul { color: var(--text); padding-left: 1.3em; }
.legal li { margin-bottom: var(--sp-2); }

/* --- Лидерборд: медали ------------------------------------------------------- */
.lb-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lb-rank--gold, .lb-rank--silver, .lb-rank--bronze {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0 auto;
    border-radius: 50%;
    font-size: .95rem;
}

.lb-rank--gold { border: 1px solid var(--gold); color: var(--gold); background: rgba(201, 168, 92, .10); }
.lb-rank--silver { border: 1px solid #b9b9c6; color: #cfcfda; background: rgba(185, 185, 198, .10); }
.lb-rank--bronze { border: 1px solid #b0714b; color: #d99a6e; background: rgba(176, 113, 75, .10); }

/* --- Онбординг-визард ---------------------------------------------------- */
.onb-wrap {
    min-height: calc(100vh - var(--header-h));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4) 0;
}

.onb-card { width: 100%; max-width: 540px; }
.onb-step-num { font-size: .8rem; color: var(--text-muted); letter-spacing: .04em; text-transform: uppercase; }
.onb-actions { display: flex; gap: var(--sp-3); justify-content: space-between; margin-top: var(--sp-5); }
.onb-rules { background: var(--bg-void); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--sp-4) var(--sp-4) var(--sp-4) calc(var(--sp-4) + 1.4em); list-style: disc outside; }
.onb-rules li { margin-bottom: var(--sp-2); padding-left: .25em; }
.onb-check { display: flex; gap: var(--sp-3); align-items: flex-start; cursor: pointer; }
.onb-check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    color: var(--text-muted);
    font-size: .82rem;
    margin: var(--sp-4) 0;
}

    .auth-divider::before, .auth-divider::after {
        content: "";
        flex: 1;
        height: 1px;
        background: var(--border);
    }

/* --- Состояния валидации форм ------------------------------------------ */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--success); }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); font-size: .85rem; }

/* --- Blazor error UI ---------------------------------------------------- */
.blazor-error-boundary {
    background: var(--danger);
    padding: var(--sp-4);
    color: #fff;
}

    .blazor-error-boundary::after { content: "Произошла ошибка."; }

#blazor-error-ui {
    color-scheme: dark;
    background: var(--bg-elevated);
    color: var(--text);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
    display: none;
    left: 0;
    padding: .6rem 1.25rem .7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* =========================================================================
   Админка (Этап 12)
   ========================================================================= */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--sp-4);
    margin-top: var(--sp-5);
}

.admin-tile {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: border-color .2s, transform .2s;
}
    .admin-tile:hover {
        border-color: rgba(142, 31, 58, .45);
        text-decoration: none;
        color: inherit;
        transform: translateY(-2px);
    }
.admin-tile__ico { color: var(--accent-glow); margin-bottom: var(--sp-2); }
.admin-tile__title { font-weight: 600; margin-bottom: 4px; }

.admin-meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--sp-3);
    margin: 0 0 var(--sp-4);
}
.admin-meta dt { font-size: .75rem; color: var(--text-muted); margin: 0; }
.admin-meta dd { margin: 2px 0 0; font-weight: 500; }
.admin-code {
    font-family: ui-monospace, monospace;
    font-size: 1.15rem;
    letter-spacing: .08em;
    color: var(--gold);
}

.admin-photos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
}
@media (max-width: 768px) {
    .admin-photos { grid-template-columns: 1fr; }
}
.admin-photo__img {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-void);
}
.admin-photo__empty {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: var(--sp-4);
    text-align: center;
}
.mt-4 { margin-top: var(--sp-4); }
