/* ═══════════════════════════════════════════════════════════════════
   COSMIC COIN CATCHER v2.0 — Game Styles
   ═══════════════════════════════════════════════════════════════════ */

/* ─── OVERLAY ─── */
#game-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: radial-gradient(ellipse at center, #0f0a2a 0%, #030014 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px 10px;
    animation: gameOverlayIn 0.3s ease-out;
    overflow-y: auto;
}

#game-overlay.hidden { display: none; }

@keyframes gameOverlayIn {
    from { opacity: 0; transform: scale(0.98); }
    to   { opacity: 1; transform: scale(1); }
}

/* ─── CLOSE BUTTON ─── */
.game-close-x {
    position: fixed;
    top: 15px;
    right: 20px;
    background: none;
    border: 2px solid rgba(192, 132, 252, 0.4);
    color: #c084fc;
    font-size: 22px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-close-x:hover {
    background: rgba(192, 132, 252, 0.15);
    border-color: #c084fc;
    transform: scale(1.1);
}

/* ─── TITLE ─── */
.game-title {
    font-family: 'Cinzel Decorative', serif;
    font-size: 28px;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
    margin-top: 10px;
}

.game-subtitle {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 12px;
}

/* ─── CANVAS ─── */
.game-canvas-wrap {
    position: relative;
    max-width: 400px;
    width: 100%;
    border: 2px solid rgba(192, 132, 252, 0.25);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(124, 58, 237, 0.2);
}

#game-canvas {
    display: block;
    width: 100%;
    height: auto;
    touch-action: none;
}

/* ─── HUD ─── */
#game-hud {
    position: absolute;
    bottom: 8px;
    left: 10px;
    display: flex;
    gap: 16px;
}

#game-hud.hidden { display: none; }

.game-hud-item {
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    color: #c084fc;
}

.game-hud-item strong {
    color: #ffd700;
}

.score-flash {
    animation: scoreFlash 0.3s ease-out;
}

@keyframes scoreFlash {
    0%   { color: #ffffff; transform: scale(1.4); }
    100% { color: #ffd700; transform: scale(1); }
}

/* ─── RESULT CARD ─── */
#game-result-card {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(3, 0, 20, 0.92);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 28px 20px;
    text-align: center;
}

#game-result-card.hidden { display: none; }

.game-result-tier {
    font-family: 'Cinzel Decorative', serif;
    font-size: 28px;
    text-shadow: 0 0 15px currentColor;
}

.game-result-score {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    color: #e8e0ff;
}

.game-result-score strong { color: #ffd700; }

.game-result-best {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    color: #94a3b8;
}

.game-result-multiplier {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    color: #c084fc;
}

.game-result-multiplier strong { color: #ffd700; }

.game-result-level {
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    color: #64748b;
}

.game-new-best {
    font-family: 'Cinzel Decorative', serif;
    font-size: 20px;
    color: #ffd700;
    animation: newBestPulse 0.8s ease-in-out infinite alternate;
}

@keyframes newBestPulse {
    from { text-shadow: 0 0 8px rgba(255, 215, 0, 0.4); transform: scale(1); }
    to   { text-shadow: 0 0 20px rgba(255, 215, 0, 0.8); transform: scale(1.05); }
}

/* ─── DIFFICULTY SCREEN ─── */
.game-difficulty-title {
    font-family: 'Cinzel Decorative', serif;
    font-size: 26px;
    color: #ffd700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.game-difficulty-sub {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 8px;
}

.game-difficulty-legend {
    display: flex;
    gap: 10px;
    font-size: 13px;
    color: #cbd5e1;
    font-family: 'Outfit', sans-serif;
    flex-wrap: wrap;
    justify-content: center;
}

.game-difficulty-btns {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.game-difficulty-btns button {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 90px;
}

.game-difficulty-btns button small {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 2px;
}

/* ─── BUTTONS ─── */
.game-btn {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 600;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.game-btn:hover { transform: translateY(-2px); }

.game-btn-primary {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
}

.game-btn-primary:hover { box-shadow: 0 6px 20px rgba(124, 58, 237, 0.6); }

.game-btn-secondary {
    background: rgba(192, 132, 252, 0.15);
    color: #c084fc;
    border: 1px solid rgba(192, 132, 252, 0.3);
}

.game-btn-close {
    background: transparent;
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.game-btn-cta {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #1e1b4b;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
    animation: ctaPulse 2s ease-in-out infinite;
}

@keyframes ctaPulse {
    0%, 100% { box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4); }
    50%      { box-shadow: 0 6px 24px rgba(245, 158, 11, 0.7); }
}

.game-btn-easy {
    background: linear-gradient(135deg, #06b6d4, #22d3ee);
    color: #fff;
}

.game-btn-normal {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
}

.game-btn-hard {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: #fff;
}

/* ─── LEADERBOARD ─── */
.game-leaderboard-title {
    font-family: 'Cinzel Decorative', serif;
    font-size: 22px;
    color: #ffd700;
    margin-bottom: 10px;
}

.game-leaderboard-list {
    width: 100%;
    max-height: 280px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.lb-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(192, 132, 252, 0.1);
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    color: #e8e0ff;
}

.lb-rank { color: #ffd700; font-weight: 700; width: 35px; }
.lb-name { flex: 1; text-align: left; padding: 0 8px; }
.lb-score { color: #c084fc; font-weight: 600; width: 50px; text-align: right; }
.lb-tier { font-size: 12px; width: 80px; text-align: right; }
.lb-tier-cosmic { color: #ffd700; }
.lb-tier-gold { color: #f59e0b; }
.lb-tier-silver { color: #94a3b8; }
.lb-tier-bronze { color: #cd7f32; }
.lb-empty { text-align: center; color: #64748b; padding: 20px; }

.game-loading {
    color: #94a3b8;
    font-family: 'Outfit', sans-serif;
    padding: 20px;
}

/* ─── CTA BUTTON ON MAIN PAGE ─── */
.game-play-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 10px 24px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
    animation: gameCTAPulse 3s ease-in-out infinite;
}

.game-play-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 24px rgba(124, 58, 237, 0.5);
}

@keyframes gameCTAPulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3); }
    50%      { box-shadow: 0 6px 24px rgba(168, 85, 247, 0.5); }
}

.cta-emoji { font-size: 18px; }

/* ─── RESPONSIVE ─── */
@media (max-width: 500px) {
    .game-title { font-size: 22px; }
    .game-subtitle { font-size: 12px; }
    #game-overlay { padding: 10px 5px; }
    .game-difficulty-btns { gap: 6px; }
    .game-difficulty-btns button { min-width: 75px; padding: 8px 14px; font-size: 13px; }
}

/* ─── REDUCED MOTION ─── */
@media (prefers-reduced-motion: reduce) {
    @keyframes gameOverlayIn { from, to { opacity: 1; transform: none; } }
    @keyframes scoreFlash { from, to { color: #ffd700; transform: none; } }
    @keyframes ctaPulse { from, to { box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4); } }
    @keyframes gameCTAPulse { from, to { box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3); } }
    @keyframes newBestPulse { from, to { transform: none; } }
}
