:root {
    --bg-color: #0d0c11;
    --primary-color: #1a1820;
    --secondary-color: #2a2734;
    --accent-purple: #0088cc;
    --accent-blue: #0088cc;
    --accent-cyan: #229ED9;
    --accent-gold: #ffc947;
    --text-color: #f0f0f0;
    --text-secondary-color: #a0a0a0;
    --font-family: 'Inter', sans-serif;
    /* Responsive sizing */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --app-max-width: 100vw;
    --app-radius: 0px;
    --spacing: clamp(6px, 2vmin, 14px);
    --wheel-size: clamp(350px, 98vw, 504px); /* Увеличено для маленьких экранов */
    /* ✅ НОВОЕ: Поддержка клавиатуры */
    --keyboard-height: 0px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    overflow-x: hidden;
    max-width: 100vw;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 0;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    
    /* Allow overflow for .app scrolling */
    overflow: visible;
    
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
    touch-action: pan-y;
}

.pvp-bg-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    pointer-events: none;
    background-color: #0d0c11;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    will-change: opacity;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    
    /* Darken only the video background */
    filter: brightness(0.4) contrast(1.1);
}

.pvp-bg-video.active {
    opacity: 1;
}

/* Dark overlay on video background */
.pvp-bg-video::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    pointer-events: none;
}

/* Animated Background with stars */
.background-stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--app-radius);
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0.8;
}

.star:nth-child(1) { width: 3px; height: 3px; top: 20%; left: 15%; animation: float1 12s linear infinite, twinkle1 2s ease-in-out infinite; }
.star:nth-child(2) { width: 4px; height: 4px; top: 35%; left: 80%; animation: float2 15s linear infinite, twinkle2 1.8s ease-in-out infinite; }
.star:nth-child(3) { width: 2px; height: 2px; top: 60%; left: 25%; animation: float3 10s linear infinite, twinkle3 2.2s ease-in-out infinite; }
.star:nth-child(4) { width: 3px; height: 3px; top: 10%; left: 60%; animation: float4 14s linear infinite, twinkle1 1.5s ease-in-out infinite; }
.star:nth-child(5) { width: 4px; height: 4px; top: 75%; left: 70%; animation: float5 11s linear infinite, twinkle2 2.5s ease-in-out infinite; }
.star:nth-child(6) { width: 2px; height: 2px; top: 45%; left: 40%; animation: float6 13s linear infinite, twinkle3 1.9s ease-in-out infinite; }
.star:nth-child(7) { width: 3px; height: 3px; top: 85%; left: 20%; animation: float7 12s linear infinite, twinkle1 2.1s ease-in-out infinite; }
.star:nth-child(8) { width: 3px; height: 3px; top: 15%; left: 90%; animation: float8 14s linear infinite, twinkle2 1.7s ease-in-out infinite; }
.star:nth-child(9) { width: 4px; height: 4px; top: 50%; left: 85%; animation: float9 10s linear infinite, twinkle3 2.3s ease-in-out infinite; }
.star:nth-child(10) { width: 2px; height: 2px; top: 30%; left: 50%; animation: float10 13s linear infinite, twinkle1 2s ease-in-out infinite; }
.star:nth-child(11) { width: 3px; height: 3px; top: 70%; left: 10%; animation: float11 11s linear infinite, twinkle2 1.6s ease-in-out infinite; }
.star:nth-child(12) { width: 3px; height: 3px; top: 55%; left: 95%; animation: float12 15s linear infinite, twinkle3 2.4s ease-in-out infinite; }
.star:nth-child(13) { width: 2px; height: 2px; top: 5%; left: 35%; animation: float1 13s linear infinite, twinkle1 1.8s ease-in-out infinite; }
.star:nth-child(14) { width: 4px; height: 4px; top: 90%; left: 55%; animation: float2 11s linear infinite, twinkle2 2.2s ease-in-out infinite; }
.star:nth-child(15) { width: 3px; height: 3px; top: 25%; left: 75%; animation: float3 14s linear infinite, twinkle3 1.9s ease-in-out infinite; }
.star:nth-child(16) { width: 2px; height: 2px; top: 65%; left: 45%; animation: float4 12s linear infinite, twinkle1 2.1s ease-in-out infinite; }
.star:nth-child(17) { width: 3px; height: 3px; top: 40%; left: 65%; animation: float5 12s linear infinite, twinkle2 1.7s ease-in-out infinite; }
.star:nth-child(18) { width: 4px; height: 4px; top: 80%; left: 30%; animation: float6 14s linear infinite, twinkle3 2s ease-in-out infinite; }
.star:nth-child(19) { width: 2px; height: 2px; top: 12%; left: 48%; animation: float7 10s linear infinite, twinkle1 2.3s ease-in-out infinite; }
.star:nth-child(20) { width: 3px; height: 3px; top: 95%; left: 88%; animation: float8 13s linear infinite, twinkle2 1.5s ease-in-out infinite; }

@keyframes float1 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-60px, 120px); }
}
@keyframes float2 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(80px, -100px); }
}
@keyframes float3 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-90px, -70px); }
}
@keyframes float4 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(70px, 110px); }
}
@keyframes float5 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-85px, 90px); }
}
@keyframes float6 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(100px, -60px); }
}
@keyframes float7 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-75px, -110px); }
}
@keyframes float8 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(95px, 85px); }
}
@keyframes float9 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-100px, 105px); }
}
@keyframes float10 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(65px, -95px); }
}
@keyframes float11 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-80px, 75px); }
}
@keyframes float12 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(85px, -80px); }
}

@keyframes twinkle1 {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.8; }
}
@keyframes twinkle2 {
    0%, 100% { opacity: 0.3; }
    45% { opacity: 0.9; }
}
@keyframes twinkle3 {
    0%, 100% { opacity: 0.25; }
    60% { opacity: 0.85; }
}


.app {
    width: 100%;
    max-width: var(--app-max-width);
    background-color: var(--primary-color);
    border-radius: var(--app-radius);
    border: 1px solid var(--secondary-color);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.7);
    
    /* Allow vertical scroll, prevent horizontal */
    overflow-x: hidden;
    overflow-y: auto;
    
    display: flex;
    flex-direction: column;
    height: calc(100dvh - (var(--safe-top) + var(--safe-bottom)));
    position: relative;
    
    /* Убираем любые внешние отступы */
    margin: 0 !important;
    padding: 0 !important;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    
    /* Background stays fixed while content scrolls */
    background-attachment: fixed;
}

/* Header - Fixed at top */
.header { 
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(13, 12, 17, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 0 0 16px 16px;
    width: 100%;
    margin: 0;
    /* Убираем любые внешние отступы */
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}
.top-info-card {
    display: flex;
    gap: 8px;
    
    /* Убираем общий фон */
    background: transparent;
    border: none;
    box-shadow: none;
    
    padding: 12px;
    border-radius: 16px;
}

/* Отдельный стиль для classic gifts - временно отключен для тестирования */
/* body.classic-gifts .top-info-card {
    background: rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
} */

/* Отдельный стиль для pvp2-gifts - временно отключен для тестирования */
/* body.pvp2-gifts .top-info-card {
    background: rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
} */
.top-info-item { 
    flex: 1; 
    font-size: clamp(0.68rem, 1.6vmin, 0.85rem);
    display: flex;
    border-radius: 12px;
    transition: all 0.3s ease;
    /* Фиксируем ширину карточки */
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    /* Предотвращаем расширение карточки */
    box-sizing: border-box;
}

/* Убираем анимацию при наведении и оставляем элементы в позиции "при наведении" */
.top-info-item {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
    align-items: center;
    gap: 8px;
    justify-content: space-between;
    padding: 8px 12px;
}
.top-player-avatar {
    width: clamp(26px, 6vmin, 36px);
    height: clamp(26px, 6vmin, 36px);
    border-radius: 50%;
    border: 1.5px solid var(--accent-blue);
    background: var(--primary-color);
}
.top-player-left {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    overflow: hidden;
}

.top-player-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0; /* Не сжимаем правую часть */
    margin-left: auto; /* Прижимаем к правому краю */
}

.top-player-info {
    display: flex;
    flex-direction: column;
    flex: 1; /* Занимает оставшееся пространство */
    min-width: 0; /* Позволяет сжиматься */
    overflow: hidden;
}

