/* ============================================
   WORLD SOCIAL GAMES - LANDING PAGE STYLES
   Современный дизайн с glassmorphism эффектами
   ============================================ */

/* === БАЗОВЫЕ СТИЛИ === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Цветовая палитра */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --success-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);

    /* Цвета */
    --bg-dark: #0a0e27;
    --bg-darker: #050814;
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Тени */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --glow-primary: 0 0 20px rgba(102, 126, 234, 0.5);
    --glow-accent: 0 0 30px rgba(79, 172, 254, 0.6);
}

html {
    /* iOS 26 Safari - background must be on html to extend to rounded corners */
    background: var(--bg-darker);
    /* Use min-height to allow content to expand */
    min-height: 100%;
    min-height: 100dvh;
    /* Critical for iOS Safari to show background in safe areas */
    background-attachment: fixed;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-darker);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for iOS Safari */
    width: 100%;
    position: relative;
}

/* iOS 26 Safari fix - pseudo element to fill safe area corners */
body::before {
    content: '';
    position: fixed;
    inset: -100px; /* Extend well beyond screen edges */
    background: var(--bg-darker);
    z-index: -1;
    pointer-events: none;
}

/* === ФОНОВАЯ АНИМАЦИЯ === */
.background-animation {
    position: fixed;
    /* Fill entire screen including safe areas on iOS */
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background: var(--bg-darker);
}

/* Звездное небо */
.stars {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20% 30%, white, transparent),
        radial-gradient(2px 2px at 60% 70%, white, transparent),
        radial-gradient(1px 1px at 50% 50%, white, transparent),
        radial-gradient(1px 1px at 80% 10%, white, transparent),
        radial-gradient(2px 2px at 90% 60%, white, transparent),
        radial-gradient(1px 1px at 33% 80%, white, transparent);
    background-size: 200% 200%;
    animation: twinkle 8s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 0.3;
    }
}

/* Градиентные орбы */
.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--primary-gradient);
    top: -200px;
    left: -200px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: var(--accent-gradient);
    bottom: -250px;
    right: -250px;
    animation-delay: 5s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: var(--secondary-gradient);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 10s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(50px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-50px, 50px) scale(0.9);
    }
}

/* === ГЛАВНЫЙ КОНТЕЙНЕР === */
.landing-container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    /* Account for safe area insets on iOS devices with rounded corners */
    padding: calc(2rem + env(safe-area-inset-top, 0px)) calc(2rem + env(safe-area-inset-right, 0px)) calc(2rem + env(safe-area-inset-bottom, 0px)) calc(2rem + env(safe-area-inset-left, 0px));
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for iOS Safari */
    display: flex;
    flex-direction: column;
}

/* === ШАПКА === */
.header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 2rem;
    height: 52px; /* Fixed height to align all elements */
    gap: 1rem;
}

/* Demo badge - left aligned in first column */
.demo-badge {
    justify-self: start;
}

/* Avatar - centered in middle column */
.btn-login {
    justify-self: center;
}

/* Lite mode - right aligned in third column */
.btn-lite {
    justify-self: end;
}

/* Демо бейдж */
.demo-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    backdrop-filter: blur(10px);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: #fbbf24;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #fbbf24;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

/* Кнопка входа - Circular Avatar Button */
.btn-login {
    width: 52px;
    height: 52px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
}

/* Static gradient ring */
.btn-login::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    z-index: -1;
    opacity: 0.8;
    transition: all 0.4s ease;
}

/* Glow effect */
.btn-login::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.4) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -2;
}

.btn-login:hover::before {
    inset: -4px;
    animation-duration: 2s;
    opacity: 1;
}

.btn-login:hover::after {
    opacity: 1;
}

