/* ============================================
   🎨 TURBO TAPPER - Liquid Glass & 3D Styles
   ============================================ */

:root {
    /* Colors */
    --primary: #667eea;
    --primary-light: #764ba2;
    --secondary: #f093fb;
    --accent: #4facfe;
    --success: #43e97b;
    --warning: #fa709a;
    --danger: #ff6b6b;
    
    /* Glass effect */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: rgba(0, 0, 0, 0.1);
    
    /* Gradients */
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-glow: linear-gradient(135deg, #667eea, #764ba2, #f093fb);
    
    /* Sizes */
    --border-radius: 24px;
    --border-radius-sm: 16px;
    --border-radius-lg: 32px;
    
    /* Animation */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ============================================
   🌐 Base Styles
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    height: 100%;
    overflow: hidden;
}

body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: #0f0c29;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    color: white;
    position: fixed;
    user-select: none;
    touch-action: manipulation; /* Предотвращает зум при двойном тапе */
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================
   🎭 Animated Background
   ============================================ */

.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s ease-in-out infinite;
}

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

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

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

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(100px, -100px) scale(1.1);
    }
    66% {
        transform: translate(-100px, 100px) scale(0.9);
    }
}

/* ============================================
   ✨ Particle Canvas
   ============================================ */

#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* ============================================
   📦 Container
   ============================================ */

.container {
    position: fixed;
    z-index: 2;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 600px;
    margin: 0 auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* ============================================
   💎 Glass Card
   ============================================ */

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: 
        0 8px 32px 0 var(--glass-shadow),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 48px 0 rgba(0, 0, 0, 0.2),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.15);
}

/* ============================================
   🎯 Header
   ============================================ */

.header {
    text-align: center;
    padding: 16px 20px;
    animation: slideDown 0.6s var(--bounce);
    flex-shrink: 0;
}

.logo {
    font-size: 36px;
    margin-bottom: 8px;
    animation: pulse 2s ease-in-out infinite;
}

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

.title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 2px;
    background: var(--gradient-glow);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
    margin-bottom: 4px;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.subtitle {
    font-size: 14px;
    opacity: 0.8;
    font-weight: 500;
}

