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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(180deg, #3d2b79 0%, #2a1f5d 50%, #1d1333 100%);
    color: #ffffff;
    min-height: 100vh;
    padding-bottom: 80px;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
}

/* Страницы */
.page {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.page.active {
    display: block;
}

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

/* Верхняя информация */
.top-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.online-header {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    background: rgba(138, 92, 246, 0.15);
    backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(138, 92, 246, 0.3);
}

.round-number {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    background: rgba(251, 191, 36, 0.15);
    backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

/* Информация о раунде */
.round-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.info-item {
    background: rgba(138, 92, 246, 0.15);
    backdrop-filter: blur(10px);
    padding: 20px 15px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid rgba(138, 92, 246, 0.3);
}

.info-label {
    font-size: 13px;
    opacity: 0.7;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-value {
    font-size: 32px;
    font-weight: bold;
    color: #fbbf24;
}

/* Рулетка */
.roulette-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px 0;
    position: relative;
}

/* Треугольник-стрелка */
.roulette-container::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 20px solid #fbbf24;
    z-index: 10;
    filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.5));
}

#rouletteCanvas {
    position: absolute;
    border-radius: 50%;
}

.roulette-overlay {
    position: relative;
    width: 280px;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.roulette-text {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    padding: 40px 25px;
    line-height: 1.4;
    z-index: 5;
}

/* Список участников */
.players-list {
    background: rgba(138, 92, 246, 0.15);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 16px;
    margin-bottom: 20px;
    border: 1px solid rgba(138, 92, 246, 0.3);
    display: none;
}

.players-list.active {
    display: block;
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(88, 28, 135, 0.3);
    border-radius: 10px;
}

.player-item:last-child {
    margin-bottom: 0;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.player-name {
    font-weight: 600;
    font-size: 15px;
}

.player-bet {
    font-weight: bold;
    color: #fbbf24;
    font-size: 16px;
}

.player-chance {
    font-size: 13px;
    opacity: 0.7;
    margin-left: 8px;
}

/* Секция ставок */
.bet-section {
    background: rgba(138, 92, 246, 0.15);
    backdrop-filter: blur(10px);
    padding: 30px 25px;
    border-radius: 20px;
    border: 1px solid rgba(138, 92, 246, 0.3);
}

.bet-amount {
    text-align: center;
    font-size: 64px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #fbbf24;
    text-shadow: 0 0 30px rgba(251, 191, 36, 0.6);
}

.bet-slider {
    width: 100%;
    height: 8px;
    border-radius: 10px;
    background: rgba(138, 92, 246, 0.2);
    outline: none;
    margin: 15px 0 25px 0;
    -webkit-appearance: none;
}

.bet-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    cursor: pointer;
    box-shadow: 0 0 15px rgba(167, 139, 250, 0.6);
}

.bet-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 15px rgba(167, 139, 250, 0.6);
}

.bet-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 25px;
}

.percent-btn {
    padding: 14px;
    background: rgba(88, 28, 135, 0.4);
    border: 1px solid rgba(138, 92, 246, 0.4);
    border-radius: 12px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.percent-btn:hover {
    background: rgba(138, 92, 246, 0.5);
    border-color: #a78bfa;
    transform: translateY(-2px);
}

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

.bet-btn {
    width: 100%;
    padding: 20px;
    background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
    border: none;
    border-radius: 16px;
    color: #ffffff;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.4);
    transition: all 0.2s;
    text-transform: none;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.bet-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 35px rgba(124, 58, 237, 0.6);
}

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

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

.current-balance {
    text-align: center;
    font-size: 16px;
    opacity: 0.8;
    padding: 12px;
    background: rgba(88, 28, 135, 0.3);
    border-radius: 10px;
}

.current-balance span {
    font-weight: bold;
    color: #fbbf24;
}

/* Профиль */
#profilePage h1 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 32px;
}

.profile-info {
    text-align: center;
    margin-bottom: 30px;
}

