/* === Контейнер всех popups === */
.reward-popup-overlay {
    position: fixed;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    /* ?? Новое - свежие popups сверху */
    align-items: center;
    gap: 10px;
    pointer-events: none;
    animation: fade-in 0.25s ease-out;
}

/* === Каждый popup === */
.reward-popup {
    --reward-border: var(--card-border, var(--tg-button-color, gold));
    --reward-shadow: var(--shadow-soft, 0 6px 24px rgba(0, 0, 0, 0.45));
    background: var(--surface-2, rgba(28, 31, 43, 0.95));
    border: 2px solid var(--reward-border);
    color: var(--text-1, var(--tg-text-color, #fff));
    padding: 16px 22px;
    border-radius: 18px;
    min-width: 260px;
    max-width: 90vw;
    box-shadow: var(--reward-shadow);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    transform: translateY(15px);
    opacity: 0;

    animation:
        popup-slide 0.35s cubic-bezier(0.25, 1, 0.5, 1) forwards,
        fade-out-popup 0.7s ease-in var(--popup-hide-delay, 2.6s) forwards;
    transition: all 0.3s ease;
}

.reward-popup.tier-minor {
    --popup-hide-delay: 1.8s;
    --reward-border: var(--reward-tier-minor, #6bd6ff);
    --reward-shadow: 0 6px 18px rgba(49, 174, 255, 0.3);
}

.reward-popup.tier-major {
    --popup-hide-delay: 2.4s;
    --reward-border: var(--reward-tier-major, #65e2b0);
    --reward-shadow: 0 8px 24px rgba(91, 214, 164, 0.35);
}

.reward-popup.tier-epic {
    --popup-hide-delay: 3.2s;
    --reward-border: var(--reward-tier-epic, #b37bff);
    --reward-shadow: 0 10px 28px rgba(164, 99, 255, 0.4);
    background: linear-gradient(135deg, var(--surface-2, rgba(40, 28, 62, 0.96)), var(--surface-3, rgba(28, 31, 43, 0.92)));
}

.reward-popup.tier-legendary {
    --popup-hide-delay: 4s;
    --reward-border: var(--reward-tier-legendary, #ffd36a);
    --reward-shadow: 0 12px 32px rgba(255, 209, 106, 0.45);
    background: radial-gradient(
        circle at top left,
        var(--accent-glow, rgba(255, 220, 140, 0.25)),
        var(--surface-2, rgba(28, 31, 43, 0.95))
    );
}

.reward-popup.tier-epic .reward-icon,
.reward-popup.tier-legendary .reward-icon {
    width: 24px;
    height: 24px;
}

.reward-popup.tier-legendary .reward-info h3 {
    font-size: 20px;
}

/* === ?? Эффект каскада для нескольких popup'ов === */
.reward-popup:nth-child(1) {
    transform: scale(1) translateY(0);
    opacity: 1;
    z-index: 5;
}

.reward-popup:nth-child(2) {
    transform: scale(0.96) translateY(-6px);
    opacity: 0.9;
    z-index: 4;
}

.reward-popup:nth-child(3) {
    transform: scale(0.92) translateY(-12px);
    opacity: 0.8;
    z-index: 3;
}

.reward-popup:nth-child(4) {
    transform: scale(0.88) translateY(-18px);
    opacity: 0.7;
    z-index: 2;
}

.reward-popup:nth-child(n + 5) {
    transform: scale(0.85) translateY(-24px);
    opacity: 0.6;
    z-index: 1;
}

/* === Иконка === */
.reward-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    animation: pulse 0.8s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.15));
}

/* === Текст === */
.reward-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.reward-info h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-1, var(--tg-text-color, #fff));
    line-height: 1.2;
}

.reward-desc {
    font-size: 14px;
    margin: 3px 0 0;
    opacity: 0.85;
    line-height: 1.25;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.reward-bonus {
    font-size: 15px;
    color: var(--accent, gold);
    font-weight: 600;
    margin-top: 4px;
    text-shadow: 0 0 5px var(--accent-glow, rgba(255, 215, 0, 0.4));
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.reward-effect {
    margin-top: 6px;
    font-size: 13px;
    opacity: 0.9;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.reward-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    opacity: 0.65;
}

.reward-text {
    font-size: 13px;
    line-height: 1.25;
}

.reward-meta {
    margin-top: 6px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.reward-tier,
.reward-memory {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--surface-3, rgba(255, 255, 255, 0.12));
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.reward-tier.minor {
    background: rgba(107, 214, 255, 0.18);
    color: #a8dcff;
}

.reward-tier.major {
    background: rgba(101, 226, 176, 0.2);
    color: #a8f0cd;
}

.reward-tier.epic {
    background: rgba(179, 123, 255, 0.2);
    color: #d0b0ff;
}

.reward-tier.legendary {
    background: rgba(255, 211, 106, 0.25);
    color: #ffe3a8;
}

.reward-memory {
    color: var(--text-2, var(--tg-hint-color, #bbb));
}

/* === Анимации === */
@keyframes popup-slide {
    0% {
        transform: translateY(30px);
        opacity: 0;
    }

    60% {
        transform: translateY(-5px);
        opacity: 1;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fade-out-popup {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-15px);
    }
}

@keyframes pulse {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.2);
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* === Safe area для Telegram === */
@supports (padding: env(safe-area-inset-bottom)) {
    .reward-popup-overlay {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* === ?? Поддержка тёмных / светлых Telegram тем === */
html[data-theme="dark"] .reward-popup {
    background: var(--surface-2, rgba(28, 31, 43, 0.95));
}

html[data-theme="light"] .reward-popup {
    background: var(--surface-2, rgba(255, 255, 255, 0.9));
    color: var(--text-1, #222);
}
/* === Контейнер достижений === */
.achievements-view {
    width: 100%;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fadeSlide 0.3s ease;
    color: var(--tg-text-color, #fff);
    background: transparent;
}

.achievements-view h2 {
    text-align: center;
    color: var(--accent, #ffd700);
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.achievements-view.empty {
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 60vh;
}

.achievements-view.empty .hint {
    color: var(--tg-hint-color, #aaa);
    font-size: 1rem;
    margin-top: 8px;
}

/* === Сетка достижений === */
.achievements-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* === Карточка достижения === */
.achievement-card {
    background: var(--surface-2, var(--card-color, rgba(255, 255, 255, 0.05)));
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: var(--shadow-soft, 0 2px 8px rgba(0, 0, 0, 0.25));
    transition: all 0.25s ease;
    animation: popIn 0.4s ease;
    backdrop-filter: blur(6px);
}

.achievement-card--rewarded {
    border: 2px solid var(--accent, #ffd700);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

.achievement-card.legacy {
    border: 1px dashed rgba(255, 255, 255, 0.2);
    box-shadow: none;
    opacity: 0.85;
}

/* === Заголовок достижения === */
.achievement-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.title-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.achievement-header h3 {
    font-size: 1rem;
    color: var(--tg-text-color, #fff);
    margin: 0;
    font-weight: 600;
}

.tier-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: var(--tg-text-color, #fff);
    letter-spacing: 0.2px;
    text-transform: uppercase;
}

.tier-badge.minor {
    background: rgba(120, 210, 255, 0.18);
    color: #a8dcff;
}

.tier-badge.major {
    background: rgba(101, 226, 176, 0.2);
    color: #a8f0cd;
}

.tier-badge.epic {
    background: rgba(179, 123, 255, 0.2);
    color: #d0b0ff;
}

.tier-badge.legendary {
    background: rgba(255, 211, 106, 0.25);
    color: #ffe3a8;
}

.tier-badge.legacy {
    background: rgba(255, 255, 255, 0.08);
    color: var(--tg-hint-color, #bbb);
}

.reward {
    font-weight: 600;
    color: var(--accent, #ffd700);
}

.reward.approx {
    color: #ffd36a;
}

/* === Детали достижения === */
.achievement-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 6px 0 8px;
}

.achievement-line {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.85rem;
}

.achievement-line .label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.7rem;
    color: var(--tg-hint-color, #aaa);
}

.achievement-line .value {
    color: var(--tg-text-color, #fff);
}

/* === Прогресс === */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    overflow: hidden;
    margin: 6px 0;
}

.progress-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent, #ffd700), #fff);
    transition: width 0.3s ease;
}

/* === Статус === */
.achievement-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.achievement-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.memory-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--tg-hint-color, #bbb);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status {
    font-size: 0.85rem;
    color: var(--tg-hint-color, #bbb);
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.status-text.done {
    color: #00ffcc;
    font-weight: 600;
}

.status-text.in-progress {
    opacity: 0.8;
}
.status-text.pending {
    color: #ffd36a;
    font-weight: 600;
}
.status-text.legacy {
    color: var(--tg-hint-color, #aaa);
    font-style: italic;
}

.status-progress {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.65);
    letter-spacing: 0.3px;
}

.streak-info {
    font-size: 0.65rem;
    color: var(--tg-hint-color, #aaa);
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* === Анимации === */
@keyframes popIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


.achievement-card--pending {
    border: 1px solid rgba(255, 211, 106, 0.35);
    box-shadow: 0 0 10px rgba(255, 211, 106, 0.18);
}

.achievement-card--just-granted {
    animation: achvPulse 1.2s ease;
}
@keyframes achvPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(255, 211, 106, 0.0); }
    50% { transform: scale(1.02); box-shadow: 0 0 16px rgba(255, 211, 106, 0.35); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(255, 211, 106, 0.0); }
}




.debug-log-toggle {
    position: fixed;
    bottom: 50px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #1a1a2e;
    color: #fff;
    border: 2px solid #16c784;
    font-size: 24px;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
}

.debug-log-toggle:hover {
    background: #252541;
    transform: scale(1.1);
}

.debug-log-panel {
    position: fixed;
    width: 90vw;
    max-width: 500px;
    height: 60vh;
    max-height: 600px;
    background: #1a1a2e;
    border: 2px solid #16c784;
    border-radius: 8px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    font-family: "Monaco", "Courier New", monospace;
    font-size: 11px;
}

.debug-log-header {
    padding: 8px 12px;
    background: #0f3460;
    border-bottom: 1px solid #16c784;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: move;
    touch-action: none;
}

.debug-log-title {
    font-weight: bold;
    color: #16c784;
    font-size: 12px;
    display: flex;
    gap: 6px;
    align-items: center;
}

.debug-log-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.debug-log-header-actions {
    margin-left: auto;
}

.debug-log-close {
    background: transparent;
    border: 1px solid rgba(22, 199, 132, 0.6);
    color: #fff;
    padding: 2px 6px;
    font-size: 11px;
    border-radius: 6px;
    cursor: pointer;
}

.debug-log-close:hover {
    border-color: #16c784;
}

.debug-log-tab {
    background: transparent;
    border: 1px solid rgba(22, 199, 132, 0.6);
    color: inherit;
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 6px;
    cursor: pointer;
}

.debug-log-tab[data-active="true"] {
    border-color: #16c784;
}

.debug-log-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.debug-log-filter {
    flex: 1 1 140px;
    padding: 4px 6px;
    background: #1a1a2e;
    border: 1px solid #16c784;
    color: #fff;
    border-radius: 3px;
    font-size: 11px;
    font-family: "Monaco", "Courier New", monospace;
}

.debug-log-filter::placeholder {
    color: #888;
}

.debug-log-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #aaa;
    font-size: 10px;
    cursor: pointer;
    user-select: none;
}

.debug-log-checkbox input {
    cursor: pointer;
}

.debug-log-clear-btn {
    padding: 3px 8px;
    background: #e74c3c;
    border: 1px solid #c0392b;
    color: #fff;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
    font-family: "Monaco", "Courier New", monospace;
    transition: all 0.1s;
}

.debug-log-clear-btn:hover {
    background: #c0392b;
}

.debug-log-copy-btn {
    padding: 3px 8px;
    background: #16c784;
    border: 1px solid #12a66d;
    color: #fff;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
    font-family: "Monaco", "Courier New", monospace;
    transition: all 0.1s;
}

.debug-log-control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 420px) {
    .debug-log-controls {
        align-items: stretch;
    }
    .debug-log-control-group {
        width: 100%;
        justify-content: space-between;
    }
    .debug-log-filter {
        flex: 1 1 100%;
    }
}

.debug-log-copy-btn:hover {
    background: #12a66d;
}

.debug-log-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.debug-log-content::-webkit-scrollbar {
    width: 6px;
}

.debug-log-content::-webkit-scrollbar-track {
    background: #0f3460;
}

.debug-log-content::-webkit-scrollbar-thumb {
    background: #16c784;
    border-radius: 3px;
}

.debug-log-content::-webkit-scrollbar-thumb:hover {
    background: #0fb881;
}

.debug-log-empty {
    color: #666;
    text-align: center;
    padding: 20px;
}

.debug-log-entry {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 4px;
    border-radius: 2px;
    white-space: pre-wrap;
    word-break: break-all;
}

.debug-log-log {
    color: #aaa;
    background: rgba(255, 255, 255, 0.05);
}

.debug-log-warn {
    color: #f39c12;
    background: rgba(243, 156, 18, 0.1);
}

.debug-log-error {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.debug-log-time {
    color: #666;
    font-weight: bold;
    min-width: 50px;
    text-align: right;
}

.debug-log-level {
    color: #16c784;
    font-weight: bold;
    min-width: 60px;
}

.debug-log-message {
    flex: 1;
    line-height: 1.3;
}

.debug-log-footer {
    padding: 6px 12px;
    background: #0f3460;
    border-top: 1px solid #16c784;
    color: #888;
    font-size: 10px;
    text-align: right;
}

/* Мобильная версия */
@media (max-width: 600px) {
    .debug-log-panel {
        width: 95vw;
        height: 50vh;
        max-width: none;
    }

    .debug-log-entry {
        font-size: 10px;
    }

    .debug-log-time {
        min-width: 40px;
    }

    .debug-log-level {
        min-width: 50px;
    }
}
:root {
    /* Основные цвета Telegram Mini App */
    --tg-bg-color: var(--tg-theme-bg-color, #0b132b);
    --tg-text-color: var(--tg-theme-text-color, #ffffff);
    --tg-hint-color: var(--tg-theme-hint-color, #a7b3c7);
    /* Visual reset: keep accent aligned with primary icon tone */
    --accent: var(--icon-primary);
    --accent-text: var(--tg-theme-button-text-color, #111111);
    --accent-glow: rgba(143, 179, 255, 0.35);

    /* Theme tokens (visual-only) */
    --bg-0: var(--tg-bg-color);
    --text-1: var(--tg-text-color);
    --text-2: var(--tg-hint-color);
    --text-3: rgba(255, 255, 255, 0.6);

    /* Visual reset: icon-first palette (cool + warm) */
    --icon-primary: #8fb3ff;
    --icon-primary-rgb: 143, 179, 255;
    --icon-secondary: #f0b48a;
    --icon-secondary-rgb: 240, 180, 138;
    --icon-neutral: rgba(255, 255, 255, 0.85);
    --icon-economy: #b89c7a;
    --icon-social: #7f97c9;
    --icon-progress: #78a39b;
    --bg-gradient: radial-gradient(120% 90% at 50% 0%,
            rgba(255, 255, 255, 0.05) 0%,
            rgba(255, 255, 255, 0) 60%),
        linear-gradient(180deg,
            rgba(255, 255, 255, 0.02) 0%,
            rgba(0, 0, 0, 0) 60%);
    --surface-1: rgba(255, 255, 255, 0.05);
    --surface-2: rgba(255, 255, 255, 0.08);
    --surface-3: rgba(255, 255, 255, 0.035);
    --card-border: rgba(255, 255, 255, 0.12);
    --divider: rgba(255, 255, 255, 0.08);

    /* Дополнительные */
    --card-color: rgba(255, 255, 255, 0.06);
    --energy-bg: #111;
    /* Visual reset: energy stays neutral within icon palette */
    --energy-fill: linear-gradient(90deg,
            rgba(var(--icon-primary-rgb), 0.55),
            rgba(var(--icon-primary-rgb), 0.3));
    --tabs-bg: rgba(255, 255, 255, 0.08);

    /* Размеры и анимации */
    --radius: 14px;
    --transition: 0.25s ease;

    /* Buttons */
    --btn-primary-bg: var(--accent);
    --btn-primary-text: var(--accent-text);
    --btn-secondary-bg: var(--surface-1);
    --btn-secondary-text: var(--text-1);
    --btn-border: var(--card-border);
}

/* === Glass UI v2.2 Enhancements === */
:root {
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-blur: blur(10px);
    --shadow-soft: 0 0 20px rgba(0, 0, 0, 0.25);
    --shadow-strong: 0 10px 28px rgba(0, 0, 0, 0.4);
    --transition-fast: 0.15s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
/* === БАЗОВЫЙ RESET === */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body,
#root {
    height: -webkit-fill-available;
    /* ✅ для Telegram Android/iOS */
    min-height: 100vh;
    /* ✅ fallback для desktop */
    overflow-x: hidden;
    overflow-y: hidden;
}

/* === КОНТЕЙНЕР === */
.App {
    width: 100%;
    max-width: 420px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-0);
    margin: 0 auto;
    overflow-y: auto;
    border-radius: var(--radius);
    scrollbar-width: none;
}

/* === Fade-in on load === */
.App {
    animation: fadeIn 0.4s ease-out;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.App::-webkit-scrollbar {
    display: none;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
    margin: 0;
}

.ui-card {
    background: var(--surface-2);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

/* === АДАПТИВ === */
@media (max-width: 480px) {
    .App {
        border-radius: 0;
    }
}

:root {
    --icon-size-s: 16px;
    --icon-size-m: 20px;
    --icon-size-l: 24px;
}

.ui-icon {
    display: inline-block;
    vertical-align: middle;
    /* Icon visual pass: baseline size uplift for readability */
    width: var(--icon-size-m);
    height: var(--icon-size-m);
    flex-shrink: 0;
    color: var(--icon-neutral);
    line-height: 1;
    opacity: 0.85;
    filter: none;
    transform: scale(1);
    transform-origin: center;
    transition: opacity 0.2s ease, filter 0.2s ease, transform 0.12s ease;
}

.ui-icon.is-interactive {
    opacity: 0.95;
}

.ui-icon.is-disabled {
    opacity: 0.4;
    filter: none;
}

.ui-icon.active,
.ui-icon.current,
.ui-icon.selected,
.active .ui-icon,
.current .ui-icon,
.selected .ui-icon {
    opacity: 1;
    filter: brightness(1.07);
}

.ui-icon.is-interactive:active,
button:active .ui-icon,
a:active .ui-icon {
    transform: scale(0.98);
}

.ui-icon.size-s {
    width: var(--icon-size-s);
    height: var(--icon-size-s);
}

.ui-icon.size-m {
    width: var(--icon-size-m);
    height: var(--icon-size-m);
}

.ui-icon.size-l {
    width: var(--icon-size-l);
    height: var(--icon-size-l);
}

.ui-section-title .ui-icon {
    color: var(--icon-neutral);
}

.ui-icon.icon-neutral {
    color: var(--icon-neutral);
}

.ui-icon.icon-economy {
    color: var(--icon-economy);
}

.ui-icon.icon-social {
    color: var(--icon-social);
}

.ui-icon.icon-progress {
    color: var(--icon-progress);
}

.ui-icon.primary {
    color: var(--icon-neutral);
}

.ui-icon.muted {
    color: var(--text-2);
}
/* === ОСНОВНОЙ LAYOUT === */
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-0);
    color: var(--text-1);
}

iframe.payment-verification,
iframe[src*="telegram"] {
    pointer-events: none !important;
}

.App {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: var(--app-height, 100vh);
    width: 100%;
    /*
      Telegram WebView is unreliable with scrolling the outer app container
      when html/body are overflow-hidden. Make the content area the single
      scroll container to ensure tab content is always reachable.
    */
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-0);
    background-image: var(--bg-gradient);
}

.App,
.App * {
    pointer-events: auto;
}

/* === HEADER === */
.header {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--surface-2, var(--tabs-bg));
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--card-border, var(--divider));
    box-shadow: var(--shadow-soft);
    padding-top: calc(env(safe-area-inset-top, 12px) + 8px);
    padding-bottom: 10px;
    position: sticky;
    top: 0;
    z-index: 50;
}

/* === Заголовок игры 💰 CriptoClicker === */
.header h1 {
    /* Branded header (locked):
       gold pulse as logo breathing,
       do not modify without UX approval */
    background: linear-gradient(
        90deg,
        #ffd700 0%,
        #fff3b0 25%,
        #ffe066 50%,
        #fff3b0 75%,
        #ffd700 100%
    );
    color: transparent;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35),
        0 0 6px rgba(255, 215, 0, 0.35);
    letter-spacing: 0.4px;
    font-weight: 700;
    font-size: 1.4rem;
    text-transform: none;
    text-align: center;
    margin: 0;
    padding: 4px 0;
    animation: headerPulse 4.5s ease-in-out infinite;
}

@keyframes headerPulse {
    0% {
        opacity: 0.92;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35),
            0 0 4px rgba(255, 215, 0, 0.25);
    }

    50% {
        opacity: 1;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35),
            0 0 8px rgba(255, 215, 0, 0.45);
    }

    100% {
        opacity: 0.92;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35),
            0 0 4px rgba(255, 215, 0, 0.25);
    }
}

/* === Вкладки === */
.tabs.top-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
}

.tabs.top-tabs button {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 10px;
    border: none;
    background: var(--surface-1);
    color: var(--text-1);
    cursor: pointer;
    transition: background 0.25s ease;
}

.tabs.top-tabs button.has-badge {
    position: relative;
}

.tab-badge-dot {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #33ff99;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

.tabs.top-tabs button.active {
    background: var(--surface-2);
    color: var(--text-1);
}

/* === КОНТЕНТ === */
.content {
    flex: 1;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    /*
      Single scroll container for all tabs. min-height:0 is required for
      flex children to be allowed to shrink and overflow-scroll correctly.
    */
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: 12px 0 calc(100px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}

.content.content-game {
    padding-top: 8px;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

/* === НИЖНЯЯ ПАНЕЛЬ === */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 420px;

    background: var(--surface-1);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--divider);

    padding: 6px 0 env(safe-area-inset-bottom, 4px);
    z-index: 999;
}

.content,
.header,
.tabs.top-tabs,
.bottom-nav {
    position: relative;
    z-index: 1;
}

/* === Bottom nav items === */
.bn-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;

    min-height: 44px;
    padding: 6px 0;

    font-size: 0.8rem;
    color: var(--text-1);
    opacity: 0.6;

    background: transparent;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.bn-item:active {
    transform: scale(0.96);
}

/* active = location, not reward */
.bn-item.active {
    opacity: 1;
    font-weight: 700;
}

.bn-ico {
    width: var(--icon-size-l);
    height: var(--icon-size-l);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
    opacity: 0.9;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.bn-item .ui-icon {
    opacity: 0.6;
    filter: none;
    transition: opacity 0.2s ease, filter 0.2s ease, transform 0.12s ease;
}

.bn-item.active .bn-ico {
    opacity: 1;
    transform: translateY(-1px);
}

.bn-item.active .ui-icon {
    opacity: 1;
    filter: brightness(1.08);
}

.bn-item:active .ui-icon {
    transform: scale(0.98);
}

.bn-lbl {
    font-size: 0.7rem;
    font-weight: 600;
}

/* === Friends screen polish === */
.friends-view .ui-section {
    margin-bottom: 22px;
}

.friends-view {
    line-height: 1.4;
    padding-bottom: 80px;
}

.friends-view .ui-section-title {
    line-height: 1.22;
}

.friends-view .ui-label,
.friends-view .ui-value,
.friends-view p {
    line-height: 1.35;
}

.friends-header {
    margin-bottom: 20px;
}

.friends-subtitle {
    font-size: 0.85rem;
    opacity: 0.75;
    margin-top: 6px;
    line-height: 1.4;
    max-width: 340px;
}

.friends-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.22;
}

.friends-card .ui-row + .ui-row {
    margin-top: 8px;
}

.friends-boost-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px 18px 16px;
    text-align: center;
    background: var(--surface-2, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-soft);
}

.friends-boost-heading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.85;
}

.friends-loading {
    margin-left: 8px;
    font-size: 0.7rem;
    opacity: 0.65;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.friends-boost-heading .ui-icon {
    width: 18px;
    height: 18px;
}

.friends-boost-heading + .friends-boost-hero {
    margin-top: -2px;
}

.friends-boost-hero {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: center;
}

.friends-boost-value {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.25);
}

.friends-boost-title {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.85;
}

.friends-boost-line {
    font-size: 0.8rem;
    opacity: 0.7;
}

.friends-boost-hint {
    font-size: 0.75rem;
    opacity: 0.6;
}

.friends-boost-cap {
    margin-top: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.8;
}

.friends-boost-meter {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    margin-top: 2px;
}

.friends-boost-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.6), rgba(255, 215, 0, 0.2));
    width: 0%;
    transition: width 0.4s ease;
}

.friends-boost-fill.cap {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.9), rgba(255, 215, 0, 0.5));
}

.friends-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.friends-meta-block {
    margin-top: 8px;
    line-height: 1.3;
    max-width: 360px;
    align-items: center;
    text-align: center;
}

.friends-cta-group {
    display: flex;
    gap: 10px;
    flex-direction: column;
    width: 100%;
}

.friends-cta-note {
    margin-top: 8px;
    font-size: 0.78rem;
    opacity: 0.7;
    max-width: 360px;
    text-align: center;
}

.friends-cta-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--btn-border);
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    justify-content: center;
}

.friends-cta-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.friends-cta-button.primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border-color: var(--btn-border);
    box-shadow: var(--shadow-soft), 0 0 12px var(--accent-glow);
}

.friends-cta-button.secondary {
    background: var(--btn-secondary-bg);
}

.friends-cta-button .cta-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--icon-size-m);
    height: var(--icon-size-m);
}

.friends-leave {
    margin-top: 12px;
}

.friends-list-card {
    margin-top: 10px;
}

.friends-list-container {
    margin-top: 8px;
}

.friends-divider {
    width: 100%;
    height: 1px;
    background: var(--divider);
    margin: 4px 0 18px;
}

.friends-circle-section {
    margin-top: 20px;
}

.friends-circle-shell {
    background: var(--surface-3);
    border-radius: 16px;
    padding: 14px;
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.06));
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.friends-circle-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.friends-circle-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.friends-circle-id-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    opacity: 0.7;
    padding: 6px 10px;
    border-radius: 12px;
    background: var(--surface-3, rgba(255, 255, 255, 0.04));
    width: fit-content;
}

