/* Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Предотвращаем горизонтальную прокрутку на всех уровнях */
html {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    position: relative;
    overscroll-behavior-x: none;
    -webkit-overflow-scrolling: touch;
}

/* CSS переменные для премиального black & gold дизайна */
:root {
    --bg: #040405;
    --bg-radial-start: #0C0C0E;
    --bg-radial-mid: #040405;
    --bg-radial-end: #020203;
    --surface: rgba(255,255,255,0.02);
    --surface-strong: rgba(4,4,5,0.35);
    --gold: #F4D38B;
    --gold-soft: rgba(244,211,139,0.12);
    --gold-border: rgba(244,211,139,0.28);
    --gold-gradient-start: #F4D38B;
    --gold-gradient-mid: #F2C76E;
    --gold-gradient-end: #D89B3E;
    --gold-dark: #8F6520;
    --text: rgba(255,255,255,0.95);
    --text-muted: rgba(255,255,255,0.55);
    --text-dim: rgba(255,255,255,0.45);
}

/* Скрываем кнопку Telegram MainButton */
.tg-main-button,
.tgMainButton,
[class*="main-button"],
[class*="MainButton"],
button[style*="position: fixed"][style*="bottom"],
button.MainButton {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top, var(--bg-radial-start) 0%, var(--bg-radial-mid) 55%, var(--bg-radial-end) 100%);
    color: var(--text);
    overflow-x: hidden;
    overscroll-behavior-x: none;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 100vw;
    min-width: 100vw;
    position: relative;
    touch-action: pan-y pinch-zoom;
}

/* Золотая засветка сверху */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 400px;
    background: linear-gradient(180deg, rgba(244,211,139,0.14) 0%, rgba(4,4,5,0) 45%);
    pointer-events: none;
    z-index: 0;
}

/* Темы */
.theme-light {
    background: #f5f5f5;
    color: #000;
}

.theme-light .app-container {
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
}