.profile-name {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 10px;
}

.profile-id {
    font-size: 16px;
    opacity: 0.7;
}

.balance-section {
    background: rgba(138, 92, 246, 0.15);
    backdrop-filter: blur(10px);
    padding: 40px 30px;
    border-radius: 20px;
    text-align: center;
    margin-bottom: 20px;
    border: 1px solid rgba(138, 92, 246, 0.3);
}

.balance-label {
    font-size: 16px;
    opacity: 0.8;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.balance-value {
    font-size: 64px;
    font-weight: bold;
    color: #fbbf24;
    text-shadow: 0 0 30px rgba(251, 191, 36, 0.6);
}

.add-balance-btn {
    width: 100%;
    padding: 20px;
    background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
    border: none;
    border-radius: 16px;
    color: #ffffff;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.4);
    transition: all 0.2s;
}

.add-balance-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 35px rgba(124, 58, 237, 0.6);
}

/* Нижняя навигация */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(45, 27, 85, 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(138, 92, 246, 0.3);
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 12px 0;
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.5);
}

.nav-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn.active {
    color: #a78bfa;
}

.nav-icon {
    font-size: 26px;
}

.nav-label {
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
}

/* Popup */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s;
    backdrop-filter: blur(10px);
}

.popup.hidden {
    display: none;
}

.popup-content {
    background: linear-gradient(135deg, #3d2b79 0%, #2a1f5d 100%);
    padding: 45px 40px;
    border-radius: 24px;
    text-align: center;
    max-width: 340px;
    box-shadow: 0 15px 60px rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(138, 92, 246, 0.4);
}

.popup-emoji {
    font-size: 72px;
    margin-bottom: 25px;
}

.popup-title {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 20px;
}

.popup-message {
    font-size: 42px;
    font-weight: bold;
    margin-bottom: 30px;
    color: #fbbf24;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

.popup-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.popup-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(124, 58, 237, 0.5);
}

/* Уведомления */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    max-width: 90%;
}

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

.notification.success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.9) 0%, rgba(21, 128, 61, 0.9) 100%);
    border: 2px solid rgba(34, 197, 94, 0.5);
}

.notification.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.9) 0%, rgba(185, 28, 28, 0.9) 100%);
    border: 2px solid rgba(239, 68, 68, 0.5);
}

/* 🔐 ЭКРАН ВХОДА - МОБИЛЬНАЯ ВЕРСИЯ */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, #3d2b79 0%, #2a1f5d 50%, #1d1333 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    overflow-y: auto;
}

.login-container {
    text-align: center;
    padding: 50px 30px;
    background: rgba(42, 31, 61, 0.8);
    border-radius: 24px;
    border: 2px solid rgba(167, 139, 250, 0.3);
    max-width: 420px;
    width: 90%;
    backdrop-filter: blur(10px);
    margin: 20px auto;
}

.login-logo {
    font-size: 100px;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

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

.login-title {
    font-size: 42px;
    font-weight: bold;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle {
    font-size: 18px;
    color: #cbd5e1;
    margin-bottom: 35px;
    line-height: 1.6;
}

.telegram-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0088cc 0%, #005580 100%);
    color: white;
    padding: 18px 45px;
    border-radius: 14px;
    font-size: 20px;
    font-weight: 700;
    text-decoration: none;
    margin: 25px 0;
    transition: all 0.3s;
    box-shadow: 0 6px 25px rgba(0, 136, 204, 0.4);
}

.telegram-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 136, 204, 0.5);
}

.info-box {
    background: rgba(124, 58, 237, 0.12);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 14px;
    padding: 22px;
    margin-top: 30px;
}

.info-box p {
    font-size: 15px;
    color: #cbd5e1;
    line-height: 1.7;
    margin: 6px 0;
}