.friends-circle-id-label {
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
}

.friends-circle-id-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        "Liberation Mono", "Courier New", monospace;
    font-size: 0.75rem;
}

.friends-info {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.7rem;
    font-weight: 700;
    opacity: 0.7;
    cursor: default;
}

.friends-tooltip-layer {
    position: fixed;
    background: #111;
    color: #fff;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.75rem;
    line-height: 1.4;
    width: min(260px, 72vw);
    text-align: left;
    z-index: 1000;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
    white-space: normal;
    border: 1px solid rgba(255, 255, 255, 0.12);
    pointer-events: none;
}

.friends-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.friend-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    line-height: 1.35;
}

.friend-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}

.friend-name {
    font-weight: 600;
}

.friend-chapter {
    font-size: 0.75rem;
    opacity: 0.7;
}

.friend-badges {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.friend-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.75rem;
    opacity: 0.85;
}

.friend-badge .ui-icon {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.friends-empty {
    text-align: center;
    padding: 16px 12px;
    margin-top: 8px;
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.friends-empty-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
    opacity: 0.7;
}

.friends-empty-text {
    font-size: 0.85rem;
    opacity: 0.7;
    margin: 0;
}

.friends-empty-subtext {
    font-size: 0.78rem;
    opacity: 0.6;
    margin-top: 6px;
}

.friends-meta-text {
    margin-left: auto;
    font-size: 0.75rem;
    opacity: 0.65;
    line-height: 1.3;
}

.friends-chip {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--surface-2, rgba(255, 255, 255, 0.08));
    line-height: 1.2;
}

