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

body {
    font-family: 'Arial', sans-serif;
    background-image: url("assets/ace.jpg");
    background-size: cover; /* Cover the entire viewport */
    background-position: center center; /* Center the image */
    background-repeat: no-repeat; /* Do not repeat the image */
    background-attachment: fixed; /* Keep the background fixed during scroll */
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative; /* Needed for the overlay */
    /* animation: gradientShift 8s ease infinite; // Removed gradient animation */
}
body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4); /* Dark overlay */
    z-index: -1; /* Place it behind the content but above the background image */
}
/* @keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
} */

#game-container {
    width: 90%;
    max-width: 800px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    position: relative; /* Ensure game container is above the body's ::before pseudo-element */
    z-index: 1;
}

#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px 20px;
    border-radius: 15px;
    color: white;
    font-weight: bold;
}

#question-counter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.counter-circle {
    width: 40px;
    height: 40px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

#timer-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

#timer-bar {
    width: 200px;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

#timer-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #FFC107, #FF5722);
    border-radius: 4px;
    transition: width 0.1s linear;
    width: 100%;
}

/* ── Coin display in header ─────────────────────────────── */
#coin-display {
    display: flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(45deg, #f6d365, #fda085);
    padding: 6px 13px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    font-weight: bold;
    font-size: 16px;
    color: #3a2000;
}
.coin-icon { font-size: 1.1em; }
.coin-icon-small { font-size: 0.9em; }

#score-display {
    font-size: 18px;
    background: linear-gradient(45deg, #f093fb, #f5576c);
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
#header-right-side {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Floating coin earned popup ─────────────────────────── */
.coin-popup {
    position: fixed;
    font-size: 1.1em;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    pointer-events: none;
    z-index: 9999;
    animation: coinFloat 1s ease-out forwards;
    transform: translateX(-50%);
}
@keyframes coinFloat {
    0%   { opacity: 1;   transform: translateX(-50%) translateY(0px) scale(1); }
    100% { opacity: 0;   transform: translateX(-50%) translateY(-55px) scale(1.2); }
}

/* ── Auth bar on start screen ───────────────────────────── */
#auth-bar {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}
.auth-state {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ── Start screen coin wallet ───────────────────────────── */
#start-coin-wallet {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(45deg, #f6d365, #fda085);
    padding: 7px 18px;
    border-radius: 25px;
    font-size: 1.15em;
    font-weight: bold;
    color: #3a2000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
}

/* ── Auth pill buttons ──────────────────────────────────── */
.auth-pill-btn {
    padding: 8px 18px;
    font-size: 0.9em;
    font-weight: bold;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    transition: all 0.25s ease;
    white-space: nowrap;
}
.auth-pill-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 18px rgba(0,0,0,0.35);
}
.auth-pill-btn.secondary {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    font-size: 0.82em;
    padding: 6px 14px;
}
.auth-pill-btn.secondary:hover {
    background: rgba(255,255,255,0.25);
}

#auth-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.1);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.2);
}
#auth-username {
    font-weight: bold;
    color: #fff;
    font-size: 0.95em;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Auth modal ─────────────────────────────────────────── */
#auth-modal-content {
    max-width: 420px;
    width: 95%;
    padding: 28px 28px 22px;
}

#auth-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 22px;
    background: rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 4px;
}
.auth-tab {
    flex: 1;
    padding: 8px 6px;
    font-size: 0.85em;
    font-weight: bold;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    background: transparent;
    color: rgba(255,255,255,0.55);
    transition: all 0.2s ease;
}
.auth-tab:hover { color: rgba(255,255,255,0.85); }
.auth-tab.active {
    background: rgba(255,255,255,0.18);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.auth-panel h2 {
    font-size: 1.4em;
    margin-bottom: 4px;
    color: #ffeaa7;
}
.auth-subtitle {
    font-size: 0.85em;
    opacity: 0.65;
    margin-bottom: 16px;
}

.auth-input {
    display: block;
    width: 100%;
    padding: 11px 14px;
    margin-bottom: 10px;
    font-size: 0.95em;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    color: white;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
    box-sizing: border-box;
}
.auth-input::placeholder { color: rgba(255,255,255,0.45); }
.auth-input:focus {
    border-color: rgba(102,126,234,0.8);
    background: rgba(255,255,255,0.15);
}

.auth-submit-btn {
    width: 100%;
    padding: 12px;
    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 5px 15px rgba(102,126,234,0.4);
    transition: all 0.25s ease;
    margin-top: 4px;
}
.auth-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102,126,234,0.5);
}
.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-error {
    background: rgba(244,67,54,0.15);
    border: 1px solid rgba(244,67,54,0.4);
    color: #ff8a80;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.85em;
    margin-bottom: 8px;
}
.auth-success {
    background: rgba(76,175,80,0.15);
    border: 1px solid rgba(76,175,80,0.4);
    color: #a5d6a7;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.85em;
    margin-bottom: 8px;
}

