/* ============================================
   Tokens
   ============================================ */
:root {
    --bg-dark: #050505;
    --bg-panel: #111111;
    --bg-card: #1a1a1a;
    --text-main: #ffffff;
    --text-muted: #888888;
    --neon-blue: #00f3ff;
    --neon-gold: #ffd700;
    --neon-purple: #b026ff;
    --neon-green: #00ff66;
    --neon-red: #ff3333;
    --tg-theme-button-color: #3390ec;

    --nav-height: 70px;
}

/* ============================================
   Reset / Base
   ============================================ */
* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
}

img {
    -webkit-user-drag: none;
}

.inline-icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    object-fit: contain;
    display: inline-block;
    flex-shrink: 0;
}

.btn-icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    object-fit: contain;
    flex-shrink: 0;
}

h1, h2, h3 { margin: 0; }

/* Icon color tints */
img[src*="/assets/icons/label.webp"] {
    filter: brightness(0) saturate(100%) invert(80%) sepia(50%) saturate(2500%) hue-rotate(2deg) brightness(101%);
}
img[src*="/assets/icons/lock.webp"] {
    filter: brightness(0) saturate(100%) invert(85%) sepia(50%) saturate(3000%) hue-rotate(155deg) brightness(110%);
}
img[src*="/assets/icons/energy.webp"] {
    filter: brightness(0) saturate(100%) invert(96%) sepia(100%) saturate(800%) hue-rotate(6deg) brightness(108%);
}

/* ============================================
   Fullscreen state screens
   ============================================ */
.fullscreen-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
    padding: 20px;
}

#loading { display: flex; }

.btn {
    background-color: var(--tg-theme-button-color);
    color: #ffffff;
    border: none;
    padding: 12px 20px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
    width: 100%;
    max-width: 300px;
}

/* ============================================
   Refresh button (global, top-right)
   ============================================ */
.settings-btn {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 200;
    background: rgba(17, 17, 17, 0.85);
    backdrop-filter: blur(6px);
    border: 1px solid #333;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}
.settings-btn:active { opacity: 0.6; }
.settings-btn-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    background-color: var(--text-muted, #888);
    -webkit-mask-image: url('/assets/icons/settings.webp');
    mask-image: url('/assets/icons/settings.webp');
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

/* ── Settings panel ── */
.settings-panel {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 190;
    background: var(--bg-dark, #050505);
    color: var(--text-main, #f0f0f0);
    overflow-y: auto;
    padding: 16px 16px 32px;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.settings-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-top: env(safe-area-inset-top, 0px);
}
.settings-panel-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main, #f0f0f0);
}
.settings-panel-close {
    background: none;
    border: none;
    color: var(--text-muted, #666);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}
.settings-section-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted, #666);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 10px;
}
.settings-lang-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.settings-lang-btn {
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.12);
    background: var(--bg-panel, #111111);
    color: var(--text-main, #f0f0f0);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.settings-lang-btn.active {
    background: var(--neon-blue, #00f3ff);
    border-color: var(--neon-blue, #00f3ff);
    color: #000;
}
.settings-action-btn {
    display: block;
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 10px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: var(--bg-panel, #111111);
    color: var(--text-main, #f0f0f0);
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}
.settings-action-btn:active { background: var(--bg-card, #1a1a1a); }

/* ============================================
   Main content container
   ============================================ */
#content {
    padding: 20px 15px;
    padding-bottom: calc(var(--nav-height) + 44px);
    min-height: 100vh;
}

/* ============================================
   Bottom navigation
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 24px;
    left: 12px;
    right: 12px;
    height: var(--nav-height);
    background: rgba(10, 10, 10, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid #222;
    border-radius: 18px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 6px;
    z-index: 90;
    margin-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.nav-item {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    cursor: pointer;
    border-radius: 10px;
    transition: color 0.2s, background-color 0.2s;
    min-width: 0;
}

.nav-item:active {
    background-color: rgba(0, 243, 255, 0.08);
}

.nav-icon {
    width: 26px;
    height: 26px;
    background-color: var(--text-muted);
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
    -webkit-mask-position: center;
            mask-position: center;
    -webkit-mask-size: contain;
            mask-size: contain;
    transition: background-color 0.2s;
}

.nav-label {
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.nav-item.active { color: var(--neon-blue); }
.nav-item.active .nav-icon { background-color: var(--neon-blue); }

/* ============================================
   Profile header (Garage)
   ============================================ */
.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 10px -15px 25px;
    padding: 14px 15px 10px;
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.avatar-wrapper {
    position: relative;
    width: 120px;
    height: 150px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.avatar-outline-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    z-index: 2;
}

.avatar-container {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    padding: 3px;
    background: #222;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    transition: box-shadow 0.3s ease;
    overflow: hidden;
    flex-shrink: 0;
}

.avatar-container img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.profile-action-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding: 0 2px;
}

.share-collection-btn {
    background: transparent;
    border: 1px solid #444;
    color: var(--text-muted);
    padding: 6px 15px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    transition: border-color 0.2s, color 0.2s;
}
.share-collection-btn:active {
    border-color: var(--neon-blue);
    color: var(--neon-blue);
}

.decor-open-btn {
    background: transparent;
    border: 1px solid #444;
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: border-color 0.2s, color 0.2s;
}
.decor-open-btn:active {
    border-color: var(--neon-blue);
    color: var(--neon-blue);
}
.decor-btn-icon {
    width: 15px;
    height: 15px;
    object-fit: contain;
}

.get-car-btn {
    width: 100%;
    margin: 14px 0 18px;
    background: transparent;
    border: 1px solid var(--neon-blue);
    color: var(--neon-blue);
    padding: 11px 15px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s, color 0.2s;
}
.get-car-btn:active {
    background: var(--neon-blue);
    color: var(--bg-dark, #0b0b0f);
}
.get-car-btn.cooldown,
.get-car-btn:disabled {
    border-color: #444;
    color: var(--text-muted);
    cursor: default;
}
.get-car-btn.cooldown:active {
    background: transparent;
    color: var(--text-muted);
}

.user-name {
    margin-top: 10px;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.balance-container {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    background: var(--bg-panel);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #333;
}

.balance-item {
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
}

.balance-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    vertical-align: middle;
}

.gen-icon-fallback {
    font-size: 14px;
    vertical-align: middle;
    color: var(--neon-gold);
}


/* ============================================
   XP bar (Garage)
   ============================================ */
.xp-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 25px;
    cursor: pointer;
}

.xp-bar-container {
    width: 100%;
    background-color: var(--bg-panel);
    border-radius: 12px;
    height: 24px;
    position: relative;
    overflow: hidden;
    border: 1px solid #333;
}

.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #0055ff, var(--neon-blue));
    width: 0%;
    transition: width 0.5s ease-out;
}

.xp-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
}

.xp-subtext {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-muted);
    margin-left: 5px;
}

/* ============================================
   Favorites slots (Garage)
   ============================================ */
.favorites-section {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

.fav-slot {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    background-color: var(--bg-panel);
    border: 2px dashed #444;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    color: #555;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.fav-slot.filled {
    border: 2px solid var(--neon-blue);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}

.fav-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

/* ============================================
   Sorting chips (Garage)
   ============================================ */
.sorting-section {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    margin-bottom: 20px;
    padding-bottom: 5px;
    scrollbar-width: none;
}

.sorting-section::-webkit-scrollbar { display: none; }

.chip {
    background-color: var(--bg-panel);
    color: var(--text-muted);
    border: 1px solid #333;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
}

.chip.active {
    background-color: rgba(0, 243, 255, 0.1);
    color: var(--neon-blue);
    border-color: var(--neon-blue);
    box-shadow: 0 0 8px rgba(0, 243, 255, 0.2);
}

/* ============================================
   Collection grid (Garage)
   ============================================ */
.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.card-item {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid #222;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.card-item::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, var(--glow-color) 0%, transparent 60%);
    opacity: 0.05;
    pointer-events: none;
}

.card-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    margin-bottom: 10px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
}

.card-name {
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 6px;
    line-height: 1.2;
}

.card-rarity {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    background: #000;
    border: 1px solid var(--glow-color);
    color: var(--glow-color);
}

.card-count-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: var(--neon-blue);
    border: 1px solid var(--neon-blue);
    border-radius: 10px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: bold;
    z-index: 2;
    pointer-events: none;
}

.card-serial-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid var(--glow-color);
    color: var(--glow-color);
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
    transition: transform 0.2s;
}

.card-serial-btn:active {
    transform: scale(0.9);
}

.empty-grid {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 40px 0;
}

/* ============================================
   Selection banner (favorites picker)
   ============================================ */
#selection-banner {
    display: none;
    position: fixed;
    bottom: calc(var(--nav-height) + 36px);
    left: 0;
    width: 100%;
    background: var(--neon-blue);
    color: #000;
    padding: 15px;
    text-align: center;
    z-index: 1000;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 -5px 15px rgba(0, 243, 255, 0.3);
}

/* ============================================
   Modals
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100;
    display: none;
    flex-direction: column;
    backdrop-filter: blur(5px);
}

.modal-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #222;
    background: var(--bg-dark);
    gap: 12px;
}

.modal-header h2 {
    flex: 1;
    min-width: 0;
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.close-btn {
    background: none;
    border: none;
    color: var(--neon-red);
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
    font-weight: bold;
    flex-shrink: 0;
    transition: transform 0.2s, color 0.2s;
}

.close-btn:active {
    transform: scale(0.9);
    color: #ff6666;
}

.progress-scroll-area {
    flex: 1;
    display: flex;
    align-items: center;
    overflow-x: auto;
    padding: 40px 20px;
    gap: 24px;
    scrollbar-width: none;
}

.progress-scroll-area::-webkit-scrollbar { display: none; }

.level-node {
    min-width: 110px;
    background: var(--bg-card);
    border: 2px solid #333;
    border-radius: 16px;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.5;
    position: relative;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.level-node.unlocked {
    opacity: 1;
    border-color: var(--neon-blue);
}

.level-node.milestone-5 {
    min-width: 130px;
    border-color: var(--neon-red);
    border-width: 3px;
    box-shadow: 0 0 12px rgba(255, 51, 51, 0.25);
}

.level-node.milestone-major {
    min-width: 160px;
    border-color: var(--neon-purple);
    border-width: 3px;
    padding: 20px 12px;
    box-shadow: 0 0 18px rgba(176, 38, 255, 0.4);
}

.level-node.current {
    opacity: 1;
    border-color: var(--neon-gold);
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.45);
    z-index: 2;
}

.level-node.milestone-major.current {
    border-color: var(--neon-gold);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.6), 0 0 12px rgba(176, 38, 255, 0.3);
}

.level-number {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
}

.level-node.milestone-major .level-number { font-size: 22px; }

.reward-box {
    width: 60px;
    height: 60px;
    background: #000;
    border-radius: 12px;
    border: 1px solid #444;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.level-node.milestone-major .reward-box {
    width: 76px;
    height: 76px;
}

.reward-box img {
    width: 30px;
    height: 30px;
    margin-bottom: 2px;
}

.level-node.milestone-major .reward-box img {
    width: 38px;
    height: 38px;
}

.reward-amount {
    font-size: 12px;
    font-weight: bold;
    color: var(--neon-blue);
}

.status-badge {
    position: absolute;
    bottom: -10px;
    background: #333;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    text-transform: uppercase;
}

.unlocked .status-badge { background: var(--neon-blue); color: #000; }
.current .status-badge { background: var(--neon-gold); color: #000; }

.serials-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 200;
    display: none;
    flex-direction: column;
    backdrop-filter: blur(8px);
}

.serials-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.serials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}

.serial-chip {
    background: var(--bg-card);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    color: var(--neon-blue);
}

.serial-chip .sn-label {
    font-size: 10px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
    font-family: inherit;
}

/* ============================================
   Module placeholder (stub sections)
   ============================================ */
.module-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    min-height: 60vh;
    color: var(--text-muted);
}

.module-placeholder h2 {
    font-size: 24px;
    color: var(--text-main);
    margin-bottom: 12px;
}

.module-placeholder p {
    font-size: 14px;
    line-height: 1.5;
}

/* ============================================
   Clicker
   ============================================ */
.clicker-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding-top: 20px;
}

.clicker-balance {
    display: flex;
    gap: 16px;
    background: var(--bg-panel);
    padding: 10px 18px;
    border-radius: 20px;
    border: 1px solid #333;
    font-size: 16px;
    font-weight: bold;
}

.clicker-balance .label {
    color: var(--text-muted);
    font-weight: 500;
    margin-right: 4px;
}

.clicker-button-wrap {
    width: 240px;
    height: 240px;
    perspective: 800px;
    perspective-origin: center;
    margin: 16px 0;
}

.clicker-button {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background:
        radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.35) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, var(--neon-blue) 0%, #006d80 70%, #003f4d 100%);
    box-shadow:
        0 12px 28px rgba(0, 243, 255, 0.35),
        inset 0 -10px 24px rgba(0, 0, 0, 0.45),
        inset 0 8px 18px rgba(255, 255, 255, 0.18);
    transform-style: preserve-3d;
    will-change: transform;
    transition: transform 0.18s ease-out, box-shadow 0.18s ease-out;
    color: #001b21;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.4);
}