.theme-light .header {
    background: rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.theme-light .logo {
    background: linear-gradient(45deg, #000, #333);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.theme-light .balance {
    background: rgba(0, 0, 0, 0.1);
    color: #000;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.theme-light .username {
    background: linear-gradient(45deg, #000, #333);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.theme-light .settings-btn {
    color: #666;
}

.theme-light .settings-btn:hover {
    color: #000;
    background: rgba(0, 0, 0, 0.1);
}

.theme-light .bottom-menu {
    background: rgba(0, 0, 0, 0.05);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.theme-light .menu-btn {
    color: #666;
}

.theme-light .menu-btn.active,
.theme-light .menu-btn:hover {
    color: #000;
    background: rgba(0, 0, 0, 0.05);
}

.theme-light .dice {
    background: #fff;
    color: #000;
    border: 2px solid rgba(0, 0, 0, 0.2);
}

.theme-light .btn-primary {
    background: linear-gradient(140deg, #F4D38B 0%, #E8B450 40%, #B47223 100%);
    color: #101013;
    box-shadow: 0 10px 26px rgba(244,211,139,0.35);
}

.theme-light .btn-secondary {
    background: rgba(0, 0, 0, 0.1);
    color: #000;
    border: 1px solid rgba(0, 0, 0, 0.3);
}

.theme-light .screen {
    color: #000;
}

.theme-light .screen h2 {
    background: linear-gradient(45deg, #000, #333);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.theme-light .stat-label {
    color: #666;
}

.theme-light .stat-value {
    background: linear-gradient(45deg, #000, #333);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.theme-light .rating-area h2,
.theme-light .shop-area h2 {
    background: linear-gradient(45deg, #000, #333);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.theme-light .player {
    color: #000;
}

.theme-light .score {
    background: linear-gradient(45deg, #000, #333);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.theme-light .item-info h3 {
    color: #000;
}

.theme-light .price {
    background: linear-gradient(45deg, #000, #333);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.theme-light .rating-item,
.theme-light .shop-item {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.theme-light .rating-item:hover,
.theme-light .shop-item:hover {
    background: rgba(0, 0, 0, 0.1);
}

.theme-light .modal-content {
    background: #f5f5f5;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.theme-light .modal-header h3 {
    color: #000;
}

.theme-light .close-btn {
    color: #666;
}

.theme-light .close-btn:hover {
    color: #000;
    background: rgba(0, 0, 0, 0.1);
}

.theme-light .settings-option {
    background: rgba(0, 0, 0, 0.05);
}

.theme-light .settings-option:hover {
    background: rgba(0, 0, 0, 0.1);
}

.theme-light .settings-option:has(input[type="radio"]:checked) {
    background: rgba(0, 0, 0, 0.1);
    border-color: #000;
}

.theme-light .option-text {
    color: #666;
}

.theme-light .settings-option input[type="radio"]:checked + .option-text {
    color: #000;
}

.theme-light .settings-section h4 {
    color: #000;
}

.theme-light #username-input {
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.2);
    color: #000;
}

.theme-light #username-input:focus {
    border-color: #000;
    background: rgba(0, 0, 0, 0.15);
}

.theme-light #username-input::placeholder {
    color: #999;
}

.theme-light .ton-connection-info h4 {
    color: #000;
}

.theme-light .ton-connection-info p {
    color: #666;
}

.theme-light .wallet-info h5 {
    color: #000;
}

.theme-light .wallet-info p {
    color: #666;
}

.theme-light .wallet-arrow {
    color: #666;
}

.theme-light .status-text h5 {
    color: #000;
}

.theme-light .status-text p {
    color: #666;
}

.theme-dark {
    background: #000;
    color: #fff;
}

.theme-system {
    /* Использует системную тему */
    background: #000;
    color: #fff;
}

@media (prefers-color-scheme: light) {
    .theme-system {
        background: #f5f5f5;
        color: #000;
    }
    
    .theme-system .app-container {
        background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    }
    
    .theme-system .header {
        background: rgba(0, 0, 0, 0.05);
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .theme-system .logo {
        background: linear-gradient(45deg, #000, #333);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .theme-system .balance {
        background: rgba(0, 0, 0, 0.1);
        color: #000;
        border: 1px solid rgba(0, 0, 0, 0.2);
    }
    
    .theme-system .username {
        background: linear-gradient(45deg, #000, #333);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .theme-system .settings-btn {
        color: #666;
    }
    
    .theme-system .settings-btn:hover {
        color: #000;
        background: rgba(0, 0, 0, 0.1);
    }
    
    .theme-system .bottom-menu {
        background: rgba(0, 0, 0, 0.05);
        border-top: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .theme-system .menu-btn {
        color: #666;
    }
    
    .theme-system .menu-btn.active,
    .theme-system .menu-btn:hover {
        color: #000;
        background: rgba(0, 0, 0, 0.05);
    }
    
    .theme-system .dice {
        background: #fff;
        color: #000;
        border: 2px solid rgba(0, 0, 0, 0.2);
    }
    
    .theme-system .btn-primary {
        background: linear-gradient(45deg, #000, #333);
        color: #fff;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    }
    
    .theme-system .btn-secondary {
        background: rgba(0, 0, 0, 0.1);
        color: #000;
        border: 1px solid rgba(0, 0, 0, 0.3);
    }
    
    .theme-system .screen {
        color: #000;
    }
    
    .theme-system .screen h2 {
        background: linear-gradient(45deg, #000, #333);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .theme-system .stat-label {
        color: #666;
    }
    
    .theme-system .stat-value {
        background: linear-gradient(45deg, #000, #333);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .theme-system .rating-area h2,
    .theme-system .shop-area h2 {
        background: linear-gradient(45deg, #000, #333);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .theme-system .player {
        color: #000;
    }
    
    .theme-system .score {
        background: linear-gradient(45deg, #000, #333);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .theme-system .item-info h3 {
        color: #000;
    }
    
    .theme-system .price {
        background: linear-gradient(45deg, #000, #333);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .theme-system .rating-item,
    .theme-system .shop-item {
        background: rgba(0, 0, 0, 0.05);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .theme-system .rating-item:hover,
    .theme-system .shop-item:hover {
        background: rgba(0, 0, 0, 0.1);
    }
    
    .theme-system .modal-content {
        background: #f5f5f5;
        border: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .theme-system .modal-header h3 {
        color: #000;
    }
    
    .theme-system .close-btn {
        color: #666;
    }
    
    .theme-system .close-btn:hover {
        color: #000;
        background: rgba(0, 0, 0, 0.1);
    }
    
    .theme-system .settings-option {
        background: rgba(0, 0, 0, 0.05);
    }
    
    .theme-system .settings-option:hover {
        background: rgba(0, 0, 0, 0.1);
    }
    
    .theme-system .settings-option:has(input[type="radio"]:checked) {
        background: rgba(0, 0, 0, 0.1);
        border-color: #000;
    }
    
    .theme-system .option-text {
        color: #666;
    }
    
    .theme-system .settings-option input[type="radio"]:checked + .option-text {
        color: #000;
    }
    
    .theme-system .settings-section h4 {
        color: #000;
    }
    
    .theme-system #username-input {
        background: rgba(0, 0, 0, 0.1);
        border: 1px solid rgba(0, 0, 0, 0.2);
        color: #000;
    }
    
    .theme-system #username-input:focus {
        border-color: #000;
        background: rgba(0, 0, 0, 0.15);
    }
    
    .theme-system #username-input::placeholder {
        color: #999;
    }
    
    .theme-system .ton-connection-info h4 {
        color: #000;
    }
    
    .theme-system .ton-connection-info p {
        color: #666;
    }
    
    .theme-system .wallet-info h5 {
        color: #000;
    }
    
    .theme-system .wallet-info p {
        color: #666;
    }
    
    .theme-system .wallet-arrow {
        color: #666;
    }
    
    .theme-system .status-text h5 {
        color: #000;
    }
    
    .theme-system .status-text p {
        color: #666;
    }
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: transparent;
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    overscroll-behavior-x: none;
}

/* Заголовок */
/* Шапка - премиальный black & gold (двухстрочная) */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: radial-gradient(circle at top, #0C0C0E 0%, #040405 55%, #020203 100%);
    border-bottom: 1px solid rgba(244,211,139,0.06);
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    position: relative;
    min-height: 72px;
}

/* Блок профиля (слева) - теперь с балансом внутри */
.profile-block {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.avatar-container {
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease-out;
}

.avatar-container:hover {
    transform: scale(1.03);
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 9999px;
    background: radial-gradient(circle, rgba(244,211,139,0.12), rgba(0,0,0,0));
    border: 1px solid rgba(244,211,139,0.25);
    object-fit: cover;
    transition: all 0.2s ease-out;
}

.avatar-edit-btn {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: rgba(244,211,139,0.1);
    border: 1px solid rgba(244,211,139,0.35);
    border-radius: 9999px;
    color: #F4D38B;
    display: grid;
    place-items: center;
    font-size: 9px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease-out;
}

.avatar-container:hover .avatar-edit-btn {
    opacity: 1;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.username-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.username {
    font-weight: 600;
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.edit-name-btn {
    width: 16px;
    height: 16px;
    background: none;
    border: none;
    color: rgba(244,211,139,0.6);
    display: grid;
    place-items: center;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease-out;
    flex-shrink: 0;
    padding: 0;
}

.edit-name-btn:hover {
    color: #F4D38B;
    transform: scale(1.1);
}

/* Блок баланса - золотая пилюля (теперь внутри профиля) */
.balance-pill {
    background: radial-gradient(circle, rgba(244,211,139,0.25) 0%, rgba(4,4,5,0.1) 65%);
    border: 1px solid rgba(244,211,139,0.35);
    border-radius: 9999px;
    padding: 4px 12px 4px 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 6px 18px rgba(244,211,139,0.18);
    flex-shrink: 0;
    width: fit-content;
}

.balance-icon-circle {
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    background: radial-gradient(circle, #F4D38B 0%, #B47223 85%);
    display: grid;
    place-items: center;
    color: #131416;
    font-weight: 700;
    font-size: 11px;
    flex-shrink: 0;
}

.balance {
    color: #fff;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

/* Блок действий (справа) */
.actions-block {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.action-btn {
    width: 34px;
    height: 34px;
    border-radius: 14px;
    background: rgba(4,4,5,0.3);
    border: 1px solid rgba(244,211,139,0.08);
    backdrop-filter: blur(8px);
    display: grid;
    place-items: center;
    color: #fff;
    cursor: pointer;
    transition: all 0.15s ease-out;
}

.action-btn:hover {
    background: rgba(244,211,139,0.08);
    border-color: rgba(244,211,139,0.25);
}

/* Активная/главная кнопка (пополнить) */
.action-primary {
    background: linear-gradient(145deg, #F4D38B 0%, #B87927 100%);
    color: #101012;
    border: 1px solid rgba(244,211,139,0.45);
    box-shadow: 0 6px 16px rgba(244,211,139,0.32);
}

.action-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(244,211,139,0.4);
}

.action-icon {
    font-size: 16px;
}

/* Адаптив для маленьких экранов */
@media (max-width: 420px) {
    .header {
        padding: 10px 12px;
    }
    
    .balance {
        font-size: 11px;
    }
    
    .username {
        max-width: 100px;
    }
    
    .actions-block {
        gap: 6px;
    }
    
    .action-btn {
        width: 32px;
        height: 32px;
    }
}

/* Основной контент */
.main-content {
    flex: 1;
    position: relative;
    overflow-x: hidden;
    overflow-y: visible;
    background: transparent;
    height: 100%;
    padding: 20px 16px;
    width: 100%;
    max-width: 100vw;
}

.theme-light .main-content {
    background: #f5f5f5;
}

.theme-system .main-content {
    background: transparent;
}

@media (prefers-color-scheme: light) {
    .theme-system .main-content {
        background: #f5f5f5;
    }
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 100vw;
    height: 100%;
    padding: 0;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    background: transparent;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-x: none;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

.theme-light .screen {
    background: #f5f5f5;
}

.theme-system .screen {
    background: transparent;
}

@media (prefers-color-scheme: light) {
    .theme-system .screen {
        background: #f5f5f5;
    }
}

.screen.active {
    opacity: 1;
    transform: translateX(0);
}

/* Игровые вкладки */
.game-tabs {
    display: flex;
    background: var(--surface-strong);
    border: 1px solid rgba(244,211,139,0.12);
    border-radius: 9999px;
    padding: 4px;
    margin-top: 18px;
    margin-bottom: 24px;
    backdrop-filter: blur(14px);
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 100%;
    flex-shrink: 0;
}

.theme-light .game-tabs {
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.theme-system .game-tabs {
    background: rgba(255, 255, 255, 0.05);
}

@media (prefers-color-scheme: light) {
    .theme-system .game-tabs {
        background: rgba(0, 0, 0, 0.1);
        border: 1px solid rgba(0, 0, 0, 0.2);
    }
}

.game-tab {
    flex: 1;
    padding: 10px 18px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: 9999px;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.15s ease-out;
    text-align: center;
    position: relative;
    z-index: 100;
    pointer-events: auto;
}

.theme-light .game-tab {
    color: #666;
}

.game-tab.active {
    background: linear-gradient(135deg, var(--gold-gradient-start) 0%, var(--gold-gradient-mid) 45%, var(--gold-dark) 100%);
    color: #0F1012;
    font-weight: 600;
    box-shadow: 0 6px 22px rgba(244,211,139,0.45);
}

.game-tab:not(.active):hover {
    color: rgba(255,255,255,0.9);
}

.theme-light .game-tab.active {
    background: rgba(0, 0, 0, 0.1);
    color: #000;
}

.game-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.theme-light .game-tab:hover {
    color: #000;
    background: rgba(0, 0, 0, 0.05);
}

.game-tab-content {
    display: none !important;
    background: transparent;
    position: relative;
    z-index: 1;
}

.game-tab-content.active {
    display: block !important;
}

.theme-light .game-tab-content {
    background: #f5f5f5;
}

.theme-system .game-tab-content {
    background: transparent;
}

@media (prefers-color-scheme: light) {
    .theme-system .game-tab-content {
        background: #f5f5f5;
    }
}

/* Заголовок игр */
.games-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.games-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.games-header h2::before {
    content: '🎲';
    font-size: 18px;
}

.games-header h2::after {
    content: '🎲';
    font-size: 18px;
}

.theme-light .games-header h2 {
    background: linear-gradient(45deg, #000, #666);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 8px 14px;
    padding-right: 35px;
    background: var(--surface-strong);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    border: 1px solid rgba(244,211,139,0.12);
    border-radius: 9999px;
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: all 0.15s ease-out;
    backdrop-filter: blur(10px);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.theme-light .filter-select {
    background: rgba(0, 0, 0, 0.1);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='black' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    color: #000;
}

.filter-select:focus {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.15);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
}

.theme-light .filter-select:focus {
    border-color: #000;
    background: rgba(0, 0, 0, 0.15);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='black' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
}

.filter-select option {
    background: #1a1a1a;
    color: #fff;
}

.theme-light .filter-select option {
    background: #fff;
    color: #000;
}

/* Список лобби */
.lobbies-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.lobby-item {
    background: radial-gradient(circle at top, rgba(244,211,139,0.16) 0%, rgba(3,3,3,0.05) 40%), rgba(2,2,2,0.35);
    border: 1px solid rgba(244,211,139,0.08);
    border-radius: 20px;
    padding: 16px;
    transition: all 0.15s ease-out;
    cursor: pointer;
    backdrop-filter: blur(12px);
    box-shadow: 0 12px 36px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

.theme-light .lobby-item {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.lobby-item:hover {
    transform: translateY(-2px);
    border-color: rgba(244,211,139,0.4);
    box-shadow: 0 18px 28px rgba(0,0,0,0.35);
}

.theme-light .lobby-item:hover {
    background: rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

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

.lobby-id {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-light .lobby-id {
    color: #000;
}

.lobby-bet {
    background: var(--gold-soft);
    border: 1px solid rgba(244,211,139,0.3);
    padding: 4px 10px;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 12px;
    color: var(--gold);
    white-space: nowrap;
}

.theme-light .lobby-bet {
    background: rgba(0, 0, 0, 0.1);
    color: #000;
}

.lobby-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 12px;
}

.lobby-info-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.lobby-players {
    display: flex;
    align-items: center;
    gap: 10px;
}

.players-count {
    color: #ccc;
    font-size: 14px;
}

.theme-light .players-count {
    color: #666;
}

.players-avatars {
    display: flex;
    gap: 5px;
}

.player-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.lobby-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.lobby-status.waiting {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.lobby-status.playing {
    background: rgba(40, 167, 69, 0.2);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.lobby-join {
    width: 100%;
    padding: 12px 18px;
    background: linear-gradient(135deg, var(--gold-gradient-start) 0%, var(--gold-gradient-mid) 45%, var(--gold-dark) 100%);
    color: #0F1012;
    border: none;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.15s ease-out;
    box-shadow: 0 6px 22px rgba(244,211,139,0.45);
}

.theme-light .lobby-join {
    background: linear-gradient(135deg, var(--gold-gradient-start) 0%, var(--gold-gradient-mid) 45%, var(--gold-dark) 100%);
    color: #0F1012;
}

.lobby-join:hover {
    background: #0F1012;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.theme-light .lobby-join:hover {
    background: #0F1012;
    color: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Мои игры */
.my-games-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.my-games-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 12px;
}

/* Иконка истории в золотом круге */
.my-games-header h2::before {
    content: '📜';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--gold-soft);
    border: 1px solid var(--gold-border);
    font-size: 14px;
    margin-right: 8px;
    flex-shrink: 0;
}

.theme-light .my-games-header h2 {
    background: linear-gradient(45deg, #000, #666);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.my-games-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}


/* Бейдж количества игр (добавляется через JS) */
.game-history-count {
    background: var(--gold-soft);
    border: 1px solid rgba(244,211,139,0.3);
    border-radius: 9999px;
    padding: 2px 10px;
    font-size: 11px;
    color: var(--gold);
    font-weight: 500;
}

.theme-light .game-history h3 {
    color: #000;
}

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

.history-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.theme-light .history-item {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.history-game-id {
    font-weight: bold;
    color: #fff;
}

.theme-light .history-game-id {
    color: #000;
}

.history-details {
    font-size: 14px;
    color: #ccc;
}

.theme-light .history-details {
    color: #666;
}

.history-result {
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
}

.history-result.win {
    background: rgba(40, 167, 69, 0.2);
    color: #28a745;
}

.history-result.loss {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

/* Создание игры - премиальный black & gold стиль */
.create-game-section {
    margin-bottom: 12px;
}

.create-game-section h4 {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 6px 0;
}

.create-game-section h4::before {
    font-size: 18px;
}

.players-options,
.bet-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.player-option,
.bet-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    min-height: 36px;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(244, 211, 139, 0.04);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease-out;
    font-size: 12px;
}

.player-option:hover,
.bet-option:hover {
    background: rgba(255, 255, 255, 0.025);
    border-color: rgba(244, 211, 139, 0.12);
}

.player-option input[type="radio"],
.bet-option input[type="radio"] {
    margin: 0;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    appearance: none;
    border: 2px solid rgba(244, 211, 139, 0.35);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s ease-out;
}

.player-option input[type="radio"]:checked,
.bet-option input[type="radio"]:checked {
    background: radial-gradient(circle, #F4D38B 0%, #B47223 100%);
    border-color: #F4D38B;
    box-shadow: 0 0 8px rgba(244, 211, 139, 0.4);
}

.player-option:has(input[type="radio"]:checked),
.bet-option:has(input[type="radio"]:checked) {
    background: radial-gradient(circle, rgba(244, 211, 139, 0.18) 0%, rgba(4, 4, 5, 0.1) 70%);
    border: 1px solid rgba(244, 211, 139, 0.55);
    box-shadow: 0 6px 18px rgba(244, 211, 139, 0.25);
    color: #fff;
}

.player-option input[type="radio"]:checked + .option-text,
.bet-option input[type="radio"]:checked + .option-text {
    color: #fff;
    font-weight: 600;
}

.option-text {
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.15s ease-out;
}

.custom-bet {
    margin-top: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.015);
    border-radius: 10px;
    border: 1px solid rgba(244, 211, 139, 0.08);
}

.custom-bet input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(244, 211, 139, 0.12);
    border-radius: 10px;
    color: #fff;
    font-size: 13px;
    outline: none;
    transition: all 0.15s ease-out;
}

.custom-bet input:focus {
    border-color: rgba(244, 211, 139, 0.45);
    background: rgba(255, 255, 255, 0.035);
    box-shadow: 0 0 12px rgba(244, 211, 139, 0.15);
}

.custom-bet input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Модалка "Создать игру" - премиальный стеклянный стиль */
#create-game-modal .modal-content {
    background: radial-gradient(circle at top, rgba(244, 211, 139, 0.04) 0%, rgba(4, 4, 5, 0.9) 45%), rgba(4, 4, 5, 0.65);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(244, 211, 139, 0.18);
    border-radius: 20px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
    padding: 0;
    max-height: 70vh;
    overflow-y: auto;
}

#create-game-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(244, 211, 139, 0.12) 0%, rgba(4, 4, 5, 0) 80%);
    padding: 12px 14px 10px 14px;
    border-bottom: 1px solid rgba(244, 211, 139, 0.03);
}

#create-game-modal .modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

#create-game-modal .close-btn {
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(244, 211, 139, 0.18);
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease-out;
}

#create-game-modal .close-btn:hover {
    background: rgba(244, 211, 139, 0.15);
    border-color: rgba(244, 211, 139, 0.45);
    color: #fff;
}

#create-game-modal .modal-body {
    padding: 12px 14px 14px 14px;
}

#create-game-modal .modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 4px;
}

#create-game-modal .btn-primary {
    width: 100%;
    background: linear-gradient(140deg, #F4D38B 0%, #B47223 100%);
    color: #101013;
    font-weight: 600;
    font-size: 14px;
    border-radius: 12px;
    padding: 9px 0;
    box-shadow: 0 8px 20px rgba(244, 211, 139, 0.3);
    border: none;
    cursor: pointer;
    transition: all 0.15s ease-out;
}

#create-game-modal .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(244, 211, 139, 0.4);
}

#create-game-modal .btn-secondary {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(244, 211, 139, 0.12);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease-out;
}

#create-game-modal .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.035);
    border-color: rgba(244, 211, 139, 0.25);
    color: #fff;
}

/* Кнопки */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s ease-out;
    min-width: 150px;
}

.btn-primary {
    background: linear-gradient(140deg, #F4D38B 0%, #E8B450 40%, #B47223 100%);
    color: #101013;
    box-shadow: 0 10px 26px rgba(244,211,139,0.35);
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 30px rgba(244,211,139,0.45);
}

/* Кнопка броска кубиков - всегда золотая */
#roll-dice-btn {
    background: linear-gradient(140deg, #F4D38B 0%, #E8B450 40%, #B47223 100%) !important;
    color: #101013 !important;
    box-shadow: 0 10px 26px rgba(244,211,139,0.35) !important;
    font-weight: 600 !important;
    border: none !important;
}

#roll-dice-btn:hover:not(:disabled) {
    transform: translateY(-1px) !important;
    box-shadow: 0 12px 30px rgba(244,211,139,0.45) !important;
}

#roll-dice-btn:disabled {
    background: rgba(255,255,255,0.015) !important;
    border: 1px solid rgba(244,211,139,0.12) !important;
    color: rgba(255,255,255,0.85) !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* Кнопка "Создать игру" - премиальный стиль */
#create-game-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(140deg, var(--gold-gradient-start) 0%, var(--gold-gradient-mid) 40%, #B87927 100%);
    color: #161719;
    font-weight: 600;
    border-radius: 9999px;
    padding: 10px 18px;
    box-shadow: 0 10px 28px rgba(244,211,139,0.38);
    border: none;
    cursor: pointer;
    transition: all 0.15s ease-out;
    min-width: auto;
    font-size: 15px;
}

#create-game-btn::before {
    content: '➕';
    width: 22px;
    height: 22px;
    border-radius: 9999px;
    background: rgba(0,0,0,0.18);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 14px;
    flex-shrink: 0;
}

#create-game-btn:hover {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 12px 32px rgba(244,211,139,0.48);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Рейтинг */
.rating-area {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rating-area h2 {
    text-align: center;
    font-size: 24px;
    margin-bottom: 20px;
}

.rating-list {
    flex: 1;
    overflow-y: auto;
}

.rating-item {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.rating-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.rank {
    font-size: 20px;
    font-weight: bold;
    margin-right: 15px;
    min-width: 30px;
}

.player {
    flex: 1;
    font-size: 16px;
}

.score {
    font-weight: bold;
    color: #fff;
}

/* Пустой рейтинг */
.rating-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
    min-height: 300px;
    margin: 20px 0;
    border: 1px solid rgba(244,211,139,0.08);
    border-radius: 20px;
    background: radial-gradient(circle at top, rgba(244,211,139,0.16) 0%, rgba(3,3,3,0.05) 40%), rgba(2,2,2,0.35);
    box-shadow: 0 12px 36px rgba(0,0,0,0.35);
    backdrop-filter: blur(12px);
    transition: all 0.15s ease-out;
}

.rating-empty:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 
        0 6px 30px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset,
        0 4px 20px rgba(255, 255, 255, 0.08) inset;
}

.empty-icon {
    font-size: 56px;
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(244,211,139,0.45), rgba(244,211,139,0) 70%);
    border-radius: 20px;
}

.empty-text {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text);
    text-align: center;
}

.empty-description {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
}

/* Магазин */
.shop-area {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px 16px;
}

/* Заголовок магазина */
.shop-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.shop-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Иконка магазина в золотом круге */
.shop-header h2::before {
    content: '🛍️';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: radial-gradient(circle, rgba(244,211,139,0.35), rgba(4,4,5,0));
    border: 1px solid rgba(244,211,139,0.25);
    border-radius: 14px;
    font-size: 18px;
}

.shop-items {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Карточка товара - стеклянный премиум стиль */
.shop-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    background: radial-gradient(circle at top, rgba(244,211,139,0.08) 0%, rgba(2,2,2,0.35) 40%), rgba(1,1,1,0.35);
    border: 1px solid rgba(244,211,139,0.05);
    border-radius: 18px;
    backdrop-filter: blur(12px);
    box-shadow: 0 14px 34px rgba(0,0,0,0.35);
    transition: all 0.15s ease-out;
}

.shop-item:hover {
    transform: translateY(-1px);
    border-color: rgba(244,211,139,0.16);
}

/* Левая часть карточки */
.shop-item-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
}

/* Иконка товара в золотом круге */
.item-icon {
    font-size: 26px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(244,211,139,0.22), rgba(7,7,7,0));
    border: 1px solid rgba(244,211,139,0.18);
    border-radius: 16px;
    flex-shrink: 0;
}

.item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.item-info h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.item-info p {
    color: rgba(255,255,255,0.42);
    font-size: 12px;
    margin: 0;
}

.price {
    font-size: 13px;
    font-weight: 600;
    color: var(--gold);
    margin-top: 6px;
}

/* Кнопка покупки - премиальная золотая капсула */
.shop-item .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 102px;
    background: linear-gradient(140deg, #F4D38B 0%, #E8B450 40%, #B47223 100%);
    color: #131416;
    font-weight: 600;
    border-radius: 9999px;
    padding: 9px 22px;
    box-shadow: 0 8px 18px rgba(244,211,139,0.33);
    border: none;
    cursor: pointer;
    transition: all 0.15s ease-out;
    font-size: 14px;
}

.shop-item .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(244,211,139,0.4);
}

.shop-item .btn:disabled {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(244,211,139,0.15);
    color: rgba(255,255,255,0.5);
    box-shadow: none;
    cursor: not-allowed;
}

/* Нижнее меню */
.bottom-menu {
    display: flex;
    background: rgba(3,3,3,0.35);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(244,211,139,0.07);
    border-bottom: none;
    border-radius: 22px 22px 0 0;
    padding: 10px 0;
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 100vw;
}

.menu-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.15s ease-out;
    border-radius: 12px;
    margin: 0 4px;
}

.menu-btn.active {
    color: var(--gold);
    font-weight: 500;
}

.menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 24px;
    transition: all 0.15s ease-out;
}

.menu-btn.active .menu-icon {
    border-radius: 50%;
    background: var(--gold-soft);
    border: 1px solid var(--gold-border);
    box-shadow: 0 4px 12px rgba(244, 211, 139, 0.25);
    font-size: 18px;
}

.menu-btn:hover:not(.active) {
    color: rgba(255,255,255,0.75);
}

.menu-label {
    font-size: 12px;
    font-weight: 500;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: #1a1a1a;
    border-radius: 20px;
    padding: 0;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

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

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

.modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: 18px;
}

.close-btn {
    background: none;
    border: none;
    color: #ccc;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Выбор аватара */
.avatar-selection {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 20px;
}

.avatar-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.avatar-option:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.avatar-option.selected {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.avatar-option img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Поле ввода имени */
#username-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
}

#username-input:focus {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

#username-input::placeholder {
    color: #999;
}

/* Настройки */
.settings-section {
    margin-bottom: 25px;
}

.settings-section h4 {
    color: #fff;
    font-size: 16px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.settings-option:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.settings-option input[type="radio"] {
    margin: 0;
    width: 18px;
    height: 18px;
    accent-color: #fff;
}

.settings-option input[type="radio"]:checked + .option-text {
    color: #fff;
    font-weight: bold;
}

.settings-option:has(input[type="radio"]:checked) {
    background: rgba(255, 255, 255, 0.1);
    border-color: #fff;
}

.option-text {
    color: #ccc;
    font-size: 15px;
    transition: all 0.3s ease;
}

/* TON подключение */
.ton-modal-content {
    max-width: 450px;
}

.ton-connection-info {
    text-align: center;
    margin-bottom: 25px;
}

.ton-icon-large {
    font-size: 48px;
    margin-bottom: 15px;
}

.ton-connection-info h4 {
    color: #fff;
    font-size: 18px;
    margin-bottom: 10px;
}

.ton-connection-info p {
    color: #ccc;
    font-size: 14px;
    line-height: 1.5;
}

.ton-wallet-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.ton-wallet-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    text-align: left;
}

.ton-wallet-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.wallet-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.wallet-info {
    flex: 1;
}

.wallet-info h5 {
    color: #fff;
    font-size: 16px;
    margin: 0 0 5px 0;
    font-weight: bold;
}

.wallet-info p {
    color: #ccc;
    font-size: 13px;
    margin: 0;
}

.wallet-arrow {
    color: #ccc;
    font-size: 18px;
    font-weight: bold;
}

.ton-connection-status {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: rgba(0, 255, 0, 0.1);
    border: 2px solid rgba(0, 255, 0, 0.3);
    border-radius: 15px;
    margin-bottom: 20px;
}

.status-icon {
    font-size: 24px;
}

.status-text h5 {
    color: #fff;
    font-size: 16px;
    margin: 0 0 5px 0;
    font-weight: bold;
}

.status-text p {
    color: #ccc;
    font-size: 14px;
    margin: 0;
}

/* Адаптивность */
@media (max-width: 480px) {
    .dice-container {
        gap: 15px;
    }
    
    .dice {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }
    
    .game-stats {
        gap: 20px;
    }
    
    .btn {
        min-width: 120px;
        padding: 10px 20px;
    }
    
    .user-profile {
        gap: 10px;
    }
    
    .avatar {
        width: 40px;
        height: 40px;
    }
    
    .username {
        font-size: 14px;
    }
    
    .balance {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .avatar-selection {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .avatar-option img {
        width: 50px;
        height: 50px;
    }
    
    .header-actions {
        gap: 8px;
    }
    
    .ton-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .ton-text {
        display: none;
    }
    
    .ton-modal-content {
        max-width: 95%;
    }
    
    .ton-wallet-btn {
        padding: 12px 15px;
    }
    
    .wallet-icon {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    .wallet-info h5 {
        font-size: 14px;
    }
    
    .wallet-info p {
        font-size: 12px;
    }
    
    /* Исправления для мобильной верстки */
    .user-profile {
        gap: 8px;
        flex: 1;
        min-width: 0;
    }
    
    .avatar {
        width: 35px;
        height: 35px;
        flex-shrink: 0;
    }
    
    .username {
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 80px;
    }
    
    .balance {
        font-size: 10px;
        padding: 3px 6px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .logo {
        font-size: 18px;
        flex-shrink: 0;
    }
    
    .header-actions {
        gap: 6px;
        flex-shrink: 0;
    }
    
    .ton-btn {
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .ton-text {
        display: none;
    }
    
    .ton-icon {
        font-size: 14px;
    }
    
    .bottom-menu {
        padding: 8px 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
    }
    
    .menu-btn {
        padding: 8px 4px;
        gap: 3px;
    }
    
    .menu-icon {
        font-size: 20px;
    }
    
    .menu-label {
        font-size: 10px;
    }
    
    .main-content {
        padding-bottom: 80px;
    }
    
    /* Дополнительные исправления для предотвращения наложения */
    .header {
        padding: 10px 15px;
        min-height: 60px;
    }
    
    .user-details {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        min-width: 0;
    }
    
    .username-container {
        display: flex;
        align-items: center;
        gap: 5px;
        flex: 1;
        min-width: 0;
    }
    
    .edit-name-btn {
        font-size: 12px;
        padding: 2px 4px;
    }
    
    /* Исправление для кнопки "Играть" */
    .menu-btn[data-screen="game-screen"] {
        position: relative;
        z-index: 1;
    }
    
    /* Убираем наложение на нижнее меню */
    .app-container {
        padding-bottom: 0;
    }
}

/* Игровой экран */
#game-screen {
    display: none;
    flex-direction: column;
    height: 100vh;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: white;
}

#game-screen.active {
    display: flex !important;
}

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

.back-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.game-info {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.game-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
}

.players-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
}

.players-list {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.player-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    min-width: 120px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.player-card.active {
    border-color: #F4D38B;
    background: rgba(244, 211, 139, 0.2);
}

.player-card.winner {
    border-color: #FFD700;
    background: rgba(255, 215, 0, 0.2);
}

.player-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.player-score {
    font-size: 18px;
    font-weight: bold;
    color: #4CAF50;
}

.player-wins {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 5px;
}

.dice-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.dice-container {
    display: flex;
    gap: 30px;
    justify-content: center;
}

.dice {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.dice-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.dice-result {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    z-index: 2;
}

.dice-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.current-player {
    font-size: 16px;
    color: #4CAF50;
    font-weight: bold;
}

.game-status {
    text-align: center;
}

.game-message {
    font-size: 18px;
    margin-bottom: 15px;
    color: rgba(255, 255, 255, 0.9);
}

.game-results {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.round-results {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
}

.result-item {
    text-align: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    min-width: 100px;
}

.result-player {
    font-weight: bold;
    margin-bottom: 5px;
}

.result-score {
    font-size: 20px;
    color: #4CAF50;
}

.round-winner {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    color: #FFD700;
    margin-top: 15px;
}

.game-winner {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: #FFD700;
    background: rgba(255, 215, 0, 0.2);
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
}

/* Адаптивность для игрового экрана */
@media (max-width: 480px) {
    .dice-container {
        gap: 15px;
    }
    
    .dice {
        width: 80px;
        height: 80px;
    }
    
    .players-list {
        justify-content: center;
    }
    
    .player-card {
        min-width: 100px;
        padding: 10px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .game-info {
        flex-direction: column;
        gap: 5px;
    }
}

/* Стили для кнопок баланса */
/* Старые стили balance-btn удалены - теперь используется action-btn */

/* Стили для модальных окон пополнения и вывода */
.deposit-section, .withdraw-section {
    margin-bottom: 20px;
}

.amount-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.amount-btn {
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.amount-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.amount-btn.selected {
    background: linear-gradient(45deg, #fff, #f0f0f0);
    color: #000;
    border-color: #fff;
}

.custom-amount {
    margin-bottom: 20px;
}

.custom-amount label {
    display: block;
    margin-bottom: 8px;
    color: #ccc;
    font-weight: 500;
}

.custom-amount input {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
}

.custom-amount input:focus {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.payment-info {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.payment-info h4 {
    margin-bottom: 15px;
    color: #fff;
}

.wallet-address {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.wallet-address code {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #fff;
    word-break: break-all;
    background: none;
    border: none;
    padding: 0;
}

.copy-btn {
    background: linear-gradient(45deg, #fff, #f0f0f0);
    color: #000;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
}

.copy-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.2);
}

.payment-note {
    color: #ccc;
    font-size: 14px;
    margin: 15px 0;
    text-align: center;
}

.payment-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.balance-info {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.balance-info p {
    color: #fff;
    font-size: 16px;
    font-weight: 500;
}

.balance-info span {
    color: #FFD700;
    font-weight: bold;
}

.withdraw-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.withdraw-form label {
    color: #ccc;
    font-weight: 500;
    margin-bottom: 5px;
}

.withdraw-form input {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
}

.withdraw-form input:focus {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.withdraw-note {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin-top: 10px;
}

.withdraw-note p {
    color: #FFD700;
    font-size: 12px;
    margin: 5px 0;
}

/* Адаптивность для модальных окон */
@media (max-width: 480px) {
    .amount-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .payment-actions {
        flex-direction: column;
    }
    
    .wallet-address {
        flex-direction: column;
        align-items: stretch;
    }
    
    .wallet-address code {
        text-align: center;
        margin-bottom: 10px;
    }
}

/* Версия страницы */
.page-version {
    position: fixed;
    bottom: 80px;
    right: 16px;
    font-size: 10px;
    color: rgba(244,211,139,0.85);
    z-index: 100;
    pointer-events: auto;
    cursor: pointer;
    font-weight: 500;
    padding: 3px 8px;
    background: rgba(5,5,5,0.35);
    border: 1px solid rgba(244,211,139,0.4);
    border-radius: 9999px;
}

/* Debug overlay - компактный (2 строки) */
.debug-overlay,
#debug-log {
    position: fixed;
    bottom: 80px;
    left: 8px;
    right: 8px;
    max-height: 50px !important;
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid rgba(244,211,139,0.4);
    border-radius: 8px;
    padding: 4px 8px;
    z-index: 9999;
    display: none;
    overflow-y: auto;
    font-family: monospace;
    font-size: 10px;
    line-height: 1.3;
    color: #0f0;
    backdrop-filter: blur(8px);
    pointer-events: auto;
}

.debug-content {
    white-space: pre-wrap;
    word-break: break-all;
    user-select: text;
}

.debug-content div {
    margin-bottom: 4px;
    padding: 2px 0;
    border-bottom: 1px solid rgba(244,211,139,0.1);
}

.theme-light .page-version {
    color: rgba(0, 0, 0, 0.5);
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 480px) {
    .page-version {
        bottom: 70px; /* Выше нижнего меню */
    }
}

/* Дополнительная защита от горизонтального сдвига на мобильных */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden !important;
        overscroll-behavior-x: none !important;
        width: 100vw !important;
        max-width: 100vw !important;
        position: relative !important;
    }
    
    .app-container,
    .screen,
    .main-content,
    .header,
    .bottom-menu {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
    
    /* Все дочерние элементы не должны выходить за границы */
    .app-container > *,
    .screen > *,
    .main-content > * {
        max-width: 100%;
        overflow-x: hidden;
    }
}