.friends-cta-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px;
}

.friends-circle-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--surface-3, rgba(255, 255, 255, 0.02));
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.08));
    text-align: center;
}

.friends-circle-name {
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
}

.friends-circle-note {
    font-size: 0.8rem;
    opacity: 0.7;
    text-align: center;
}

.friends-code-chip {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--surface-2, rgba(255, 255, 255, 0.06));
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    max-width: min(320px, 90%);
    text-align: center;
    word-break: break-all;
}

.friends-invite-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface-3, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.08));
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
}

.friends-circle-code-hint {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 4px;
    text-align: center;
}

.friends-code-copy {
    border: 1px solid var(--btn-border);
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    min-width: 140px;
}

.friends-code-copy:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.friends-empty-note {
    margin-bottom: 12px;
}

.friends-toast {
    position: fixed;
    left: 50%;
    bottom: 90px;
    transform: translateX(-50%);
    background: var(--surface-2, rgba(0, 0, 0, 0.75));
    color: var(--text-1, #fff);
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.8rem;
    z-index: 50;
    max-width: 80%;
    text-align: center;
    box-shadow: var(--shadow-soft, 0 6px 18px rgba(0, 0, 0, 0.35));
}

.friends-toast.error {
    background: color-mix(in srgb, rgba(160, 32, 32, 0.85) 70%, var(--surface-2) 30%);
    border-color: color-mix(in srgb, rgba(160, 32, 32, 0.85) 60%, var(--card-border) 40%);
}

.friends-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    background: color-mix(in srgb, var(--bg-0) 70%, #000 30%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
    padding: 16px;
}

.friends-modal {
    width: min(360px, 92vw);
    background: var(--surface-2);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow-strong);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.friends-modal-title {
    font-size: 1rem;
    font-weight: 700;
}

.friends-modal-text {
    font-size: 0.85rem;
    opacity: 0.75;
    margin: 0;
}

.friends-modal-input {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    background: var(--surface-3);
    color: var(--text-1, inherit);
    padding: 10px 12px;
    font-size: 0.9rem;
}

.friends-modal-input::placeholder {
    color: var(--text-2, var(--tg-hint-color, #bbb));
}

.friends-modal-input:focus-visible {
    outline: none;
    border-color: var(--accent, var(--card-border));
    box-shadow: 0 0 0 2px var(--accent-glow, rgba(255, 255, 255, 0.2));
}

.friends-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.friends-modal-button {
    border-radius: 10px;
    border: 1px solid var(--btn-border);
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.friends-modal-button.primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border-color: var(--btn-border);
    box-shadow: var(--shadow-soft);
}

.friends-modal-button.ghost {
    background: transparent;
}

/* === Tasks screen rhythm === */
.tasks-view {
    line-height: 1.4;
}

.tasks-page-title {
    margin-bottom: 10px;
}

.tasks-section {
    margin-bottom: 22px;
}

.tasks-section-title {
    line-height: 1.22;
    margin-bottom: 10px;
}

.tasks-section-primary .tasks-section-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.tasks-section-secondary .tasks-section-title {
    font-size: 1rem;
    font-weight: 700;
    opacity: 0.9;
}

.tasks-section-tertiary .tasks-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    opacity: 0.8;
}

.task-card {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-card-primary {
    margin-bottom: 16px;
}

.task-card-primary .task-title {
    font-size: 1.08rem;
    font-weight: 700;
}

.task-card-primary .task-desc {
    font-size: 0.95rem;
}

.daily-mission {
    padding: 18px 20px;
    border-radius: 16px;
    background: var(--surface-2);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    margin-bottom: 16px;
}

.daily-mission .task-cta {
    margin-top: 4px;
}

.task-card-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.task-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.task-title {
    font-weight: 600;
    font-size: 0.98rem;
    line-height: 1.3;
}

.task-desc {
    font-size: 0.9rem;
    opacity: 0.85;
    line-height: 1.4;
    max-width: 360px;
}

.task-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

.task-meta-line {
    font-size: 0.85rem;
    opacity: 0.8;
    line-height: 1.35;
}

.task-meta-text {
    margin-left: auto;
    opacity: 0.75;
    font-size: 0.85rem;
    line-height: 1.3;
}

.task-cta {
    display: flex;
    align-items: flex-start;
}

.task-timer {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.9;
    line-height: 1.3;
}

.task-progress {
    font-weight: 600;
    opacity: 0.9;
}

.task-status {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    padding-left: 6px;
    gap: 6px;
}

.task-status-text {
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.85;
    line-height: 1.2;
}

.task-pending-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    min-height: 18px;
    border-radius: 999px;
    font-size: 0.65rem;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.08);
    color: var(--tg-text-color, #fff);
    opacity: 0.7;
}

.task-status-completed,
.task-status-claimed {
    color: rgba(255, 255, 255, 0.85);
}

.task-status-expired {
    color: rgba(255, 255, 255, 0.65);
}

.task-row-completed,
.task-row-claimed {
    opacity: 0.72;
}

.task-row-expired {
    opacity: 0.6;
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    line-height: 1.35;
    background: var(--surface-3, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.08));
}

.task-row-compact {
    padding: 8px 10px;
}

.tasks-list-compact {
    gap: 8px;
}

.tasks-empty {
    opacity: 0.7;
    margin-top: 6px;
}

.tasks-seasonal {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tasks-progress {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.tasks-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.6), rgba(255, 215, 0, 0.25));
}

.tasks-legacy-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
    background: var(--surface-2, rgba(255, 255, 255, 0.05));
    color: var(--text-1, var(--tg-text-color));
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.tasks-primary-cta {
    min-width: 120px;
}

.tasks-primary-cta .bn-lbl {
    font-size: 0.85rem;
    font-weight: 700;
}

/* === Stats screen UX === */
.stats-view {
    line-height: 1.4;
}

.stats-page-title {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    text-align: center;
}

.stats-section {
    margin-bottom: 18px;
}

.stats-section-title {
    margin-bottom: 10px;
    line-height: 1.22;
}

.stats-card {
    padding: 6px 0;
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stats-row {
    padding: 8px 12px;
    border-radius: 12px;
    line-height: 1.35;
    background: var(--surface-2, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
    box-shadow: var(--shadow-soft, none);
}

.stats-row span {
    max-width: 260px;
}

.stats-row-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stats-row-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.stats-value {
    font-weight: 700;
}

.stats-subtext {
    font-size: 0.75rem;
    opacity: 0.7;
    line-height: 1.3;
}

.stats-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* === Bootstrap shell === */
.app-root {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.app-bootstrap-shell {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100vh;
    background: var(--tg-bg-color, #0b132b);
    z-index: 0;
}

/* === Splash screen === */
.splash-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: fixed;
    inset: 0;
    z-index: 1;
    background: var(--tg-bg-color, #0b132b);
    background-image: radial-gradient(circle at 50% 35%,
            rgba(255, 255, 255, 0.12),
            rgba(255, 255, 255, 0) 55%);
    color: var(--tg-text-color, #fff);
    text-align: center;
    z-index: 9999;
    animation: fadeIn 0.4s ease-out;
    gap: 12px;
    padding: 16px;
}

.splash-brand {
    background: linear-gradient(
        90deg,
        #ffd700 0%,
        #fff3b0 25%,
        #ffe066 50%,
        #fff3b0 75%,
        #ffd700 100%
    );
    color: transparent;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35),
        0 0 6px rgba(255, 215, 0, 0.35);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    animation: splashPulse 3.6s ease-in-out infinite;
}

/* Splash emoji is used as a fast-read visual anchor.
   Decorative animation only, no loading logic. */
.splash-logo {
    font-size: 68px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35))
        drop-shadow(0 0 10px rgba(255, 215, 0, 0.35));
    animation: splashEmoji 3.6s ease-in-out infinite;
    opacity: 0.9;
}

.splash-text {
    color: var(--tg-hint-color, #aaa);
    font-size: 0.95rem;
    letter-spacing: 0.6px;
    opacity: 0.75;
    animation: splashFade 3.6s ease-in-out infinite;
}

/* === Maintenance screen === */
.maintenance-screen {
    text-align: center;
    background: var(--bg-gradient);
}

.maintenance-logo {
    position: relative;
    width: 78px;
    height: 78px;
    border-radius: 22px;
    background: radial-gradient(
            circle at 30% 30%,
            rgba(255, 255, 255, 0.25) 0%,
            rgba(255, 255, 255, 0.08) 45%,
            rgba(0, 0, 0, 0.12) 100%
        );
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft);
}

.maintenance-logo-ring {
    position: absolute;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 3px solid rgba(var(--icon-primary-rgb), 0.6);
    box-shadow: 0 0 12px rgba(var(--icon-primary-rgb), 0.25);
}

.maintenance-logo-core {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--icon-secondary);
    box-shadow: 0 0 12px rgba(var(--icon-secondary-rgb), 0.45);
}

.maintenance-panel {
    width: min(92vw, 420px);
    padding: 18px 20px;
    border-radius: 18px;
    background: var(--glass-bg);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-soft);
    backdrop-filter: var(--glass-blur);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.maintenance-badge {
    align-self: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(var(--icon-primary-rgb), 0.12);
    color: rgba(var(--icon-primary-rgb), 0.95);
    font-size: 0.72rem;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.maintenance-title {
    font-size: 1.25rem;
    color: var(--text-1);
    letter-spacing: 0.4px;
}

.maintenance-message {
    font-size: 1rem;
    color: var(--text-1);
    opacity: 0.92;
}

.maintenance-subtext {
    font-size: 0.9rem;
    color: var(--text-2);
    opacity: 0.85;
}

@media (max-width: 420px) {
    .maintenance-panel {
        padding: 16px;
    }

    .maintenance-title {
        font-size: 1.1rem;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes splashPulse {
    0% {
        opacity: 0.92;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35),
            0 0 4px rgba(255, 215, 0, 0.25);
    }

    50% {
        opacity: 1;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35),
            0 0 8px rgba(255, 215, 0, 0.45);
    }

    100% {
        opacity: 0.92;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35),
            0 0 4px rgba(255, 215, 0, 0.25);
    }
}

@keyframes splashFade {
    0% {
        opacity: 0.7;
    }

    50% {
        opacity: 0.85;
    }

    100% {
        opacity: 0.7;
    }
}

@keyframes splashEmoji {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.9;
    }

    50% {
        transform: translateY(-5px) scale(1.07);
        opacity: 1;
    }

    100% {
        transform: translateY(0) scale(1);
        opacity: 0.9;
    }
}

