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

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            overflow-x: hidden;
            position: relative;
        }

        .stars {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
        }

        .star {
            position: absolute;
            background: white;
            border-radius: 50%;
            animation: twinkle 3s infinite;
        }

        @keyframes twinkle {
            0%, 100% { opacity: 0.3; }
            50% { opacity: 1; }
        }

        .container {
            position: relative;
            z-index: 1;
            padding: 20px;
            width: 100%;
            max-width: 900px;
        }

        .home-screen, .game-screen, .win-screen {
            background: rgba(255, 255, 255, 0.95);
            border-radius: 30px;
            padding: 50px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            text-align: center;
            animation: slideUp 0.5s ease-out;
        }

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

        .hidden {
            display: none;
        }

        h1 {
            font-size: 3.5em;
            background: linear-gradient(135deg, #667eea, #764ba2);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            margin-bottom: 20px;
            animation: bounce 2s infinite;
        }

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

        .description {
            font-size: 1.2em;
            color: #555;
            margin-bottom: 40px;
            line-height: 1.6;
        }

        .difficulty-buttons {
            display: flex;
            flex-direction: column;
            gap: 15px;
            max-width: 400px;
            margin: 0 auto;
        }

        .btn {
            padding: 18px 40px;
            font-size: 1.2em;
            font-weight: bold;
            border: none;
            border-radius: 15px;
            cursor: pointer;
            transition: all 0.3s ease;
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
        }

        .btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
        }

        .btn.custom {
            background: linear-gradient(135deg, #f093fb, #f5576c);
        }

        .custom-grid-setup {
            margin-top: 30px;
            padding: 25px;
            background: #f8f9fa;
            border-radius: 20px;
        }

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

        .input-wrapper {
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .input-wrapper label {
            font-weight: bold;
            color: #555;
            margin-bottom: 8px;
        }

        .input-wrapper input {
            width: 80px;
            padding: 10px;
            font-size: 1.1em;
            border: 2px solid #667eea;
            border-radius: 10px;
            text-align: center;
        }

        .game-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
            padding: 20px;
            background: linear-gradient(135deg, #667eea, #764ba2);
            border-radius: 20px;
            color: white;
            flex-wrap: wrap;
            gap: 15px;
        }

        .stat {
            font-size: 1.3em;
            font-weight: bold;
        }

        .control-btn {
            padding: 10px 20px;
            background: rgba(255, 255, 255, 0.2);
            border: 2px solid white;
            color: white;
            border-radius: 10px;
            cursor: pointer;
            font-weight: bold;
            transition: all 0.3s;
        }

        .control-btn:hover {
            background: white;
            color: #667eea;
        }

        .game-grid {
            display: grid;
            gap: 12px;
            max-width: 800px;
            margin: 0 auto;
        }

        .card {
            aspect-ratio: 1;
            background: linear-gradient(135deg, #667eea, #764ba2);
            border-radius: 15px;
            cursor: pointer;
            position: relative;
            transform-style: preserve-3d;
            transition: transform 0.6s;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        }

        .card:hover:not(.flipped):not(.matched) {
            transform: scale(1.05);
        }

        .card.flipped {
            transform: rotateY(180deg);
        }

        .card-front, .card-back {
            position: absolute;
            width: 100%;
            height: 100%;
            backface-visibility: hidden;
            display: flex;
            justify-content: center;
            align-items: center;
            border-radius: 15px;
        }

        .card-front {
            background: linear-gradient(135deg, #667eea, #764ba2);
            font-size: 2em;
            color: white;
        }

        .card-back {
            background: white;
            transform: rotateY(180deg);
            font-size: 3em;
        }

        .card.matched {
            animation: matchPulse 0.6s;
        }

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

        .win-screen {
            padding: 60px;
        }

        .win-screen h2 {
            font-size: 3em;
            color: #667eea;
            margin-bottom: 20px;
        }

        .win-stats {
            font-size: 1.5em;
            color: #555;
            margin: 30px 0;
        }

        .win-stats span {
            color: #764ba2;
            font-weight: bold;
        }

        .confetti {
            position: fixed;
            font-size: 2em;
            animation: fall 3s linear;
            pointer-events: none;
        }

        @keyframes fall {
            to {
                transform: translateY(100vh) rotate(360deg);
                opacity: 0;
            }
        }

        @media (max-width: 768px) {
            .home-screen, .game-screen, .win-screen {
                padding: 30px 20px;
            }

            h1 {
                font-size: 2.5em;
            }

            .description {
                font-size: 1em;
            }

            .game-header {
                flex-direction: column;
            }
        }