.top-player-main {
    display: block;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.prize-amount {
    font-family: var(--font-family);
    font-size: clamp(0.7rem, 1.6vmin, 0.9rem);
    font-weight: 800;
    color: #ffc947;
    text-shadow: 
        0 0 20px rgba(255, 201, 71, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.02em;
    /* Сумма в правом углу */
    position: absolute;
    top: 0;
    right: 0;
    white-space: nowrap;
    max-width: 80px; /* Уменьшаем максимальную ширину */
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 2px;
}

/* Стили для TON внутри prize-amount */
.prize-amount span {
    font-size: 1em !important; /* Такой же размер как сумма */
    font-weight: 800 !important; /* Жирнее */
    color: inherit; /* Наследует цвет от родителя */
}

/* Стили для нижней части с лейблом и шансом */
.top-player-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 4px;
}

/* Стили для шанса выигрыша */
.win-chance {
    color: var(--text-secondary-color);
    font-size: clamp(0.55rem, 1.4vmin, 0.7rem);
    font-weight: 600;
}
.label { color: var(--text-secondary-color); font-size: clamp(0.55rem, 1.4vmin, 0.7rem); }
.value { 
    display: block; 
    font-weight: 800; /* Сделали жирнее */
    font-size: clamp(0.7rem, 1.8vmin, 0.9rem);
    /* Адаптивное сжатие текста */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: calc(100% - 70px); /* Еще меньше места для username */
    margin-right: 4px; /* Отступ от суммы */
}
.win { color: var(--accent-gold); }
.neutral { color: var(--text-secondary-color); }
.mode { color: var(--text-secondary-color); font-size: 0.8em; }
.wins { color: var(--text-secondary-color); font-size: 0.8em; }

/* Main Content */
.main-content {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 12px 12px;
    gap: clamp(8px, 1.6vmin, 12px);
    position: relative;
    z-index: 3;
}

.game-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    
    /* Light glassmorphism with Telegram blue tint */
    background: linear-gradient(135deg, rgba(34, 158, 217, 0.08), rgba(34, 158, 217, 0.03));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1.5px solid rgba(34, 158, 217, 0.2);
    
    padding: 8px 12px;
    gap: 8px;
    border-radius: 16px;
    width: 100%;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(34, 158, 217, 0.15);
    
    /* Smooth transition */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Slightly fade when scrolling */
.game-bar.scrolled {
    opacity: 0.7;
}

/* Game bar skeleton loading effect - whole card */
.game-bar.skeleton-game-bar {
    background: linear-gradient(
        90deg,
        rgba(34, 158, 217, 0.1) 0%,
        rgba(34, 158, 217, 0.05) 50%,
        rgba(34, 158, 217, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-color: rgba(34, 158, 217, 0.2);
}

.icon-button {
    width: clamp(30px, 6.5vmin, 38px);
    height: clamp(30px, 6.5vmin, 38px);
    
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    transition: all 0.3s ease;
    cursor: pointer;
}

.icon-button:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.icon-button:active {
    transform: scale(0.95);
}

/* Mode Toggle Button */
.mode-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    
    font-size: clamp(0.75rem, 2vmin, 0.85rem);
    font-weight: 600;
    color: var(--text-color);
    
    transition: all 0.3s ease;
    cursor: pointer;
    
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.mode-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.mode-toggle:active {
    transform: scale(0.98);
}

.mode-icon {
    font-size: 1.1em;
}

.mode-label {
    white-space: nowrap;
}

/* Gifts mode styling */
.mode-toggle.gifts-mode {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(236, 72, 153, 0.2));
    border-color: rgba(168, 85, 247, 0.3);
}

/* Mode Switch (segmented) */
.mode-switch {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    overflow: hidden;
}

.mode-switch-label {
    margin-right: 8px;
    font-size: 12px;
    opacity: 0.8;
    display: none;
}

.mode-option {
    appearance: none;
    background: transparent;
    color: #fff;
    padding: 8px 12px;
    font-weight: 600;
    border: none;
    outline: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    position: relative;
}

.mode-option .star-icon {
    width: 1.3em;
    height: 1.3em;
}

.mode-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mode-option.active {
    background: linear-gradient(135deg, rgba(34, 158, 217, 0.2), rgba(34, 158, 217, 0.1));
    box-shadow: 0 0 12px rgba(34, 158, 217, 0.4);
    animation: pulse-once 0.4s ease-out;
    border: 1.5px solid rgba(34, 158, 217, 0.6);
    backdrop-filter: blur(10px);
}

.mode-option.active::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
    pointer-events: none;
}

@keyframes pulse-once {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@media (min-width: 480px) {
    .mode-switch-label { display: inline-block; }
}

/* Onboarding tooltip for mode switch */
.mode-tip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translate(-50%, 8px);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.mode-tip.show {
    opacity: 1;
    transform: translate(-50%, 12px);
}

.mode-tip::after {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: rgba(0, 0, 0, 0.85);
}

.history-button {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='1.5' stroke='%23a0a0a0'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z' /%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 60%;
}

.chat-button {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='1.5' stroke='%23a0a0a0'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193l-3.72-3.72a1.5 1.5 0 010-2.122l3.72-3.72zM3.75 8.511c-.884.284-1.5 1.128-1.5 2.097v4.286c0 1.136.847 2.1 1.98 2.193l3.72-3.72a1.5 1.5 0 010-2.122l-3.72-3.72z' /%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 60%;
}
/* Bank info for game pages (classic, pvp2) */
.game-bar .bank-info { 
    font-size: clamp(0.85rem, 2vmin, 0.95rem); 
    font-weight: 700; 
    color: #ffc947;
    text-shadow: 
        0 0 20px rgba(255, 201, 71, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.02em;
}

/* Bank info for shop page */
.shop-app .bank-info { 
    font-size: clamp(0.85rem, 2vmin, 1rem); 
    font-weight: 700; 
    color: #fff;
    text-shadow: 
        0 0 15px rgba(255, 255, 255, 0.6),
        0 2px 8px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    letter-spacing: 0.05em;
    background: linear-gradient(145deg, rgba(30, 30, 60, 0.95), rgba(20, 20, 50, 0.9));
    padding: 16px 28px;
    border-radius: 25px;
    border: 1.5px solid rgba(100, 200, 255, 0.3);
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.5),
        inset 0 2px 10px rgba(255, 255, 255, 0.05),
        0 0 80px rgba(0, 136, 204, 0.15),
        inset 0 0 30px rgba(100, 200, 255, 0.08);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    position: relative;
    overflow: hidden;
    animation: bank-gentle-float 4s ease-in-out infinite;
}

.shop-app .bank-info::before {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background: 
        radial-gradient(circle at 30% 30%, rgba(100, 200, 255, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(157, 80, 187, 0.2) 0%, transparent 50%);
    animation: bank-shimmer 8s linear infinite;
    pointer-events: none;
}

.shop-app .bank-info::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: bank-sweep 6s ease-in-out infinite;
}

@keyframes bank-gentle-float {
    0%, 100% { transform: translateY(0) scale(1); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), inset 0 2px 10px rgba(255, 255, 255, 0.05), 0 0 80px rgba(0, 136, 204, 0.15), inset 0 0 30px rgba(100, 200, 255, 0.08); }
    50% { transform: translateY(-3px) scale(1.005); box-shadow: 0 12px 45px rgba(0, 0, 0, 0.6), inset 0 2px 10px rgba(255, 255, 255, 0.05), 0 0 100px rgba(0, 136, 204, 0.2), inset 0 0 40px rgba(100, 200, 255, 0.12); }
}

@keyframes bank-shimmer {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes bank-sweep {
    0% { left: -100%; }
    100% { left: 200%; }
}

.shop-app .bank-info .balance-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 15px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(40, 60, 100, 0.4);
    min-height: 44px;
    border: 1px solid rgba(100, 200, 255, 0.2);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.shop-app .bank-info .balance-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s;
}

.shop-app .bank-info .balance-item:hover {
    background: rgba(60, 100, 160, 0.5);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 6px 20px rgba(0, 136, 204, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 30px rgba(100, 200, 255, 0.3);
    border-color: rgba(100, 200, 255, 0.5);
}

.shop-app .bank-info .balance-item:hover::before {
    left: 200%;
}

.shop-app .bank-info .balance-icon {
    filter: drop-shadow(0 0 10px rgba(255, 201, 71, 0.6));
    animation: icon-glow 2s ease-in-out infinite alternate;
}

@keyframes icon-glow {
    0% { filter: drop-shadow(0 0 10px rgba(255, 201, 71, 0.6)); }
    100% { filter: drop-shadow(0 0 15px rgba(255, 201, 71, 0.9)); }
}

.ton-icon {
    width: 1.5em;
    height: 1.5em;
    display: inline-block;
    vertical-align: baseline;
    filter: drop-shadow(0 0 8px rgba(0, 136, 204, 0.7));
    animation: ton-pulse 2.5s ease-in-out infinite;
}

@keyframes ton-pulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 8px rgba(0, 136, 204, 0.7)); }
    50% { transform: scale(1.05); filter: drop-shadow(0 0 12px rgba(0, 136, 204, 1)); }
}

.shop-app .bank-info .balance-divider {
    color: rgba(150, 180, 255, 0.6);
    font-weight: 400;
    margin: 0 8px;
    text-shadow: 0 0 8px rgba(150, 180, 255, 0.5);
}

/* Wheel */
.wheel-container { 
    position: relative; 
    width: 100%; 
    max-width: var(--wheel-size); 
    aspect-ratio: 1 / 1;
    margin-top: clamp(15px, 4vmin, 30px);
    margin-bottom: clamp(15px, 4vmin, 30px);
}
.wheel-border {
    width: 100%; 
    height: 100%; 
    border-radius: 50%;
    background: linear-gradient(45deg, var(--accent-purple), var(--accent-pink));
    padding: 1.5px;
    filter: drop-shadow(0 0 4px rgba(157, 80, 187, 0.2));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Анимация ожидания игроков - только вращающаяся граница */
.wheel-border.waiting-animation {
    position: relative;
    overflow: visible;
    transition: opacity 1s ease-out;
}

/* Вращающееся свечение границы - бежит по кругу */
.wheel-border.waiting-animation::before {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        transparent 200deg,
        rgba(0, 136, 204, 0.5) 220deg,
        rgba(100, 200, 255, 0.6) 240deg,
        rgba(0, 136, 204, 0.5) 260deg,
        transparent 280deg,
        transparent 360deg
    );
    filter: blur(8px);
    z-index: -1;
    animation: waiting-border-rotate 2s linear infinite,
               waiting-glow-pulse 4s ease-in-out infinite;
    opacity: 0.4;
}

/* Плавное затухание при countdown (игнорирует автоматическую пульсацию) */
.wheel-border.waiting-animation.fading-out::before {
    animation: waiting-border-rotate 2s linear infinite;
    opacity: 0 !important;
    transition: opacity 1s ease-out;
}

/* Вращающиеся частицы вокруг колеса - орбитальное движение */
.wheel-border.waiting-animation .waiting-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    transform-origin: center center;
}

/* Затухание частиц при countdown */
.wheel-border.waiting-animation.fading-out .waiting-particles {
    opacity: 0;
    transition: opacity 1s ease-out;
}

.wheel-border.waiting-animation.fading-out .waiting-particles span,
.wheel-border.waiting-animation.fading-out .waiting-particles::before,
.wheel-border.waiting-animation.fading-out .waiting-particles::after {
    opacity: 0;
    transition: opacity 1s ease-out;
}

/* Частицы вращаются по орбите вокруг колеса */
.wheel-border.waiting-animation .waiting-particles span {
    position: absolute;
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, var(--accent-blue), rgba(100, 200, 255, 0.8));
    border-radius: 50%;
    box-shadow: 
        0 0 20px var(--accent-blue),
        0 0 30px rgba(0, 136, 204, 0.8),
        0 0 40px rgba(100, 200, 255, 0.4);
    top: 50%;
    left: 50%;
    transform-origin: center center;
    animation: waiting-orbit-rotate 3s linear infinite, 
               waiting-particle-pulse 2s ease-in-out infinite;
}

/* Орбита 1 - ближняя орбита, быстрое вращение (сверху) */
.wheel-border.waiting-animation .waiting-particles span:nth-child(1) {
    transform: translate(-50%, -50%) rotate(0deg) translateY(-140%);
    animation: waiting-orbit-rotate-fast 2s linear infinite,
               waiting-particle-pulse 1.5s ease-in-out infinite;
    animation-delay: 0s, 0s;
}

/* Орбита 2 - дальняя орбита, медленное вращение (снизу) */
.wheel-border.waiting-animation .waiting-particles span:nth-child(2) {
    transform: translate(-50%, -50%) rotate(180deg) translateY(140%);
    animation: waiting-orbit-rotate-slow 4s linear infinite,
               waiting-particle-pulse 2s ease-in-out infinite;
    animation-delay: 0s, 0.5s;
}

/* Орбита 3 - горизонтальная, средняя скорость (слева) */
.wheel-border.waiting-animation .waiting-particles span:nth-child(3) {
    transform: translate(-50%, -50%) rotate(-90deg) translateX(-140%);
    animation: waiting-orbit-rotate-medium 3s linear infinite,
               waiting-particle-pulse 1.8s ease-in-out infinite;
    animation-delay: 0s, 1s;
}

/* Орбита 4 - горизонтальная, обратное направление (справа) */
.wheel-border.waiting-animation .waiting-particles span:nth-child(4) {
    transform: translate(-50%, -50%) rotate(90deg) translateX(140%);
    animation: waiting-orbit-rotate-medium-reverse 3s linear infinite,
               waiting-particle-pulse 2.2s ease-in-out infinite;
    animation-delay: 0s, 1.5s;
}

/* Дополнительные частицы на диагональных орбитах */
.wheel-border.waiting-animation .waiting-particles::before,
.wheel-border.waiting-animation .waiting-particles::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, rgba(100, 200, 255, 1), var(--accent-blue));
    border-radius: 50%;
    box-shadow: 0 0 18px rgba(100, 200, 255, 0.9), 0 0 28px rgba(0, 136, 204, 0.6);
    top: 50%;
    left: 50%;
    transform-origin: center center;
    animation: waiting-orbit-diagonal-1 3.5s linear infinite,
               waiting-particle-glow 2.5s ease-in-out infinite;
}

.wheel-border.waiting-animation .waiting-particles::before {
    transform: translate(-50%, -50%) rotate(-45deg) translate(-100px, -100px);
    animation-delay: 0s, 0s;
}

.wheel-border.waiting-animation .waiting-particles::after {
    transform: translate(-50%, -50%) rotate(135deg) translate(100px, 100px);
    animation: waiting-orbit-diagonal-2 3.5s linear infinite,
               waiting-particle-glow 2.5s ease-in-out infinite;
    animation-delay: 1.75s, 1s;
}

/* Вращение границы - свечение бежит по кругу */
@keyframes waiting-border-rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Пульсация свечения границы */
@keyframes waiting-glow-pulse {
    0% {
        opacity: 0.4;
    }
    35% {
        opacity: 0.4;
    }
    50% {
        opacity: 0.05;
    }
    65% {
        opacity: 0.05;
    }
    100% {
        opacity: 0.4;
    }
}