/* === АДАПТИВ === */
@media (max-width: 480px) {
    .bn-ico {
        width: var(--icon-size-l);
        height: var(--icon-size-l);
    }

    .bn-lbl {
        font-size: 0.75rem;
    }
}

@media (max-width: 360px) {
    .bn-lbl {
        font-size: 0.65rem;
    }
}

@media (min-width: 600px) {
    .bottom-nav {
        max-width: 380px;
        padding: 4px 0;
    }
}
/* UI INVARIANT: Main screen must fit without vertical scroll. */
/* UI INVARIANT: Tap must remain fully visible. */
/* UI INVARIANT: Rebirth is progression, not loss. */
/* === Основная зона игры === */
.game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 10px 0 16px;
    min-height: 100%;
    box-sizing: border-box;
    cursor: pointer;
    position: relative;
    gap: 8px;
}

.game-top,
.game-footer {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tap-stage {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Secondary info block */
.game-secondary {
    width: 92%;
    max-width: 360px;
    margin-top: 4px;
    margin-bottom: 6px;
    padding: 8px 12px;
    /* Visual reset: neutral secondary surface */
    background: var(--surface-3);
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
    box-shadow: var(--shadow-soft, none);
    border-radius: 12px;
}

.game-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    text-align: left;
}

.game-metrics.compact {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.game-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.pending-indicator-slot {
    display: block;
    height: 18px;
    line-height: 18px;
    white-space: nowrap;
    pointer-events: none;
}

.pending-indicator-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 18px;
    min-width: 140px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.65rem;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    color: var(--text-1, var(--tg-text-color, #fff));
    background: var(--surface-2, rgba(255, 255, 255, 0.08));
    font-weight: 600;
}

.pending-indicator-inline.is-active {
    opacity: 1;
}

.pending-indicator-inline.is-idle {
    opacity: 0.35;
}

.pending-indicator-label {
    color: inherit;
}

.pending-indicator-bullet {
    opacity: 0.6;
}

.pending-indicator-value {
    min-width: 5ch;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.game-metric .ui-value {
    font-size: 1.05rem;
    font-weight: 700;
}

.game-metric .ui-label {
    font-size: 0.7rem;
    opacity: 0.7;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.rebirth-status {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--tg-hint-color);
    justify-content: center;
    flex-wrap: wrap;
}

.rebirth-status .ui-icon {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.rebirth-status-sep {
    opacity: 0.6;
}

.rebirth-status-note {
    margin-top: 2px;
    font-size: 0.72rem;
    opacity: 0.65;
    text-align: center;
}

.game-meter {
    margin-top: 12px;
}

.tap-cluster {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.energy-cluster {
    width: 90%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    position: relative;
}

.energy-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

/* Energy hierarchy */
.energy-metric .ui-label {
    opacity: 0.8;
}

.energy-value {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

/* Баланс */
.balance {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 10px;
    /* Visual reset: neutral label */
    color: var(--tg-text-color);
}

/* Энергия */
.energy-bar {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    margin: 0;
    overflow: hidden;
    /* Visual reset: subtle depth */
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
    position: relative;
}

.energy-fill {
    height: 100%;
    /* Visual reset: calm energy fill */
    background: var(--energy-fill);
    transition: width 0.35s ease;
    transform-origin: left;
}

.energy-status {
    margin-bottom: 16px;
    color: #aaa;
    font-size: 0.95rem;
}

/* === Кнопка Tap === */
.click-btn {
    /* Visual reset: neutral tap surface */
    background: linear-gradient(
        180deg,
        var(--surface-2, rgba(255, 255, 255, 0.08)),
        var(--surface-3, rgba(255, 255, 255, 0.04))
    );
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.1));
    border-radius: 50%;
    width: clamp(160px, 44vw, 210px);
    height: clamp(160px, 44vw, 210px);
    font-size: 1.7rem;
    color: var(--text-1, var(--tg-text-color));
    cursor: pointer;
    margin: 2px 0;
    /* Visual reset: calm depth, no glow */
    box-shadow: var(--shadow-strong, 0 8px 20px rgba(0, 0, 0, 0.35)),
        inset 0 0 8px rgba(255, 255, 255, 0.15);
    transition: transform var(--transition-fast), box-shadow var(--transition-slow);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 2;
    backdrop-filter: var(--glass-blur);
}

.click-btn:active {
    transform: scale(0.92);
    box-shadow: var(--shadow-soft, 0 6px 16px rgba(0, 0, 0, 0.28));
}

.click-btn.energy-low {
    filter: saturate(0.7);
    box-shadow: var(--shadow-soft, 0 6px 12px rgba(0, 0, 0, 0.25));
    background: linear-gradient(
        180deg,
        var(--surface-2, rgba(255, 255, 255, 0.06)),
        var(--surface-3, rgba(255, 255, 255, 0.03))
    );
}

.click-btn.energy-full {
    box-shadow: var(--shadow-strong, 0 10px 22px rgba(0, 0, 0, 0.35)),
        inset 0 0 10px rgba(255, 255, 255, 0.2),
        0 0 14px var(--accent-glow, rgba(255, 215, 0, 0.35));
}

.game-secondary.energy-regening .energy-bar::after,
.tap-cluster.energy-regening .energy-bar::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 10px rgba(var(--icon-primary-rgb), 0.18);
    opacity: 0.6;
    animation: energyPulse 2.2s ease-in-out infinite;
    pointer-events: none;
}

.energy-bar.energy-flash {
    animation: energyFlash 0.28s ease-out;
}

.click-btn.energy-shake {
    animation: energyShake 0.28s ease-in-out;
}

.energy-bar.energy-full-burst {
    animation: energyFullBurst 0.4s ease-out;
}

/* energyFullBurst removed from tap button by visual reset */

.energy-fill.energy-refill {
    animation: energyRefill 0.35s ease-out;
}

.energy-return-label {
    min-height: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    opacity: 0;
    margin-top: -4px;
}

.energy-return-label.energy-return {
    animation: energyReturn 0.5s ease-out;
}

.energy-regen {
    font-size: 0.78rem;
    opacity: 0.75;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.energy-regen .ui-icon {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.energy-bar.has-pending::before {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: 8px;
    border: 1px dashed rgba(140, 246, 255, 0.7);
    pointer-events: none;
    animation: pendingPulse 1.4s ease-in-out infinite;
}

@keyframes pendingPulse {
    0% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.5;
    }
}

.energy-bar[data-empty]:after {
    content: attr(data-empty);
    position: absolute;
    right: 8px;
    top: -22px;
    font-size: 0.75rem;
    color: var(--tg-hint-color);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.energy-bar.energy-flash[data-empty]:after {
    opacity: 1;
    transform: translateY(0);
}

.click-btn.boosted {
    /* Visual reset: neutral boosted surface */
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.1),
            rgba(255, 255, 255, 0.04));
}

/* pulse removed by visual reset */

/* tapBreath removed by visual reset */

@keyframes energyPulse {
    0% {
        opacity: 0.25;
        box-shadow: 0 0 8px rgba(var(--icon-primary-rgb), 0.12);
    }
    50% {
        opacity: 0.7;
        box-shadow: 0 0 12px rgba(var(--icon-primary-rgb), 0.2);
    }
    100% {
        opacity: 0.25;
        box-shadow: 0 0 8px rgba(var(--icon-primary-rgb), 0.12);
    }
}

@keyframes energyFlash {
    0% {
        box-shadow: 0 0 0 rgba(0, 0, 0, 0);
        background: rgba(255, 255, 255, 0.08);
    }
    50% {
        box-shadow: 0 0 12px rgba(0, 0, 0, 0.25);
        background: rgba(255, 255, 255, 0.12);
    }
    100% {
        box-shadow: 0 0 0 rgba(0, 0, 0, 0);
        background: rgba(255, 255, 255, 0.1);
    }
}

@keyframes energyShake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
    100% { transform: translateX(0); }
}

@keyframes energyFullBurst {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 14px rgba(0, 0, 0, 0.25);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    }
}

@keyframes energyRefill {
    0% {
        transform: scaleX(0.94);
        filter: brightness(0.9);
    }
    100% {
        transform: scaleX(1);
        filter: brightness(1.05);
    }
}

@keyframes energyReturn {
    0% {
        opacity: 0;
        transform: translateY(4px);
    }
    35% {
        opacity: 0.9;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-4px);
    }
}

/* Tap coin feedback (+N) */
.tap-feedback-layer {
    position: fixed;
    inset: 0;
    z-index: 999;
    pointer-events: none;
}

.tap-popup {
    position: absolute;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent, gold);
    pointer-events: none;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    animation: tapRise 0.7s ease-out forwards;
}

