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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #e2e8f0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.site-header {
    text-align: center;
    padding: 40px 20px 20px;
}

.site-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: 0.5px;
}

.subtitle {
    margin-top: 8px;
    color: #94a3b8;
    font-size: 0.95rem;
}

.game {
    width: 100%;
    max-width: 520px;
    padding: 20px;
    flex: 1;
}

.stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 1rem;
    color: #cbd5e1;
}

.stat .label { color: #94a3b8; }

.board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    perspective: 1000px;
}

.card {
    aspect-ratio: 1 / 1;
    background: #334155;
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.35s ease;
    user-select: none;
}

.card.flipped,
.card.matched {
    transform: rotateY(180deg);
    cursor: default;
}

.card.matched {
    box-shadow: 0 0 0 2px #22c55e inset;
}

.card .face {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    backface-visibility: hidden;
    font-size: 2rem;
}

.card .front {
    background: #334155;
    color: #64748b;
    font-size: 1.4rem;
}

.card .back {
    background: #1e293b;
    transform: rotateY(180deg);
}

.card.matched .back {
    background: #14532d;
}

.controls {
    margin-top: 24px;
    text-align: center;
}

.btn {
    background: #3b82f6;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn:hover { background: #2563eb; }

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

.message {
    text-align: center;
    margin-top: 20px;
    min-height: 1.5em;
    color: #22c55e;
    font-weight: 600;
}

.site-footer {
    padding: 24px;
    color: #64748b;
    font-size: 0.85rem;
    text-align: center;
}

@media (max-width: 480px) {
    .site-header h1 { font-size: 1.5rem; }
    .board { gap: 8px; }
    .card .face { font-size: 1.5rem; }
}