/* Avatar image */
.btn-login-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--bg-darker);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 0 20px rgba(102, 126, 234, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-login:hover {
    transform: translateY(-3px) scale(1.05);
}

.btn-login:hover .btn-login-avatar {
    box-shadow:
        0 8px 25px rgba(102, 126, 234, 0.5),
        0 0 40px rgba(102, 126, 234, 0.3),
        inset 0 0 30px rgba(102, 126, 234, 0.2);
}

.btn-login:active {
    transform: translateY(-1px) scale(1);
}

.btn-login:active .btn-login-avatar {
    box-shadow:
        0 4px 15px rgba(102, 126, 234, 0.4),
        inset 0 0 20px rgba(102, 126, 234, 0.2);
}

/* Кнопка lite режима */
.btn-lite {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: rgba(67, 233, 123, 0.1);
    border: 1px solid rgba(67, 233, 123, 0.3);
    border-radius: 50px;
    backdrop-filter: blur(10px);
    color: #43e97b;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-lite:hover {
    background: rgba(67, 233, 123, 0.15);
    border-color: rgba(67, 233, 123, 0.5);
    box-shadow: 0 0 15px rgba(67, 233, 123, 0.3);
    transform: translateY(-2px);
}

/* === ОСНОВНОЙ КОНТЕНТ === */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
}

/* === BRANDING === */
.branding {
    text-align: center;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 5rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.logo-world {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(var(--glow-primary));
    animation: glow-pulse 3s ease-in-out infinite;
}

.logo-social {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(var(--glow-accent));
    animation: glow-pulse 3s ease-in-out infinite 1s;
}

.logo-games {
    background: var(--secondary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: glow-pulse 3s ease-in-out infinite 2s;
}

@keyframes glow-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

.presented-by {
    font-size: 1rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.brand-name {
    font-weight: 700;
    background: var(--success-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === STATISTICS === */
.stats-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    width: 100%;
    max-width: 800px;
}

.stat-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    overflow: hidden;
    min-width: 320px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
    border-radius: 16px;
    flex-shrink: 0;
}

.stat-icon svg {
    color: white;
}

.stat-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    overflow: hidden;
    line-height: 1.2;
}

.stat-pulse {
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(79, 172, 254, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse-expand 2s ease-out infinite;
}

@keyframes pulse-expand {
    0% {
        transform: scale(0);
        opacity: 1;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* === КНОПКИ ДЕЙСТВИЙ === */
.action-buttons {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* Общие стили кнопок */
button {
    border: none;
    outline: none;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

/* Главная кнопка JOIN */
.btn-primary {
    position: relative;
    padding: 1.25rem 3rem;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: var(--primary-gradient);
    color: white;
    border-radius: 16px;
    cursor: pointer;
    overflow: hidden;
    box-shadow: var(--shadow-lg), var(--glow-primary);
    animation: float-button 3s ease-in-out infinite, pulse-glow 2s ease-in-out infinite;
}

@keyframes float-button {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: var(--shadow-lg), 0 0 20px rgba(102, 126, 234, 0.5);
    }

    50% {
        box-shadow: var(--shadow-lg), 0 0 40px rgba(102, 126, 234, 0.8), 0 0 60px rgba(102, 126, 234, 0.4);
    }
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
    transform: rotate(45deg);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }

    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

.btn-primary:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 16px 48px rgba(102, 126, 234, 0.7), 0 0 60px rgba(102, 126, 234, 0.9);
    animation: float-button 1.5s ease-in-out infinite, pulse-glow 1s ease-in-out infinite;
}

.btn-primary:active {
    transform: translateY(-2px) scale(1.02);
}

.btn-text {
    position: relative;
    z-index: 2;
}

.btn-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-primary:hover .btn-glow {
    opacity: 1;
    animation: rotate-glow 3s linear infinite;
}

@keyframes rotate-glow {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Кнопка трансляции */
.btn-secondary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    cursor: pointer;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #ef4444;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
    transform: translateY(-2px);
}

.live-indicator {
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

/* === ЛИДЕРБОРДЫ === */
.leaderboards-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
}

.leaderboard {
    padding: 2rem;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.leaderboard-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.leaderboard-title svg {
    color: #667eea;
}

.leaderboard-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    background: var(--glass-bg);
    border-radius: 20px;
    letter-spacing: 1px;
}

/* Список лидерборда */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

/* Топ 3 позиции с особым стилем */
.leaderboard-item.rank-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 215, 0, 0.05) 100%);
    border-color: rgba(255, 215, 0, 0.3);
}

.leaderboard-item.rank-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.1) 0%, rgba(192, 192, 192, 0.05) 100%);
    border-color: rgba(192, 192, 192, 0.3);
}