.auth-guest-note {
    font-size: 0.8em;
    opacity: 0.55;
    margin: 16px 0 8px;
    line-height: 1.4;
}
.auth-guest-note strong { opacity: 0.9; }

/* Signup success floating toast */
.signup-success-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(45deg, #4CAF50, #66bb6a);
    color: white;
    font-weight: bold;
    padding: 14px 28px;
    border-radius: 25px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    z-index: 9999;
    font-size: 0.95em;
    animation: toastSlideIn 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}

/* ── Power-ups bar ──────────────────────────────────────── */
#powerups-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 12px 0 8px;
    padding: 10px 16px;
    background: rgba(0,0,0,0.25);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.12);
}

.powerup-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 18px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    background: rgba(255,255,255,0.1);
    color: white;
    cursor: pointer;
    transition: all 0.25s ease;
    min-width: 80px;
    opacity: 0.45;
}
.powerup-btn.powerup-affordable {
    opacity: 1;
    border-color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.18);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.powerup-btn.powerup-affordable:hover {
    transform: translateY(-3px);
    background: rgba(255,255,255,0.28);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.powerup-btn:disabled { cursor: not-allowed; }
.powerup-icon  { font-size: 1.4em; line-height: 1; }
.powerup-label { font-size: 0.75em; font-weight: bold; letter-spacing: 0.03em; }
.powerup-cost  { font-size: 0.7em; color: #ffd700; display: flex; align-items: center; gap: 2px; }

/* ── Eliminated option (hint) ───────────────────────────── */
.option-btn.eliminated {
    opacity: 0.2 !important;
    text-decoration: line-through;
    cursor: not-allowed !important;
    pointer-events: none;
    transform: none !important;
    box-shadow: none !important;
}

/* ── Streak display ─────────────────────────────────────── */
#streak-display {
    display: flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1em;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    box-shadow: 0 4px 12px rgba(255,107,53,0.4);
}
#streak-flame { font-size: 1.3em; }
#streak-count { font-size: 1.2em; }
#streak-label { font-size: 0.75em; opacity: 0.9; }

.streak-pulse {
    animation: streakPulse 0.4s ease-out;
}
@keyframes streakPulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.18); }
    100% { transform: scale(1); }
}

/* ── Daily bonus modal ──────────────────────────────────── */
#daily-bonus-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    opacity: 0;
    transition: opacity 0.35s ease;
    padding: 20px;
}
#daily-bonus-overlay.visible { opacity: 1; }

#daily-bonus-modal {
    background: linear-gradient(145deg, rgba(20,20,40,0.97), rgba(40,20,60,0.97));
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 24px;
    padding: 36px 32px 28px;
    text-align: center;
    color: white;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(246,211,101,0.15);
    transform: scale(0.85);
    transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
    position: relative;
    overflow: hidden;
}
#daily-bonus-overlay.visible #daily-bonus-modal { transform: scale(1); }

#daily-bonus-emoji {
    font-size: 3.5em;
    line-height: 1;
    margin-bottom: 10px;
    animation: bonusEmojiPop 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.2s both;
}
@keyframes bonusEmojiPop {
    from { transform: scale(0) rotate(-20deg); opacity: 0; }
    to   { transform: scale(1) rotate(0deg);   opacity: 1; }
}

#daily-bonus-title {
    font-size: 1.8em;
    font-weight: bold;
    background: linear-gradient(45deg, #f6d365, #fda085);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}
#daily-bonus-subtitle {
    font-size: 0.95em;
    opacity: 0.75;
    margin-bottom: 16px;
}
#daily-bonus-coins {
    font-size: 2.8em;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255,215,0,0.5);
    margin: 10px 0 20px;
    animation: coinAmountPulse 0.6s ease 0.4s both;
}
@keyframes coinAmountPulse {
    0%   { transform: scale(0.5); opacity: 0; }
    70%  { transform: scale(1.15); }
    100% { transform: scale(1);   opacity: 1; }
}