.tournament-timer {
    margin-top: 12px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tournament-timer-label {
    font-size: 11px;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    font-weight: 600;
}

.tournament-timer-value {
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, #43e97b, #38f9d7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   📊 Stats Bar (Collapsible)
   ============================================ */

.stats-bar {
    padding: 12px 16px;
    animation: slideUp 0.6s var(--bounce) 0.1s backwards;
    flex-shrink: 0;
    transition: var(--transition);
}

.stats-bar.collapsible {
    cursor: pointer;
}

.stats-header {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: space-between;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-item.compact {
    flex: 1;
    justify-content: center;
}

.stat-icon {
    font-size: 24px;
    line-height: 1;
}

.stat-value {
    font-size: 20px;
    font-weight: 800;
    background: var(--gradient-3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.collapse-icon {
    font-size: 16px;
    opacity: 0.7;
    transition: transform 0.3s ease;
}

.stats-bar:not(.collapsed) .collapse-icon {
    transform: rotate(180deg);
}

.stats-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: var(--transition);
}

.stat-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-size: 12px;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.stat-value-detail {
    font-size: 18px;
    font-weight: 800;
    background: var(--gradient-3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* ============================================
   🎮 Game Area
   ============================================ */

.game-area {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 0.6s ease 0.2s backwards;
}

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

/* Game Info */
.game-info {
    display: flex;
    gap: 12px;
    padding: 16px;
    flex-shrink: 0;
}

.timer-section,
.score-section {
    flex: 1;
    text-align: center;
}

.timer-label,
.score-label {
    font-size: 12px;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    font-weight: 600;
}

.timer-value,
.score-value {
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 12px;
}

.timer-value {
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: transform 0.2s ease, color 0.3s ease;
}

.score-value {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.timer-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.timer-progress {
    height: 100%;
    background: var(--gradient-2);
    border-radius: 4px;
    transition: width 0.1s linear, background 0.3s ease, box-shadow 0.2s ease;
    box-shadow: 0 0 20px rgba(250, 112, 154, 0.6);
}

.combo {
    display: inline-block;
    font-size: 20px;
    font-weight: 700;
    padding: 4px 12px;
    background: var(--gradient-3);
    border-radius: 12px;
    margin-top: 8px;
    animation: comboAppear 0.3s var(--bounce);
}

@keyframes comboAppear {
    from {
        opacity: 0;
        transform: scale(0);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   🎯 Tap Button (3D Liquid Glass)
   ============================================ */

.tap-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    perspective: 1000px;
    flex-shrink: 0;
    position: relative;
}

.tap-button {
    width: 220px;
    height: 220px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.1s ease;
    animation: buttonFloat 3s ease-in-out infinite;
    touch-action: manipulation; /* Предотвращает зум */
    pointer-events: none; /* Кнопка теперь визуальная, тапы через overlay */
}

/* Tap Overlay - большая область тапа для iOS */
.tap-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.tap-overlay.hidden {
    display: none;
    pointer-events: none;
}

@keyframes buttonFloat {
    0%, 100% {
        transform: translateY(0) rotateX(0deg) rotateY(0deg);
    }
    50% {
        transform: translateY(-10px) rotateX(5deg) rotateY(5deg);
    }
}

.tap-button:active {
    transform: scale(0.95) !important;
}

.tap-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.button-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--glass-bg);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border: 2px solid var(--glass-border);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 100px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.button-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        transparent,
        var(--primary),
        var(--secondary),
        var(--accent),
        transparent
    );
    animation: rotate 4s linear infinite;
    opacity: 0.5;
}

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

.button-text {
    position: relative;
    z-index: 2;
    font-size: 36px;
    font-weight: 900;
    letter-spacing: 3px;
    background: var(--gradient-glow);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
    text-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
}

.ripple-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    pointer-events: none;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.6) 0%, transparent 70%);
    transform: scale(0);
    animation: rippleEffect 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ============================================
   🚀 Start Button
   ============================================ */

.glass-button {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 20px 40px;
    font-size: 20px;
    font-weight: 700;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: var(--transition);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

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

.glass-button:hover::before {
    left: 100%;
}

.glass-button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 12px 48px rgba(102, 126, 234, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-color: var(--primary);
}

.glass-button:active {
    transform: scale(0.98);
}

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

.start-button {
    width: 100%;
    letter-spacing: 2px;
}

/* ============================================
   ⏱️ Countdown
   ============================================ */

.countdown {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    gap: 20px;
}

.countdown.hidden {
    display: none;
}

.countdown-number {
    font-size: 120px;
    font-weight: 900;
    background: var(--gradient-glow);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: countdownPulse 1s ease-in-out, gradientShift 2s ease infinite;
    text-shadow: 0 0 60px rgba(102, 126, 234, 0.8);
}

@keyframes countdownPulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.countdown-text {
    font-size: 24px;
    font-weight: 600;
    color: white;
    opacity: 0.8;
    animation: fadeIn 0.5s ease;
}

/* ============================================
   🏆 Leaderboard (Collapsible)
   ============================================ */

.leaderboard {
    padding: 16px;
    animation: slideUp 0.6s var(--bounce) 0.3s backwards;
    flex-shrink: 0;
    transition: var(--transition);
}

.leaderboard.collapsible {
    cursor: pointer;
}

.leaderboard.collapsed {
    padding-bottom: 16px;
}

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

.leaderboard-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 800;
}

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

.leaderboard-body {
    margin-top: 16px;
    transition: var(--transition);
}

.leaderboard.collapsed #leaderboardCollapseIcon {
    transform: rotate(0deg);
}

.leaderboard:not(.collapsed) #leaderboardCollapseIcon {
    transform: rotate(180deg);
}

.leaderboard-tabs {
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 12px;
}

.tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.tab.active {
    background: var(--gradient-1);
    color: white;
}

.leaderboard-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    max-height: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.leaderboard-loading {
    text-align: center;
    padding: 40px;
    opacity: 0.6;
}

.leader-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    animation: slideRight 0.4s var(--bounce) backwards;
}

.leader-item:nth-child(1) { animation-delay: 0s; }
.leader-item:nth-child(2) { animation-delay: 0.05s; }
.leader-item:nth-child(3) { animation-delay: 0.1s; }
.leader-item:nth-child(4) { animation-delay: 0.15s; }
.leader-item:nth-child(5) { animation-delay: 0.2s; }

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.leader-item.highlight {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    border: 1px solid var(--primary);
}

.leader-rank {
    font-size: 24px;
    font-weight: 800;
    min-width: 40px;
    text-align: center;
}

.leader-rank.medal {
    font-size: 32px;
}

.leader-info {
    flex: 1;
    min-width: 0;
}

