/* ═══════════════════════════════════════════════
   FLAG FINDER — kid-friendly flag-matching game
═══════════════════════════════════════════════ */
.ff-page {
    background: linear-gradient(160deg, #ecfeff 0%, #eef2ff 100%);
    min-height: calc(100vh - 250px);
    padding: 40px 0 60px;
}
.ff-shell {
    max-width: 640px;
    margin: 0 auto;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, .12);
    padding: 28px 24px 32px;
}
.ff-title {
    text-align: center;
    font-weight: 800;
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    color: #1e293b;
    margin-bottom: 4px;
}
.ff-subtitle {
    text-align: center;
    color: #64748b;
    font-size: 1rem;
    margin-bottom: 24px;
}
.ff-screen { display: none; }
.ff-screen.active { display: block; animation: ff-fade .25s ease; }
@keyframes ff-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Setup screen ── */
.ff-step-label {
    font-weight: 700;
    font-size: 0.95rem;
    color: #334155;
    margin: 18px 0 10px;
}
.ff-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.ff-choice-btn {
    border: 3px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 16px;
    padding: 18px 10px;
    font-weight: 800;
    font-size: 1.15rem;
    color: #334155;
    cursor: pointer;
    transition: transform .15s, border-color .15s, background .15s;
    text-align: center;
}
.ff-choice-btn .ff-choice-icon { display: block; font-size: 1.8rem; margin-bottom: 6px; }
.ff-choice-btn .ff-choice-sub { display: block; font-size: .72rem; font-weight: 600; color: #94a3b8; margin-top: 4px; }
.ff-choice-btn:hover { transform: translateY(-2px); border-color: #67e8f9; }
.ff-choice-btn.selected {
    border-color: #06b6d4;
    background: linear-gradient(135deg, #ecfeff, #cffafe);
    color: #0e7490;
    transform: translateY(-2px);
}
.ff-nickname {
    width: 100%;
    border: 3px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e293b;
}
.ff-nickname:focus { outline: none; border-color: #67e8f9; }
.ff-btn-primary {
    width: 100%;
    margin-top: 24px;
    border: none;
    border-radius: 16px;
    padding: 16px;
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 8px 20px rgba(22,163,74,.3);
    cursor: pointer;
    transition: transform .15s, opacity .15s;
}
.ff-btn-primary:hover:not(:disabled) { transform: translateY(-2px); }
.ff-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.ff-btn-secondary {
    width: 100%;
    margin-top: 12px;
    border: 3px solid #e2e8f0;
    border-radius: 16px;
    padding: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #334155;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, transform .15s;
}
.ff-btn-secondary:hover { border-color: #67e8f9; transform: translateY(-2px); }

/* ── Play screen ── */
.ff-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.ff-stat { text-align: center; flex: 1; min-width: 70px; }
.ff-stat .ff-stat-num { font-weight: 800; font-size: 1.4rem; color: #1e293b; line-height: 1; }
.ff-stat .ff-stat-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; font-weight: 700; }
.ff-progress-wrap { flex: 1.4; min-width: 130px; }
.ff-progress-bar {
    height: 14px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
    margin-bottom: 4px;
}
.ff-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #06b6d4, #22d3ee);
    transition: width .3s ease;
    width: 10%;
}
.ff-progress-num { text-align: center; font-weight: 800; font-size: .85rem; color: #334155; }

.ff-question-card {
    background: linear-gradient(135deg, #1e293b, #334155);
    border-radius: 20px;
    padding: 28px 20px;
    text-align: center;
    margin-bottom: 22px;
    position: relative;
    overflow: hidden;
}
.ff-question-text {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: .02em;
}
.ff-question-country {
    display: block;
    font-size: clamp(1.7rem, 6vw, 2.4rem);
    font-weight: 800;
    color: #fff;
    margin-top: 2px;
}
.ff-question-mark { color: #94a3b8; font-size: 1.4rem; }

.ff-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}
.ff-option-btn {
    border: 4px solid transparent;
    border-radius: 16px;
    padding: 10px;
    background: #f1f5f9;
    cursor: pointer;
    transition: transform .12s, box-shadow .12s, border-color .12s;
    box-shadow: 0 3px 0 #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
}
.ff-option-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    image-rendering: -webkit-optimize-contrast;
    pointer-events: none;
}
.ff-option-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 5px 0 #cbd5e1; }
.ff-option-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #cbd5e1; }
.ff-option-btn:disabled { cursor: not-allowed; }
.ff-option-btn.ff-pick-correct { border-color: #22c55e; background: #dcfce7; box-shadow: 0 3px 0 #4ade80; }
.ff-option-btn.ff-pick-wrong { border-color: #ef4444; background: #fee2e2; box-shadow: 0 3px 0 #f87171; }

/* ── End screen ── */
.ff-stars {
    text-align: center;
    font-size: 2.6rem;
    letter-spacing: 6px;
    margin: 6px 0 18px;
    color: #e2e8f0;
}
.ff-stars .ff-star-on { color: #fbbf24; }
.ff-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}
.ff-summary-item {
    text-align: center;
    background: #f8fafc;
    border-radius: 14px;
    padding: 16px 6px;
}
.ff-summary-item .ff-summary-num { font-weight: 800; font-size: 1.5rem; color: #1e293b; }
.ff-summary-item .ff-summary-label { font-size: .72rem; color: #94a3b8; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

.ff-review-label { font-weight: 700; font-size: .9rem; color: #334155; margin-bottom: 10px; }
.ff-review-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; max-height: 320px; overflow-y: auto; }
.ff-review-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    border-radius: 12px;
    padding: 8px 12px;
    border-left: 4px solid #cbd5e1;
}
.ff-review-row.ff-review-correct { border-left-color: #22c55e; }
.ff-review-row.ff-review-wrong { border-left-color: #ef4444; }
.ff-review-icon { font-size: 1.1rem; width: 20px; text-align: center; flex-shrink: 0; }
.ff-review-country { font-weight: 700; color: #1e293b; flex: 1; font-size: .92rem; }
.ff-review-flags { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ff-review-flags img { width: 28px; height: 28px; object-fit: contain; border-radius: 4px; background: #fff; border: 1px solid #e2e8f0; }
.ff-review-flags .ff-review-arrow { color: #94a3b8; font-size: .8rem; }

.ff-leaderboard-link { text-align: center; margin-top: 14px; }
.ff-leaderboard-link a { color: #0891b2; font-weight: 700; text-decoration: none; }
.ff-leaderboard-link a:hover { text-decoration: underline; }

.ff-error-banner {
    background: #fef2f2;
    border: 2px solid #fecaca;
    color: #991b1b;
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: 16px;
    display: none;
}
.ff-error-banner.active { display: block; }

/* ── Leaderboard page ── */
.ff-lb-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.ff-lb-filters select {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 12px;
    font-weight: 600;
    color: #334155;
}
.ff-lb-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.ff-lb-table tr { background: #f8fafc; }
.ff-lb-table td { padding: 12px 14px; font-weight: 600; color: #334155; }
.ff-lb-table td:first-child { border-radius: 12px 0 0 12px; font-weight: 800; color: #06b6d4; }
.ff-lb-table td:last-child { border-radius: 0 12px 12px 0; text-align: right; }
.ff-lb-empty { text-align: center; color: #94a3b8; padding: 30px 0; font-weight: 600; }

@media (max-width: 480px) {
    .ff-shell { padding: 22px 16px 26px; border-radius: 18px; }
    .ff-options-grid { gap: 10px; }
}

/* ── Fullscreen mobile play (see base.css body.game-page rules) ── */
@media (max-width: 991.98px) {
    body.game-page .ff-page { min-height: 100dvh; padding: 0; }
    body.game-page .ff-page .container { max-width: none; padding: 0; }
    body.game-page .ff-shell {
        max-width: none;
        min-height: 100dvh;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 54px 16px 16px;
        display: flex;
        flex-direction: column;
    }
    body.game-page .ff-subtitle { display: none; }
    body.game-page .ff-screen.active {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        justify-content: center;
    }
}