.clicker-button:disabled {
    cursor: not-allowed;
    filter: grayscale(0.6) brightness(0.7);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4), inset 0 -6px 14px rgba(0, 0, 0, 0.5);
}

.clicker-button.tilt {
    transition: transform 0.04s linear;
}

.click-popup-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
    z-index: 5;
}

.click-popup {
    position: absolute;
    transform: translate(-50%, -50%);
    color: var(--neon-gold);
    font-weight: 900;
    font-size: 26px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7), 0 0 8px rgba(255, 215, 0, 0.6);
    pointer-events: none;
    animation: click-pop 0.9s ease-out forwards;
    will-change: transform, opacity;
}

@keyframes click-pop {
    0%   { transform: translate(-50%, -50%) translateY(0)    scale(0.8); opacity: 1; }
    20%  { transform: translate(-50%, -50%) translateY(-10px) scale(1.1); opacity: 1; }
    100% { transform: translate(-50%, -50%) translateY(-90px) scale(0.9); opacity: 0; }
}

.energy-section {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.energy-bar {
    width: 100%;
    height: 16px;
    background: var(--bg-panel);
    border: 1px solid #333;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.energy-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ffaa00, var(--neon-gold), var(--neon-green));
    transition: width 0.15s linear;
}

.energy-text {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

.energy-text strong {
    color: var(--text-main);
}

.clicker-stats {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================
   Passive income — utility
   ============================================ */
.psl-muted { color: var(--text-muted); }

.ps-coin-xs { width: 14px; height: 14px; object-fit: contain; flex-shrink: 0; vertical-align: middle; }
.ps-coin-sm { width: 16px; height: 16px; object-fit: contain; flex-shrink: 0; vertical-align: middle; }
.ps-coin-md { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; }

/* ============================================
   Passive income — section
   ============================================ */
.passive-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Summary panel — стиль как clicker-balance */
.passive-summary {
    background: var(--bg-panel);
    border: 1px solid #2a2a2a;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.passive-summary-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
}

.passive-income-line {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 22px;
    font-weight: bold;
    color: var(--neon-blue);
}

.passive-income-line .psl-muted {
    font-size: 14px;
    font-weight: normal;
}

.passive-accum-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #222;
    border-radius: 12px;
    padding: 10px 14px;
}

.passive-accum-val {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 22px;
    font-weight: bold;
    color: var(--neon-blue);
}

.passive-collect-btn {
    background: linear-gradient(135deg, #0077aa, var(--neon-blue));
    color: #000;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    transition: opacity 0.2s, transform 0.15s;
}

.passive-collect-btn:disabled { opacity: 0.3; cursor: default; }
.passive-collect-btn:not(:disabled):active { transform: scale(0.95); }

/* ============================================
   Passive income — card list (2 per row)
   ============================================ */
.passive-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* Карточка — вертикальная компоновка как .card-item в гараже */
.passive-card {
    background: var(--bg-card);
    border: 1px solid #222;
    border-radius: 14px;
    padding: 12px 10px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.ps-icon-box {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ps-icon-box img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.ps-card-name {
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    line-height: 1.2;
    width: 100%;
}

.ps-card-rate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
    width: 100%;
}

.ps-rate-val {
    font-size: 14px;
    font-weight: bold;
    color: var(--neon-blue);
}

/* Нижняя строка: уровень + кнопка апгрейда */
.ps-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    margin-top: auto;
}

.ps-lvl-badge {
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid rgba(0, 243, 255, 0.3);
    color: var(--neon-blue);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
}

.ps-lvl-badge.dim {
    background: rgba(100, 100, 100, 0.08);
    border-color: #333;
    color: var(--text-muted);
}

.passive-upgrade-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 243, 255, 0.08);
    border: 1px solid rgba(0, 243, 255, 0.35);
    color: var(--neon-blue);
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, transform 0.15s;
}

.passive-upgrade-btn:active { transform: scale(0.95); background: rgba(0, 243, 255, 0.18); }
.passive-upgrade-btn:disabled { opacity: 0.35; cursor: default; transform: none; }

.ps-badge-max {
    background: rgba(0, 255, 102, 0.08);
    border: 1px solid rgba(0, 255, 102, 0.3);
    color: var(--neon-green);
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
}

/* Оверлей замка — поверх карточки */
.ps-lock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 5, 0.75);
    backdrop-filter: blur(2px);
    border-radius: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    pointer-events: none;
}

.ps-lock-icon { font-size: 28px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.ps-lock-icon img { width: 28px; height: 28px; object-fit: contain; }

.ps-lock-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Shake на кнопке апгрейда */
@keyframes passive-shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}