.leader-name {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leader-score {
    font-size: 24px;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

.leaderboard-footer {
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.prize-info {
    text-align: center;
    font-size: 14px;
    opacity: 0.8;
}

/* ============================================
   🎉 Result Modal
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

.modal-content {
    max-width: 400px;
    width: 100%;
    padding: 40px;
    text-align: center;
    animation: modalAppear 0.4s var(--bounce);
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.result-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounce 0.6s var(--bounce);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.result-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 16px;
    background: var(--gradient-glow);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-score {
    font-size: 48px;
    font-weight: 900;
    margin-bottom: 24px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.result-stat {
    flex: 1;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-sm);
}

.result-stat-label {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 8px;
}

.result-stat-value {
    font-size: 24px;
    font-weight: 800;
}

.promo-block {
    padding: 24px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    border: 1px solid var(--primary);
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    animation: prizeWin 0.8s var(--bounce);
}

@keyframes prizeWin {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
}

.promo-badge {
    font-size: 14px;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.promo-code {
    font-size: 32px;
    font-weight: 900;
    letter-spacing: 2px;
    margin-bottom: 16px;
    font-family: 'Courier New', monospace;
}

/* ============================================
   🔘 Buttons
   ============================================ */

.btn {
    padding: 16px 32px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.6);
}

.btn-copy {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-copy:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-share {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

.btn-share:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

.result-actions {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-top: 8px;
}

.result-actions .btn {
    flex: 1;
}

/* ============================================
   📖 Rules Modal
   ============================================ */

.rules-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: bounce 0.6s var(--bounce);
}

.rules-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 20px;
    background: var(--gradient-glow);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.rules-text {
    text-align: left;
    margin-bottom: 24px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.rules-text p {
    margin-bottom: 12px;
    line-height: 1.6;
}

.rules-text strong {
    color: var(--success);
    font-size: 16px;
}

.rules-text ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 16px;
}

.rules-text li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
    line-height: 1.5;
}

.rules-text li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

.rules-note {
    background: rgba(67, 233, 123, 0.1);
    border-left: 3px solid var(--success);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}

/* ============================================
   ⏳ Loader
   ============================================ */

.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    gap: 20px;
}

.loader.hidden {
    display: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   ⚠️ Error Toast
   ============================================ */

.error-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: rgba(255, 107, 107, 0.9);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px rgba(255, 107, 107, 0.4);
    animation: toastAppear 0.3s var(--bounce);
}

.error-toast.hidden {
    display: none;
}

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

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

.error-text {
    font-size: 16px;
    font-weight: 600;
}

/* ============================================
   📱 Responsive
   ============================================ */

@media (max-width: 480px) {
    .container {
        padding: 10px;
        gap: 10px;
    }
    
    .header {
        padding: 12px 16px;
    }
    
    .logo {
        font-size: 32px;
    }
    
    .title {
        font-size: 20px;
    }
    
    .tournament-timer {
        margin-top: 10px;
        padding: 6px 12px;
    }
    
    .tournament-timer-label {
        font-size: 10px;
        margin-bottom: 2px;
    }
    
    .tournament-timer-value {
        font-size: 14px;
    }
    
    .rules-text {
        max-height: 300px;
        font-size: 14px;
    }
    
    .rules-title {
        font-size: 20px;
    }
    
    .rules-icon {
        font-size: 48px;
    }
    
    .modal-content {
        padding: 24px;
    }
    
    .tap-button {
        width: 200px;
        height: 200px;
    }
    
    .button-text {
        font-size: 32px;
    }
    
    .timer-value,
    .score-value {
        font-size: 32px;
    }
    
    .result-score {
        font-size: 36px;
    }
    
    .result-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .result-actions .btn {
        width: 100%;
        padding: 14px 24px;
        font-size: 14px;
    }
}

@media (max-height: 700px) {
    .tap-button {
        width: 180px;
        height: 180px;
    }
    
    .button-text {
        font-size: 28px;
    }
    
    .tap-button-container {
        padding: 10px 0;
    }
}

/* ============================================
   🎨 Utility Classes
   ============================================ */

.hidden {
    display: none !important;
}

/* Предотвращение масштабирования при двойном тапе */
* {
    touch-action: manipulation;
}

button, .tap-button, .glass-button {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

/* ============================================
   ⏱️ Time Bonus Indicator
   ============================================ */

.time-bonus {
    position: fixed;
    font-size: 20px;
    font-weight: 800;
    color: #43e97b;
    text-shadow: 
        0 0 10px rgba(67, 233, 123, 0.8),
        0 0 20px rgba(67, 233, 123, 0.5);
    pointer-events: none;
    z-index: 9999;
    transform: translateX(-50%);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    animation: timeBonusPop 0.3s ease;
}

@keyframes timeBonusPop {
    0% {
        transform: translateX(-50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translateX(-50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}

/* Скрыть скроллбар но оставить функциональность */
.leaderboard-content::-webkit-scrollbar {
    width: 4px;
}

.leaderboard-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.leaderboard-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

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

.disabled {
    opacity: 0.5;
    pointer-events: none;
}
