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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe-ui', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    touch-action: manipulation;
}

.screen {
    display: block;
}

.screen.hidden {
    display: none !important;
}

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

.header {
    text-align: center;
    margin-bottom: 20px;
    color: white;
}

.header h1 {
    font-size: 24px;
    margin-bottom: 10px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.info-item {
    text-align: center;
}

.info-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.info-value {
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.game-board {
    display: grid;
    gap: 6px;
    margin: 20px auto;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 7/9;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 10px;
}

.tile {
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    position: relative;
}

.tile:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

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

@keyframes tileFall {
    0% {
        transform: translateY(-100px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.tile.new {
    animation: tileFall 0.3s ease;
}

/* Кнопки */
.start-btn-green {
    padding: 16px 30px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    width: 100%;
    margin-bottom: 12px;
}

.start-btn-green:hover {
    background: linear-gradient(135deg, #218838 0%, #1ba87e 100%);
    transform: translateY(-2px);
}

.leaders-btn {
    padding: 16px 30px;
    background: linear-gradient(135deg, #ff9900 0%, #ff6600 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    width: 100%;
}

.leaders-btn:hover {
    background: linear-gradient(135deg, #e68900 0%, #e65c00 100%);
    transform: translateY(-2px);
}

.back-btn-mobile {
    padding: 14px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
}

/* Модальные окна */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    width: 100%;
    max-width: 400px;
    animation: modalAppear 0.3s ease;
}

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

/* Результаты */
.results-container {
    background: white;
    padding: 25px;
    border-radius: 15px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.score-result {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #333;
}

/* Адаптивность */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .game-board {
        gap: 4px;
        padding: 8px;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .start-btn-green,
    .leaders-btn {
        padding: 14px;
        font-size: 16px;
    }
}

/* Стили для элементов с картинками */
.tile > div {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Анимация для новых элементов при заполнении */
@keyframes newTileAppear {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}