/* CSS Variables for theming */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --background: #ffffff;
    --surface: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --success: #10b981;
    --error: #ef4444;
    --card-bg: #ffffff;
    --card-hover: #f1f5f9;
}

/* Dark mode variables */
[data-theme="dark"] {
    --background: #0f172a;
    --surface: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --card-bg: #1e293b;
    --card-hover: #334155;
}

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

body {
    font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', 'Poppins', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 15px;
}

.title i {
    font-size: 2rem;
    animation: pulse 2s infinite;
}

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

.theme-btn {
    background: var(--surface);
    border: 2px solid var(--border);
    color: var(--text-primary);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.theme-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: rotate(180deg);
}

/* Game Info */
.game-info {
    margin-bottom: 30px;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    padding: 15px 25px;
    border-radius: 15px;
    border: 2px solid var(--border);
    min-width: 120px;
    justify-content: center;
    transition: all 0.3s ease;
}

.stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat i {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.stat span {
    font-weight: 600;
    font-size: 1.1rem;
}

/* Game Container */
.game-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    max-width: 600px;
    width: 100%;
    padding: 20px;
    background: var(--surface);
    border-radius: 20px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.card {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 15px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    perspective: 800px;
    min-width: 0;
    min-height: 0;
    display: block;
}

.card-inner {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.5s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
}

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

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

.card-front {
    background: var(--primary-color);
    color: white;
    transform: rotateY(180deg);
    z-index: 2;
}

.card-back {
    background: var(--card-bg);
    border: 2px solid var(--border);
    z-index: 1;
    font-size: 2rem;
    color: var(--text-secondary);
}

.card-symbol {
    font-size: 2.5rem;
    display: block;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', 'Poppins', sans-serif;
}

.card:hover {
    background: var(--card-hover);
    box-shadow: var(--shadow);
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    min-width: 140px;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: var(--surface);
    padding: 40px;
    border-radius: 20px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    text-align: center;
    animation: slideIn 0.3s ease;
}

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

.modal-content h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 2rem;
}

.final-stats {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.final-stats p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.final-stats span {
    color: var(--text-primary);
    font-weight: 600;
}

.name-input {
    margin: 20px 0;
    text-align: left;
}

.name-input label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
}

.name-input input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.name-input input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* Leaderboard */
.leaderboard-list {
    max-height: 300px;
    overflow-y: auto;
    margin: 20px 0;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--card-bg);
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.3s ease;
}

.leaderboard-item:hover {
    background: var(--card-hover);
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-rank {
    font-weight: 700;
    color: var(--primary-color);
    min-width: 30px;
}

.leaderboard-name {
    flex: 1;
    text-align: left;
    margin-left: 15px;
    font-weight: 600;
}

.leaderboard-score {
    color: var(--text-secondary);
    font-weight: 600;
}

.leaderboard-time {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-left: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .title i {
        font-size: 1.5rem;
    }
    
    .stats {
        gap: 20px;
    }
    
    .stat {
        padding: 12px 20px;
        min-width: 100px;
    }
    
    .game-board {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        padding: 15px;
    }
    
    .card {
        font-size: 1.5rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 250px;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
    
    .modal-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .leaderboard-item {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
    
    .leaderboard-name {
        text-align: center;
        margin-left: 0;
    }
    
    .leaderboard-time {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .game-board {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats {
        flex-direction: column;
        align-items: center;
    }
    
    .stat {
        width: 100%;
        max-width: 200px;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

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

/* Success animation */
.success-flash {
    animation: successFlash 0.5s ease;
}

@keyframes successFlash {
    0%, 100% { background: var(--card-bg); }
    50% { background: var(--success); }
} 