/* ──────────────────────────────────────────
   Number Match — Styles
   ────────────────────────────────────────── */

body {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    padding: 0;
    margin: 0;
    background: radial-gradient(circle at top left, #b91c1c 0%, #7f1d1d 60%, #450a0a 100%);
    overflow: hidden;
}

.game-container {
    width: 100%;
    max-width: 500px;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    background: rgba(0,0,0,0.15);
}

/* ── Header ── */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    position: absolute;
    top: 0.75rem; left: 0.75rem; right: 0.75rem;
    z-index: 10;
    border-radius: var(--radius-full);
}

.btn-back {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    background: rgba(255,255,255,0.1);
    border: none;
}

.stats {
    display: flex;
    gap: 1.25rem;
    font-weight: 700;
    font-size: 0.9rem;
}

.moves-display { color: white; }
.timer-display { color: #facc15; font-variant-numeric: tabular-nums; }

/* ── Prompt bar ── */
.prompt-bar {
    position: absolute;
    top: 4.5rem;
    left: 1.5rem; right: 1.5rem;
    z-index: 10;
    padding: 0.8rem 1.25rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255,255,255,0.15);
}

.prompt-label {
    color: rgba(255,255,255,0.6);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.prompt-category {
    color: #f87171;
    font-size: 1.2rem;
    font-weight: 800;
}

.round-counter {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ── Play area ── */
.play-area {
    flex-grow: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-top: 7rem;
    padding-bottom: 2rem;
    width: 100%;
}

/* ── Grid Container ── */
.grid-container {
    display: grid;
    gap: 0.75rem;
    width: 90%;
    max-width: 420px;
    padding: 0.5rem;
    transition: opacity 0.3s;
}

.grid-container.disabled {
    pointer-events: none;
}

/* ── Memory Card ── */
.memory-card {
    background: transparent;
    aspect-ratio: 1 / 1.1; /* slightly taller than wide */
    perspective: 1000px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}

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

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0.25rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Back of the card (the hidden side that shows the logo/pattern) */
.card-front {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.9));
    border: 2px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.4);
    font-size: 1.5rem;
}

.card-front::after {
    content: '🔢';
    font-size: 2rem;
}

.memory-card:hover .card-front {
    border-color: #f87171;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(248, 113, 113, 0.2));
}

/* Front of the card (the revealed side with word) */
.card-back {
    background: white;
    transform: rotateY(180deg);
    border: 2px solid #ef4444;
    color: #0f172a;
    font-weight: 800;
    font-size: 1.5rem;
    word-break: break-word;
}

/* specific styles for kr vs en texts */
.card-back.kr-word {
    font-family: var(--font-kr);
    font-size: 1.8rem;
}

.card-back.en-word {
    font-family: var(--font-ui);
    font-size: 1.8rem;
    color: #334155;
}

.memory-card.matched .card-back {
    background: #ef4444;
    color: white;
    border-color: #b91c1c;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

.memory-card.matched.en-word .card-back {
    color: rgba(255,255,255,0.9);
}

/* ── Overlays ── */
.round-clear, .game-over {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    text-align: center;
    padding: 2.5rem 2rem;
    z-index: 100;
}

.hidden { display: none; }

.round-clear-title {
    font-size: 1.8rem;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #f87171, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.round-clear-detail {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.stars {
    font-size: 2rem;
    letter-spacing: 0.2rem;
    margin: 1rem 0;
}

.game-over h2 { color: #facc15; font-size: 2.25rem; margin-bottom: 0.75rem; }
.game-over p { font-size: 1.2rem; margin-bottom: 0.25rem; }

.mt-4 { margin-top: 1.5rem; }

/* ── Mobile tweaks ── */
@media (max-width: 500px) {
    .card-back.kr-word { font-size: 1.4rem; }
    .card-back.en-word { font-size: 1.4rem; }
    .game-over, .round-clear { width: 92%; padding: 2rem 1.25rem; }
}

/* Shake animation for wrong match */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
.animate-shake {
    animation: shake 0.4s ease;
}