.shake { animation: passive-shake 0.4s ease-out; }

/* ============================================
   Passive income — return popup
   ============================================ */
.passive-return-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.passive-return-popup {
    background: var(--bg-panel);
    border: 1px solid #333;
    border-radius: 20px;
    padding: 32px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: min(320px, 90vw);
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.12);
}

.passive-return-icon { font-size: 52px; line-height: 1; }

.passive-return-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-muted);
}

.passive-return-amount {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 34px;
    font-weight: bold;
    color: var(--neon-blue);
    text-shadow: 0 0 16px rgba(0, 243, 255, 0.4);
}

.passive-coin-inline {
    width: 30px;
    height: 30px;
    object-fit: contain;
    vertical-align: middle;
}

.passive-return-btn {
    width: 100%;
    max-width: 220px;
    background: linear-gradient(135deg, #0077aa, var(--neon-blue));
    color: #000;
    font-weight: bold;
    font-size: 16px;
    margin-top: 0;
    border-radius: 12px;
}

/* ============================================
   Language modal (first-open)
   ============================================ */
.lang-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
}

.lang-modal {
    background: var(--bg-panel, #111);
    border: 1px solid #333;
    border-radius: 20px;
    padding: 32px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: min(340px, 92vw);
}

.lang-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main, #f0f0f0);
}

.lang-modal-sub {
    font-size: 14px;
    color: var(--text-muted, #888);
    margin-bottom: 8px;
}

.lang-modal-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.lang-modal-btn {
    padding: 14px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    background: var(--bg-card, #1a1a1a);
    color: var(--text-main, #f0f0f0);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: inherit;
}

.lang-modal-btn:active {
    background: var(--neon-blue, #00f3ff);
    border-color: var(--neon-blue, #00f3ff);
    color: #000;
}

/* ============================================
   Shop
   ============================================ */
.shop-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 8px;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}

/* Featured (XTR) banner */
.shop-featured {
    background: var(--bg-card);
    border: 1px solid rgba(255, 215, 0, 0.45);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.08);
}

.shop-featured-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.shop-featured-name {
    font-size: 16px;
    font-weight: bold;
}

.shop-xtr-badge {
    background: rgba(255, 215, 0, 0.12);
    border: 1px solid rgba(255, 215, 0, 0.5);
    color: var(--neon-gold);
    border-radius: 8px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.shop-featured-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.shop-featured-rewards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.shop-featured-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
}

.shop-featured-timer {
    font-size: 12px;
    color: var(--text-muted);
}

/* Filter tabs */
.shop-filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.shop-filters::-webkit-scrollbar { display: none; }

.shop-filter-btn {
    background: var(--bg-panel);
    color: var(--text-muted);
    border: 1px solid #333;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
}

.shop-filter-btn.active {
    background: rgba(0, 243, 255, 0.1);
    color: var(--neon-blue);
    border-color: var(--neon-blue);
}

/* Offers grid */
.shop-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* Offer card */
.shop-offer-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid #222;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.shop-offer-body {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 110px;
    background: #111;
    overflow: hidden;
}

.shop-offer-art {
    width: 100%;
    height: 110px;
    object-fit: contain;
    padding: 8px;
}

.shop-chest-art {
    max-height: 90px;
    width: auto;
    padding: 12px;
}

.shop-parts-badge {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: var(--neon-blue);
    border: 1px solid rgba(0, 243, 255, 0.35);
    border-radius: 8px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.shop-parts-gear-img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    flex-shrink: 0;
}

.shop-bundle-rewards-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.shop-bundle-reward-icon {
    position: relative;
    width: 44px;
    height: 44px;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.shop-bundle-reward-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.shop-bundle-reward-qty {
    position: absolute;
    bottom: -6px;
    right: -6px;
    background: var(--bg-dark);
    color: var(--neon-blue);
    border: 1px solid rgba(0, 243, 255, 0.4);
    border-radius: 6px;
    font-size: 9px;
    font-weight: bold;
    padding: 1px 4px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 2px;
}

.shop-bundle-qty-gear {
    width: 10px;
    height: 10px;
    object-fit: contain;
    flex-shrink: 0;
}

.shop-offer-info {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.shop-offer-name {
    font-size: 12px;
    font-weight: bold;
    line-height: 1.3;
}

.shop-offer-timer {
    font-size: 11px;
    color: var(--text-muted);
    min-height: 14px;
}

/* Buy buttons */
.shop-buy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: rgba(0, 243, 255, 0.08);
    border: 1px solid rgba(0, 243, 255, 0.35);
    color: var(--neon-blue);
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s, transform 0.15s;
    margin-top: auto;
}

.shop-buy-btn:active { transform: scale(0.96); background: rgba(0, 243, 255, 0.18); }

.shop-buy-xtr {
    border-color: rgba(255, 215, 0, 0.5);
    color: var(--neon-gold);
    background: rgba(255, 215, 0, 0.08);
    padding: 9px 16px;
    font-size: 14px;
    border-radius: 12px;
    width: auto;
    flex-shrink: 0;
}

.shop-buy-xtr:active { background: rgba(255, 215, 0, 0.18); }

.shop-price-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    flex-shrink: 0;
}

/* ============================================
   Shop modals
   ============================================ */
.shop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    padding: 16px;
}

.shop-modal-box {
    background: var(--bg-panel);
    border: 1px solid #333;
    border-radius: 20px;
    padding: 24px 20px;
    width: min(360px, 100%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 80vh;
    overflow-y: auto;
}

.shop-modal-title {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
}

.shop-modal-desc {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

.shop-modal-price {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 22px;
    font-weight: bold;
    color: var(--neon-blue);
}

.shop-modal-price img { width: 22px; height: 22px; }

.shop-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.shop-btn-primary {
    flex: 1;
    background: linear-gradient(135deg, #0077aa, var(--neon-blue));
    color: #000;
    border: none;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.2s;
}

.shop-btn-primary:active { transform: scale(0.96); }
.shop-btn-primary:disabled { opacity: 0.4; cursor: default; transform: none; }

.shop-btn-secondary {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid #333;
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.shop-btn-secondary:active { background: rgba(255, 255, 255, 0.1); }

/* Rewards list */
.shop-rewards-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 2px;
}

.shop-reward-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid #222;
    border-radius: 12px;
    padding: 10px 12px;
}

.shop-reward-img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 8px;
    background: #111;
}

.shop-reward-label {
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

/* ============================================
   Chest reel
   ============================================ */
.chest-reel-wrapper {
    position: relative;
    padding: 6px 0;
}

.chest-reel-pointer {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    background: var(--neon-blue);
    box-shadow: 0 0 8px var(--neon-blue);
    z-index: 2;
    pointer-events: none;
}

.chest-reel-viewport {
    overflow: hidden;
    border-radius: 10px;
    border: 1px solid #333;
    background: #0a0a0a;
    height: 110px;
}

.chest-reel-track {
    display: flex;
    will-change: transform;
}

.chest-reel-item {
    min-width: 90px;
    width: 90px;
    height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-right: 1px solid #1a1a1a;
    padding: 6px;
    flex-shrink: 0;
}

.chest-reel-item img {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.chest-reel-item-label {
    font-size: 9px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
    max-width: 80px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.chest-result {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.4s ease;
}

.chest-result-title {
    font-size: 13px;
    color: var(--text-muted);
}

.chest-result-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.chest-result-name {
    font-size: 16px;
    font-weight: bold;
    color: var(--neon-blue);
}

/* ============================================
   Offer card — info button
   ============================================ */
.shop-info-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(0, 243, 255, 0.4);
    background: rgba(0, 0, 0, 0.7);
    color: var(--neon-blue);
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

/* ============================================
   Info modal — reward list
   ============================================ */
.shop-info-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.shop-info-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 6px;
}

.shop-info-row-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

.shop-info-row-thumb {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}

.shop-info-row-label {
    font-size: 13px;
    color: #ddd;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.shop-info-row-gear {
    position: absolute;
    bottom: -8px;
    right: -8px;
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.shop-info-row-gear-label {
    width: 14px;
    height: 14px;
    object-fit: contain;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ============================================
   Chest preview scroll
   ============================================ */
.chest-preview-desc {
    font-size: 12px;
    color: #888;
    margin: 4px 0 10px;
    text-align: center;
}

.chest-preview-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}

.chest-preview-track {
    display: flex;
    gap: 10px;
    width: max-content;
}

.chest-preview-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 80px;
    flex-shrink: 0;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    padding: 8px 4px 6px;
}

.chest-preview-thumb {
    position: relative;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
}

.chest-preview-thumb img:not(.chest-preview-gear) {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.chest-preview-gear {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 18px !important;
    height: 18px !important;
    object-fit: contain;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.9));
}

.chest-preview-item > img {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.chest-preview-label {
    font-size: 10px;
    color: #ccc;
    text-align: center;
    line-height: 1.3;
    word-break: break-word;
}

.chest-preview-chance {
    font-size: 11px;
    color: var(--neon-blue);
    font-weight: bold;
}

/* ============================================
   Toast
   ============================================ */
.shop-toast {
    position: fixed;
    bottom: calc(var(--nav-height) + 36px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid #444;
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 500;
    pointer-events: none;
    animation: fadeIn 0.3s ease, fadeOut 0.4s ease 2.6s forwards;
    white-space: nowrap;
    max-width: 90vw;
    text-align: center;
}

/* ============================================
   Section loading
   ============================================ */
.section-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
    color: var(--text-muted);
    font-size: 14px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ============================================
   Decor modal
   ============================================ */
.decor-modal-box {
    background: var(--bg-panel);
    border: 1px solid #333;
    border-radius: 20px;
    padding: 20px;
    width: min(400px, 100%);
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.decor-preview-area {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #111;
    border-radius: 12px;
    padding: 14px;
}

.decor-preview-bg-wrap {
    flex: 1;
    height: 90px;
    border-radius: 10px;
    background: #1a1a1a;
    border: 1px dashed #333;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.decor-preview-bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.decor-preview-bg-hint {
    color: #555;
    font-size: 12px;
}

.decor-tabs {
    display: flex;
    gap: 8px;
}

.decor-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.decor-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    border-radius: 12px;
    padding: 10px 6px 8px;
    background: #111;
    border: 1px solid #2a2a2a;
    transition: border-color 0.2s;
    position: relative;
}

.decor-item.active {
    border-color: var(--neon-blue);
}

.decor-item.selected {
    border-color: var(--neon-blue);
}

.decor-item.locked {
    opacity: 0.65;
}

.decor-item.owned:not(.active):not(.selected):active {
    border-color: #555;
}

.decor-item-thumb {
    position: relative;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.decor-item-thumb > img:not(.decor-avatar-mini-bg):not(.decor-avatar-mini-outline) {
    max-width: 64px;
    max-height: 64px;
    object-fit: contain;
}

.decor-active-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--neon-blue);
    color: #000;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.decor-buy-btn-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 100%;
    background: rgba(0, 243, 255, 0.12);
    border: 1px solid var(--neon-blue);
    color: var(--neon-blue);
    border-radius: 8px;
    padding: 4px 6px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 2px;
}
.decor-buy-btn-inline:disabled {
    opacity: 0.5;
    cursor: default;
}

.decor-currency-icon {
    width: 12px;
    height: 12px;
    object-fit: contain;
    vertical-align: middle;
}

.decor-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.decor-modal-title {
    font-size: 17px;
    font-weight: bold;
}

.decor-item-name {
    font-size: 11px;
    color: #ccc;
    text-align: center;
    line-height: 1.3;
}

.decor-expires-label {
    font-size: 10px;
    color: #e57373;
    text-align: center;
    margin-top: 2px;
}

/* Mini avatar+outline in decor grid (4:5 ratio matching 160×200 overlay spec) */
.decor-avatar-mini {
    position: relative;
    width: 44px;
    height: 55px;  /* 44 * 200/160 */
    display: flex;
    align-items: flex-end;
    justify-content: center;
    flex-shrink: 0;
}

.decor-avatar-mini-bg {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.decor-avatar-mini-fallback {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #333;
    flex-shrink: 0;
}

.decor-avatar-mini-outline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.decor-item-bg-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
}

/* Shop decoration avatar preview */
.shop-decor-avatar-preview {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 10px auto;
}

.shop-decor-avatar-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.shop-decor-avatar-fallback {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #333;
}

.shop-decor-outline-img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140%;
    height: 140%;
    object-fit: contain;
    pointer-events: none;
}

/* ============================================
   Market module
   ============================================ */
.market-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.market-top-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.market-sell-btn {
    width: 100%;
    background: linear-gradient(135deg, rgba(0,243,255,0.15), rgba(0,243,255,0.05));
    border: 1px solid var(--neon-blue);
    color: var(--neon-blue);
    border-radius: 12px;
    padding: 12px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: background 0.2s, box-shadow 0.2s;
}

.market-sell-btn:active {
    box-shadow: 0 0 12px rgba(0,243,255,0.3);
}

.market-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.market-search-row {
    margin-bottom: 2px;
}

.market-search-input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid #333;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-main);
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.market-search-input:focus {
    border-color: var(--neon-blue);
}

.market-sort-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.market-filter-row {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.market-filter-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.market-filter-label input[type="checkbox"] {
    accent-color: var(--neon-blue);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Listings grid */
.market-listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.market-listing-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--tier-color, #222);
    box-shadow: 0 0 8px color-mix(in srgb, var(--tier-color, transparent) 25%, transparent);
    position: relative;
    overflow: hidden;
}

.market-listing-card::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, var(--glow-color) 0%, transparent 60%);
    opacity: 0.05;
    pointer-events: none;
}

.market-top-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 10px;
    background: rgba(255, 200, 0, 0.15);
    border: 1px solid #f0c020;
    color: #f0c020;
    border-radius: 6px;
    padding: 2px 5px;
    z-index: 2;
}

.market-mark-img {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    object-fit: contain;
    z-index: 2;
}

.market-lock-icon {
    position: absolute;
    bottom: 44px;
    right: 8px;
    font-size: 14px;
    opacity: 0.7;
}

.market-listing-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    filter: drop-shadow(0 3px 5px rgba(0,0,0,0.5));
}