.leaderboard-item.rank-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.1) 0%, rgba(205, 127, 50, 0.05) 100%);
    border-color: rgba(205, 127, 50, 0.3);
}

.rank-number {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    width: 40px;
    text-align: center;
    color: var(--text-secondary);
}

.rank-1 .rank-number {
    color: #ffd700;
}

.rank-2 .rank-number {
    color: #c0c0c0;
}

.rank-3 .rank-number {
    color: #cd7f32;
}

.player-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.player-name,
.country-name {
    font-weight: 600;
    font-size: 1rem;
}

.player-country,
.country-players {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.player-score,
.country-score {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Флаг страны */
.country-flag {
    font-size: 2rem;
}

/* === GLASS CARD ЭФФЕКТ === */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
}

/* === ФУТЕР === */
.footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--glass-border);
}

/* === АДАПТИВНОСТЬ === */
@media (max-width: 768px) {
    .logo {
        font-size: 3rem;
    }

    .stats-section {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
        width: 100%;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .leaderboards-section {
        grid-template-columns: 1fr;
        justify-items: center;
        width: 100%;
    }

    .leaderboard {
        width: 100%;
        max-width: 100%;
    }

    .header {
        flex-direction: column;
        gap: 1.25rem;
        height: auto;
        align-items: center;
        justify-content: center;
        margin-bottom: 1.5rem;
    }

    .main-content {
        gap: 2rem;
    }

    .branding {
        margin-bottom: 0;
    }

    /* Bigger avatar on mobile - centered */
    .btn-login {
        width: 64px;
        height: 64px;
        order: 0; /* Avatar in the middle visually */
    }

    .btn-login::before {
        inset: -3px;
    }

    .btn-login:hover::before {
        inset: -4px;
    }

    /* Demo badge above avatar */
    .demo-badge {
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
        order: -1; /* Demo mode on top */
    }

    /* Lite mode below avatar */
    .btn-lite {
        font-size: 0.7rem;
        padding: 0.5rem 0.8rem;
        order: 1; /* Lite mode on bottom */
    }

    .landing-container {
        /* Account for safe area on mobile iOS devices */
        padding: calc(1rem + env(safe-area-inset-top, 0px)) calc(1rem + env(safe-area-inset-right, 0px)) calc(1rem + env(safe-area-inset-bottom, 0px)) calc(1rem + env(safe-area-inset-left, 0px));
    }
}

/* === EXTRA SMALL SCREENS === */
@media (max-width: 480px) {
    .header {
        gap: 0.75rem;
        padding: 0.5rem 0;
    }

    /* Slightly smaller avatar for tiny screens */
    .btn-login {
        width: 56px;
        height: 56px;
    }

    .demo-badge {
        font-size: 0.65rem;
        padding: 0.35rem 0.7rem;
    }

    .btn-lite {
        font-size: 0.65rem;
        padding: 0.45rem 0.7rem;
    }

    .btn-lite svg {
        width: 14px;
        height: 14px;
    }

    /* Disable glow effects on small screens for performance */
    .btn-login::after {
        display: none;
    }
}

/* === АНИМАЦИЯ ПОЯВЛЕНИЯ === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.branding,
.stats-section,
.action-buttons,
.leaderboards-section {
    animation: fadeInUp 0.8s ease-out forwards;
}

.stats-section {
    animation-delay: 0.2s;
}

.action-buttons {
    animation-delay: 0.4s;
}

.leaderboards-section {
    animation-delay: 0.6s;
}