/* Орбитальное вращение - быстрое (2 секунды), вертикальная орбита */
@keyframes waiting-orbit-rotate-fast {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) translateY(-140%);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg) translateY(-140%);
    }
}

/* Орбитальное вращение - медленное (4 секунды), вертикальная орбита */
@keyframes waiting-orbit-rotate-slow {
    0% {
        transform: translate(-50%, -50%) rotate(180deg) translateY(140%);
    }
    100% {
        transform: translate(-50%, -50%) rotate(540deg) translateY(140%);
    }
}

/* Орбитальное вращение - средняя скорость (3 секунды), горизонтальная орбита */
@keyframes waiting-orbit-rotate-medium {
    0% {
        transform: translate(-50%, -50%) rotate(-90deg) translateX(-140%);
    }
    100% {
        transform: translate(-50%, -50%) rotate(270deg) translateX(-140%);
    }
}

/* Орбитальное вращение - средняя скорость, обратное направление */
@keyframes waiting-orbit-rotate-medium-reverse {
    0% {
        transform: translate(-50%, -50%) rotate(90deg) translateX(140%);
    }
    100% {
        transform: translate(-50%, -50%) rotate(-270deg) translateX(140%);
    }
}

/* Орбитальное вращение - диагональ 1 */
@keyframes waiting-orbit-diagonal-1 {
    0% {
        transform: translate(-50%, -50%) rotate(-45deg) translate(-100px, -100px);
    }
    100% {
        transform: translate(-50%, -50%) rotate(315deg) translate(-100px, -100px);
    }
}

/* Орбитальное вращение - диагональ 2 */
@keyframes waiting-orbit-diagonal-2 {
    0% {
        transform: translate(-50%, -50%) rotate(135deg) translate(100px, 100px);
    }
    100% {
        transform: translate(-50%, -50%) rotate(495deg) translate(100px, 100px);
    }
}

/* Пульсация частиц - изменяем только opacity и box-shadow, без scale чтобы не конфликтовать с орбитой */
@keyframes waiting-particle-pulse {
    0%, 100% {
        opacity: 0.5;
        filter: brightness(0.8);
    }
    50% {
        opacity: 1;
        filter: brightness(1.3);
    }
}

/* Свечение частиц */
@keyframes waiting-particle-glow {
    0%, 100% {
        box-shadow: 
            0 0 18px rgba(100, 200, 255, 0.7),
            0 0 28px rgba(0, 136, 204, 0.4);
        opacity: 0.7;
    }
    50% {
        box-shadow: 
            0 0 25px rgba(100, 200, 255, 1),
            0 0 40px rgba(0, 136, 204, 0.8),
            0 0 55px rgba(0, 136, 204, 0.4);
        opacity: 1;
    }
}

/* Skeleton loader for wheel during initial load */
.wheel-border.loading::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(
        90deg,
        rgba(0, 136, 204, 0.3) 0%,
        rgba(0, 136, 204, 0.1) 50%,
        rgba(0, 136, 204, 0.3) 100%
    );
    background-size: 200% 100%;
    animation: wheel-skeleton-shimmer 2s ease-in-out infinite;
    z-index: 1;
    opacity: 0.6;
}

@keyframes wheel-skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes spin-border {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#wheelCanvas {
    display: block;
    border-radius: 50%;
    transition: transform 8s cubic-bezier(0.2, 0.95, 0.3, 1);
    box-shadow: inset 0 0 30px rgba(0,0,0,0.8);
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    position: relative;
    z-index: 2;
}
.wheel-avatars {
    position: absolute;
    inset: 1.5px;
    transition: transform 8s cubic-bezier(0.2, 0.95, 0.3, 1);
    pointer-events: none;
    z-index: 2;
}
.wheel-avatar {
    position: absolute;
    top: 50%;
    left: 50%;
    width: clamp(20px, 6vmin, 32px);
    height: clamp(20px, 6vmin, 32px);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: none;
    transform-origin: center center;
    transform: translate(-50%, -50%);
    z-index: 3;
}

.pointer {
    position: absolute; 
    top: calc(-1 * clamp(4px, 1.5vmin, 8px)); 
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    width: clamp(20px, 5vmin, 30px);
    height: clamp(20px, 5vmin, 30px);
}

/* Белая обводка треугольника */
.pointer::before {
    content: '';
    position: absolute;
    width: 28px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 24'%3E%3Cpath d='M14 21 L26 3 L2 3 Z' fill='white' stroke='white' stroke-width='5' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
    z-index: 1;
}

/* Темно-синий треугольник с закругленными углами */
.pointer::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 20'%3E%3Cpath d='M12 18 L22 2 L2 2 Z' fill='%23152a5e' stroke='%23152a5e' stroke-width='4' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}
.wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(64px, 20vmin, 100px);
    height: clamp(64px, 20vmin, 100px);
    min-width: clamp(64px, 20vmin, 100px);
    min-height: clamp(64px, 20vmin, 100px);
    max-width: clamp(64px, 20vmin, 100px);
    max-height: clamp(64px, 20vmin, 100px);
    
    /* Dark solid with neon glow */
    background: radial-gradient(
        circle at 35% 35%,
        rgba(26, 24, 32, 1) 0%,
        rgba(13, 12, 17, 1) 100%
    );
    border: none; // Убрали обводку полностью
    border-radius: 50%;
    overflow: hidden; /* Обрезаем содержимое по кругу */
    
    display: flex;
    justify-content: center;
    align-items: center;
    
    font-size: clamp(0.8rem, 2.2vmin, 1rem);
    font-weight: 700;
    z-index: 5;
    text-align: center;
    line-height: 1.2;
    padding: 10px;
    word-wrap: break-word;
    
    box-shadow: none; /* Убрали свечение */
    
    transition: all 0.3s ease;
}

.wheel-center.countdown-active {
    color: white;
    border-color: rgba(255, 201, 71, 0.6);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    box-shadow: none; /* Убрали свечение в активном состоянии */
    /* animation: pulse-center 1s ease-in-out infinite; */ /* Убрали анимацию пульсации */
}

@keyframes pulse-center {
    0%, 100% { 
        box-shadow: 
            0 0 50px rgba(255, 201, 71, 0.5),
            0 0 20px rgba(0, 0, 0, 0.5);
    }
    50% { 
        box-shadow: 
            0 0 70px rgba(255, 201, 71, 0.7),
            0 0 25px rgba(0, 0, 0, 0.5);
    }
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--secondary-color);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Players Section */
.players-section { 
    width: 100%;
    background-color: transparent;
    
    /* Take remaining space and grow to push content down */
    flex: 1 1 auto;
    
    /* Allow minimum height so content can grow and trigger scroll */
    min-height: min-content;
    
    /* NO scrolling here - parent .app handles it */
    overflow: visible;
    
    /* Proper spacing to prevent overlap */
    padding: 4px 12px calc(12px + 20px);
    position: relative;
    z-index: 3;
}
.players-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px; font-size: clamp(0.85rem, 2.1vmin, 1rem); color: var(--text-secondary-color);
}
#game-id {
    font-weight: 700;
    color: var(--accent-gold);
}

/* Skeleton loader - Telegram blue theme */
.skeleton-text {
    display: inline-block;
    width: 100px;
    height: 1.2em;
    background: linear-gradient(
        90deg,
        var(--accent-blue) 0%,
        rgba(0, 136, 204, 0.3) 50%,
        var(--accent-blue) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
    opacity: 0.6;
}

@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Skeleton for different sizes */
#players-count.skeleton-text, #game-id.skeleton-text { 
    width: 120px; 
}

/* Skeleton for total-bank */
#total-bank.skeleton-text {
    width: 60px;
}

/* Skeleton for shop/inventory balance */
.balance-item #wallet-balance.skeleton-text,
.balance-item #stars-balance.skeleton-text {
    width: 50px;
}

/* Skeleton sizes for top-info-item */
.top-info-item .value.skeleton-text { width: 90px; }
.top-info-item .prize-amount.skeleton-text { width: 60px; }
.top-info-item .win-chance.skeleton-text { width: 70px; }

#game-id:not(.skeleton-text), #players-count:not(.skeleton-text) {
    animation: fadeInUp 0.3s ease-out;
}

/* Remove skeleton class when data is loaded */
.top-info-item:not(.skeleton-loading) .skeleton-text {
    animation: fadeInUp 0.3s ease-out;
}