/* 🔐 ЭКРАН ВХОДА - ДЕСКТОПНАЯ ВЕРСИЯ (КОМПАКТНАЯ) */
.login-container-desktop {
    text-align: center;
    padding: 25px 30px 30px 30px;
    background: rgba(42, 31, 61, 0.85);
    border-radius: 20px;
    border: 2px solid rgba(167, 139, 250, 0.3);
    max-width: 440px;
    width: 90%;
    backdrop-filter: blur(10px);
    margin: 10px auto;
    max-height: 95vh;
    overflow-y: auto;
}

.login-logo-small {
    font-size: 60px;
    margin-bottom: 12px;
}

.login-title-small {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle-small {
    font-size: 15px;
    color: #cbd5e1;
    margin-bottom: 20px;
    opacity: 0.9;
}

.login-method-compact {
    margin: 15px 0;
    padding: 18px;
    background: rgba(88, 28, 135, 0.2);
    border-radius: 14px;
    border: 1px solid rgba(167, 139, 250, 0.2);
}

.method-title-compact {
    font-size: 14px;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 12px;
    opacity: 0.9;
}

.method-btn-compact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 280px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
    color: white;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    box-shadow: 0 3px 12px rgba(124, 58, 237, 0.3);
}

.method-btn-compact:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(124, 58, 237, 0.4);
}

.divider-compact {
    position: relative;
    margin: 12px 0;
    text-align: center;
}

.divider-compact::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: rgba(167, 139, 250, 0.2);
}

.divider-compact span {
    position: relative;
    background: rgba(42, 31, 61, 0.85);
    padding: 0 12px;
    font-size: 12px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* QR-код компактный */
#qrcode {
    display: inline-block;
    padding: 10px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
    margin: 10px auto;
    position: relative;
}

/* Принудительно скрываем дубликаты */
#qrcode > *:not(:first-child) {
    display: none !important;
}

#qrcode img,
#qrcode canvas {
    display: block !important;
    margin: 0 auto !important;
    border-radius: 4px;
}

.qr-hint-compact {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 8px;
    opacity: 0.8;
}

/* Telegram Login Widget */
#telegram-login-widget {
    display: flex;
    justify-content: center;
    min-height: 36px;
}

#telegram-login-widget iframe {
    border-radius: 8px !important;
}

/* Referral Section */
.referral-section {
    background: rgba(42, 31, 61, 0.6);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 16px;
    padding: 20px;
    margin-top: 20px;
}

.referral-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.ref-stat {
    background: rgba(26, 22, 37, 0.5);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
}

.ref-label {
    color: #9ca3af;
    font-size: 12px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ref-value {
    color: #a78bfa;
    font-size: 24px;
    font-weight: 700;
}

.referral-link-box {
    margin-top: 15px;
}

.link-container {
    display: flex;
    gap: 10px;
}

.btn-copy {
    padding: 10px 16px;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

/* Profile Header */
.profile-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.profile-avatar {
    width: 60px;
    height: 60px;
    background: rgba(167, 139, 250, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.profile-name {
    font-size: 20px;
    font-weight: 600;
    color: #e5e7eb;
}

.profile-id {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 4px;
}

.balance-section {
    background: rgba(42, 31, 61, 0.6);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
}

.balance-label {
    color: #9ca3af;
    font-size: 14px;
    margin-bottom: 8px;
}

.balance-amount {
    font-size: 48px;
    font-weight: 700;
    color: #fbbf24;
    margin-bottom: 15px;
}

.add-balance-btn {
    padding: 12px 32px;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

/* Referral Section */
.referral-section {
    background: rgba(42, 31, 61, 0.6);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 16px;
    padding: 20px;
}

.referral-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.ref-stat {
    background: rgba(26, 22, 37, 0.5);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
}

.ref-label {
    color: #9ca3af;
    font-size: 12px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ref-value {
    color: #a78bfa;
    font-size: 24px;
    font-weight: 700;
}

.referral-link-box {
    margin-top: 15px;
}

.link-container {
    display: flex;
    gap: 10px;
}

.btn-copy {
    padding: 10px 16px;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 18px;
    cursor: pointer;
}