/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    /* Core Colors */
    --bg-gradient-1: #0f2027;
    --bg-gradient-2: #203a43;
    --bg-gradient-3: #2c5364;

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glass-blur: 10px;

    /* Accents */
    --primary: #00f260;
    --secondary: #0575e6;
    --accent: #ff0099;
    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);

    /* Game Colors */
    --card-back: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-matched: linear-gradient(135deg, #00f260 0%, #0575e6 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

*::selection {
    background-color: #00f260;
    color: #0f2027;
}

body {
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    background: linear-gradient(to right, var(--bg-gradient-1), var(--bg-gradient-2), var(--bg-gradient-3));
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

body::-webkit-scrollbar {
    display: none;
}

/* Background Animation */
.bg-circles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.circle {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    opacity: 0.2;
    filter: blur(80px);
    animation: float 20s infinite ease-in-out;
}

.circle:nth-child(1) {
    width: 400px;
    height: 400px;
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.circle:nth-child(2) {
    width: 300px;
    height: 300px;
    bottom: -50px;
    right: -50px;
    background: linear-gradient(45deg, var(--accent), var(--secondary));
    animation-delay: -5s;
}

.circle:nth-child(3) {
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(45deg, var(--primary), var(--accent));
    animation-delay: -10s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, 50px);
    }
}

/* Common Glass Styles */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 20px;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

/* Screens */
.screen {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.5s ease-out;
}

.screen.active {
    display: flex;
}

/* Setup Screen */
.setup-container {
    max-width: 500px;
    width: 100%;
    padding: 40px;
    text-align: center;
}

.game-logo {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 40px;
    font-size: 1.1rem;
}

.form-group {
    margin-bottom: 25px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-field {
    width: 100%;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 242, 96, 0.2);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.option-card {
    position: relative;
}

.option-card input {
    display: none;
}

.option-card label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    height: 100%;
}

.option-card label i {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.option-card input:checked+label {
    background: rgba(5, 117, 230, 0.2);
    border-color: var(--secondary);
    box-shadow: 0 0 15px rgba(5, 117, 230, 0.3);
}

.option-card input:checked+label i,
.option-card input:checked+label span {
    color: var(--text-main);
}

.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 242, 96, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Game Screen */
.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 15px 25px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.stats-container {
    display: flex;
    gap: 20px;
}

.stat-box {
    text-align: center;
    padding: 10px 20px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

.game-controls {
    display: flex;
    gap: 10px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.icon-btn:hover {
    background: var(--primary);
    color: var(--bg-gradient-1);
}

/* Grid */
.game-grid {
    display: grid;
    gap: 15px;
    perspective: 1000px;
    margin: 0 auto;
}

.card {
    position: relative;
    width: 100px;
    height: 100px;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.card.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-front {
    background: var(--card-back);
    transform: rotateY(0deg);
}

.card-front i {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.8);
}

.card-back {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transform: rotateY(180deg);
    color: var(--text-main);
    border: 2px solid var(--primary);
}

.card.matched .card-back {
    background: var(--card-matched);
    box-shadow: 0 0 20px var(--primary);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        transform: rotateY(180deg) scale(1);
    }

    50% {
        transform: rotateY(180deg) scale(1.05);
    }

    100% {
        transform: rotateY(180deg) scale(1);
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    max-width: 400px;
    width: 90%;
    text-align: center;
    padding: 40px;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    color: var(--primary);
}

.modal-title {
    font-size: 2rem;
    margin-bottom: 10px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 25px 0;
}

/* Leaderboard */
.leaderboard-list {
    list-style: none;
    margin-top: 20px;
    text-align: left;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.rank {
    color: var(--primary);
    font-weight: 700;
    width: 30px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: 20px;
    }

    .stats-container {
        width: 100%;
        justify-content: space-around;
    }

    .card {
        width: 70px;
        height: 70px;
    }

    .card-face {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .card {
        width: 60px;
        height: 60px;
    }

    .game-logo {
        font-size: 2.5rem;
    }
}