@keyframes tapRise {
    from {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    to {
        opacity: 0;
        transform: translate(-50%, -60px);
    }
}

/* === Текстовые блоки === */
.click-power,
.rebirth-info {
    font-size: 0.95rem;
    margin: 2px 0 0;
    color: #bbb;
}

.game-footer {
    gap: 6px;
    padding-bottom: 4px;
}

.game-footer .ui-subtle {
    font-size: 0.8rem;
}

/* === Для мобильных (автоцентр + безопасная зона iPhone) === */
@media (max-width: 480px) {
    .game-view {
        justify-content: flex-start;
        padding-bottom: calc(env(safe-area-inset-bottom, 16px) + 6px);
    }

    .click-btn {
        width: clamp(145px, 50vw, 190px);
        height: clamp(145px, 50vw, 190px);
        margin: 6px 0 4px;
    }

    .balance {
        font-size: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .game-secondary.energy-regening .energy-bar::after,
    .tap-cluster.energy-regening .energy-bar::after,
    .click-btn.boosted,
    .click-btn:not(.tap-engaged):not(.energy-low):not(.boosted),
    .energy-bar.energy-flash,
    .click-btn.energy-shake,
    .energy-bar.energy-full-burst,
    .click-btn.energy-full-burst,
    .energy-return-label.energy-return,
    .energy-fill.energy-refill {
        animation: none !important;
    }
    .energy-fill {
        transition: none !important;
    }
}

/* === Для планшетов и десктопов === */
@media (min-width: 600px) {
    .game-view {
        min-height: calc(100vh - 180px);
    }
}

/* Невидимый слой для пустых кликов */
.tap-surface {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: transparent;
}

/* Чтобы кнопки и элементы были поверх */
.click-btn,
.energy-bar,
.balance,
.energy-status,
.click-power,
.rebirth-info,
.rebirth-btn {
    position: relative;
    z-index: 1;
}

/* Анимация тоста */
.secret-toast {
    position: fixed;
    left: 50%;
    bottom: 100px;
    transform: translateX(-50%);
    /* Visual reset: neutral toast */
    background: var(--surface-2, rgba(255, 255, 255, 0.9));
    color: var(--text-1, #111);
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 10px;
    box-shadow: var(--shadow-soft, 0 0 10px rgba(0, 0, 0, 0.25));
    z-index: 9999;
    transition: opacity 0.6s, transform 0.6s;
}

.secret-toast.fade-out {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
}

/* Тост-пасхалка */
.secret-toast {
    position: fixed;
    left: 50%;
    bottom: 100px;
    transform: translateX(-50%);
    background: var(--surface-2, rgba(255, 255, 255, 0.9));
    color: var(--text-1, #111);
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 10px;
    box-shadow: var(--shadow-soft, 0 0 10px rgba(0, 0, 0, 0.25));
    z-index: 9999;
    transition: opacity 0.6s, transform 0.6s;
}

.secret-toast.fade-out {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
}

/* Отладочный счётчик */
.hidden-debug {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--icon-primary);
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.7;
    z-index: 999;
    user-select: none;
}

.reset-btn.full {
    background: rgba(255, 80, 80, 0.15);
    border-color: rgba(255, 100, 100, 0.4);
}

.reset-btn.full:hover {
    background: rgba(255, 80, 80, 0.25);
    color: #ffaaaa;
}

/* === Ripple при клике по пустому экрану === */
.game-view:active::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255, 255, 255, 0.15), transparent 70%);
    pointer-events: none;
    animation: tapRipple 0.6s ease-out;
}

@keyframes tapRipple {
    from {
        opacity: 1;
        transform: scale(0.8);
    }

    to {
        opacity: 0;
        transform: scale(2);
    }
}

/* === Rebirth подсветка === */
.rebirth-btn.glow {
    box-shadow: 0 0 18px rgba(0, 255, 150, 0.5);
    transition: all var(--transition-slow);
}