/* Remove skeleton from shop/inventory when data is loaded */
.shop-app .top-info-card:not(.skeleton-loading) .skeleton-text {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(2px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Skeleton for shop cards - whole card */
.shop-card.skeleton-card {
    background: linear-gradient(
        90deg,
        rgba(34, 158, 217, 0.1) 0%,
        rgba(34, 158, 217, 0.05) 50%,
        rgba(34, 158, 217, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-color: rgba(34, 158, 217, 0.2);
}

.shop-card.skeleton-card .shop-media,
.shop-card.skeleton-card .shop-title,
.shop-card.skeleton-card .shop-prices,
.shop-card.skeleton-card .shop-btn {
    background: transparent;
    animation: none;
}

/* Skeleton for profile stats - whole card */
.stat-card.skeleton-stat {
    background: linear-gradient(
        90deg,
        rgba(34, 158, 217, 0.1) 0%,
        rgba(34, 158, 217, 0.05) 50%,
        rgba(34, 158, 217, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-color: rgba(34, 158, 217, 0.2);
}

.stat-card.skeleton-stat .stat-icon,
.stat-card.skeleton-stat .stat-value,
.stat-card.skeleton-stat .stat-label {
    background: transparent;
    animation: none;
}

/* Skeleton for balance card - whole card */
.balance-card.skeleton-balance {
    background: linear-gradient(
        90deg,
        rgba(34, 158, 217, 0.1) 0%,
        rgba(34, 158, 217, 0.05) 50%,
        rgba(34, 158, 217, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-color: rgba(34, 158, 217, 0.2);
}

.balance-card.skeleton-balance .balance-value {
    background: transparent;
    animation: none;
}

/* Skeleton for profile-hero - whole card */
.profile-hero.skeleton-hero {
    background: linear-gradient(
        90deg,
        rgba(34, 158, 217, 0.1) 0%,
        rgba(34, 158, 217, 0.05) 50%,
        rgba(34, 158, 217, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 20px;
    margin: 20px 15px;
}

/* Skeleton for level-progress-card - whole card */
.level-progress-card.skeleton-level-progress {
    background: linear-gradient(
        90deg,
        rgba(34, 158, 217, 0.1) 0%,
        rgba(34, 158, 217, 0.05) 50%,
        rgba(34, 158, 217, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-color: rgba(34, 158, 217, 0.2);
}

/* Skeleton for section-card - whole card */
.section-card.skeleton-section {
    background: linear-gradient(
        90deg,
        rgba(34, 158, 217, 0.1) 0%,
        rgba(34, 158, 217, 0.05) 50%,
        rgba(34, 158, 217, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-color: rgba(34, 158, 217, 0.2);
}

/* Skeleton for bet-controls - whole card */
.bet-controls.skeleton-bet-controls {
    background: linear-gradient(
        90deg,
        rgba(34, 158, 217, 0.1) 0%,
        rgba(34, 158, 217, 0.05) 50%,
        rgba(34, 158, 217, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 16px;
    padding: 12px;
    border: 1.5px solid rgba(34, 158, 217, 0.2);
}

.players-list {
    display: flex; 
    flex-direction: column; 
    gap: 8px;
    
    /* Padding for nav bar and extra space */
    padding-bottom: 90px;
    
    /* Prevent horizontal scroll */
    overflow-x: hidden;
}
.player-card {
    display: grid; 
    grid-template-columns: 32px 1fr auto; 
    align-items: start;
    gap: 10px;
    
    /* Solid dark with subtle gradient */
    background: linear-gradient(135deg, 
        rgba(42, 39, 52, 0.95) 0%, 
        rgba(26, 24, 32, 0.95) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.08);
    
    padding: 10px;
    border-radius: 12px;
    transform: translateX(100%);
    animation: slide-in 0.5s forwards;
    
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Subtle left border accent */
.player-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, 
        rgba(99, 102, 241, 0.6) 0%,
        rgba(59, 130, 246, 0.4) 50%,
        rgba(6, 182, 212, 0.6) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

.player-card:hover {
    transform: translateX(4px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 
        -3px 0 0 0 rgba(99, 102, 241, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.3);
}

.player-card:hover::before {
    opacity: 1;
}

@keyframes slide-in {
    to { transform: translateX(0); }
}
.player-avatar { width: clamp(26px, 6vmin, 36px); height: clamp(26px, 6vmin, 36px); border-radius: 50%; }
.player-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.player-name { font-weight: 500; font-size: clamp(0.85rem, 2.2vmin, 1rem); }
.player-chance { font-size: clamp(0.7rem, 2vmin, 0.85rem); color: var(--text-secondary-color); }
.player-bet { font-weight: 600; color: var(--accent-gold); font-size: clamp(0.85rem, 2.2vmin, 1rem); display: flex; align-items: center; gap: 2px; align-self: center; margin-top: 0; }

/* Bet Controls */
.bet-controls { 
    display: flex; 
    gap: clamp(8px, 2vmin, 12px); 
    width: 100%;
    max-width: 100%;
}
.bet-input {
    flex-grow: 1;
    
    /* Glassmorphism for input */
    background-color: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    
    border-radius: 14px;
    color: var(--text-color);
    padding: 14px 44px 14px 16px;
    font-size: clamp(0.95rem, 2.3vmin, 1.05rem);
    font-weight: 600;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Иконка звезды справа */
    background-image: url('/assets/telegram-star-128.png');
    background-size: 20px 20px;
    background-position: right 14px center;
    background-repeat: no-repeat;
}

.bet-input:focus {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 201, 71, 0.5);
    box-shadow: 
        0 0 0 3px rgba(255, 201, 71, 0.1),
        0 4px 12px rgba(255, 201, 71, 0.2);
    background-image: url('/assets/telegram-star-128.png');
    background-size: 20px 20px;
    background-position: right 14px center;
    background-repeat: no-repeat;
}

.bet-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}
.bet-button {
    /* Telegram Blue gradient button */
    background: linear-gradient(135deg, 
        #0088cc 0%, 
        #229ED9 50%,
        #40A7E3 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 14px;
    
    color: white;
    font-weight: 800;
    font-size: clamp(0.95rem, 2.3vmin, 1.05rem);
    padding: 14px 20px;
    cursor: pointer;
    
    box-shadow: 
        0 4px 20px rgba(0, 136, 204, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.bet-button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.3) 0%,
        rgba(255, 255, 255, 0) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bet-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 
        0 8px 28px rgba(0, 136, 204, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.bet-button:hover:not(:disabled)::before {
    opacity: 1;
}

.bet-button:active:not(:disabled) {
    transform: translateY(0);
}
.bet-button:disabled {
    background: #555; color: #888; cursor: not-allowed;
}

/* Адаптивные стили для bet-button */
@media (max-width: 480px) {
    .bet-button {
        padding: 10px 12px;
        font-size: clamp(0.7rem, 1.8vmin, 0.85rem);
        white-space: nowrap;
        text-align: center;
        min-width: 0;
        max-width: 100%;
        flex-shrink: 1;
    }
}

@media (max-width: 410px) {
    .bet-button {
        padding: 6px 8px;
        font-size: clamp(0.6rem, 1.4vmin, 0.75rem);
        font-weight: 700;
        min-width: 80px;
        flex: 0 0 auto;
    }
    
    .bet-input {
        flex: 1;
        min-width: 0;
        font-weight: 600;
    }
}

/* Quick Bet Button - Telegram Blue */
.quick-bet-button {
    background: linear-gradient(135deg, 
        #0088cc 0%, 
        #0066aa 50%,
        #004488 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-direction: column;
    text-align: center;
    min-height: 60px;
    padding: 8px 12px;
}

.quick-bet-button .gift-info {
    font-size: 0.9em;
    opacity: 0.95;
    line-height: 1.3;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.quick-bet-button .gift-name {
    font-weight: 600;
}

.quick-bet-button .gift-price {
    font-size: 1em;
    opacity: 0.9;
    font-weight: 500;
}

.quick-bet-button .gift-icon {
    font-size: 1.2em;
}

.quick-bet-button:hover:not(:disabled) {
    background: linear-gradient(135deg, 
        #0099dd 0%, 
        #0077bb 50%,
        #005599 100%
    );
    transform: translateY(-3px);
    box-shadow: 
        0 8px 28px rgba(0, 136, 204, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Gifts Bet Button - Telegram Blue */
.gifts-bet-button {
    background: linear-gradient(135deg, 
        #0088cc 0%, 
        #0066aa 50%,
        #004488 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.gifts-bet-button .gift-icon {
    font-size: 1.2em;
}

.gifts-bet-button:hover:not(:disabled) {
    background: linear-gradient(135deg, 
        #0099dd 0%, 
        #0077bb 50%,
        #005599 100%
    );
    transform: translateY(-3px);
    box-shadow: 
        0 8px 28px rgba(0, 136, 204, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Confirm Bet Button - Telegram Blue */
.confirm-bet-button {
    background: linear-gradient(135deg, 
        #0088cc 0%, 
        #0066aa 50%,
        #004488 100%
    );
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.confirm-bet-button:hover:not(:disabled) {
    background: linear-gradient(135deg, 
        #0099dd 0%, 
        #0077bb 50%,
        #005599 100%
    );
    transform: translateY(-3px);
    box-shadow: 
        0 8px 28px rgba(0, 136, 204, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.selected-gifts-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: clamp(0.85rem, 2vmin, 0.95rem);
    gap: 16px;
}

/* Gift Modal */
.gift-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

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

.gift-modal-content {
    background: rgba(26, 24, 32, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(40px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

.gift-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.gift-modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-color);
}

.gift-modal-close {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.gift-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.gift-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.gift-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.gift-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary-color);
}

.gift-item {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.gift-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(168, 85, 247, 0.3);
    transform: translateY(-2px);
}

.gift-item.selected {
    background: linear-gradient(135deg, 
        rgba(168, 85, 247, 0.2) 0%, 
        rgba(236, 72, 153, 0.2) 100%
    );
    border-color: rgba(168, 85, 247, 0.6);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
}

.gift-item-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.gift-item-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
}

.gift-item-price {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-gold);
}

.gift-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gift-selection-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Bottom Navigation - Glassmorphism Style */
.bottom-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    
    /* Glassmorphism effect */
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    
    /* Gradient border effect */
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    
    /* Soft shadow */
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
    
    /* Reduced vertical padding */
    padding: 6px 14px;
    margin: 0 12px 10px;
    
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    
    transform: translateY(0);
    transition: transform 0.25s ease, opacity 0.25s ease;
    
    /* Telegram WebApp specific fixes */
    -webkit-transform: translateY(0);
    -webkit-transition: -webkit-transform 0.25s ease, opacity 0.25s ease;
}

/* Telegram WebApp specific bottom navigation fix */
@supports (bottom: env(safe-area-inset-bottom)) {
    .bottom-nav {
        bottom: env(safe-area-inset-bottom);
    }
}

/* iPhone specific fixes for Telegram WebApp */
@media screen and (-webkit-min-device-pixel-ratio: 2) and (max-width: 428px) {
    .bottom-nav {
        bottom: max(env(safe-area-inset-bottom, 0px), 30px);
        margin-bottom: 0;
        /* Принудительно показываем меню на iPhone в Telegram WebApp */
        transform: translateY(0) !important;
        opacity: 1 !important;
        pointer-events: all !important;
    }
    
    /* Убираем лишние отступы на iPhone */
    .app {
        padding-bottom: 0;
    }
}

/* Subtle inner glow for nav bar */
.bottom-nav::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    padding: 1px;
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    
    /* Reduced vertical padding */
    padding: 8px 10px;
    border-radius: 14px;
    
    min-width: 58px;
    position: relative;
    flex: 1;
    
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover glass effect */
.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
}

/* Active state - glass bubble */
.nav-item.active {
    background: rgba(255, 255, 255, 0.12);
    color: #0088cc;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, 
        rgba(0, 136, 204, 0.2) 0%,
        rgba(0, 136, 204, 0.05) 100%
    );
    pointer-events: none;
}

.nav-item.active .nav-icon {
    filter: drop-shadow(0 0 8px rgba(0, 136, 204, 0.6));
    transform: scale(1.05);
}

.nav-icon {
    width: clamp(20px, 5vmin, 24px);
    height: clamp(20px, 5vmin, 24px);
    transition: all 0.3s ease;
}

.nav-label {
    font-size: clamp(0.6rem, 1.6vmin, 0.7rem);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.nav-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 9px;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Mobile keyboard handling - only on mobile devices */
@media (max-width: 768px) and (hover: none) {
    .keyboard-open .bottom-nav {
        transform: translateY(110%);
        opacity: 0;
        pointer-events: none;
    }
    
    /* Telegram WebApp fix - не скрываем меню на iPhone */
    @media screen and (-webkit-min-device-pixel-ratio: 2) and (max-width: 428px) {
        .keyboard-open .bottom-nav {
            transform: translateY(0) !important;
            opacity: 1 !important;
            pointer-events: all !important;
        }
    }

    .keyboard-open .app {
        padding-bottom: 0;
    }

    .keyboard-open .players-section {
        padding-bottom: 10px;
    }

    .keyboard-open .bet-controls {
        position: fixed;
        bottom: 8px;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        z-index: 250;
        background: rgba(26, 24, 32, 0.98);
        border-radius: 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
        transform: none;
    }
}

/* Modal is mostly unchanged, slight color adjustments */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: flex-end; z-index: 1000; opacity: 0; transition: opacity 0.3s ease; pointer-events: none; }
.modal-overlay:not(.hidden) { opacity: 1; pointer-events: all; }
.modal-content { background: var(--primary-color); border: 1px solid var(--secondary-color); padding: 30px; border-radius: 15px; text-align: center; transform: scale(0.9); transition: transform 0.3s ease; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.modal-overlay:not(.hidden) .modal-content:not(.result-modal) { transform: scale(1); }
/* Правило для .result-modal теперь выше в блоке Result Modal */
.modal-title { font-size: 2.5rem; font-weight: 700; margin-bottom: 10px; background: linear-gradient(45deg, var(--accent-purple), var(--accent-pink)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.eliminated-title { background: linear-gradient(45deg, #ff0077, #ff6b6b); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* Elimination Toast */
.elimination-toast {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(45deg, #ff0077, #ff6b6b);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(255, 0, 119, 0.4);
    z-index: 20;
    opacity: 1;
    transition: opacity 0.3s ease;
}
.elimination-toast.hidden {
    opacity: 0;
    pointer-events: none;
}
.prize-label { font-size: 1.2rem; color: var(--text-secondary-color); margin-bottom: 25px; }
.prize-label span { color: var(--accent-gold); font-weight: bold; }
.close-modal-btn { padding: 12px 30px; border: none; border-radius: 10px; background: linear-gradient(45deg, var(--accent-purple), var(--accent-pink)); color: #fff; font-size: 1rem; font-weight: 600; cursor: pointer; }

/* Result Modal — выезжающее снизу, шикарный дизайн */
.modal-content.result-modal {
    /* Полностью переопределяем базовые стили .modal-content */
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 85vh !important;
    background: linear-gradient(
        180deg, 
        rgba(26, 24, 32, 0.99) 0%, 
        rgba(22, 20, 28, 0.98) 40%,
        rgba(18, 17, 24, 0.99) 100%
    ) !important;
    border: none !important;
    border-top: 2px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 24px 24px 0 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    box-shadow: 
        0 -20px 80px rgba(0, 0, 0, 0.9),
        0 -8px 30px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    text-align: left !important;
    backdrop-filter: blur(20px) !important;
    /* Убираем все transform из базового .modal-content */
    transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px))) !important;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Декоративная полоска сверху */
.modal-content.result-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(0, 136, 204, 0.5),
        rgba(139, 92, 246, 0.5),
        rgba(0, 136, 204, 0.5),
        transparent
    );
    border-radius: 0 0 2px 2px;
    opacity: 0.8;
}

/* Когда модалка открыта */
.modal-overlay:not(.hidden) .modal-content.result-modal {
    transform: translateY(0) !important;
}

/* Отключаем transition когда используется modal-enter анимация */
.modal-overlay.modal-enter .modal-content.result-modal {
    transition: none !important;
}

/* Анимации появления элементов модалки */
.modal-overlay.modal-enter .winner-avatar {
    animation: avatar-appear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

.modal-overlay.modal-enter .winner-name {
    animation: text-fade-in-up 0.4s ease-out 0.4s both;
}

.modal-overlay.modal-enter .prize-display {
    animation: prize-appear 0.5s ease-out 0.5s both;
}

.modal-overlay.modal-enter .participant-item {
    animation: participant-appear 0.4s ease-out both;
}

.modal-overlay.modal-enter .participant-item:nth-child(1) { animation-delay: 0.6s; }
.modal-overlay.modal-enter .participant-item:nth-child(2) { animation-delay: 0.65s; }
.modal-overlay.modal-enter .participant-item:nth-child(3) { animation-delay: 0.7s; }
.modal-overlay.modal-enter .participant-item:nth-child(4) { animation-delay: 0.75s; }
.modal-overlay.modal-enter .participant-item:nth-child(5) { animation-delay: 0.8s; }
.modal-overlay.modal-enter .participant-item:nth-child(n+6) { animation-delay: 0.85s; }

@keyframes avatar-appear {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.15) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes text-fade-in-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes prize-appear {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes participant-appear {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
.result-modal-header {
    padding: 24px 20px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.03) 0%,
        transparent 100%
    );
    text-align: center;
    position: relative;
}

.result-modal-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent,
        rgba(0, 136, 204, 0.3),
        rgba(139, 92, 246, 0.3),
        rgba(0, 136, 204, 0.3),
        transparent
    );
}

.result-modal-title {
    font-weight: 800;
    font-size: clamp(1.2rem, 3.8vmin, 1.7rem);
    letter-spacing: 1px;
    background: linear-gradient(135deg, 
        var(--accent-blue) 0%,
        var(--accent-purple) 50%,
        var(--accent-pink) 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px rgba(139, 92, 246, 0.4);
    margin: 0;
    position: relative;
}

.winner-section { 
    padding: 32px 20px 28px 20px; 
    text-align: center;
    position: relative;
}

.winner-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
}

.winner-avatar-container {
    position: relative;
    display: inline-block;
    margin-bottom: 16px;
}

.winner-avatar-container::before {
    content: '';
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(255, 201, 71, 0.15) 0%,
        rgba(255, 201, 71, 0.05) 50%,
        transparent 70%
    );
    animation: winner-glow 3s ease-in-out infinite;
    z-index: -1;
}

@keyframes winner-glow {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

.winner-avatar { 
    width: clamp(90px, 20vmin, 120px); 
    height: clamp(90px, 20vmin, 120px); 
    border-radius: 50%; 
    border: 4px solid rgba(255, 201, 71, 0.6); 
    box-shadow: 
        0 8px 32px rgba(255, 201, 71, 0.4),
        0 4px 16px rgba(0, 0, 0, 0.5),
        inset 0 2px 8px rgba(255, 255, 255, 0.1),
        0 0 0 3px rgba(0, 136, 204, 0.2); 
    margin: 0;
    display: block;
    object-fit: cover;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.winner-avatar:hover {
    transform: scale(1.05);
}

/* Fallback для пустой аватарки */
.winner-avatar[src=""],
.winner-avatar:not([src]) {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.winner-avatar[src=""]::before,
.winner-avatar:not([src])::before {
    content: "👤";
    font-size: clamp(36px, 8vmin, 48px);
    opacity: 0.6;
}
.winner-name { 
    margin: 16px 0 20px 0; 
    font-weight: 700; 
    font-size: clamp(1.15rem, 3vmin, 1.4rem); 
    color: rgba(255, 255, 255, 0.98); 
    text-shadow: 
        0 2px 10px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(255, 255, 255, 0.1);
    letter-spacing: 0.3px;
}

.prize-display { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 10px; 
    margin-top: 8px;
    padding: 14px 24px;
    background: linear-gradient(135deg, 
        rgba(255, 201, 71, 0.15),
        rgba(255, 215, 0, 0.1)
    );
    border: 1px solid rgba(255, 201, 71, 0.3);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    box-shadow: 
        0 4px 16px rgba(255, 201, 71, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Специфичные стили для prize-amount в модалке - переопределяют общие стили */
.prize-display .prize-amount,
.winner-section .prize-amount,
.result-modal .prize-amount {
    font-family: var(--font-family) !important; 
    font-size: clamp(1rem, 2vmin, 1.2rem) !important; 
    font-weight: 700 !important; 
    color: #ffc947 !important; 
    text-shadow: 0 0 20px rgba(255, 201, 71, 0.5), 1px 1px 0 rgba(0, 0, 0, 0.7) !important; 
    white-space: nowrap !important;
    /* Переопределяем position из общих стилей */
    position: static !important;
    top: auto !important;
    right: auto !important;
    max-width: none !important;
    overflow: visible !important;
    text-overflow: clip !important;
    display: inline !important;
    align-items: normal !important;
    gap: 0 !important;
    letter-spacing: normal !important;
}

.prize-display .prize-currency { 
    font-size: clamp(1.15rem, 2.8vmin, 1.4rem); 
    font-weight: 700; 
    color: rgba(255, 228, 181, 0.95); 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 8px rgba(255, 201, 71, 0.4));
}

.participants-section { 
    background: rgba(255, 255, 255, 0.02); 
    padding: 20px 20px max(24px, env(safe-area-inset-bottom)) 20px; 
    border-top: 1px solid rgba(255, 255, 255, 0.08); 
    position: relative;
}

.participants-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
}

.participants-title { 
    font-size: clamp(0.95rem, 2.6vmin, 1.1rem); 
    color: rgba(255, 255, 255, 0.8); 
    font-weight: 600;
    text-align: center; 
    margin: 0 0 16px 0;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.participants-list { 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
    max-height: 200px; 
    overflow-y: auto; 
    padding-right: 4px; 
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.participants-list::-webkit-scrollbar {
    width: 6px;
}

.participants-list::-webkit-scrollbar-track {
    background: transparent;
}

.participants-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.participants-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.participant-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    gap: 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    margin-bottom: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.participant-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transition: left 0.5s ease;
}

.participant-item:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-color: rgba(0, 136, 204, 0.4);
    transform: translateX(6px) translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.3),
        0 2px 8px rgba(0, 136, 204, 0.2);
}

.participant-item:hover::before {
    left: 100%;
}

.participant-item.winner,
.participant-item.winner-highlight {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 215, 0, 0.12));
    border: 2.5px solid rgba(255, 215, 0, 0.6);
    box-shadow: 
        0 6px 20px rgba(255, 215, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.participant-item.winner::before,
.participant-item.winner-highlight::before {
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.1), transparent);
}

.participant-item.winner:hover,
.participant-item.winner-highlight:hover {
    border-color: rgba(255, 215, 0, 0.8);
    box-shadow: 
        0 8px 24px rgba(255, 215, 0, 0.5),
        0 4px 12px rgba(255, 215, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: translateX(6px) translateY(-2px) scale(1.02);
}

.participant-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.participant-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    object-fit: cover;
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
}

/* Fallback для пустых аватарок участников */
.participant-avatar[src=""],
.participant-avatar:not([src]) {
    display: flex;
    align-items: center;
    justify-content: center;
}

.participant-avatar[src=""]::before,
.participant-avatar:not([src])::before {
    content: "👤";
    font-size: 20px;
    opacity: 0.6;
}

.participant-name {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.participant-item.winner .participant-name,
.participant-item.winner-highlight .participant-name {
    color: rgba(255, 255, 255, 1);
    font-weight: 700;
}

.participant-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.participant-bet {
    color: #ffc947;
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 4px;
}

.participant-chance {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    white-space: nowrap;
}

.participant-item.winner .participant-chance,
.participant-item.winner-highlight .participant-chance {
    color: rgba(255, 215, 0, 0.9);
    font-weight: 600;
}

.winner-badge {
    font-size: 24px;
    margin-left: 8px;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(255, 215, 0, 0.5));
    animation: winner-badge-bounce 0.6s ease-out;
}

@keyframes winner-badge-bounce {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.close-modal-btn { width: calc(100% - 32px); margin: 14px 16px 16px 16px; }

/* ✅ Адаптация для result-modal под разные экраны */
@media (max-width: 480px) {
    .result-modal {
        border-radius: 16px 16px 0 0;
    }
    
    .result-modal-header {
        padding: 16px 12px 14px 12px;
    }
    
    .result-modal-title {
        font-size: clamp(1rem, 3.2vmin, 1.4rem);
    }
    
    .winner-section {
        padding: 20px 12px 16px 12px;
    }
    
    .winner-avatar {
        width: clamp(70px, 16vmin, 95px);
        height: clamp(70px, 16vmin, 95px);
    }
    
    .winner-name {
        font-size: clamp(1rem, 2.6vmin, 1.2rem);
        margin: 10px 0 12px 0;
    }
    
    .prize-display {
        gap: 6px;
    }
    
    .prize-display .prize-amount {
        font-size: clamp(0.9rem, 1.8vmin, 1.1rem);
        gap: 3px;
    }
    
    .prize-currency {
        font-size: clamp(1rem, 2.4vmin, 1.2rem);
    }
    
    .participants-section {
        padding: 14px 12px 18px 12px;
    }
    
    .participants-title {
        font-size: clamp(0.8rem, 2.2vmin, 0.95rem);
        margin: 0 0 8px 0;
    }
    
    .participant-item {
        padding: 8px 10px;
        gap: 10px;
    }
    
    .participant-avatar {
        width: 28px;
        height: 28px;
    }
    
    .participant-bet {
        font-size: 0.9rem;
    }
    
    .participant-chance {
        font-size: 0.75rem;
    }
}

@media (max-width: 360px) {
    .result-modal-header {
        padding: 14px 10px 12px 10px;
    }
    
    .result-modal-title {
        font-size: clamp(0.95rem, 3vmin, 1.2rem);
    }
    
    .winner-section {
        padding: 18px 10px 14px 10px;
    }
    
    .winner-avatar {
        width: clamp(65px, 14vmin, 85px);
        height: clamp(65px, 14vmin, 85px);
        border-width: 2px;
        margin-bottom: 6px;
    }
    
    .winner-name {
        font-size: clamp(0.95rem, 2.4vmin, 1.1rem);
        margin: 8px 0 10px 0;
    }
    
    .prize-display .prize-amount {
        font-size: clamp(0.85rem, 1.6vmin, 1rem);
    }
    
    .prize-currency {
        font-size: clamp(0.95rem, 2.2vmin, 1.1rem);
    }
    
    .participants-section {
        padding: 12px 10px 16px 10px;
    }
    
    .participants-title {
        font-size: clamp(0.75rem, 2vmin, 0.9rem);
        margin: 0 0 6px 0;
    }
    
    .participant-item {
        padding: 6px 8px;
        gap: 8px;
        border-radius: 8px;
    }
    
    .participant-avatar {
        width: 24px;
        height: 24px;
    }
    
    .participant-bet {
        font-size: 0.85rem;
    }
    
    .participant-chance {
        font-size: 0.7rem;
    }
}

/* Landscape tweaks for short viewports */
@media (orientation: landscape) and (max-height: 480px) {
    .main-content { padding: 10px; gap: 10px; }
    .wheel-container { --wheel-size: clamp(320px, 85vmin, 450px); }
    .players-section { max-height: 140px; }
}

/* Tablet and up */
@media (min-width: 768px) {
    :root { --app-max-width: clamp(560px, 80vw, 760px); --wheel-size: clamp(380px, 58vmin, 560px); }
    .players-section { max-height: min(32vh, 300px); }
}

/* Small phones */
@media (max-width: 360px) {
    :root { --wheel-size: clamp(300px, 90vmin, 380px); }
    .bet-controls { gap: 6px; }
    .nav-label { display: none; }
    
    /* Более агрессивное сжатие username на маленьких экранах */
    .value {
        font-size: clamp(0.5rem, 1.3vmin, 0.7rem);
    }
    
    
    /* Smaller elements */
    .bet-input { padding: 12px 14px; font-size: clamp(0.9rem, 2.2vmin, 1rem); }
    .bet-button { padding: 12px 16px; font-size: clamp(0.9rem, 2.2vmin, 1rem); }
    
    /* Quick bet button mobile adaptation */
    .quick-bet-button {
        min-height: 50px;
        padding: 6px 10px;
        font-size: clamp(0.8rem, 2vmin, 0.9rem);
    }
    
    .quick-bet-button .gift-info {
        font-size: 0.8em;
    }
    
    .quick-bet-button .gift-name {
        font-size: 0.9em;
    }
    
    .quick-bet-button .gift-price {
        font-size: 0.9em;
    }
    
    /* Compact top info */
    .top-info-card { padding: 8px; gap: 8px; }
    .top-info-item { font-size: clamp(0.65rem, 1.5vmin, 0.8rem); }
    
    /* Compact game bar */
    .game-bar { padding: 6px 10px; }
    .bank-info { font-size: clamp(0.85rem, 2vmin, 0.95rem); gap: 8px; }
    
    /* Player cards */
    .player-card { padding: 8px; gap: 8px; }
    .player-avatar { width: clamp(24px, 5.5vmin, 32px); height: clamp(24px, 5.5vmin, 32px); }
    
    /* More compact nav bar on small phones */
    .bottom-nav { 
        padding: 4px 8px; 
        margin: 0 5px 8px;
        gap: 2px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .nav-item { 
        padding: 4px 6px;
        min-width: 50px;
        flex-shrink: 0;
        gap: 1px;
    }
    .nav-icon {
        width: clamp(16px, 4vmin, 20px);
        height: clamp(16px, 4vmin, 20px);
    }
    .nav-label {
        font-size: clamp(0.5rem, 1.4vmin, 0.65rem);
    }
    
    /* Reduced scrolling padding */
    .players-list { padding-bottom: 65px; }
    .shop-content { padding-bottom: calc(var(--safe-bottom) + 65px); }
    .profile-app { padding-bottom: 55px; }
}

/* Очень маленькие экраны - еще более компактное меню */
@media (max-width: 320px) {
    .bottom-nav { 
        padding: 3px 4px; 
        margin: 0 2px 6px;
        gap: 1px;
    }
    .nav-item { 
        padding: 3px 4px;
        min-width: 45px;
    }
    .nav-icon {
        width: clamp(14px, 3.5vmin, 18px);
        height: clamp(14px, 3.5vmin, 18px);
    }
    .nav-label {
        font-size: clamp(0.45rem, 1.2vmin, 0.6rem);
    }
    
    /* Еще более компактные кнопки для iPhone SE */
    .bet-button {
        padding: 4px 6px;
        font-size: clamp(0.55rem, 1.2vmin, 0.7rem);
        font-weight: 700;
        min-width: 70px;
    }
    
    .bet-input {
        padding: 8px 10px;
        font-size: clamp(0.8rem, 2vmin, 0.9rem);
        font-weight: 600;
    }
}

/* Phablets */
@media (min-width: 361px) and (max-width: 479px) {
    :root { --wheel-size: clamp(340px, 88vmin, 420px); }
    
    
    .bet-controls { gap: 8px; }
    .bet-input { padding: 13px 15px; }
    .bet-button { padding: 13px 18px; }
}

/* Tablets portrait */
@media (min-width: 600px) and (max-width: 767px) {
    :root { --wheel-size: clamp(360px, 68vmin, 480px); }
    
    /* Slightly larger elements */
    .top-info-card { padding: 12px; }
    .game-bar { padding: 10px 14px; }
    .player-card { padding: 12px; }
}

/* Tablets landscape / Small laptops */
@media (min-width: 768px) and (max-width: 1023px) {
    .bet-controls { max-width: 90%; margin: 0 auto; }
    .players-section { max-height: min(35vh, 320px); }
}

/* Laptops */
@media (min-width: 1024px) {
    :root { --app-max-width: clamp(720px, 70vw, 880px); --wheel-size: clamp(460px, 52vmin, 620px); }
    
    /* More spacious on desktop */
    .top-info-card { padding: 12px; }
    .game-bar { padding: 10px 16px; }
    .bet-controls { max-width: 85%; margin: 0 auto; gap: 14px; }
    .player-card { padding: 12px; }
    
    /* Desktop scrolling optimizations */
    .app {
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.2) rgba(0, 0, 0, 0.1);
    }
    
    .app::-webkit-scrollbar {
        width: 8px;
    }
    
    .app::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.1);
        border-radius: 4px;
    }
    
    .app::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 4px;
    }
    
    .app::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.3);
    }
    
    /* Profile scrollbar */
    .profile-app {
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.2) rgba(0, 0, 0, 0.1);
    }
    
    .profile-app::-webkit-scrollbar {
        width: 8px;
    }
    
    .profile-app::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.1);
        border-radius: 4px;
    }
    
    .profile-app::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 4px;
    }
    
    .profile-app::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.3);
    }
}

/* Very large screens */
@media (min-width: 1440px) {
    :root { 
        --app-max-width: 920px; 
        --wheel-size: min(640px, 55vmin); 
    }
}

/* High DPI screens - sharper glassmorphism */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .top-info-card,
    .game-bar,
    .bet-input,
    .bottom-nav {
        backdrop-filter: blur(16px) saturate(160%);
        -webkit-backdrop-filter: blur(16px) saturate(160%);
    }
}

/* Fallback for browsers without backdrop-filter support */
@supports not (backdrop-filter: blur(10px)) {
    .top-info-card {
        background: rgba(26, 24, 32, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.15);
    }
    
    .game-bar {
        background: linear-gradient(135deg, rgba(34, 158, 217, 0.12), rgba(34, 158, 217, 0.05));
        border: 1.5px solid rgba(34, 158, 217, 0.3);
    }
    
    .bet-input {
        background: rgba(42, 39, 52, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .bottom-nav {
        background: rgba(26, 24, 32, 0.95);
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .icon-button {
        background: rgba(255, 255, 255, 0.12);
    }
}

/* Performance optimizations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Shop */
.shop-app { 
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 25%, #3b82f6 50%, #0ea5e9 75%, #06b6d4 100%);
    background-size: 400% 400%;
    animation: gradient-shift 15s ease infinite;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.shop-app::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, 
        rgba(13, 12, 17, 0.85) 0%,
        rgba(13, 12, 17, 0.9) 100%);
    z-index: 1;
    pointer-events: none;
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.shop-content { 
    align-items: stretch; 
    flex: 1; 
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    
    /* Reduced padding for smaller nav bar */
    padding-bottom: calc(var(--safe-bottom) + 75px); 
}
.shop-toolbar { 
    display: flex; 
    gap: 10px; 
    width: 100%; 
}

.search-wrapper,
.sort-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.search-wrapper {
    min-width: 0;
    flex: 1.5;
}

.sort-wrapper {
    flex: 1;
    min-width: 120px;
}

.search-icon,
.sort-icon {
    position: absolute;
    left: 12px;
    width: clamp(18px, 4.5vmin, 22px);
    height: clamp(18px, 4.5vmin, 22px);
    color: var(--text-secondary-color);
    pointer-events: none;
    z-index: 1;
    transition: all 0.3s ease;
}

.search-wrapper:focus-within .search-icon,
.sort-wrapper:focus-within .sort-icon {
    color: var(--accent-purple);
    transform: scale(1.1);
}

.shop-search-input {
    width: 100%;
    background: linear-gradient(145deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-color); 
    border: 1px solid rgba(255, 255, 255, 0.18); 
    border-radius: 12px; 
    padding: 12px 12px 12px 40px;
    font-size: clamp(0.8rem, 2vmin, 0.95rem); 
    outline: none;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.shop-search-input::placeholder {
    color: var(--text-secondary-color);
}

.shop-search-input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 20px rgba(157, 80, 187, 0.5);
    background: linear-gradient(145deg, rgba(255,255,255,0.15), rgba(255,255,255,0.08));
}

.shop-select { 
    width: 100%;
    background: linear-gradient(145deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-color); 
    border: 1px solid rgba(255, 255, 255, 0.18); 
    border-radius: 12px; 
    padding: 12px 12px 12px 42px;
    font-size: clamp(0.8rem, 2vmin, 0.95rem); 
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23a0a0a0'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
    padding-right: 38px;
}

.shop-select:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 20px rgba(157, 80, 187, 0.5);
    background-color: rgba(255,255,255,0.12);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239D50BB'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
}

.shop-select:hover {
    background-color: rgba(255,255,255,0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Адаптация для маленьких экранов */
@media (max-width: 480px) {
    .shop-toolbar {
        flex-direction: column;
        gap: 8px;
    }
    
    .search-wrapper,
    .sort-wrapper {
        flex: 1;
        width: 100%;
    }
    
    .search-wrapper {
        min-width: 100%;
    }
    
    .sort-wrapper {
        min-width: 100%;
    }
}

@media (max-width: 360px) {
    .shop-search-input,
    .shop-select {
        padding: 10px 10px 10px 36px;
        font-size: 0.8rem;
    }
    
    .search-icon,
    .sort-icon {
        left: 10px;
        width: 16px;
        height: 16px;
    }
}
.shop-grid { 
    margin-top: 12px; 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: clamp(8px, 2vmin, 12px); 
}

/* Адаптивные колонки для разных размеров экрана */
@media (max-width: 360px) {
    .shop-grid { 
        grid-template-columns: repeat(3, 1fr); 
        gap: 6px;
    }
    
    .shop-card {
        border-radius: 12px;
    }
    
    .shop-media {
        min-height: 100px;
    }
    
    .shop-media img {
        padding: 2px;
    }
    
    .shop-body {
        padding: 6px;
        gap: 4px;
    }
    
    .shop-title {
        font-size: clamp(0.65rem, 1.4vmin, 0.75rem);
        min-height: 2.2em;
    }
    
    .shop-btn {
        padding: 5px 6px;
        font-size: clamp(0.55rem, 1.3vmin, 0.65rem);
        min-height: 28px;
    }
    
    .shop-payment-methods {
        gap: 4px;
    }
}

@media (min-width: 480px) {
    .shop-grid { 
        grid-template-columns: repeat(3, 1fr); 
        gap: 10px;
    }
}

@media (min-width: 768px) {
    .shop-grid { 
        grid-template-columns: repeat(3, 1fr); 
        gap: 12px;
    }
}

@media (min-width: 1024px) {
    .shop-grid { 
        grid-template-columns: repeat(3, 1fr); 
        gap: 14px;
    }
}

.shop-card {
    background: linear-gradient(145deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 16px;
    overflow: hidden;
    display: flex; 
    flex-direction: column; 
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    animation: card-appear 0.6s ease-out backwards;
}

.shop-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 16px;
    padding: 2px;
    background: linear-gradient(135deg, 
        rgba(59, 130, 246, 0.5),
        rgba(14, 165, 233, 0.5),
        rgba(6, 182, 212, 0.5)
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.shop-card:hover::before {
    opacity: 1;
}

@keyframes card-appear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes card-disappear {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        opacity: 0;
        transform: scale(0.8);
    }
}

.shop-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 16px 48px rgba(59, 130, 246, 0.4),
                0 0 24px rgba(14, 165, 233, 0.2);
    border-color: rgba(255,255,255,0.3);
}

.shop-media { 
    position: relative; 
    aspect-ratio: 1 / 1; 
    overflow: hidden; 
    background: linear-gradient(135deg, 
        rgba(59, 130, 246, 0.1),
        rgba(6, 182, 212, 0.1)
    );
    min-height: 120px;
}

.shop-media img { 
    width: 100%; 
    height: 100%; 
    object-fit: contain; 
    display: block; 
    padding: 4px;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.shop-media .gift-emoji {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.shop-media lottie-player {
    width: 100% !important;
    height: 100% !important;
}

.shop-card:hover .shop-media img,
.shop-card:hover .shop-media .gift-emoji,
.shop-card:hover .shop-media lottie-player {
    transform: scale(1.1) rotate(5deg);
}

.shop-body { 
    padding: 8px; 
    display: flex; 
    flex-direction: column; 
    gap: 6px; 
    flex: 1;
    background: linear-gradient(180deg, 
        rgba(255,255,255,0.05) 0%, 
        rgba(255,255,255,0.02) 100%
    );
}

.shop-title { 
    font-weight: 600; 
    font-size: clamp(0.7rem, 1.6vmin, 0.8rem); 
    line-height: 1.2;
    color: var(--text-color);
    min-height: 2.4em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: color 0.3s;
    text-align: center;
    margin-bottom: 2px;
}

.shop-card:hover .shop-title {
    color: #fff;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
}

.shop-prices {
    display: none;
}

.price-ton {
    color: #0088cc;
    font-weight: 600;
}

.price-stars {
    color: #f59e0b;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 2px;
}

.shop-payment-methods {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    margin-top: 4px;
}

.shop-btn { 
    padding: 6px 8px; 
    border-radius: 8px; 
    border: none; 
    cursor: pointer; 
    font-weight: 600; 
    font-size: clamp(0.6rem, 1.5vmin, 0.7rem); 
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    margin-top: 0;
    min-height: 32px;
}

.shop-btn:active {
    transform: scale(0.95);
}

.shop-btn .btn-icon {
    font-size: 1.1em;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.shop-btn .btn-icon .ton-icon.small,
.shop-btn .btn-icon .star-icon-img.small {
    width: 16px;
    height: 16px;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.shop-btn .btn-icon .ton-icon.small {
    filter: drop-shadow(0 1px 2px rgba(0, 136, 204, 0.5));
}

.shop-btn .btn-icon .star-icon-img.small {
    filter: drop-shadow(0 1px 2px rgba(245, 158, 11, 0.5));
}

.shop-btn.buy-ton {
    background: linear-gradient(135deg, #0088cc, #006699);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 136, 204, 0.4);
}

.shop-btn.buy-ton:hover {
    background: linear-gradient(135deg, #0099ee, #0088cc);
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.6);
    transform: translateY(-2px);
}

.shop-btn.buy-stars {
    background: linear-gradient(135deg, var(--accent-gold), #f59e0b);
    color: #fff;
    box-shadow: 0 2px 8px rgba(255, 201, 71, 0.4);
}

.shop-btn.buy-stars:hover {
    background: linear-gradient(135deg, #ffd700, var(--accent-gold));
    box-shadow: 0 4px 12px rgba(255, 201, 71, 0.6);
    transform: translateY(-2px);
}

.shop-btn.buy { 
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
    background-size: 200% 200%;
    color: #fff; 
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.shop-btn.buy::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent
    );
    transition: left 0.5s;
}

.shop-btn.buy:hover::before {
    left: 100%;
}

.shop-btn.buy:hover {
    background-position: 100% 50%;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6),
                0 0 20px rgba(14, 165, 233, 0.4);
    transform: translateY(-2px);
}

.shop-btn.buy .btn-text {
    font-size: clamp(0.6rem, 1.5vmin, 0.7rem);
    font-weight: 600;
}

.shop-btn.buy .btn-price {
    font-size: clamp(0.75rem, 2vmin, 0.85rem);
    font-weight: 800;
}

/* ============================================
   ✨ SHOP TABS - Табы магазина
   ============================================ */

.shop-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 0;
}

.shop-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    font-size: clamp(0.85rem, 2.2vmin, 0.95rem);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.shop-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

.shop-tab.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(99, 102, 241, 0.2));
    border-color: rgba(59, 130, 246, 0.4);
    color: #fff;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.shop-tab .tab-icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.shop-tab .badge {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.shop-tab.active .badge {
    background: linear-gradient(135deg, #fff, #e0e7ff);
    color: var(--accent-blue);
}

/* ============================================
   🎁 OWNED GIFTS - Купленные подарки
   ============================================ */

.owned-gift {
    background: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.owned-gift::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(147, 51, 234, 0.15) 0%, rgba(79, 70, 229, 0.1) 40%, rgba(255, 255, 255, 0) 70%);
    transform: rotate(0deg);
    transition: transform 1s ease-in-out, opacity 0.5s;
    opacity: 0;
    pointer-events: none;
    animation: owned-gift-sweep 8s linear infinite;
}

.owned-gift:hover::after {
    opacity: 1;
}

@keyframes owned-gift-sweep {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.purchase-date {
    font-size: clamp(0.6rem, 1.5vmin, 0.7rem);
    color: var(--text-secondary-color);
    background: rgba(0, 0, 0, 0.2);
    padding: 3px 6px;
    border-radius: 6px;
    align-self: center;
    margin-top: auto;
}

.owned-gift .shop-body {
    gap: 4px;
}

.owned-gift .shop-title {
    min-height: 2.4em;
    margin-bottom: 4px;
}

/* Тестовая кнопка пополнения баланса */
.test-balance-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, var(--accent-gold), #f59e0b);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 201, 71, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.test-balance-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 201, 71, 0.5);
}

.test-balance-btn:active {
    transform: scale(0.95);
}

.test-balance-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Profile */
.profile-app {
    overflow-y: auto;
    height: 100vh;
    
    /* Reduced padding for smaller nav bar */
    padding-bottom: 65px;
    
    position: relative;
    background-color: #0d0c11;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.profile-bg-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    pointer-events: none;
    background-color: #0d0c11;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    will-change: opacity;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.profile-bg-video.active {
    opacity: 1;
}

.profile-app::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, 
        rgba(13, 12, 17, 0.7) 0%,
        rgba(13, 12, 17, 0.85) 100%);
    z-index: 1;
    pointer-events: none;
}

.profile-hero {
    padding: 30px 20px 20px;
    text-align: center;
    position: relative;
    z-index: 2;
}

.profile-avatar-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 16px;
}

.avatar-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue), var(--accent-cyan));
    animation: avatar-pulse 3s ease-in-out infinite;
    filter: blur(20px);
    opacity: 0.6;
}

@keyframes avatar-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.8; }
}

.profile-avatar {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    object-fit: cover;
    background: var(--secondary-color);
}

.level-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-gold), #ff6b6b);
    color: white;
    font-weight: 800;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--bg-color);
    box-shadow: 0 4px 12px rgba(255, 201, 71, 0.5);
}

.profile-name {
    font-size: clamp(1.4rem, 4vmin, 1.8rem);
    font-weight: 800;
    margin-bottom: 8px;
    color: white;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.profile-rank {
    font-size: clamp(1rem, 2.6vmin, 1.2rem);
    color: var(--accent-gold);
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.balance-card {
    margin: 0 15px 20px;
    padding: 20px;
    background: linear-gradient(145deg, rgba(255,255,255,0.15), rgba(255,255,255,0.08));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 2;
    animation: card-appear 0.6s ease-out backwards;
}

.balance-label {
    font-size: clamp(0.85rem, 2.2vmin, 1rem);
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: clamp(0.9rem, 2.2vmin, 1rem);
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-icon {
    width: 20px;
    height: 20px;
}

.ton-connect-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 0;
}

.balance-amount {
    font-size: clamp(2rem, 6vmin, 2.8rem);
    font-weight: 800;
    color: #0088cc;
    margin-top: 8px;
    text-align: center;
    text-shadow: 0 2px 12px rgba(0, 136, 204, 0.5);
}

.wallet-address {
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(0, 136, 204, 0.1);
    border: 1px solid rgba(0, 136, 204, 0.3);
    border-radius: 8px;
    text-align: center;
    font-size: clamp(0.8rem, 2vmin, 0.9rem);
    color: #0088cc;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 15px 20px;
    position: relative;
    z-index: 2;
}

.stat-card {
    background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.06));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s;
    animation: card-appear 0.6s ease-out backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.15s; }
.stat-card:nth-child(3) { animation-delay: 0.2s; }
.stat-card:nth-child(4) { animation-delay: 0.25s; }

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
    border-color: rgba(255, 255, 255, 0.3);
}

.stat-icon {
    font-size: clamp(1.8rem, 5vmin, 2.5rem);
    margin-bottom: 8px;
}

.stat-value {
    font-size: clamp(1.4rem, 4vmin, 1.8rem);
    font-weight: 800;
    color: white;
    margin-bottom: 4px;
}

.stat-label {
    font-size: clamp(0.75rem, 2vmin, 0.9rem);
    color: rgba(255, 255, 255, 0.7);
}

.level-progress-card {
    margin: 0 15px 20px;
    padding: 16px;
    background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.06));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    position: relative;
    z-index: 2;
    animation: card-appear 0.6s ease-out 0.3s backwards;
}

.level-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: clamp(0.85rem, 2.2vmin, 1rem);
    color: white;
    font-weight: 600;
}

.level-progress-text {
    color: rgba(255, 255, 255, 0.7);
}

.level-progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
}

.level-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue), var(--accent-cyan));
    border-radius: 10px;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.profile-content {
    padding: 0 15px 30px;
    position: relative;
    z-index: 2;
}

.section-card {
    background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.06));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: card-appear 0.6s ease-out backwards;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-title {
    font-size: clamp(1.1rem, 3vmin, 1.3rem);
    font-weight: 700;
    color: white;
}