.market-listing-name {
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    line-height: 1.2;
}

.market-listing-rarity {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 5px;
    background: #000;
    border: 1px solid currentColor;
}

.market-listing-serial {
    font-size: 11px;
    color: var(--text-muted);
}

.market-listing-price {
    font-size: 12px;
    color: var(--neon-gold);
    font-weight: bold;
}

.market-listing-expires {
    font-size: 10px;
    color: var(--text-muted);
}

.market-buy-btn {
    width: 100%;
    margin-top: 4px;
    background: rgba(0,243,255,0.1);
    border: 1px solid var(--neon-blue);
    color: var(--neon-blue);
    border-radius: 8px;
    padding: 7px 0;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.market-buy-btn:active {
    background: rgba(0,243,255,0.2);
}

.market-cancel-btn {
    width: 100%;
    margin-top: 4px;
    background: rgba(255,60,60,0.08);
    border: 1px solid var(--neon-red);
    color: var(--neon-red);
    border-radius: 8px;
    padding: 7px 0;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.market-cancel-btn:active {
    background: rgba(255,60,60,0.2);
}

/* History */
.market-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.market-history-row {
    background: var(--bg-card);
    border: 1px solid #222;
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.market-history-role {
    font-size: 11px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 6px;
    display: inline-block;
    width: fit-content;
    margin-bottom: 4px;
}

.market-history-role.buyer {
    background: rgba(0,243,255,0.1);
    color: var(--neon-blue);
    border: 1px solid var(--neon-blue);
}

.market-history-role.seller {
    background: rgba(160,32,240,0.1);
    color: var(--neon-purple);
    border: 1px solid var(--neon-purple);
}

.market-history-card {
    font-size: 13px;
    font-weight: bold;
}

.market-history-serial {
    color: var(--text-muted);
    font-weight: normal;
}

.market-history-price {
    font-size: 13px;
    color: var(--neon-gold);
}

.market-history-amount-label {
    font-size: 11px;
    color: var(--text-muted);
}

.market-history-gen {
    font-size: 12px;
}

.market-history-date {
    font-size: 11px;
    color: var(--text-muted);
}

/* Popups */
.market-confirm-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    text-align: center;
}

.market-confirm-body p {
    margin: 0;
}

.market-confirm-price {
    font-size: 20px;
    font-weight: bold;
    color: var(--neon-gold);
}

.market-confirm-btn {
    width: 100%;
    background: rgba(0,243,255,0.1);
    border: 1px solid var(--neon-blue);
    color: var(--neon-blue);
    border-radius: 10px;
    padding: 13px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.market-confirm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.market-confirm-btn.danger {
    background: rgba(255,60,60,0.08);
    border-color: var(--neon-red);
    color: var(--neon-red);
}

.market-alert-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.market-error-msg {
    text-align: center;
    font-size: 13px;
    color: var(--neon-red);
    padding: 4px 0;
}

/* Sell popup */
.market-sell-box {
    max-height: 88vh;
}


.market-mini-garage {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-height: 55vh;
    overflow-y: auto;
}

.market-mini-card {
    background: var(--bg-card);
    border: 1px solid #222;
    border-radius: 10px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    position: relative;
    transition: border-color 0.2s;
}

.market-mini-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    background: radial-gradient(circle, var(--glow-color) 0%, transparent 70%);
    opacity: 0.05;
    pointer-events: none;
}

.market-mini-card:active {
    border-color: var(--glow-color);
}

.market-mini-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
}

.market-mini-card-name {
    font-size: 10px;
    text-align: center;
    line-height: 1.2;
}

.market-mini-card-count {
    font-size: 10px;
    color: var(--neon-blue);
}

.market-mini-card-ghost {
    opacity: 0.55;
    border-style: dashed !important;
}

.market-sell-preview {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--bg-dark);
    border-radius: 10px;
    padding: 10px;
}