/* 7-dot streak tracker */
#daily-bonus-streak-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0 0 16px;
}
.streak-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78em;
    font-weight: bold;
    border: 2px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.05);
    transition: all 0.3s ease;
}
.streak-dot.active {
    background: linear-gradient(45deg, #f6d365, #fda085);
    border-color: #fda085;
    color: #3a2000;
    box-shadow: 0 0 12px rgba(246,211,101,0.5);
    animation: dotPop 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes dotPop {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}

#daily-bonus-wallet {
    font-size: 0.88em;
    opacity: 0.65;
    margin-bottom: 18px;
}

#daily-bonus-claim-btn {
    padding: 13px 44px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    background: linear-gradient(45deg, #f6d365, #fda085);
    color: #3a2000;
    box-shadow: 0 6px 20px rgba(246,211,101,0.4);
    transition: all 0.25s ease;
}
#daily-bonus-claim-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(246,211,101,0.55);
}

/* Coin burst particles */
.bonus-coin-particle {
    position: absolute;
    top: 50%;
    left: 50%;
    font-size: 1.4em;
    pointer-events: none;
    animation: coinBurst 0.9s ease-out forwards;
}
@keyframes coinBurst {
    0%   { transform: translate(-50%,-50%) translate(0,0) scale(1);   opacity: 1; }
    100% { transform: translate(-50%,-50%) translate(var(--dx),var(--dy)) scale(0); opacity: 0; }
}

/* ── Streak milestone toast ──────────────────────────────── */
#streak-milestone-toast {
    text-align: center;
    font-size: 1em;
    font-weight: bold;
    padding: 8px 16px;
    border-radius: 12px;
    background: rgba(0,0,0,0.6);
    border: 2px solid currentColor;
    margin-bottom: 8px;
    letter-spacing: 0.03em;
    animation: toastSlideIn 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes toastSlideIn {
    from { transform: translateY(-12px) scale(0.9); opacity: 0; }
    to   { transform: translateY(0)     scale(1);   opacity: 1; }
}
.toast-fade-out {
    animation: toastFadeOut 0.4s ease forwards !important;
}
@keyframes toastFadeOut {
    to { opacity: 0; transform: translateY(-8px); }
}

/* ── Action feedback toast ──────────────────────────────── */
#action-feedback {
    text-align: center;
    font-size: 0.95em;
    font-weight: bold;
    padding: 6px 14px;
    border-radius: 10px;
    background: rgba(0,0,0,0.45);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
    transition: opacity 0.4s ease;
}
#action-feedback.feedback-show { opacity: 1; }
#action-feedback.feedback-hide { opacity: 0; }

/* ── Coins earned on results screen ─────────────────────── */
#coins-earned-display {
    margin: 8px 0 4px;
}
.coins-earned-badge {
    display: inline-block;
    background: linear-gradient(45deg, #f6d365, #fda085);
    color: #3a2000;
    font-weight: bold;
    font-size: 1.25em;
    padding: 8px 22px;
    border-radius: 25px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.3);
    letter-spacing: 0.02em;
}
#instructions-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, transform 0.3s ease;
    padding: 0; /* Remove default button padding */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
#instructions-btn:hover {
    background-color: rgba(255, 255, 255, 0.35);
    transform: scale(1.1);
}

#flag-display {
    text-align: center;
    margin-bottom: 30px;
}

#flag-container {
    display: inline-block;
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border: 3px solid rgba(255, 255, 255, 0.3);
}

#current-flag {
    width: 300px; /* Adjust as needed */
    height: 200px; /* Adjust as needed */
    object-fit: contain; /* Ensures the image fits well without distortion */
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    background: #f0f0f0; /* Fallback background */
    display: block; /* Changed from flex to block for img */
    margin: 0 auto; /* Center the image if flag-container is wider */
}
#fact-text-display {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 15px;
    color: white;
    font-size: 1.3em; /* Larger text for facts */
    line-height: 1.6;
    min-height: 100px; /* Ensure some space even for short facts */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border: 3px solid rgba(255, 255, 255, 0.3);
}
#current-fact-text {
    max-width: 90%;
}
#options-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