.section-count {
    font-size: clamp(0.9rem, 2.4vmin, 1.1rem);
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    background: linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: all 0.3s;
}

.setting-item:hover {
    background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.06));
}

.setting-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.setting-icon {
    font-size: 1.8rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.setting-icon-box {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(99, 102, 241, 0.2));
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.setting-svg {
    width: 24px;
    height: 24px;
    color: var(--accent-blue);
}

.setting-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.setting-name {
    font-size: clamp(0.9rem, 2.3vmin, 1.05rem);
    font-weight: 600;
    color: white;
}

.setting-desc {
    font-size: clamp(0.75rem, 2vmin, 0.85rem);
    color: rgba(255, 255, 255, 0.6);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: 0.3s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.referral-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.referral-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: clamp(0.9rem, 2.3vmin, 1.05rem);
    text-align: center;
}

.referral-link-wrapper {
    display: flex;
    gap: 8px;
}

.referral-input {
    flex: 1;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
    font-size: clamp(0.8rem, 2.1vmin, 0.95rem);
    outline: none;
}

.btn-copy {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    border: none;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-copy:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

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

.btn-copy .btn-icon {
    color: white;
}

.profile-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.95), rgba(14, 165, 233, 0.95));
    backdrop-filter: blur(10px);
    color: white;
    padding: 14px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: clamp(0.9rem, 2.2vmin, 1rem);
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.profile-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Адаптация для маленьких экранов */
@media (max-width: 360px) {
    .stats-grid {
        gap: 8px;
    }
    
    .stat-card {
        padding: 12px 8px;
    }
}