.market-sell-preview-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    flex-shrink: 0;
}

.market-sell-preview-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.market-sell-preview-name {
    font-size: 13px;
    font-weight: bold;
}

.market-sell-preview-rarity {
    font-size: 11px;
}

.market-sell-preview-base {
    font-size: 11px;
    color: var(--text-muted);
}

.market-instance-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.market-field-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: block;
}

.market-instance-select {
    flex: 1;
    background: var(--bg-dark);
    border: 1px solid #333;
    border-radius: 8px;
    color: var(--text-main);
    padding: 8px 10px;
    font-size: 13px;
    outline: none;
}

.market-price-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.market-price-field {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.market-price-arrow {
    font-size: 18px;
    color: var(--text-muted);
    padding-bottom: 8px;
    flex-shrink: 0;
}

.market-price-input {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid #333;
    border-radius: 8px;
    color: var(--text-main);
    padding: 10px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.market-price-input:focus {
    border-color: var(--neon-blue);
}

.market-gen-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-dark);
    border-radius: 8px;
    padding: 8px 12px;
    min-height: 36px;
}

.market-gen-mark {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.market-gen-label {
    font-size: 13px;
    color: var(--text-main);
}

.market-preset-btn {
    background: transparent;
    border: 1px dashed #444;
    color: var(--text-muted);
    border-radius: 8px;
    padding: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.market-preset-btn:active {
    border-color: var(--neon-blue);
    color: var(--neon-blue);
}

.market-top-label {
    margin-top: -4px;
}

/* Popup box with absolute close/back buttons */
.market-popup-box {
    position: relative;
    padding-top: 44px;
}

.market-popup-title {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 4px;
}

.market-popup-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.2s;
}

.market-popup-close:active {
    color: var(--text-main);
}

.market-popup-back {
    position: absolute;
    top: 12px;
    left: 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.2s;
}

.market-popup-back:active {
    color: var(--text-main);
}

/* Учитывать комиссию — чекбокс */
.market-tax-label {
    padding: 9px 12px;
    background: rgba(212,175,55,0.06);
    border: 1px solid rgba(212,175,55,0.3);
    border-radius: 8px;
    color: var(--neon-gold);
}

/* Options row (preset + top label) */
.market-options-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* [fix #8] Info button */
.market-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 1px solid #555;
    color: var(--text-muted);
    font-size: 10px;
    font-style: italic;
    cursor: pointer;
    vertical-align: middle;
    margin-left: 4px;
    flex-shrink: 0;
}

.market-info-body p {
    text-align: left;
    color: var(--text-muted);
    font-size: 13px;
    margin: 0;
    line-height: 1.5;
}

/* [fix #7] Generosity in buy confirm */
.market-confirm-gen {
    font-size: 14px;
    font-weight: bold;
}

/* ============================================
   Social module
   ============================================ */
.social-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 12px 12px calc(var(--nav-height) + 16px);
}

.social-card {
    background: var(--bg-panel);
    border: 1px solid #2a2a2a;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.social-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.social-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.social-icon-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

.social-card-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-main);
}

.social-card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.social-accent {
    color: var(--neon-blue);
    font-weight: bold;
}

.social-reward-badge {
    font-size: 14px;
    color: var(--neon-green);
    font-weight: bold;
    padding: 8px 12px;
    background: rgba(0, 255, 102, 0.08);
    border: 1px solid rgba(0, 255, 102, 0.25);
    border-radius: 10px;
    text-align: center;
}

.social-reward-info {
    font-size: 14px;
    color: var(--text-muted);
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: 10px;
    text-align: center;
}

.social-btn-row {
    display: flex;
    gap: 8px;
}

.social-btn {
    flex: 1;
    padding: 11px 14px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.social-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.social-btn-primary {
    background: transparent;
    color: var(--neon-blue);
    border: 1px solid rgba(0, 243, 255, 0.45);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.22);
}

.social-btn-secondary {
    background: var(--bg-card);
    border: 1px solid #444;
    color: var(--text-main);
}

.social-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    text-align: center;
}

.social-rewards-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 10px 12px;
}

.social-reward-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding: 4px 0;
}

.social-reward-row--premium .social-reward-label {
    color: #ffd700;
}

.social-reward-label {
    color: var(--text-muted);
}

.social-reward-value {
    color: var(--text-main);
    font-weight: bold;
    font-size: 12px;
}

.social-link-block {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid #333;
    border-radius: 10px;
    padding: 9px 12px;
}

.social-link-text {
    flex: 1;
    font-size: 12px;
    color: var(--neon-blue);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: text;
    -webkit-user-select: text;
}

.social-copy-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0 2px;
    transition: transform 0.15s;
    display: flex;
    align-items: center;
}

.social-copy-btn img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.social-copy-btn:active {
    transform: scale(0.85);
}

/* ============================================
   Shop: limit badges
   ============================================ */
.shop-limit-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 4px 0 2px;
}

.shop-limit-badge {
    font-size: 11px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.shop-limit-sold {
    background: rgba(255, 51, 51, 0.15);
    border: 1px solid rgba(255, 51, 51, 0.4);
    color: var(--neon-red);
}

.shop-limit-done {
    background: rgba(0, 255, 102, 0.1);
    border: 1px solid rgba(0, 255, 102, 0.3);
    color: var(--neon-green);
}

.shop-limit-global {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.35);
    color: var(--neon-gold);
}

.shop-limit-account {
    background: rgba(0, 243, 255, 0.08);
    border: 1px solid rgba(0, 243, 255, 0.25);
    color: var(--neon-blue);
}

.social-toast {
    position: fixed;
    bottom: calc(var(--nav-height) + 16px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid #444;
    color: var(--text-main);
    padding: 9px 18px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 500;
    pointer-events: none;
    animation: fadeIn 0.3s ease, fadeOut 0.4s ease 2.6s forwards;
    white-space: nowrap;
    max-width: 90vw;
    text-align: center;
}

/* ── Events ────────────────────────────────────────────────────────────── */

.events-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 16px;
}

.event-card-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.event-card {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    max-height: 320px;
    border-radius: 20px;
    overflow: hidden;
    background: #1a1a2e center/cover no-repeat;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 18px;
    box-shadow: 0 0 0 2px rgba(0,220,180,0.35), 0 4px 24px rgba(0,0,0,0.5);
}

.event-open-btn {
    background: #00c9a0;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    border: none;
    border-radius: 30px;
    padding: 10px 36px;
    cursor: pointer;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 12px rgba(0,201,160,0.4);
}