.option-btn {
    padding: 15px 20px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    color: #333;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.option-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3);
    background: linear-gradient(45deg, #fff, #f0f0f0);
}

.option-btn.correct {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    border-color: #2e7d32;
}

.option-btn.incorrect {
    background: linear-gradient(45deg, #f44336, #d32f2f);
    color: white;
    border-color: #c62828;
}

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}
.option-btn.facts-mode-option {
    padding: 10px; /* Adjust padding for image content */
    height: 80px; /* Fixed height for consistency with images */
    display: flex;
    align-items: center;
    justify-content: center;
}
.option-btn.facts-mode-option img {
    display: block;
    border-radius: 5px; /* Slight rounding for flag images */
}
#start-screen, #results-screen {
    text-align: center;
    color: white;
    padding: 40px;
}

#start-screen h1, #results-screen h1 {
    font-size: 3em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    background: linear-gradient(45deg, #667eea, #764ba2, #f093fb, #f5576c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#start-screen p {
    font-size: 1.2em;
    margin-bottom: 15px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}
#start-screen img#start-screen-image {
    display: block;
    width: 80%;
    max-width: 400px;
    max-height: 250px;
    object-fit: contain;
    margin: 25px auto;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
}
#difficulty-selection {
    margin: 25px auto;
    padding: 15px;
    background: rgba(0,0,0,0.15);
    border-radius: 12px;
    max-width: 350px;
}
#difficulty-selection p {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}
.difficulty-options {
    display: flex;
    justify-content: space-around;
    align-items: center;
}
.difficulty-options label {
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-size: 0.95em;
    color: rgba(255,255,255,0.8);
    background-color: rgba(255,255,255,0.1);
    border: 1px solid transparent;
}
.difficulty-options label:hover {
    background-color: rgba(255,255,255,0.2);
    color: #fff;
}
.difficulty-options input[type="radio"] {
    display: none; /* Hide the actual radio button */
}
.difficulty-options input[type="radio"]:checked + label {
    background: linear-gradient(45deg, #ffd700, #ffcc00); /* Yellow gradient */
    color: #333; /* Darker text for yellow background */
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    border-color: rgba(255,215,0,0.5); /* Goldish border */
    transform: scale(1.05); /* Slightly enlarge selected */
    animation: difficultySelected 0.3s ease-out;
}
@keyframes difficultySelected {
    from {
        transform: scale(1);
        opacity: 0.7;
    }
    to {
        transform: scale(1.05);
        opacity: 1;
    }
}
#start-btn, #play-again-btn {
    padding: 15px 40px;
    font-size: 20px;
    font-weight: bold;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    margin-top: 10px; /* Adjusted margin due to difficulty selector */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}
#review-answers-btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    background: linear-gradient(45deg, #2196F3, #21CBF3);
    color: white;
    margin-top: 15px;
    margin-left: 10px; /* Space it from the other buttons */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    transition: all 0.3s ease;
}
#review-answers-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
    background: linear-gradient(45deg, #21CBF3, #2196F3);
}
#show-high-scores-btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    background: linear-gradient(45deg, #4ecdc4, #55b7d5);
    color: white;
    margin-top: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    transition: all 0.3s ease;
}
#start-btn:hover, #play-again-btn:hover, #show-high-scores-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}
#show-high-scores-btn:hover {
    background: linear-gradient(45deg, #55b7d5, #66cfaa);
}

.hidden {
    display: none !important;
}

#results-screen div {
    margin: 15px 0;
    font-size: 1.3em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

#final-score {
    font-size: 2em;
    font-weight: bold;
    color: #ffeaa7;
}
#leaderboard-section {
    margin-top: 30px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    text-align: center;
}
#leaderboard-section h2 {
    font-size: 1.8em;
    margin-bottom: 15px;
    color: #ffeaa7;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}
.leaderboard-display-list {
    list-style: none;
    padding: 0;
    margin: 0 auto 20px auto;
    max-width: 350px;
    min-width: 300px;
    font-size: 1.1em;
    max-height: 300px; /* Added for modals if list is long */
    overflow-y: auto; /* Added for modals */
}
.leaderboard-display-list li {
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background-color 0.3s ease;
    display: flex;
    justify-content: space-between;
    text-align: left;
}
.leaderboard-display-list li:nth-child(odd) {
    background: rgba(255, 255, 255, 0.15);
}
.leaderboard-display-list li:hover {
    background: rgba(255, 255, 255, 0.25);
}
.leaderboard-display-list::-webkit-scrollbar {
    width: 8px;
}
.leaderboard-display-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}
.leaderboard-display-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}
#name-input-container {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
#name-input-container p {
    margin-bottom: 10px;
    font-size: 1.1em;
}
#player-name-input {
    padding: 10px 15px;
    font-size: 1em;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-align: center;
    width: 200px;
    margin-right: 10px;
    text-transform: uppercase;
}
#player-name-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}
#submit-score-btn {
    padding: 10px 20px;
    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: linear-gradient(45deg, #4CAF50, #66bb6a);
    color: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}
