:root {
    --bg-dark: #0f172a;
    --text-light: #f8fafc;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #10b981;
    --danger: #ef4444;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --tile-bg: rgba(51, 65, 85, 0.8);
    --tile-hover: rgba(71, 85, 105, 0.9);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    height: 100vh;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background animated shapes */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: float 20s infinite alternate ease-in-out;
}

.shape1 {
    width: 400px;
    height: 400px;
    background: rgba(59, 130, 246, 0.3);
    top: -100px;
    left: -100px;
}

.shape2 {
    width: 500px;
    height: 500px;
    background: rgba(16, 185, 129, 0.2);
    bottom: -200px;
    right: -100px;
    animation-delay: -5s;
}

.shape3 {
    width: 300px;
    height: 300px;
    background: rgba(139, 92, 246, 0.2);
    bottom: 50%;
    left: 50%;
    transform: translate(-50%, 50%);
    animation-delay: -10s;
}

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

#app {
    width: 100%;
    max-width: 800px;
    height: 100%;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    position: relative;
}

/* Header */
header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    position: relative;
    z-index: 10;
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(to right, #60a5fa, #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.stats {
    display: flex;
    gap: 2rem;
    background: var(--glass-bg);
    padding: 1rem 2rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.stat-box {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    gap: 0.5rem;
    color: #cbd5e1;
}

.stat-box span {
    color: white;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

.status-message {
    font-size: 1.5rem;
    font-weight: 600;
    height: 2rem;
    color: #94a3b8;
    transition: color 0.3s;
}

.status-message.showing { color: var(--accent); }
.status-message.playing { color: var(--primary); }

/* Main Grid */
main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.grid-container {
    display: grid;
    gap: 10px;
    background: var(--glass-bg);
    padding: 20px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.tile {
    width: 60px;
    height: 60px;
    background: var(--tile-bg);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.05),
                0 4px 6px rgba(0, 0, 0, 0.2);
}

@media (max-width: 600px) {
    .tile {
        width: 45px;
        height: 45px;
    }
    h1 { font-size: 2rem; }
    .stats { flex-direction: column; gap: 0.5rem; padding: 1rem; align-items: center;}
}

/* Tile States */
.grid-container:not(.disabled) .tile:hover {
    transform: translateY(-2px) scale(1.05);
    background: var(--tile-hover);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}

.grid-container.disabled .tile {
    cursor: default;
}

.tile.highlighted {
    background: var(--primary);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6),
                inset 0 0 10px rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.05);
}

.tile.correct {
    background: var(--accent);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.6),
                inset 0 0 10px rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255, 0.8);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.tile.incorrect {
    background: var(--danger);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
    border-color: rgba(255, 255, 255, 0.8);
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Animations */
@keyframes popIn {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 100;
}

.modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--glass-bg);
    padding: 3rem;
    border-radius: 24px;
    text-align: center;
    border: 1px solid var(--glass-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 90%;
    width: 400px;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #f8fafc, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-content.game-over h2 {
    background: linear-gradient(to right, #ef4444, #f87171);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-content p {
    color: #cbd5e1;
    font-size: 1.1rem;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.stats-recap {
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stats-recap span {
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 800;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
    width: 100%;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px rgba(59, 130, 246, 0.4);
}

.primary-btn:active {
    transform: translateY(1px);
}
