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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a3a 100%);
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

.game-container {
    max-width: 700px;
    width: 100%;
    text-align: center;
    position: relative;
}

.game-title {
    font-size: 2.5rem;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease-in-out infinite;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

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

.score-board {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.score-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 25px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 120px;
}

.score-item.winner {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    animation: scoreGlow 1s ease-in-out;
}

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

.score-label {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

.score-value {
    font-size: 1.5rem;
    font-weight: bold;
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.player-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex: 1;
    min-width: 200px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.player-info.active {
    background: rgba(255, 107, 107, 0.2);
    border-color: #ff6b6b;
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.4);
    animation: playerPulse 2s ease-in-out infinite;
}

@keyframes playerPulse {
    0%, 100% { box-shadow: 0 0 30px rgba(255, 107, 107, 0.4); }
    50% { box-shadow: 0 0 50px rgba(255, 107, 107, 0.6); }
}

.player-name {
    font-size: 1.2rem;
    margin-bottom: 10px;
    font-weight: bold;
}

.emoji-display {
    font-size: 2.5rem;
    margin: 10px 0;
    transition: all 0.3s ease;
}

.emoji-display.next-emoji {
    animation: emojiFloat 2s ease-in-out infinite;
}

@keyframes emojiFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-5px) rotate(5deg); }
}

.emoji-count {
    font-size: 0.9rem;
    opacity: 0.8;
}

.combo-indicator {
    font-size: 0.8rem;
    margin-top: 5px;
    color: #ffd700;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.combo-indicator.active {
    opacity: 1;
    animation: comboGlow 1s ease-in-out infinite;
}

@keyframes comboGlow {
    0%, 100% { text-shadow: 0 0 5px #ffd700; }
    50% { text-shadow: 0 0 15px #ffd700, 0 0 25px #ffd700; }
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 30px auto;
    max-width: 320px;
    background: rgba(255, 255, 255, 0.05);
    padding: 25px;
    border-radius: 25px;
    backdrop-filter: blur(15px);
    position: relative;
}

.cell {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.cell:hover::before {
    transform: translateX(100%);
}

.cell:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #4ecdc4;
    box-shadow: 0 0 25px rgba(78, 205, 196, 0.4);
    transform: scale(1.05);
}

.cell.occupied {
    cursor: not-allowed;
}

.cell.vanishing {
    animation: vanishSpiral 0.8s ease-in-out;
}

.cell.placing {
    animation: placeBurst 0.6s ease-in-out;
}

.cell.winning {
    background: rgba(255, 215, 0, 0.3);
    border-color: #ffd700;
    animation: winningCell 1.5s ease-in-out infinite;
}

.cell.restricted {
    background: rgba(255, 0, 0, 0.2);
    border-color: #ff4757;
    animation: restrictedShake 0.5s ease-in-out;
}

@keyframes vanishSpiral {
    0% { transform: scale(1) rotate(0deg); opacity: 1; }
    50% { transform: scale(1.3) rotate(180deg); opacity: 0.3; }
    100% { transform: scale(0) rotate(360deg); opacity: 0; }
}

@keyframes placeBurst {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    50% { transform: scale(1.4) rotate(0deg); opacity: 0.8; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes winningCell {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.9);
        transform: scale(1.1);
    }
}

@keyframes restrictedShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.controls {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.btn {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.btn::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 ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

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

.btn.secondary {
    background: linear-gradient(45deg, #74b9ff, #0984e3);
}

.btn.secondary:hover {
    box-shadow: 0 8px 25px rgba(116, 185, 255, 0.4);
}

.setup-screen {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 25px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.category-selection {
    margin: 25px 0;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.category-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 20px 15px;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
}

.category-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.category-btn:hover::before {
    transform: translateX(100%);
}

.category-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #4ecdc4;
    transform: translateY(-2px);
}

.category-btn.selected {
    background: rgba(78, 205, 196, 0.3);
    border-color: #4ecdc4;
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.4);
    transform: scale(1.05);
}

.help-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 25px;
    border-radius: 18px;
    margin: 20px 0;
    text-align: left;
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.help-section.active {
    display: block;
    animation: slideIn 0.3s ease-out;
}

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

.help-section h3 {
    color: #4ecdc4;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.help-section ul {
    margin-left: 20px;
    line-height: 1.8;
}

.help-section li {
    margin-bottom: 8px;
}

.win-message {
    font-size: 2.2rem;
    margin: 25px 0;
    padding: 25px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #ffd700);
    background-size: 200% 200%;
    border-radius: 20px;
    animation: winPulse 1s ease-in-out infinite, gradientShift 2s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.win-message::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: winShine 2s linear infinite;
}

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

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

.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    font-size: 20px;
    animation: particleFloat 3s linear infinite;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

.sound-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.sound-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.streak-indicator {
    position: absolute;
    top: -30px;
    right: 10px;
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    opacity: 0;
    transition: all 0.3s ease;
}

.streak-indicator.active {
    opacity: 1;
    animation: streakGlow 1s ease-in-out infinite;
}

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

@media (max-width: 768px) {
    .game-title {
        font-size: 2rem;
    }
    
    .game-info {
        flex-direction: column;
    }
    
    .cell {
        font-size: 2.2rem;
    }
    
    .game-board {
        max-width: 300px;
        padding: 20px;
    }

    .score-board {
        gap: 15px;
    }

    .score-item {
        min-width: 100px;
        padding: 10px 15px;
    }
}