@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');

:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --grid-bg: #1e293b;
    --cell-bg: #334155;
    --target-color: #10b981;
    --target-active: #34d399;
    --danger-color: #ef4444;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    user-select: none;
    -webkit-user-select: none;
}

.game-container {
    width: 100%;
    max-width: 450px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    box-sizing: border-box;
}

.header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stats {
    display: flex;
    gap: 3rem;
    font-size: 1.25rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem 2rem;
    border-radius: 1rem;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: color 0.3s;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #94a3b8;
}

.stat-value {
    font-size: 1.75rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    background-color: var(--grid-bg);
    padding: 12px;
    border-radius: 1.5rem;
    aspect-ratio: 1;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transition: opacity 0.3s;
}

.cell {
    background-color: var(--cell-bg);
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.cell::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: transparent;
    transition: background-color 0.2s;
}

.cell:hover::after {
    background-color: rgba(255, 255, 255, 0.05);
}

.cell:active {
    transform: scale(0.95);
}

.cell.active {
    background-color: var(--target-color);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
    transform: scale(1.05);
    z-index: 2;
}

.cell.active:active {
    background-color: var(--target-active);
    transform: scale(0.95);
}

.cell.error {
    background-color: var(--danger-color);
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@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); }
}

.btn {
    background-color: #38bdf8;
    color: #0f172a;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: 700;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(56, 189, 248, 0.2);
}

.btn:hover {
    background-color: #7dd3fc;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(56, 189, 248, 0.3);
}

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

.game-over {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.game-over.visible {
    opacity: 1;
    pointer-events: auto;
}

.game-over h2 {
    font-size: 2.5rem;
    margin: 0 0 0.5rem 0;
    color: var(--text-color);
    background: linear-gradient(to right, #f43f5e, #fb923c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