.rebirth-btn.glow:hover {
    transform: scale(1.05);
}
/* === Контейнер улучшений === */
.upgrades {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 20px 8px 40px;
    color: var(--tg-text-color, #fff);
    background: transparent;
    position: relative;
    z-index: 1;
}

/* === Карточки апгрейдов === */
.upgrade-card {
    background: var(--surface-2, var(--card-color, rgba(255, 255, 255, 0.05)));
    padding: 16px 18px;
    border-radius: 14px;
    width: 100%;
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
    box-shadow: var(--shadow-soft, 0 3px 8px rgba(0, 0, 0, 0.25));
    color: var(--text-1, var(--tg-text-color, #fff));
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.3s ease;
    backdrop-filter: blur(6px);
    position: relative;
    z-index: 2;
}

/* Guard against decorative overlays blocking clicks */
.upgrade-card::before,
.upgrade-card::after {
    pointer-events: none;
}

/* При наведении — лёгкое свечение */
.upgrade-card:hover {
    transform: scale(1.02);
    box-shadow: 0 0 12px var(--accent-glow, rgba(255, 215, 0, 0.3));
    background: var(--surface-3, var(--card-hover-color, rgba(255, 255, 255, 0.08)));
}

/* === Заголовок и описание апгрейда === */
.upgrade-card h3 {
    font-size: 1rem;
    color: var(--text-1, var(--tg-text-color, #fff));
    margin-bottom: 6px;
    font-weight: 600;
}

.upgrade-card p {
    font-size: 0.9rem;
    color: var(--text-2, var(--tg-hint-color, #bbb));
    margin-bottom: 10px;
}

/* === Баланс пользователя === */
.balance {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--tg-text-color, #fff);
    text-align: center;
    margin-bottom: 12px;
}

.balance-hint {
    font-size: 0.85rem;
    color: var(--tg-hint-color, #bbb);
    text-align: center;
    margin-top: -6px;
}

/* === Кнопки покупки/активации === */
.upgrade-card button {
    background: var(--accent, #ffd700);
    color: var(--accent-text, #111);
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    z-index: 3;
    pointer-events: auto;
}

.upgrade-card.ton-card {
    z-index: 1;
}

/* Prevent TonConnect UI root from blocking app input. */
.upgrades tc-root {
    pointer-events: none !important;
}

.upgrades tc-root [data-tc-connect-button="true"],
.upgrades tc-root [data-tc-dropdown-button="true"],
.upgrades tc-root [data-tc-button="true"],
.upgrades tc-root [data-tc-icon-button="true"],
.upgrades tc-root [data-tc-modal="true"],
.upgrades tc-root [data-tc-wallets-modal-container="true"],
.upgrades tc-root [data-tc-actions-modal-container="true"],
.upgrades tc-root [data-tc-dropdown-container="true"],
.upgrades tc-root [data-tc-dropdown="true"] {
    pointer-events: auto !important;
}

.upgrade-card button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px var(--accent-glow, rgba(255, 215, 0, 0.5));
}

/* === Disabled состояние === */
.upgrade-card button[data-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* === Для мобильных устройств === */
@media (max-width: 480px) {
    .upgrade-card {
        padding: 14px 16px;
    }

    .upgrade-card h3 {
        font-size: 0.95rem;
    }

    .upgrade-card p {
        font-size: 0.85rem;
    }
}

.rebirth-btn {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 0.95rem;
    color: #111;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.6);
    transition: all 0.2s ease;
}

.rebirth-btn.glow {
    animation: rebirthGlow 1.5s infinite alternate;
}

@keyframes rebirthGlow {
    from {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
    }

    to {
        box-shadow: 0 0 25px rgba(255, 215, 0, 0.9);
    }
}

.rebirth-hint {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 215, 0, 0.9);
    color: #111;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 0.95rem;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
    z-index: 9999;
    animation: slideUp 0.4s ease;
}

.rebirth-hint-inline {
    margin-top: 6px;
    font-size: 0.8rem;
    opacity: 0.7;
    text-align: center;
}

.rebirth-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    background: color-mix(in srgb, var(--bg-0) 70%, #000 30%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
}

.rebirth-confirm {
    width: 100%;
    max-width: 420px;
    background: var(--surface-2, rgba(12, 16, 28, 0.96));
    border-radius: 16px;
    padding: 16px 18px;
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.08));
    box-shadow: var(--shadow-strong, 0 12px 28px rgba(0, 0, 0, 0.4));
    color: var(--text-1, var(--tg-text-color, #fff));
    display: grid;
    gap: 12px;
}

.rebirth-confirm-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.rebirth-confirm-subtitle {
    font-size: 0.9rem;
    opacity: 0.75;
}

.rebirth-confirm-section {
    display: grid;
    gap: 4px;
}

.rebirth-confirm-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    opacity: 0.6;
}

.rebirth-confirm-line {
    font-size: 0.9rem;
    opacity: 0.9;
}

.rebirth-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 4px;
}

.rebirth-confirm-ghost,
.rebirth-confirm-cta {
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 600;
    cursor: pointer;
}

.rebirth-confirm-ghost {
    background: rgba(255, 255, 255, 0.08);
    color: inherit;
}

.rebirth-confirm-cta {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #111;
}
.leaderboard-view {
    text-align: center;
    color: var(--tg-text-color, #fff);
    padding: 20px 10px 80px;
    /* отступ снизу под панель */
}

.lb-title {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    /* Visual reset: neutral title, rely on icons for color */
    color: var(--tg-text-color);
    text-align: center;
}

.lb-empty {
    opacity: 0.6;
    font-style: italic;
    margin-top: 2rem;
    text-align: center;
}

.lb-list {
    list-style: none;
    padding: 0;
    margin: 0 auto;
    max-width: 380px;
}

.lb-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    /* Visual reset: neutral surface */
    background: var(--surface-1);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.lb-item.primary {
    /* Visual reset: slightly lifted surface */
    background: var(--surface-2);
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
}

.lb-item.lang-toggle {
    /* language row: increase discoverability without overpowering content */
    border-color: var(--card-border, rgba(255, 255, 255, 0.2));
    background: var(--surface-2, rgba(255, 255, 255, 0.12));
}

.lb-item.lang-toggle:focus-visible {
    /* accessible focus without introducing effects */
    outline: 2px solid var(--card-border, rgba(255, 255, 255, 0.2));
    outline-offset: 2px;
}

.lb-item.secondary {
    /* Visual reset: quiet secondary surface */
    background: var(--surface-3);
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.08));
    opacity: 0.85;
}

.lb-item.clickable {
    /* clickable cue: allow pointer cursor without changing visual weight */
    cursor: pointer;
}

.lb-item .row-chevron {
    /* navigation affordance: spacing-only chevron */
    margin-left: 8px;
    font-weight: 700;
}

.lb-item.spaced {
    /* spacing pause: avoid dense list rhythm (Tertiary) */
    margin-top: 8px;
}

.lb-item:hover {
    background: var(--surface-2, rgba(255, 255, 255, 0.12));
}

.lb-item.current-user {
    border: 1px solid var(--accent, #ffd700);
    /* Visual reset: subtle highlight with primary icon tone */
    background: rgba(var(--icon-primary-rgb), 0.08);
    box-shadow: none;
}

/* Collections grid cards (CSS-only override for inline styles) */
.leaderboard-view > div[style*="grid-template-columns"] > div {
    background: var(--surface-2, rgba(255, 255, 255, 0.06)) !important;
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.08)) !important;
    box-shadow: var(--shadow-soft, 0 2px 8px rgba(0, 0, 0, 0.25));
    color: var(--text-1, var(--tg-text-color, #fff));
}

.lb-rank {
    font-weight: bold;
    font-size: 1.1rem;
    min-width: 28px;
    text-align: right;
    color: var(--icon-primary);
    flex-shrink: 0;
}

.lb-rank.ui-chip {
    width: auto;
    font-size: 0.85rem;
    text-align: center;
    margin-right: 4px;
}

.lb-name {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-score {
    font-weight: bold;
    color: #fff;
    min-width: 60px;
    text-align: right;
}

.lb-summary-row {
    width: 100%;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lb-summary-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.lb-summary-rank {
    font-size: 14px;
}

.lb-summary-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.lb-summary-crown {
    line-height: 1;
    padding: 2px 6px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.lb-summary-content {
    text-align: left;
    padding: 4px 8px;
}

.lb-summary-card {
    text-align: left;
}

.lb-summary-left {
    text-align: left;
}

.lb-summary-right {
    text-align: right;
    margin-left: auto;
}

.lb-summary-score {
    font-size: 12px;
    opacity: 0.7;
}

.lb-summary-left * {
    text-align: left;
}

.lb-summary-right * {
    text-align: right;
}

.lb-footer {
    margin-top: 1rem;
    font-size: 0.85rem;
    opacity: 0.6;
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.debug-toggle-btn {
    position: fixed;
    bottom: 90px;
    /* над bottom-nav */
    right: 12px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #222;
    color: #fff;
    font-size: 22px;
    z-index: 9999;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.debug-toggle-btn:hover {
    transform: scale(1.12);
}

.hidden-debug {
    position: fixed;
    bottom: 150px;
    /* выше toggle-кнопки */
    right: 10px;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    padding: 14px 16px;
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    backdrop-filter: blur(4px);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
    width: 190px;
    max-height: 60vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 10px;
}

.hidden-debug .debug-title {
    font-weight: bold;
    margin-bottom: 8px;
}

.hidden-debug .debug-line {
    margin-bottom: 10px;
}

.hidden-debug button {
    margin-top: 6px;
    width: 100%;
    background: #222;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #444;
    color: #fff;
    cursor: pointer;
}

.hidden-debug button.full {
    background: #4a0000;
    border-color: #ff3030;
}
/* ==========================================================
   CRYSTALS — UI for Telegram Mini App (Crystal Pack A)
   ========================================================== */

.crystals-view {
    /*
      Bottom safe-area and the fixed bottom-nav are already compensated at the
      `.content` level (app.css). Avoid double-padding that makes the tab feel
      taller than the viewport in Telegram WebView.
    */
    padding: 12px 14px 0;
}

/* ==========================================================
   NFT Burn UI (Phase 4.1 skeleton, no wallet)
   ========================================================== */

.nft-burn-panel {
    margin-top: 14px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(10, 14, 35, 0.6);
}

.nft-burn-panel__header {
    margin-bottom: 10px;
}

.nft-burn-panel__title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 700;
}

.nft-burn-panel__subtitle {
    font-size: 12px;
    opacity: 0.75;
}

.nft-burn-panel__row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 10px 0;
}

.nft-burn-panel__label {
    font-size: 12px;
    opacity: 0.85;
    min-width: 60px;
}

.nft-burn-panel__input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.18);
    color: #fff;
    outline: none;
}

.nft-burn-panel__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 12px;
}

.nft-burn-panel__btn {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.nft-burn-panel__btn.secondary {
    background: rgba(0, 0, 0, 0.20);
}

.nft-burn-panel__btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.nft-burn-panel__status {
    font-size: 12px;
    opacity: 0.9;
}

.nft-burn-panel__statusLine {
    margin: 4px 0;
}

.nft-burn-panel__statusKey {
    opacity: 0.7;
}

.nft-burn-panel__statusValue {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.nft-burn-panel__error {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 70, 70, 0.30);
    background: rgba(255, 70, 70, 0.08);
}

.nft-burn-panel__errorTitle {
    font-weight: 700;
    margin-bottom: 6px;
}

.nft-burn-panel__errorMsg {
    opacity: 0.9;
}

.nft-burn-panel__errorActions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.nft-burn-panel__hint {
    opacity: 0.75;
    font-size: 12px;
}

/* === TITLE === */
.crystals-title {
    font-size: 20px;
    margin-bottom: 10px;
    text-align: left;
}

/* === BUY BUTTON === */
.crystals-buy-btn {
    width: 100%;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid var(--btn-border);
    font-size: 16px;
    font-weight: 600;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    margin-bottom: 6px;
    box-shadow: var(--shadow-soft), 0 0 12px var(--accent-glow);
}

.crystals-buy-btn.disabled {
    opacity: 0.5;
    box-shadow: none;
}

.crystals-buy-btn:hover:not(.disabled),
.crystals-buy-btn:focus-visible:not(.disabled) {
    box-shadow: var(--shadow-soft), 0 0 16px var(--accent-glow);
}

.crystals-buy-btn:active:not(.disabled) {
    box-shadow: var(--shadow-soft);
}

/* === HINT TEXT === */
.crystals-hint {
    font-size: 13px;
    margin-bottom: 10px;
    color: var(--tg-hint-color, #a0a0a0);
}

/* === LAYOUT === */
.crystals-layout {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 100%;

    /* IMPORTANT:
       Allow vertical growth for scrolling,
       but keep horizontal overflow protected */
    overflow-x: hidden;
    overflow-y: visible;
}

/* === LEFT LIST === */
.crystals-list {
    width: 28%;
    min-width: 90px;
    max-width: 120px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    /*
      Avoid nested scroll containers inside Telegram WebView.
      The tab content scrolls via `.content` (app.css).
    */
    overflow: visible;
}

/* === LIST ITEM === */
.crystal-list-item {
    width: 100%;
    border-radius: 12px;
    padding: 8px;
    background: rgba(10, 14, 35, 0.9);
    color: #fff;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: 0.25s ease;
}

.crystal-list-item.active {
    border-color: #ffd54f;
    box-shadow: 0 0 12px rgba(255, 213, 79, 0.4);
    transform: scale(1.02);
}

/* === RARITY BADGES === */
.badge-rarity {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    display: inline-block;
    padding: 2px 6px;
    border-radius: 7px;
    margin-bottom: 4px;
}

/* === RARITY COLORS === */
.badge-common,
.pill-common {
    background: linear-gradient(135deg, #bdc3c7, #95a5a6);
}

.badge-rare,
.pill-rare {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
}

.badge-epic,
.pill-epic {
    background: linear-gradient(135deg, #a18cd1, #fbc2eb);
}

.badge-legendary,
.pill-legendary {
    background: linear-gradient(135deg, #f6d365, #fda085);
}

.badge-mythic,
.pill-mythic {
    background: linear-gradient(135deg, #ff0844, #33001b);
}

/* === DETAIL CARD (правая панель) === */
.crystal-detail {
    flex: 1;
    min-width: 0;
    padding: 10px;
    border-radius: 16px;

    background: radial-gradient(circle at top, #acb5ee, #7f88af);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
    /*
      Telegram WebView has unreliable nested scroll containers.
      Keep the detail card in normal document flow and let the app-level container scroll.
    */
    overflow: visible;
}

/* ==========================================================
   CRYSTAL VIEWPORT — Adaptive height (Mobile + Web Telegram)
   ========================================================== */

.crystal-3d-wrapper {
    position: relative;
    width: 100%;
    border-radius: 16px;
    margin-bottom: 12px;

    /* Контейнер карточки — высота НЕ управляет канвасом */
    overflow: visible;
}

/* === Главный секрет — якорь === */
.crystal-3d-anchor {
    position: relative;

    width: 100%;
    /*
      Keep the 3D scene visible, but never allow it to consume the whole viewport
      and push critical actions below the fold on mobile.
    */
    height: clamp(220px, 38vh, 320px);
    max-height: 42vh;

    display: block;
    overflow: hidden;
}

.crystal-3d-anchor[data-rarity="common"] {
    background:
        radial-gradient(ellipse at 50% 25%,
            rgba(180, 190, 200, 0.12),
            rgba(28, 32, 44, 0.95) 50%,
            #060712 100%);
    box-shadow:
        inset 0 -24px 50px rgba(0, 0, 0, 0.45),
        inset 0 16px 28px rgba(255, 255, 255, 0.03);
}

.crystal-3d-anchor[data-rarity="rare"] {
    background:
        radial-gradient(ellipse at 50% 25%,
            rgba(80, 150, 255, 0.18),
            rgba(20, 28, 46, 0.95) 48%,
            #050610 100%);
    box-shadow:
        inset 0 -26px 52px rgba(0, 0, 0, 0.5),
        inset 0 18px 32px rgba(120, 180, 255, 0.06);
}

.crystal-3d-anchor[data-rarity="epic"] {
    background:
        radial-gradient(ellipse at 50% 25%,
            rgba(160, 120, 220, 0.20),
            rgba(26, 20, 40, 0.96) 48%,
            #06040d 100%);
    box-shadow:
        inset 0 -28px 56px rgba(0, 0, 0, 0.55),
        inset 0 18px 34px rgba(190, 150, 255, 0.06);
}

.crystal-3d-anchor[data-rarity="legendary"] {
    background:
        radial-gradient(ellipse at 50% 25%,
            rgba(255, 200, 90, 0.22),
            rgba(42, 30, 12, 0.96) 46%,
            #090602 100%);
    box-shadow:
        inset 0 -30px 60px rgba(0, 0, 0, 0.55),
        inset 0 20px 36px rgba(255, 210, 120, 0.08);
}

.crystal-3d-anchor[data-rarity="mythic"] {
    background:
        radial-gradient(ellipse at 50% 25%,
            rgba(194, 22, 75, 0.22),
            rgba(32, 36, 66, 0.95) 45%,
            #060712 100%);
    box-shadow:
        inset 0 -30px 60px rgba(0, 0, 0, 0.45),
        inset 0 20px 40px rgba(255, 255, 255, 0.04);
}

.crystal-3d-anchor[data-final="true"][data-rarity="common"] {
    background:
        radial-gradient(ellipse at 50% 10%,
            rgba(150, 165, 180, 0.06),
            rgba(18, 22, 34, 0.98) 60%,
            #05060f 100%);
    box-shadow:
        inset 0 -28px 58px rgba(0, 0, 0, 0.55),
        inset 0 0 46px rgba(0, 0, 0, 0.45);
}

.crystal-3d-anchor[data-final="true"][data-rarity="rare"] {
    background:
        radial-gradient(ellipse at 50% 10%,
            rgba(90, 140, 210, 0.07),
            rgba(16, 20, 34, 0.98) 60%,
            #04060f 100%);
    box-shadow:
        inset 0 -30px 60px rgba(0, 0, 0, 0.58),
        inset 0 0 46px rgba(0, 0, 0, 0.45);
}

.crystal-3d-anchor[data-final="true"][data-rarity="epic"] {
    background:
        radial-gradient(ellipse at 50% 10%,
            rgba(140, 110, 190, 0.08),
            rgba(18, 14, 30, 0.98) 60%,
            #05030d 100%);
    box-shadow:
        inset 0 -30px 62px rgba(0, 0, 0, 0.6),
        inset 0 0 48px rgba(0, 0, 0, 0.46);
}

.crystal-3d-anchor[data-final="true"][data-rarity="legendary"] {
    background:
        radial-gradient(ellipse at 50% 10%,
            rgba(200, 160, 90, 0.09),
            rgba(30, 22, 10, 0.98) 60%,
            #070502 100%);
    box-shadow:
        inset 0 -32px 64px rgba(0, 0, 0, 0.6),
        inset 0 0 48px rgba(0, 0, 0, 0.46);
}

.crystal-3d-anchor[data-final="true"][data-rarity="mythic"] {
    background:
        radial-gradient(ellipse at 50% 10%,
            rgba(190, 30, 80, 0.09),
            rgba(20, 22, 40, 0.98) 60%,
            #050610 100%);
    box-shadow:
        inset 0 -32px 64px rgba(0, 0, 0, 0.55),
        inset 0 0 48px rgba(0, 0, 0, 0.42);
}

/* === Canvas фиксирован к anchor === */
.crystal-3d-canvas {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    /* ✅ ВАЖНО */
    top: auto;
    /* ✅ УБИРАЕМ ЦЕНТРОВКУ */
    width: 100% !important;
    height: 100% !important;
    pointer-events: none;
}

/* === META === */
.crystal-meta {
    font-size: 13px;
    margin-bottom: 8px;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
}

/* === NOTE BOX === */
.crystal-note {
    font-size: 12px;
    padding: 8px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.35);
    margin-bottom: 10px;
}

/* === ACTIONS === */
.crystal-actions {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
}

@media (max-width: 420px) {
    .crystal-detail {
        padding: 8px;
    }

    .crystal-meta {
        margin-bottom: 6px;
    }

    .crystal-note {
        margin-bottom: 8px;
    }

    /* Compact panel for marketplace / burn skeleton on small screens. */
    .nft-burn-panel {
        padding: 10px;
    }

    .nft-burn-panel__actions {
        gap: 6px;
    }

    .nft-burn-panel__btn {
        padding: 9px 10px;
        font-size: 13px;
    }
}

.crystal-primary-btn {
    flex: 1;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid var(--btn-border);
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    font-size: 15px;
    font-weight: 600;
    box-shadow: var(--shadow-soft), 0 0 12px var(--accent-glow);
}

.crystal-primary-btn.mint {
    background: var(--btn-primary-bg);
    box-shadow: var(--shadow-soft), 0 0 12px var(--accent-glow);
}

.crystal-primary-btn:hover:not(:disabled),
.crystal-primary-btn.mint:hover:not(:disabled) {
    box-shadow: var(--shadow-soft), 0 0 16px var(--accent-glow);
}

.crystal-primary-btn:active:not(:disabled),
.crystal-primary-btn.mint:active:not(:disabled) {
    box-shadow: var(--shadow-soft);
}

.crystal-primary-btn:disabled {
    opacity: 0.55;
    box-shadow: none;
    cursor: not-allowed;
}

.crystal-actions-overflow {
    width: 44px;
    min-width: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

.crystal-actions-overflow.open {
    background: rgba(255, 255, 255, 0.18);
}

.crystal-overflow-menu {
    margin-top: 8px;
    padding: 8px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.35);
    display: grid;
    gap: 8px;
}

.crystal-secondary-btn {
    width: 100%;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.crystal-secondary-btn.mint {
    background: linear-gradient(135deg, #ff9800, #ff5722);
    border: none;
    box-shadow: 0 6px 16px rgba(255, 87, 34, 0.45);
}

/* === UPGRADE BTN === */
.crystal-upgrade-btn {
    width: 100%;
    padding: 10px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, #8e2de2, #4a00e0);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
}

/* ==========================================================
   📱 HORIZONTAL / DESKTOP tweaks (если понадобится)
   ========================================================== */
@media (orientation: landscape) and (min-width: 900px) {
    .crystals-view {
        padding: 12px 18px 80px;
    }

    .crystals-list {
        width: 22%;
        max-width: 180px;
    }

    .crystal-3d-wrapper {
        height: clamp(260px, 52vh, 380px);
    }
}

.crystals-progress-hint {
    font-size: 14px;
    line-height: 1.35;
    font-weight: 500;

    color: var(--tg-hint-color, #b8c4d9);

    padding: 10px 12px;
    margin-bottom: 14px;

    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;

    backdrop-filter: blur(3px);
}

/* === FORM PRESET LABELS (A1–D+) === */
.pill-form {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 8px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #5058c9, #6f78ff);
    margin-left: 6px;
}

/* === NFT TAG (already minted) === */
.nft-tag {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(255, 152, 0, 0.18);
    border: 1px solid rgba(255, 152, 0, 0.40);
    border-radius: 10px;
    color: #ffb74d;
    font-weight: 600;
    text-align: center;
    font-size: 13px;
}

/* === NFT BUTTON === */
.nft-btn {
    background: linear-gradient(135deg, #ff9800, #ff5722) !important;
    box-shadow: 0 6px 16px rgba(255, 87, 34, 0.45);
}
:root[data-cosmetic-theme="neon_grid"] {
    --tg-bg-color: #070b1d;
    --tg-text-color: #f2f6ff;
    --tg-hint-color: rgba(210, 224, 255, 0.7);
    --accent: #8cff5c;
    --accent-text: #0a0f1b;
    --accent-glow: rgba(140, 255, 92, 0.35);
    --bg-0: #070b1d;
    --text-1: #f2f6ff;
    --text-2: rgba(210, 224, 255, 0.7);
    --text-3: rgba(210, 224, 255, 0.55);
    --surface-1: rgba(140, 255, 92, 0.08);
    --surface-2: rgba(140, 255, 92, 0.16);
    --surface-3: rgba(140, 255, 92, 0.05);
    --card-border: rgba(140, 255, 92, 0.22);
    --divider: rgba(140, 255, 92, 0.14);
    --shadow-soft: 0 8px 18px rgba(0, 0, 0, 0.35);
    --shadow-strong: 0 12px 28px rgba(0, 0, 0, 0.45);
    --btn-primary-bg: linear-gradient(135deg, rgba(140, 255, 92, 0.9), rgba(76, 190, 255, 0.85));
    --btn-primary-text: #061018;
    --btn-secondary-bg: rgba(140, 255, 92, 0.12);
    --btn-secondary-text: #f2f6ff;
    --btn-border: rgba(140, 255, 92, 0.25);
    --icon-primary: #9cc5ff;
    --icon-primary-rgb: 156, 197, 255;
    --icon-secondary: #caff7c;
    --icon-secondary-rgb: 202, 255, 124;
    --icon-neutral: #dfe8ff;
    --icon-economy: #b8ff91;
    --icon-social: #7dd4ff;
    --icon-progress: #a4ffda;
    --bg-gradient: radial-gradient(circle at 50% 0%, rgba(140, 255, 92, 0.2), transparent 55%),
        radial-gradient(circle at 20% 20%, rgba(76, 140, 255, 0.16), transparent 40%);
}

:root[data-cosmetic-theme="sunset_glow"] {
    --tg-bg-color: #1b0f0b;
    --tg-text-color: #fff1e7;
    --tg-hint-color: rgba(255, 210, 188, 0.7);
    --accent: #ff8a4c;
    --accent-text: #2b1208;
    --accent-glow: rgba(255, 138, 76, 0.35);
    --bg-0: #1b0f0b;
    --text-1: #fff1e7;
    --text-2: rgba(255, 210, 188, 0.75);
    --text-3: rgba(255, 210, 188, 0.6);
    --surface-1: rgba(255, 138, 76, 0.08);
    --surface-2: rgba(255, 138, 76, 0.16);
    --surface-3: rgba(255, 138, 76, 0.05);
    --card-border: rgba(255, 175, 120, 0.22);
    --divider: rgba(255, 170, 120, 0.14);
    --shadow-soft: 0 8px 18px rgba(0, 0, 0, 0.35);
    --shadow-strong: 0 12px 28px rgba(0, 0, 0, 0.45);
    --btn-primary-bg: linear-gradient(135deg, rgba(255, 138, 76, 0.95), rgba(255, 200, 120, 0.9));
    --btn-primary-text: #2b1208;
    --btn-secondary-bg: rgba(255, 138, 76, 0.12);
    --btn-secondary-text: #fff1e7;
    --btn-border: rgba(255, 170, 120, 0.25);
    --icon-primary: #ffad72;
    --icon-primary-rgb: 255, 173, 114;
    --icon-secondary: #ffd0a6;
    --icon-secondary-rgb: 255, 208, 166;
    --icon-neutral: #ffe7d6;
    --icon-economy: #ffd19a;
    --icon-social: #ffb089;
    --icon-progress: #ffc8a0;
    --bg-gradient: radial-gradient(circle at 30% 0%, rgba(255, 138, 76, 0.22), transparent 60%),
        radial-gradient(circle at 80% 20%, rgba(255, 196, 120, 0.2), transparent 45%);
}

:root[data-cosmetic-theme="obsidian"] {
    --tg-bg-color: #070707;
    --tg-text-color: #f5f5f5;
    --tg-hint-color: rgba(200, 200, 200, 0.7);
    --accent: #6f7bff;
    --accent-text: #0d0d1a;
    --accent-glow: rgba(111, 123, 255, 0.4);
    --bg-0: #070707;
    --text-1: #f5f5f5;
    --text-2: rgba(200, 200, 200, 0.75);
    --text-3: rgba(200, 200, 200, 0.6);
    --surface-1: rgba(111, 123, 255, 0.08);
    --surface-2: rgba(111, 123, 255, 0.16);
    --surface-3: rgba(111, 123, 255, 0.05);
    --card-border: rgba(140, 150, 255, 0.3);
    --divider: rgba(140, 150, 255, 0.18);
    --shadow-soft: 0 10px 20px rgba(0, 0, 0, 0.45);
    --shadow-strong: 0 16px 32px rgba(0, 0, 0, 0.6);
    --btn-primary-bg: linear-gradient(135deg, rgba(111, 123, 255, 0.95), rgba(150, 160, 255, 0.9));
    --btn-primary-text: #0d0d1a;
    --btn-secondary-bg: rgba(111, 123, 255, 0.14);
    --btn-secondary-text: #f5f5f5;
    --btn-border: rgba(140, 150, 255, 0.3);
    --icon-primary: #9aa5ff;
    --icon-primary-rgb: 154, 165, 255;
    --icon-secondary: #b4baff;
    --icon-secondary-rgb: 180, 186, 255;
    --icon-neutral: #e4e7ff;
    --icon-economy: #c7ccff;
    --icon-social: #9fb0ff;
    --icon-progress: #9fd8ff;
    --bg-gradient: radial-gradient(circle at 70% 0%, rgba(111, 123, 255, 0.18), transparent 60%),
        radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.06), transparent 40%);
}

.theme-card-neon_grid .theme-mini {
    --tg-bg-color: #070b1d;
    --tg-text-color: #f2f6ff;
    --tg-hint-color: rgba(210, 224, 255, 0.7);
    --accent: #8cff5c;
    --accent-text: #0a0f1b;
    --surface-1: rgba(140, 255, 92, 0.08);
    --surface-2: rgba(140, 255, 92, 0.16);
    --surface-3: rgba(140, 255, 92, 0.05);
}

.theme-card-sunset_glow .theme-mini {
    --tg-bg-color: #1b0f0b;
    --tg-text-color: #fff1e7;
    --tg-hint-color: rgba(255, 210, 188, 0.7);
    --accent: #ff8a4c;
    --accent-text: #2b1208;
    --surface-1: rgba(255, 138, 76, 0.08);
    --surface-2: rgba(255, 138, 76, 0.16);
    --surface-3: rgba(255, 138, 76, 0.05);
}

.theme-card-obsidian .theme-mini {
    --tg-bg-color: #070707;
    --tg-text-color: #f5f5f5;
    --tg-hint-color: rgba(200, 200, 200, 0.7);
    --accent: #6f7bff;
    --accent-text: #0d0d1a;
    --surface-1: rgba(111, 123, 255, 0.08);
    --surface-2: rgba(111, 123, 255, 0.16);
    --surface-3: rgba(111, 123, 255, 0.05);
}

.themes-view {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: var(--bg-0);
    color: var(--text-1);
    padding: 18px 14px 120px;
    overflow-y: auto;
    max-width: 420px;
    margin: 0 auto;
    transition: background-color 220ms ease, color 220ms ease;
}

.themes-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.themes-back {
    border: 1px solid var(--btn-border);
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
}

.themes-title {
    margin: 0;
    font-size: 1.35rem;
}

.themes-dev-badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255, 180, 90, 0.18);
    color: rgba(255, 200, 120, 0.95);
    border: 1px solid rgba(255, 200, 120, 0.3);
}

.themes-subtitle {
    opacity: 0.75;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.themes-preview-hint {
    font-size: 0.85rem;
    margin: -10px 0 12px;
    color: var(--text-2);
}

.themes-dev-note {
    font-size: 0.8rem;
    margin: -10px 0 14px;
    color: rgba(255, 200, 120, 0.85);
}

.themes-error {
    color: rgba(255, 180, 180, 0.95);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.themes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.theme-card {
    display: flex;
    gap: 12px;
    background: var(--surface-2);
    border-radius: 14px;
    padding: 12px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-soft);
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.theme-card:hover {
    transform: translateY(-1px) scale(1.005);
    box-shadow: var(--shadow-strong);
    border-color: rgba(255, 255, 255, 0.2);
}

.theme-card-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 18px var(--accent-glow);
    position: relative;
}

.theme-card-active::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: themePulse 2.4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes themePulse {
    0% {
        opacity: 0.2;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        opacity: 0.2;
    }
}

.theme-preview {
    width: 128px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-mini {
    width: 110px;
    height: 110px;
    border-radius: 16px;
    padding: 8px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.18)), var(--bg-0);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-strong);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.theme-mini-top {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-2);
}

.theme-mini-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.35);
}

.theme-mini-title {
    flex: 1;
}

.theme-mini-check {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-text);
}

.theme-mini-check svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.theme-mini-balance {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-1);
    border-radius: 10px;
    padding: 4px 6px;
    font-size: 0.6rem;
}

.theme-mini-coin {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.25);
}

.theme-mini-amount {
    font-weight: 700;
    color: var(--text-1);
}

.theme-mini-card {
    flex: 1;
    border-radius: 12px;
    padding: 6px;
    background: var(--surface-2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
}

.theme-mini-card-title {
    font-size: 0.6rem;
    font-weight: 600;
}

.theme-mini-card-sub {
    font-size: 0.5rem;
    color: var(--text-2);
}

.theme-mini-cta {
    text-align: center;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 4px 0;
    box-shadow: 0 8px 14px rgba(0, 0, 0, 0.25);
}

.theme-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.theme-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.theme-desc {
    font-size: 0.85rem;
    opacity: 0.75;
}

.theme-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    opacity: 0.85;
}

.theme-tier {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-radius: 999px;
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.theme-tier-standard {
    color: rgba(220, 230, 255, 0.9);
    background: rgba(120, 140, 190, 0.2);
}

.theme-tier-premium {
    color: rgba(255, 230, 180, 0.95);
    background: rgba(255, 175, 90, 0.2);
    border-color: rgba(255, 190, 120, 0.35);
}

.theme-tier-special {
    color: rgba(190, 200, 255, 0.95);
    background: rgba(120, 130, 255, 0.2);
    border-color: rgba(160, 170, 255, 0.35);
}

.theme-status {
    font-weight: 600;
}

.theme-value {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--tg-text-color);
}

.theme-value-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 10px;
}

.theme-value-list li {
    position: relative;
    padding-left: 10px;
    font-size: 0.75rem;
    color: var(--text-2);
}

.theme-value-list li::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    position: absolute;
    left: 0;
    top: 0.45em;
}

.theme-price-tag {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    background: var(--surface-1);
    border-radius: 12px;
    padding: 6px 8px;
    border: 1px solid var(--card-border);
}

.theme-price-tag.free {
    background: rgba(255, 255, 255, 0.06);
}

.theme-price-ton {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 0.85rem;
}

.theme-price-note {
    font-size: 0.7rem;
    color: var(--text-2);
}

.theme-cta {
    display: flex;
    align-items: center;
}

.theme-cta .bn-item {
    min-width: 110px;
    transition: transform 150ms ease, box-shadow 150ms ease;
}

.themes-view .bn-item {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: 1px solid var(--btn-border);
    border-radius: 12px;
    padding: 8px 12px;
    opacity: 1;
}

.themes-view .bn-item.active {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3), 0 0 12px var(--accent-glow);
}

.themes-view .bn-item:disabled {
    opacity: 0.6;
}

.theme-cta .bn-item.active:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: var(--shadow-strong);
}

/* Compact Themes layout */
.themes-view {
    position: relative;
    inset: auto;
    height: auto;
    padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
    overflow: visible;
    max-width: 420px;
    margin: 0 auto;
}

.themes-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg-0);
    padding: 4px 0 6px;
    border-bottom: 1px solid var(--divider);
}

.themes-subtitle {
    margin: 6px 0 10px;
    font-size: 0.95rem;
    line-height: 1.35;
    color: var(--text-2);
    letter-spacing: 0.01em;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.themes-dev-note,
.themes-error {
    margin: 0;
}

.themes-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.theme-card-compact {
    position: relative;
    display: grid;
    grid-template-rows: auto auto auto 1fr auto;
    gap: 6px;
    padding: 8px;
    min-height: 128px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.2));
}

.theme-card-compact .theme-cta {
    display: flex;
    align-items: flex-end;
    justify-content: stretch;
}

.theme-card-compact::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

.theme-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 6px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
}

.theme-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
}

.theme-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.theme-badge-active {
    background: rgba(90, 220, 140, 0.2);
    color: #9bffcf;
    border-color: rgba(90, 220, 140, 0.4);
}

.theme-badge-preview {
    background: rgba(120, 170, 255, 0.2);
    color: #b6d4ff;
    border-color: rgba(120, 170, 255, 0.4);
}

.theme-badge-premium {
    background: rgba(255, 190, 90, 0.2);
    color: #ffd39a;
    border-color: rgba(255, 190, 90, 0.4);
}

.theme-badge-locked,
.theme-badge-standard {
    background: rgba(180, 190, 210, 0.18);
    color: rgba(210, 220, 235, 0.9);
}

.theme-title {
    font-size: 0.9rem;
    font-weight: 700;
}

.theme-preview {
    height: 58px;
    border-radius: 10px;
    padding: 6px;
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 4px;
    border: 1px solid var(--card-border);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08),
        inset 0 0 18px rgba(0, 0, 0, 0.35);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent),
        var(--bg-gradient, var(--surface-1));
}

.theme-preview-locked {
    filter: grayscale(0.6) brightness(0.7);
    opacity: 0.8;
}

.theme-preview-chip {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.35);
}

.theme-preview-chip.short {
    width: 70%;
}

.theme-preview-pill {
    height: 18px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.theme-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 2px;
    font-size: 0.68rem;
    color: var(--text-2);
}

.theme-features li {
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-features li::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.8;
}

.theme-meta {
    font-size: 0.72rem;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.themes-view .bn-item {
    min-height: 36px;
    width: 100%;
    padding: 6px 10px;
    font-size: 0.8rem;
}

.theme-cta {
    padding: 6px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.theme-card-compact .theme-cta .bn-item.active {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.45), 0 0 10px var(--accent-glow);
}

.theme-card-compact.theme-card-active {
    border-color: var(--accent);
}

.theme-card-compact.theme-card-active::after {
    content: none;
}

.theme-card-neon_grid .theme-preview {
    background: linear-gradient(135deg, rgba(140, 255, 92, 0.22), rgba(76, 190, 255, 0.18)),
        radial-gradient(circle at 20% 20%, rgba(140, 255, 92, 0.4), transparent 45%),
        var(--bg-0);
}

.theme-card-sunset_glow .theme-preview {
    background: linear-gradient(135deg, rgba(255, 138, 76, 0.28), rgba(255, 200, 120, 0.2)),
        radial-gradient(circle at 70% 30%, rgba(255, 138, 76, 0.45), transparent 50%),
        var(--bg-0);
}

.theme-card-obsidian .theme-preview {
    background: linear-gradient(135deg, rgba(111, 123, 255, 0.25), rgba(200, 200, 200, 0.12)),
        radial-gradient(circle at 60% 20%, rgba(140, 150, 255, 0.35), transparent 50%),
        var(--bg-0);
}

.theme-card-compact.theme-card-dev {
    border-color: rgba(120, 170, 255, 0.5);
}

.theme-card-compact .theme-badge-premium {
    background: linear-gradient(135deg, rgba(255, 205, 120, 0.3), rgba(255, 150, 80, 0.2));
}

.theme-card-compact .theme-badge-locked {
    background: rgba(160, 170, 190, 0.25);
}

.themes-view .bn-item:active {
    transform: scale(0.98);
}

@media (max-width: 360px) {
    .themes-grid {
        grid-template-columns: 1fr;
    }
}

.theme-card-compact.theme-card-active {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 0 10px var(--accent-glow);
}

.theme-card-compact.theme-card-active::after {
    content: none;
}
:root {
  --admin-bg: #0f141b;
  --admin-panel: #151d27;
  --admin-panel-strong: #1b2430;
  --admin-accent: #f6b000;
  --admin-accent-2: #35c1a7;
  --admin-text: #e6edf3;
  --admin-muted: #9aa7b5;
  --admin-border: rgba(255, 255, 255, 0.08);
}

.admin-layout {
  height: var(--app-height, 100vh);
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at top right, rgba(246, 176, 0, 0.08), transparent 55%),
    var(--admin-bg);
  overflow: hidden;
}

.admin-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--admin-border);
  background: linear-gradient(180deg, #101722 0%, #0c121a 100%);
}

.admin-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.admin-header-secondary {
  margin-top: 8px;
  font-size: 12px;
  color: var(--admin-muted);
  gap: 16px;
  flex-wrap: wrap;
}

.admin-debug-toggle {
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  background: rgba(15, 21, 30, 0.8);
  color: var(--admin-text);
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.admin-debug-toggle.is-on {
  border-color: rgba(246, 176, 0, 0.6);
  color: var(--admin-accent);
}

.admin-debug-toggle.is-off {
  opacity: 0.7;
}

.admin-header-meta {
  flex: 1;
  min-width: 0;
}

.admin-title {
  font-size: 16px;
  font-weight: 700;
  text-transform: capitalize;
}

.admin-subtitle {
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-back {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--admin-border);
  background: transparent;
  color: var(--admin-text);
  font-weight: 600;
  cursor: pointer;
}

.admin-back:disabled {
  opacity: 0.4;
  cursor: default;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 16px;
  border-bottom: 1px solid var(--admin-border);
  background: #0f151e;
}

.admin-tab {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--admin-text);
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.admin-tab.active {
  background: rgba(246, 176, 0, 0.14);
  border-color: rgba(246, 176, 0, 0.4);
  color: var(--admin-accent);
}

.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.admin-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

.admin-card {
  background: var(--admin-panel);
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.admin-stack {
  display: grid;
  gap: 16px;
  min-height: 100%;
}

.admin-muted {
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--admin-border);
}

.admin-stat:last-child {
  border-bottom: none;
}

.admin-btn {
  min-height: 44px;
  border: none;
  border-radius: 12px;
  background: var(--admin-accent);
  color: #1a1a1a;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.admin-btn-wide {
  width: 100%;
}

.admin-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.admin-link {
  min-height: 44px;
  background: none;
  border: none;
  color: var(--admin-accent-2);
  cursor: pointer;
  text-align: left;
  font-weight: 600;
}

.admin-pill {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.admin-pill.ok {
  background: rgba(53, 193, 167, 0.2);
  color: var(--admin-accent-2);
}

.admin-pill.warn {
  background: rgba(246, 176, 0, 0.2);
  color: var(--admin-accent);
}

.admin-field {
  display: grid;
  gap: 6px;
  font-size: 12px;
}

.admin-field.inline {
  grid-template-columns: 80px 1fr;
  align-items: center;
}

.admin-field input,
.admin-field textarea,
.admin-field select {
  min-height: 44px;
  background: var(--admin-panel-strong);
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--admin-text);
}

.admin-search {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  align-items: end;
}

.admin-form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.admin-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
}

.admin-table {
  display: grid;
  gap: 8px;
}

.admin-table-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--admin-border);
  font-size: 12px;
}

.admin-table-head {
  font-weight: 700;
  color: var(--admin-muted);
}

.admin-footer {
  position: sticky;
  bottom: 0;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(15, 20, 27, 0), rgba(15, 20, 27, 0.85) 40%, rgba(15, 20, 27, 0.95));
}

@media (min-width: 720px) {
  .admin-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .admin-search {
    grid-template-columns: 1fr auto;
  }

  .admin-table-row {
    grid-template-columns: 1.4fr 1.2fr 0.7fr 0.7fr 0.8fr;
  }
}
/* ==========================================================
   NFT TAB — Asset Management Domain (ADR-028)
   Single scroll container: `.content` (app.css)
   ========================================================== */

.nft-view {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 12px 14px 0;
    box-sizing: border-box;
}

.nft-view__header {
    margin-bottom: 12px;
}

.nft-view__title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nft-view__subtitle {
    font-size: 12px;
    opacity: 0.8;
    line-height: 1.35;
}

.nft-view__hint {
    margin-top: 8px;
    font-size: 13px;
    opacity: 0.85;
}

.nft-layout {
    display: flex;
    gap: 10px;
    width: 100%;
    overflow-x: hidden;
    overflow-y: visible;
}

.nft-list {
    width: 32%;
    min-width: 100px;
    max-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nft-list-item {
    width: 100%;
    border-radius: 12px;
    padding: 8px;
    background: rgba(10, 14, 35, 0.9);
    color: #fff;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.nft-list-item.active {
    border-color: rgba(255, 213, 79, 0.9);
    box-shadow: 0 0 12px rgba(255, 213, 79, 0.32);
}

.nft-list-item__title {
    font-size: 12px;
    font-weight: 700;
    display: flex;
    gap: 6px;
    align-items: center;
}

.nft-list-item__date {
    margin-top: 6px;
    font-size: 12px;
    opacity: 0.75;
}

.nft-detail {
    flex: 1;
    min-width: 0;
    padding: 10px;
    border-radius: 16px;
    background: radial-gradient(circle at top, #acb5ee, #7f88af);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
    overflow: visible;
}

.nft-detail__media {
    margin-bottom: 10px;
}

.nft-detail__meta {
    font-size: 13px;
    margin-bottom: 10px;
}

.nft-meta-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.nft-detail__token {
    margin: 8px 0 10px;
}

.nft-token-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    opacity: 0.9;
    margin-bottom: 6px;
}

.nft-token-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.28);
    color: #fff;
    outline: none;
}

.nft-view__actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.nft-view__btn {
    flex: 1;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(10, 14, 35, 0.6);
    color: #fff;
    font-weight: 700;
}

.nft-view__btn.secondary {
    background: rgba(0, 0, 0, 0.25);
}

.nft-empty {
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 13px;
    opacity: 0.9;
}

@media (max-width: 420px) {
    .nft-view {
        padding: 12px 12px 0;
    }

    .nft-layout {
        flex-direction: column;
    }

    .nft-list {
        width: 100%;
        max-width: none;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
    }

    .nft-list-item {
        min-width: 150px;
    }
}

body,
html,
#root {
  margin: 0;
  padding: 0;
  height: -webkit-fill-available;
  min-height: 100vh;
  background: var(--tg-bg-color, #0b132b);
  color: var(--tg-text-color, #ffffff);
}

/* === Telegram Desktop fix === */
html,
body {
  height: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--tg-bg-color, #0b132b);
}