/* Removed duplicate - see line 1064 for unified reduced motion styles */

.balance-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
}

.balance-label {
    font-size: clamp(0.85rem, 2.2vmin, 1rem);
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}

.balance-amounts {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.balance-amounts .balance-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(5px);
}

.balance-amounts .balance-icon {
    font-size: 1.4em;
}

.balance-amounts .balance-value {
    font-size: clamp(1.2rem, 3.2vmin, 1.6rem);
    font-weight: 700;
    color: var(--accent-gold);
}

.balance-amounts .balance-currency {
    font-size: clamp(0.9rem, 2.4vmin, 1.1rem);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.balance-amount {
    text-align: right;
    font-size: clamp(1.4rem, 4vmin, 1.8rem) !important;
    margin-top: 0 !important;
}

/* ============================================
   ✅ KEYBOARD ADAPTATION - Адаптация клавиатуры
   ============================================ */

/* Когда клавиатура открыта */
body.keyboard-visible {
    /* Уменьшаем высоту контейнера */
    min-height: calc(100vh - var(--keyboard-height));
}

body.keyboard-visible .app {
    padding-bottom: 0;
}

body.keyboard-visible .main-content {
    padding-bottom: 10px;
}

/* Адаптация input полей при клавиатуре */
body.keyboard-visible input,
body.keyboard-visible textarea {
    /* Убеждаемся что input виден */
    position: relative;
    z-index: 1000;
}

/* Скрываем лишние элементы когда клавиатура открыта */
body.keyboard-visible .background-stars {
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

body.keyboard-visible .pvp-bg-video {
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

/* Адаптация футера при клавиатуре - полностью скрываем */
body.keyboard-visible .bottom-nav {
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Telegram WebApp fix - не скрываем меню на iPhone */
@media screen and (-webkit-min-device-pixel-ratio: 2) and (max-width: 428px) {
    body.keyboard-visible .bottom-nav,
    .keyboard-open .bottom-nav {
        transform: translateY(0) !important;
        opacity: 1 !important;
        pointer-events: all !important;
    }
}

/* Адаптация секции игроков */
body.keyboard-visible .players-section {
    max-height: 30vh;
    transition: max-height 0.3s ease;
}

/* Адаптация bet-controls при клавиатуре */
body.keyboard-visible .bet-controls {
    position: sticky;
    bottom: 10px;
    background: var(--primary-color);
    padding: 15px;
    border-radius: 12px;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

/* Уменьшаем колесо при клавиатуре для экономии места */
body.keyboard-visible .wheel-container {
    transform: scale(0.85);
    transition: transform 0.3s ease;
}

/* Адаптация заголовка */
body.keyboard-visible .header {
    padding: 5px 15px;
    transition: padding 0.3s ease;
}

/* Гарантируем круглую форму центрального элемента */
#wheel-status {
    border-radius: 50% !important;
    overflow: hidden !important;
}

/* Улучшенная видимость активного input */
input:focus,
textarea:focus {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
    background-color: rgba(255, 255, 255, 0.05);
    transform: scale(1.02);
    transition: all 0.2s ease;
}

/* Предотвращение zoom при фокусе (iOS) */
input,
textarea,
select {
    font-size: 16px !important; /* iOS не зумит если размер >= 16px */
    -webkit-text-size-adjust: 100%;
}

/* Быстрое закрытие клавиатуры - добавляем кнопку */
body.keyboard-visible::after {
    content: '✕ Закрыть';
    position: fixed;
    bottom: calc(var(--keyboard-height) + 10px);
    right: 20px;
    background: var(--accent-purple);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    z-index: 10001;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.5);
    animation: fadeInUp 0.3s ease;
    pointer-events: auto;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Обработка клика по кнопке закрытия */
body.keyboard-visible::after {
    -webkit-tap-highlight-color: transparent;
}

/* Мобильная оптимизация viewport */
@media (max-height: 600px) {
    /* На маленьких экранах уменьшаем отступы */
    body.keyboard-visible .main-content {
        padding: 10px;
    }
    
    body.keyboard-visible .wheel-container {
        transform: scale(0.8);
    }
    
    body.keyboard-visible .players-section {
        max-height: 20vh;
    }
}

/* Плавные переходы для всех адаптаций */
.app,
.main-content,
.players-section,
.bottom-nav,
.wheel-container {
    transition: transform 0.3s ease, opacity 0.3s ease, max-height 0.3s ease;
}

/* ====================================== */
/* Gifts Page: Bet Controls - 2 buttons in a row */
/* ====================================== */
.bet-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 24px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 16px;
}

@media (max-width: 480px) {
    .bet-controls {
        max-width: 100%;
        gap: 10px;
        padding: 0 12px;
    }
    
    /* Адаптивное сжатие username на средних экранах */
    .value {
        font-size: clamp(0.6rem, 1.5vmin, 0.8rem);
    }
}

@media (max-width: 360px) {
    .bet-controls {
        gap: 8px;
        padding: 0 10px;
    }
}

/* ===== STAR ICONS STYLING ===== */
/* Заменяем эмодзи звезд на PNG изображения */
.star-icon {
    display: inline-block;
    background-image: url('/assets/telegram-star-128.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 1.3em;
    height: 1.3em;
    vertical-align: baseline;
    margin: 0;
    flex-shrink: 0;
}

/* Разные размеры для разных контекстов */
.star-icon.small {
    width: 1.2em;
    height: 1.2em;
    background-image: url('/assets/telegram-star-128.png');
}

.star-icon.medium {
    width: 1.5em;
    height: 1.5em;
    background-image: url('/assets/telegram-star-256.png');
}

.star-icon.large {
    width: 1.8em;
    height: 1.8em;
    background-image: url('/assets/telegram-star-512.png');
}

/* Стили для кнопок и элементов интерфейса */
.mode-icon.star-icon {
    width: 1.6em;
    height: 1.6em;
    background-image: url('/assets/telegram-star-256.png');
}

.balance-icon.star-icon {
    width: 1.1em;
    height: 1.1em;
    background-image: url('/assets/telegram-star-256.png');
    filter: drop-shadow(0 0 8px rgba(255, 201, 71, 0.4));
}

/* Адаптивные размеры для мобильных устройств */
@media (max-width: 480px) {
    .star-icon {
        width: 1.1em;
        height: 1.1em;
        background-image: url('/assets/telegram-star-128.png');
    }
    
    .star-icon.small {
        width: 1.0em;
        height: 1.0em;
    }
    
    .mode-icon.star-icon {
        width: 1.4em;
        height: 1.4em;
    }
    
    .balance-icon.star-icon {
        width: 0.9em;
        height: 0.9em;
    }
    
    .ton-icon {
        width: 1.3em;
        height: 1.3em;
    }
}

/* Средние экраны (481px - 1023px) */
@media (min-width: 481px) and (max-width: 1023px) {
    .star-icon {
        width: 1.2em;
        height: 1.2em;
    }
    
    .star-icon.small {
        width: 1.1em;
        height: 1.1em;
    }
    
    .balance-icon.star-icon {
        width: 1.1em;
        height: 1.1em;
    }
    
    .ton-icon {
        width: 1.5em;
        height: 1.5em;
    }
}

@media (min-width: 1024px) {
    .star-icon {
        width: 1.4em;
        height: 1.4em;
        background-image: url('/assets/telegram-star-256.png');
    }
    
    .star-icon.small {
        width: 1.3em;
        height: 1.3em;
    }
    
    .mode-icon.star-icon {
        width: 1.7em;
        height: 1.7em;
    }
    
    .balance-icon.star-icon {
        width: 1.2em;
        height: 1.2em;
    }
    
    .ton-icon {
        width: 1.6em;
        height: 1.6em;
    }
}

/* Естественное сжатие username на маленьких экранах */
@media (max-width: 768px) {
    .value {
        font-size: clamp(0.6rem, 1.6vmin, 0.8rem);
    }
}

/* ✅ Стили для выбывших игроков (PVP2) */
.player-card.eliminated {
    opacity: 0.5;
    background: linear-gradient(135deg, 
        rgba(42, 39, 52, 0.5) 0%, 
        rgba(26, 24, 32, 0.5) 100%
    );
    border-color: rgba(255, 0, 0, 0.2);
}

.player-card.eliminated .player-avatar {
    filter: grayscale(100%);
    opacity: 0.6;
}

.player-card.eliminated .player-chance {
    color: #ff6b6b;
    font-weight: bold;
}

.player-card.eliminated::before {
    background: linear-gradient(180deg, 
        rgba(255, 107, 107, 0.4) 0%,
        rgba(239, 68, 68, 0.3) 50%,
        rgba(220, 38, 38, 0.4) 100%
    );
    opacity: 1;
}

.player-card.eliminated:hover {
    transform: translateX(2px);
    box-shadow: 
        -3px 0 0 0 rgba(255, 107, 107, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ✅ Анимации для модалки победителя */
.modal-overlay.modal-enter {
    animation: modalFadeIn 0.3s ease-out forwards;
}

.modal-overlay.modal-enter .modal-content {
    animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.modal-overlay.modal-exit {
    animation: modalFadeOut 0.3s ease-in forwards;
}

.modal-overlay.modal-exit .modal-content {
    animation: modalSlideDown 0.3s ease-in forwards;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(4px);
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
        backdrop-filter: blur(4px);
    }
    to {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
}

@keyframes modalSlideUp {
    from {
        transform: translateY(100%) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes modalSlideDown {
    from {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateY(50px) scale(0.95);
        opacity: 0;
    }
}

/* ✅ Дополнительная анимация для winner элемента внутри модалки */
.modal-overlay.modal-enter .winner-avatar {
    animation: avatarBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

.modal-overlay.modal-enter .winner-name-large {
    animation: textFadeInUp 0.4s ease-out 0.3s both;
}

.modal-overlay.modal-enter .prize-display {
    animation: textFadeInUp 0.4s ease-out 0.4s both;
}

@keyframes avatarBounce {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.1) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

@keyframes textFadeInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.shop-empty { 
    text-align: center; 
    color: var(--text-secondary-color); 
    padding: 24px 8px; 
    grid-column: 1 / -1;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.empty-icon {
    width: 64px;
    height: 64px;
    stroke-width: 1.5;
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 12px rgba(0, 136, 204, 0.3));
}

.empty-text {
    font-size: clamp(1rem, 2.6vmin, 1.2rem);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.empty-subtext {
    font-size: clamp(0.85rem, 2.2vmin, 0.95rem);
    color: rgba(255, 255, 255, 0.5);
}

.page-title {
    font-size: clamp(1.25rem, 4vmin, 1.75rem);
    font-weight: 800;
    color: #fff;
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 10px rgba(0, 136, 204, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#gifts-count-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: clamp(0.8rem, 2.5vmin, 1rem);
    font-weight: 700;
    background: rgba(0, 136, 204, 0.2);
    border: 1px solid rgba(0, 136, 204, 0.4);
    border-radius: 12px;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 136, 204, 0.3);
}