#submit-score-btn:hover {
    background: linear-gradient(45deg, #66bb6a, #81c784);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}
#submit-score-btn:disabled {
    background: #aaa;
    cursor: not-allowed;
    opacity: 0.7;
}
.modal-view {
    position: fixed; /* Changed to fixed to cover viewport */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000; /* Ensure it's on top */
    padding: 20px;
}
.modal-content {
    background: rgba(30, 30, 50, 0.85); /* Darker, more distinct modal bg */
    backdrop-filter: blur(15px) saturate(150%);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    color: white;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 500px;
    width: 90%;
}
#instructions-text-content {
    text-align: left;
    line-height: 1.6;
    margin-bottom: 20px;
}
#instructions-text-content p {
    margin-bottom: 12px;
    font-size: 1.05em;
}
#instructions-text-content strong {
    color: #ffeaa7; /* Highlight key terms */
}
.modal-content h2 {
    font-size: 2em;
    margin-bottom: 20px;
    color: #ffeaa7;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.4);
}
.modal-close-btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    background: linear-gradient(45deg, #f093fb, #f5576c);
    color: white;
    margin-top: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    transition: all 0.3s ease;
}
.modal-close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.35);
    background: linear-gradient(45deg, #f5576c, #f093fb);
}
#score-bonus-indicator {
    color: #FFD700; /* Bright yellow for bonus */
    font-weight: bold;
    font-size: 0.9em;
    padding: 4px 8px;
    background: rgba(34, 139, 34, 0.85); /* Dark green, semi-transparent */
    border-radius: 5px;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.4);
    margin-left: 5px; /* Space it from score if next to it */
    /* Animation applied when not hidden */
}
#score-bonus-indicator:not(.hidden) {
    animation: fadeInOutBonus 1.5s ease-in-out forwards;
}
#score-bonus-indicator.hidden {
    display: none !important;
    opacity: 0; /* Ensure it's fully transparent when hidden */
}
@keyframes fadeInOutBonus {
  0% { opacity: 0; transform: translateY(8px) scale(0.9); }
  15% { opacity: 1; transform: translateY(0) scale(1.05); }
  85% { opacity: 1; transform: translateY(0) scale(1.05); }
  100% { opacity: 0; transform: translateY(-8px) scale(0.9); }
}
@media (max-width: 600px) {
    #game-container {
        width: 95%;
        padding: 15px;
    }
    
    #header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    #header-right-side {
        flex-wrap: wrap;
        justify-content: center;
    }
    #coin-display {
        font-size: 14px;
        padding: 5px 10px;
    }
    #score-bonus-indicator {
        font-size: 0.8em;
        padding: 3px 6px;
        margin-top: 5px;
        width: fit-content;
        order: 1;
    }
    #score-display { order: 0; }
    #instructions-btn { order: 2; }

    #powerups-bar {
        padding: 8px 10px;
        gap: 8px;
    }
    .powerup-btn {
        padding: 6px 12px;
        min-width: 65px;
    }
    .powerup-icon  { font-size: 1.2em; }
    .powerup-label { font-size: 0.68em; }
    .powerup-cost  { font-size: 0.65em; }
    #streak-display { font-size: 0.88em; padding: 5px 10px; }
    
    #timer-bar {
        width: 150px;
    }
    
    #current-flag {
        width: 250px; /* Adjust for smaller screens */
        height: 167px; /* Adjust for smaller screens */
    }
    
    #options-container {
        grid-template-columns: 1fr;
    }
    
    #start-screen h1, #results-screen h1 {
        font-size: 2em;
    }
    #leaderboard-section h2 {
        font-size: 1.5em;
    }
    #leaderboard-list {
        font-size: 1em;
    }
    #player-name-input {
        width: 150px;
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    #name-input-container {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}