.event-card-info { padding: 0 4px; }
.event-card-name { font-weight: 700; font-size: 16px; text-align: center; }
.event-card-meta { font-size: 13px; color: var(--text-hint, #aaa); text-align: center; }

.events-blocked {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
    min-height: 60vh;
}
.events-blocked-icon { font-size: 56px; margin-bottom: 16px; }
.events-blocked-title { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.events-blocked-text { font-size: 14px; color: var(--text-hint, #aaa); line-height: 1.6; margin-bottom: 16px; }
.events-blocked-score { font-size: 13px; color: var(--text-hint, #aaa); }

.event-modal { max-width: 480px; width: 94vw; padding: 0; overflow: hidden; border-radius: 18px; }
.event-modal-header {
    position: relative;
    height: 160px;
    background: #1a1a2e center/cover no-repeat;
    display: flex;
    align-items: flex-end;
    padding: 14px 16px;
}
.event-modal-title { font-size: 18px; font-weight: 700; color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,0.7); }
.event-modal-body { padding: 14px 16px 20px; max-height: 60vh; overflow-y: auto; }
.event-modal-score { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; font-size: 14px; }
.event-currency-icon { width: 18px; height: 18px; object-fit: contain; }
.event-currency-icon-sm { width: 14px; height: 14px; object-fit: contain; vertical-align: middle; }
.event-modal-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.event-tab {
    flex: 1; padding: 8px; border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.12);
    background: transparent; color: var(--text-hint, #aaa); font-size: 13px; cursor: pointer;
}
.event-tab.active { background: var(--tg-theme-button-color, #3390ec); color: #fff; border-color: transparent; font-weight: 600; }
.event-tab-content.hidden { display: none; }
.event-lb-list { display: flex; flex-direction: column; gap: 6px; }
.event-lb-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 8px;
    background: rgba(255,255,255,0.04); font-size: 14px;
}
.event-lb-me { background: rgba(0,201,160,0.15); border: 1px solid rgba(0,201,160,0.35); }
.event-lb-place { width: 32px; text-align: center; font-weight: 700; }
.event-lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-lb-score { font-weight: 600; display: flex; align-items: center; gap: 4px; }
.event-lb-empty { color: var(--text-hint, #aaa); font-size: 14px; text-align: center; padding: 20px 0; }
.event-lb-list { display: flex; flex-direction: column; gap: 8px; }
.event-tier-block { border-radius: 10px; overflow: hidden; border: 1px solid rgba(255,255,255,0.08); }
.event-tier-header { background: rgba(255,255,255,0.06); padding: 10px 12px 8px; }
.event-tier-label { font-weight: 700; font-size: 13px; display: block; margin-bottom: 6px; }
.event-tier-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.event-tier-no-reward { font-size: 12px; color: var(--text-hint, #aaa); }
.event-lb-empty-tier { padding: 8px 12px; font-size: 12px; color: var(--text-hint, #aaa); background: rgba(255,255,255,0.02); }
.event-reward-chip { display: inline-flex; align-items: center; gap: 4px; background: rgba(255,255,255,0.08); border-radius: 10px; padding: 4px 6px; cursor: pointer; transition: background 0.15s; vertical-align: middle; }
.event-reward-chip:hover { background: rgba(255,255,255,0.18); }
.event-chip-img { width: 36px; height: 36px; object-fit: contain; border-radius: 6px; display: block; }
.event-chip-icon { font-size: 22px; line-height: 1; }
.event-chip-qty { font-size: 12px; font-weight: 700; color: var(--tg-theme-button-color, #3390ec); min-width: 22px; text-align: center; }
.event-reward-popup { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 500; display: flex; align-items: flex-end; justify-content: center; }
.event-reward-popup-inner { background: var(--bg-panel); border-radius: 16px 16px 0 0; padding: 20px 20px 32px; width: 100%; max-width: 480px; }
.event-popup-img { width: 120px; height: 120px; object-fit: contain; border-radius: 12px; display: block; margin: 0 auto 12px; }
.event-popup-title { font-size: 20px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.event-popup-meta { font-size: 13px; color: var(--text-hint, #aaa); text-align: center; margin-bottom: 4px; }
.event-popup-chest-label { font-size: 12px; font-weight: 600; color: var(--text-hint, #aaa); text-transform: uppercase; letter-spacing: .4px; margin: 12px 0 6px; }
.event-popup-chest-list { display: flex; flex-direction: column; gap: 4px; max-height: 160px; overflow-y: auto; }
.event-popup-chest-row { font-size: 13px; padding: 5px 8px; background: rgba(255,255,255,0.04); border-radius: 6px; display: flex; align-items: center; gap: 8px; }
.event-popup-chest-thumb { width: 36px; height: 36px; object-fit: contain; border-radius: 4px; flex-shrink: 0; }
.event-popup-chest-emoji { font-size: 18px; flex-shrink: 0; }
.event-popup-chest-qty { margin-left: auto; font-size: 12px; color: var(--text-hint, #aaa); }
.event-reward-popup-close { width: 100%; padding: 12px; margin-top: 16px; border-radius: 12px; background: var(--tg-theme-button-color, #3390ec); color: #fff; font-size: 15px; font-weight: 600; border: none; cursor: pointer; }

/* ── Event pending rewards banner ── */
.event-pending-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: rgba(0,201,160,0.12); border: 1px solid rgba(0,201,160,0.3); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.event-pending-banner-text { font-size: 14px; flex: 1; }
.event-claim-btn { flex-shrink: 0; padding: 8px 16px; font-size: 14px; font-weight: 600; border-radius: 10px; border: none; background: var(--tg-theme-button-color, #3390ec); color: #fff; cursor: pointer; }
.event-claim-btn:disabled { opacity: 0.6; cursor: default; }

/* ── Event claimed rewards popup ── */
.event-claimed-popup { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 500; display: flex; align-items: flex-end; justify-content: center; }
.event-claimed-popup-inner { background: var(--bg-panel); border-radius: 16px 16px 0 0; padding: 20px 20px 32px; width: 100%; max-width: 480px; }
.event-claimed-title { font-size: 20px; font-weight: 700; text-align: center; margin-bottom: 14px; }
.event-claimed-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; margin-bottom: 4px; }
.event-claimed-row { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.05); border-radius: 8px; padding: 8px 10px; }
.event-claimed-img { width: 36px; height: 36px; object-fit: contain; border-radius: 6px; flex-shrink: 0; }
.event-claimed-no-img { font-size: 24px; flex-shrink: 0; width: 36px; text-align: center; }
.event-claimed-label { font-size: 14px; flex: 1; }
.event-claimed-empty { font-size: 14px; color: var(--text-hint, #aaa); text-align: center; padding: 16px 0; }
.event-claimed-close { width: 100%; padding: 12px; margin-top: 16px; border-radius: 12px; background: var(--tg-theme-button-color, #3390ec); color: #fff; font-size: 15px; font-weight: 600; border: none; cursor: pointer; }

/* ── Event results phase ── */
.event-results-badge { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,0.6); color: #ffcc00; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; letter-spacing: 0.4px; }
.event-upcoming-badge { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,0.6); color: #7ecfff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; letter-spacing: 0.4px; }
.event-results-notice { background: rgba(255,204,0,0.1); border: 1px solid rgba(255,204,0,0.3); border-radius: 10px; padding: 8px 12px; font-size: 13px; color: #ffcc00; margin-bottom: 10px; text-align: center; }
.event-upcoming-notice { background: rgba(126,207,255,0.08); border-color: rgba(126,207,255,0.3); color: #7ecfff; }

/* ── Event pending rewards banner (updated) ── */
.event-pending-banner { user-select: none; }
.event-pending-banner-arrow { font-size: 20px; font-weight: 300; color: var(--tg-theme-button-color, #3390ec); flex-shrink: 0; }

/* ── Event pending claim popup ── */
.event-pending-claim-modal { padding: 20px 18px 24px; max-height: 80vh; display: flex; flex-direction: column; gap: 12px; }
.event-pending-claim-header { display: flex; align-items: center; justify-content: space-between; }
.event-pending-claim-title { font-size: 18px; font-weight: 700; }
.event-pending-close-btn { background: none; border: none; color: var(--neon-red, #ff4d6d); font-size: 22px; cursor: pointer; padding: 4px 8px; line-height: 1; flex-shrink: 0; }
.event-pending-rewards-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: 50vh; }
.event-pending-reward-row { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.05); border-radius: 10px; padding: 10px 12px; }
.event-pending-reward-img { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; flex-shrink: 0; }
.event-pending-reward-icon { font-size: 26px; width: 40px; text-align: center; flex-shrink: 0; }
.event-pending-reward-label { font-size: 14px; flex: 1; }
.event-pending-chest-tag { font-size: 11px; color: var(--text-hint, #aaa); flex-shrink: 0; }
.event-do-claim-btn { width: 100%; padding: 13px; border-radius: 12px; font-size: 15px; font-weight: 700; border: none; background: var(--tg-theme-button-color, #3390ec); color: #fff; cursor: pointer; flex-shrink: 0; }
.event-do-claim-btn:disabled { opacity: 0.6; cursor: default; }

/* ── Partner block (social section) ── */
.social-partner-card { display: flex; flex-direction: column; gap: 0; }
.social-partner-teaser { display: flex; flex-direction: column; gap: 10px; }
.social-partner-teaser-text { font-size: 14px; font-weight: 600; }
.social-partner-teaser .social-btn { flex: none; align-self: flex-start; }
.social-partner-btn { flex-shrink: 0; }
.social-partner-details { display: none; margin-top: 16px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.08); }
.social-partner-details--open { display: block; }
.social-partner-heading { font-size: 17px; font-weight: 700; margin-bottom: 4px; margin-top: 16px; line-height: 1.3; }
.social-partner-heading:first-child { margin-top: 0; }
.social-partner-subheading { font-size: 12px; color: var(--text-muted, #888); margin-bottom: 8px; }
.social-partner-text { font-size: 13px; color: var(--text-muted, #aaa); line-height: 1.5; margin: 0; }

/* ── Rules panel ── */
.rules-panel-intro { font-size: 13px; color: var(--text-muted, #aaa); margin: 0 0 16px; line-height: 1.5; }
.rules-list { margin: 0 0 20px; padding-left: 18px; display: flex; flex-direction: column; gap: 10px; }
.rules-list li { font-size: 14px; line-height: 1.4; color: var(--text-main, #f0f0f0); }
.rules-panel-note { font-size: 12px; color: var(--text-muted, #666); line-height: 1.5; margin: 0; padding: 12px; background: rgba(255,255,255,0.04); border-radius: 8px; border-left: 2px solid rgba(255,255,255,0.12); }

/* ── Chats list (social section) ── */
.chats-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.chat-item { display: flex; align-items: center; gap: 10px; }
.chat-item-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.chat-item-avatar--placeholder { display: flex; align-items: center; justify-content: center; background: var(--tg-theme-button-color, #3390ec); color: #fff; font-size: 18px; font-weight: 700; border-radius: 50%; flex-shrink: 0; width: 42px; height: 42px; }
.chat-item-info { flex: 1; min-width: 0; }
.chat-item-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-members { font-size: 12px; color: var(--tg-theme-hint-color, #888); margin-top: 1px; display: block; }
.chat-item-join-btn { flex-shrink: 0; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--tg-theme-button-color, #3390ec); background: transparent; color: var(--tg-theme-button-color, #3390ec); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background 0.15s, color 0.15s; }
.chat-item-join-btn:active { background: var(--tg-theme-button-color, #3390ec); color: #fff; }

/* ============================================
   Onboarding
   ============================================ */

/* Nav lock during onboarding */
.ob-nav-locked { pointer-events: none; opacity: 0.4; }

/* Full-screen overlay */
.ob-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    background: transparent;
}

/* Аварийная кнопка «Пропустить онбординг» (появляется при зависшей загрузке) */
.ob-skip-btn {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    left: 12px;
    z-index: 99999;
    padding: 5px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.6);
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    backdrop-filter: blur(4px);
}
.ob-skip-btn.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Развилка «пройти / пропустить обучение» */
.ob-gate-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
}
.ob-gate-buttons .ob-topic-confirm { display: block; }
.ob-gate-skip-btn {
    background: none;
    border: none;
    color: var(--text-hint, #aaa);
    font-size: 14px;
    text-decoration: underline;
    cursor: pointer;
    padding: 6px 12px;
    -webkit-tap-highlight-color: transparent;
}
.ob-skip-btn:active {
    background: rgba(255, 255, 255, 0.15);
}

/* ---- Character selection ---- */
.ob-select-screen {
    position: fixed;
    inset: 0;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 24px 12px 16px;
    overflow-y: auto;
    z-index: 9010;
}
.ob-select-title {
    font-size: 20px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 6px;
    color: #fff;
}
.ob-select-ps {
    font-size: 12px;
    color: #aaa;
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.5;
}
.ob-chars-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    width: 100%;
    max-width: 480px;
    align-items: flex-end;
}
.ob-char-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
    border-radius: 14px;
    padding: 0 0 10px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
}
.ob-char-option:active { transform: scale(0.97); }
.ob-char-podium {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.ob-char-select-img {
    width: 90%;
    max-width: 130px;
    height: 160px;
    object-fit: contain;
    object-position: bottom center;
    display: block;
    transform-origin: center bottom;
    position: relative;
    z-index: 1;
    margin-bottom: -28px;
}
.ob-podium-img {
    width: 100%;
    display: block;
    position: relative;
    z-index: 0;
}
.ob-char-select-name {
    font-weight: 700;
    font-size: 13px;
    margin-top: 8px;
    text-align: center;
    color: #fff;
}
.ob-char-select-desc {
    font-size: 11px;
    color: #aaa;
    text-align: center;
    margin: 4px 0 8px;
    line-height: 1.4;
    flex: 1;
    padding: 0 4px;
}
.ob-char-pick-btn {
    background: transparent;
    color: var(--text-main);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    width: 90%;
}

/* ---- Dialogue ---- */
.ob-dialogue-wrap {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9010;
}
.ob-char-side {
    position: fixed;
    bottom: 0;
    right: 0;
    pointer-events: none;
    z-index: 9060;
}
.ob-char-dialogue-img {
    height: 82vh;
    width: auto;
    max-width: 70vw;
    display: block;
    object-fit: contain;
    object-position: bottom;
    transform-origin: center bottom;
}
#ob-dialogue-box {
    position: fixed;
    bottom: 14px;
    left: 14px;
    right: 14px;
    background: rgba(10, 10, 20, 0.95);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 14px;
    padding: 14px 14px 10px;
    pointer-events: all;
    z-index: 9065;
    box-shadow: 0 4px 24px rgba(0,0,0,0.7);
}
.ob-dialogue-name {
    font-size: 12px;
    font-weight: 700;
    color: #3390ec;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}
.ob-dialogue-text {
    font-size: 14px;
    line-height: 1.55;
    color: #eee;
    min-height: 40px;
}
.ob-dialogue-indicator {
    text-align: right;
    font-size: 12px;
    color: #888;
    margin-top: 6px;
    display: none;
    animation: ob-blink 1s ease-in-out infinite;
}
@keyframes ob-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ---- Char-specific dialogue positioning ---- */
.ob-char-img-mac { margin-right: -24px; }
.ob-char-img-ferrara { margin-right: -24px; }

/* O'Classics — car image: wider, sits on podium surface */
.ob-char-option-classics .ob-char-select-img {
    height: auto;
    width: 95%;
    max-width: 150px;
    margin-bottom: -28px;
}

/* Selection screen: shift only character images down, podium stays in place */
.ob-char-option-ferrara .ob-char-select-img {
    margin-top: 25px;
}
.ob-char-option-ferrara .ob-podium-img {
    margin-top: -25px;
}
.ob-char-option-mac .ob-char-select-img {
    margin-top: 25px;
}
.ob-char-option-mac .ob-podium-img {
    margin-top: -25px;
}
.ob-char-option-classics .ob-char-select-img {
    margin-top: 70px;
}
.ob-char-option-classics .ob-podium-img {
    margin-top: -70px;
}

/* ---- Topic screen ---- */
.ob-topic-screen {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9055;
    padding: 20px;
}
.ob-topic-content-centered {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.ob-topic-bubble {
    background: rgba(15, 15, 30, 0.97);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 15px;
    color: #eee;
    text-align: center;
    width: 100%;
}
.ob-topics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
}
.ob-topic-btn {
    background: #1a1a2e;
    border: 2px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 12px 8px;
    font-size: 13px;
    font-weight: 600;
    color: #eee;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
}
.ob-topic-btn.selected {
    background: #3390ec;
    border-color: #3390ec;
    color: #fff;
}
.ob-topic-confirm {
    width: 100%;
    background: #3390ec;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 13px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

/* ---- Breathing animation ---- */
@keyframes ob-breathe {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.025); }
}
.ob-breathe {
    animation: ob-breathe 3s ease-in-out infinite;
}

/* ---- Settings guide row ---- */
.settings-guide-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    align-items: flex-end;
}
.settings-guide-btn {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 4px 4px 8px;
    cursor: pointer;
    font-size: 11px;
    color: var(--tg-theme-hint-color, #999);
    transition: border-color 0.2s;
}
.settings-guide-btn.active {
    border-color: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-text-color, #fff);
}
.settings-guide-img {
    width: 100%;
    max-height: 120px;
    height: auto;
    object-fit: contain;
    object-position: bottom;
}

/* Maintenance screen */
.maintenance-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 24px;
    gap: 12px;
    width: 100%;
}
.maintenance-icon { font-size: 56px; margin-bottom: 8px; }
.maintenance-title { font-size: 22px; font-weight: 700; color: var(--neon-blue, #4da6ff); text-align: center; }
.maintenance-desc { font-size: 15px; color: var(--tg-theme-hint-color, #888); max-width: 280px; line-height: 1.5; text-align: center; }
.maintenance-key-row { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 300px; margin-top: 12px; }
.maintenance-key-input { width: 100%; padding: 12px 16px; border-radius: 12px; border: 1.5px solid var(--neon-blue, #4da6ff); background: rgba(0,0,0,0.3); color: var(--tg-theme-text-color, #fff); font-size: 18px; letter-spacing: 2px; text-align: center; text-transform: uppercase; outline: none; box-sizing: border-box; }
.maintenance-key-btn { width: 100%; padding: 12px; border-radius: 12px; background: linear-gradient(135deg, #1a6fa8, #0d4f7a); color: #fff; font-size: 15px; font-weight: 600; border: none; cursor: pointer; }
.maintenance-key-error { color: #ef5350; font-size: 13px; min-height: 18px; text-align: center; }
body.maintenance-light #decor-open-btn,
body.maintenance-light #share-collection-btn,
body.maintenance-light .favorites-section { display: none !important; }

/* ── FRLCE — Friday Red Line Club Event ─────────────────────────────────── */

.rlc-card {
    box-shadow: 0 0 0 2px rgba(220, 40, 60, 0.45), 0 4px 24px rgba(0, 0, 0, 0.5);
    background: #1c1013 center/cover no-repeat;
}

.rlc-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #ff5b6e;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.4px;
    z-index: 2;
}

.rlc-photo {
    position: absolute;
    inset: 0;
    background: center/cover no-repeat;
}

.rlc-mystery {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 120px;
    font-weight: 800;
    color: rgba(255, 91, 110, 0.35);
    background: radial-gradient(circle at 50% 45%, rgba(220, 40, 60, 0.18), transparent 65%);
    user-select: none;
}

.rlc-buy-btn {
    position: relative;
    z-index: 2;
    background: #d4283c;
    box-shadow: 0 2px 12px rgba(212, 40, 60, 0.45);
}

.rlc-buy-btn:disabled {
    background: #4a3238;
    box-shadow: none;
    cursor: default;
    opacity: 0.75;
}

.rlc-price-part { font-weight: 700; color: var(--text-main); }
.rlc-price-plus { margin: 0 6px; opacity: 0.6; }
.rlc-countdown { color: #ff8a97; font-variant-numeric: tabular-nums; }

.rlc-toast {
    position: fixed;
    bottom: calc(var(--nav-height) + 36px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid #444;
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 500;
    pointer-events: none;
    animation: fadeIn 0.3s ease, fadeOut 0.4s ease 2.6s forwards;
    max-width: 90vw;
    text-align: center;
}

/* ── Публичный профиль игрока (ссылка из /get) ──────────────────────────── */

.pp-screen {
    position: fixed;
    inset: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-main, #0d0d12);
    padding: 0 15px calc(env(safe-area-inset-bottom, 0px) + 24px);
    z-index: 400;
}

/* Шапка наследует .profile-header из гаража — правим только отступы экрана */
.pp-header {
    margin: 0 -15px 20px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 14px);
}

.pp-username { font-size: 13px; color: var(--text-hint, #aaa); margin-top: 2px; }
.pp-level { font-size: 13px; color: var(--text-hint, #aaa); margin-top: 2px; }

.pp-like-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 12px;
    padding: 8px 20px;
    border-radius: 20px;
    border: 1px solid #333;
    background: var(--bg-panel);
    color: var(--text-main, #fff);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.pp-like-btn.liked {
    border-color: #e0405a;
    background: rgba(224, 64, 90, 0.14);
}
.pp-like-btn:disabled { opacity: 0.6; }
.pp-like-heart { font-size: 16px; line-height: 1; }

.pp-like-pop .pp-like-heart { animation: ppLikePop 0.35s ease; }
@keyframes ppLikePop {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.45); }
    100% { transform: scale(1); }
}

.likes-icon { font-size: 14px; line-height: 1; vertical-align: middle; }

.pp-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}
.pp-stat {
    flex: 1;
    background: var(--bg-card, #16161f);
    border: 1px solid #222;
    border-radius: 12px;
    padding: 10px;
    text-align: center;
}
.pp-stat b { display: block; font-size: 18px; }
.pp-stat span { font-size: 11px; color: var(--text-hint, #aaa); }

.pp-sort-row {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.pp-sort-btn {
    background: var(--bg-card, #16161f);
    border: 1px solid #222;
    border-radius: 14px;
    color: var(--text-hint, #aaa);
    font-size: 12px;
    padding: 6px 14px;
    cursor: pointer;
}
.pp-sort-btn.active {
    color: var(--text-main, #fff);
    border-color: var(--neon-blue, #4da6ff);
}

.pp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}
.pp-card { cursor: default; }

.pp-serials-btn {
    margin-top: 6px;
    padding: 3px 10px;
    border-radius: 10px;
    border: 1px solid #333;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-hint, #aaa);
    font-size: 11px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.pp-serials-btn:active { border-color: var(--neon-blue, #4da6ff); }

.pp-serials-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 600;
}
.pp-serials-modal {
    background: var(--bg-panel, #16161f);
    border: 1px solid #333;
    border-radius: 16px;
    padding: 16px;
    width: 100%;
    max-width: 340px;
    max-height: 70vh;
    overflow-y: auto;
}
.pp-serials-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 4px;
}
.pp-serials-close {
    background: none;
    border: none;
    color: var(--text-hint, #aaa);
    font-size: 17px;
    cursor: pointer;
    padding: 0 4px;
    flex-shrink: 0;
}
.pp-serials-sub {
    font-size: 12px;
    color: var(--text-hint, #aaa);
    margin-bottom: 12px;
}
.pp-serials-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.pp-serial-chip {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid #2c2c38;
    border-radius: 8px;
    padding: 4px 9px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.pp-serials-empty { color: var(--text-hint, #888); font-size: 12px; }

.pp-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    gap: 16px;
    text-align: center;
}

/* ── Крафт ───────────────────────────────────────────────────────────────── */

.craft-open-btn {
    margin-top: 10px;
    width: 100%;
    background: transparent;
    border: 1px solid #444;
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: border-color 0.2s, color 0.2s;
}
.craft-open-btn:active { border-color: var(--neon-blue); color: var(--neon-blue); }
.craft-open-btn .btn-icon { width: 16px; height: 16px; object-fit: contain; }

.craft-modal-box {
    background: var(--bg-panel);
    border: 1px solid #333;
    border-radius: 20px;
    padding: 20px;
    width: min(440px, 100%);
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.craft-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.craft-modal-title { font-size: 18px; font-weight: 700; }
.craft-modal-sub { font-size: 12px; color: var(--text-hint, #888); margin-bottom: 10px; }

.craft-list { display: flex; flex-direction: column; gap: 10px; }

.craft-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 14px;
    background: var(--bg-card, #16161f);
    border: 1px solid #262630;
}
.craft-row.craftable {
    border-color: var(--glow-color, #4da6ff);
    box-shadow: 0 0 12px -4px var(--glow-color, #4da6ff);
}
.craft-row-img {
    width: 54px;
    height: 54px;
    object-fit: contain;
    border-radius: 8px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.25);
}
.craft-row-info { flex: 1; min-width: 0; }
.craft-row-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.craft-row-rarity { font-size: 11px; color: var(--text-hint, #888); margin-bottom: 5px; }
.craft-progress {
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}
.craft-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--glow-color, #4da6ff);
    transition: width 0.3s ease;
}
.craft-row-count {
    font-size: 11px;
    color: var(--text-hint, #aaa);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}
.craft-row-action { flex-shrink: 0; }
.craft-do-btn {
    background: linear-gradient(135deg, #2e9d5b, #1c7a42);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.craft-do-btn:disabled { opacity: 0.6; cursor: default; }
.craft-need {
    font-size: 11px;
    color: var(--text-hint, #888);
    text-align: center;
    max-width: 72px;
    line-height: 1.3;
}

/* ── Лесенка вех за друзей ────────────────────────────────────────────────── */

.social-milestones-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    margin: 14px 0 8px;
}
.social-milestones {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.social-milestones-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

/* Гранд-приз (10-я веха) — крупная плитка по центру */
.social-ms-grand {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 18px 14px 16px;
    border-radius: 16px;
    background: var(--bg-card);
    border: 1.5px solid var(--neon-gold, #ffd700);
    opacity: 0.55;
    transition: opacity 0.2s;
}
.social-ms-grand.reached {
    opacity: 1;
    background: rgba(255, 215, 0, 0.1);
    box-shadow: 0 0 18px -6px var(--neon-gold, #ffd700);
}
.social-ms-grand-friends {
    font-size: 12px;
    font-weight: 700;
    color: var(--neon-gold, #ffd700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.social-ms-grand-img {
    width: 150px;
    height: 150px;
    object-fit: contain;
}
.social-ms-grand-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
}
.social-ms-grand-price {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}
.social-ms-tile {
    position: relative;
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid #262630;
    opacity: 0.5;
    transition: opacity 0.2s, border-color 0.2s;
}
.social-ms-tile.reached {
    opacity: 1;
    border-color: #2e9d5b;
    background: rgba(46, 157, 91, 0.12);
}
.social-ms-tile.is-card {
    border-color: var(--neon-gold, #ffd700);
}
.social-ms-tile.is-card.reached {
    background: rgba(255, 215, 0, 0.1);
}
.social-ms-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.45);
    color: var(--text-muted);
}
.social-ms-tile.reached .social-ms-badge {
    background: #2e9d5b;
    color: #fff;
}
.social-ms-reward {
    display: flex;
    align-items: center;
    gap: 3px;
    font-weight: 700;
    color: var(--text-main);
    font-size: 13px;
}
.social-ms-amount { font-variant-numeric: tabular-nums; }
.social-ms-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
}
.social-ms-card-img {
    width: 46px;
    height: 46px;
    object-fit: contain;
}
.social-ms-friends {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.1;
}

/* Подсветка карточки реф-ссылки при входе по startapp=ref */
.social-card-flash {
    animation: socialCardFlash 1.8s ease;
}
@keyframes socialCardFlash {
    0%, 100% { box-shadow: none; }
    30%      { box-shadow: 0 0 0 2px var(--neon-blue, #4da6ff), 0 0 20px -2px var(--neon-blue, #4da6ff); }
}

/* ── Попап анонса/продажи RLC ─────────────────────────────────────────────── */
.rlc-popup {
    position: relative;
    border: 1.5px solid #d4283c;
    box-shadow: 0 0 22px -6px #d4283c;
}
.rlc-popup .rlc-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.55);
    color: #ff5b6e;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.4px;
}
.rlc-popup-img {
    width: 180px;
    height: 180px;
    object-fit: contain;
    margin: 8px auto 4px;
}
.rlc-popup-later {
    display: block;
    margin: 8px auto 0;
    background: none;
    border: none;
    color: var(--text-muted, #aaa);
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
