body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: #ffffff;
    color: #000000;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header, footer {
    font-family: 'Jockey One', sans-serif;
    background-color: #000000;
    color: #ffffff;
    text-align: center;
    padding: 0.4rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    margin: 0;
    font-size: 1.6rem;
    font-family: 'Bungee', cursive;
}

.footer {
    background: #000000;
    padding: 20px;
    text-align: center;
    margin-top: auto;
}

.footer-link {
    /* font-family: 'Jockey One', sans-serif; */
    font-family: 'Bungee', cursive;
    font-size: 2.3rem;
    color: #ffffff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #ff1f06;
}

.game-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 20px;
    gap: 20px;
}

.region-selection {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    font-family: 'Jockey One', sans-serif;
}

.toggle-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-group span {
    font-size: 0.9rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
    background-color: #ccc;
    border-radius: 34px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.toggle-switch.active {
    background-color: #ec0000;
}

.toggle-slider {
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch.active .toggle-slider {
    transform: translateX(14px);
}

#drawingStatus {
    font-size: 0.9rem;
    color: #000000;
    text-align: center;
    font-family: 'Jockey One', sans-serif;
}

.map-container {
    position: relative;
    height: 70vh;
    min-height: 300px;
    max-height: 70vh;
}

#button-row1 {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    gap: 8px;
}

#button-row1 button {
    background-color: #000000;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0.8; /* Consistent opacity for mode, undo, and clear buttons */
}

/* Style for mode toggle button when in draw mode */
#button-row1 #modeToggleBtn.active {
    background-color: #333333; /* Darker background for draw mode */
    outline: 2px solid #ec0000; /* Red border for draw mode */
    opacity: 1;
}

#button-row1 button:hover {
    background-color: #333333;
    opacity: 0.8; /* Maintain consistent opacity on hover */
}

#button-row1 button:disabled {
    background-color: #666666;
    cursor: not-allowed;
    opacity: 0.8; /* Match opacity */
}

/* Ensure undo and clear buttons match mode button's opacity */
#button-row1 #undoBtn,
#button-row1 #clearBtn {
    opacity: 0.8; /* Explicitly set to match mode button */
}

#button-row1 #undoBtn:hover,
#button-row1 #clearBtn:hover {
    background-color: #333333;
    opacity: 0.8; /* Maintain consistent opacity on hover */
}

#map {
    height: 100%;
    width: 100%;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    border: #000000 2px solid;
}

.drawing-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    width: 100%;
    height: 100%;
}

.drawing-canvas.draw {
    pointer-events: auto;
    cursor: crosshair;
}

#accuracyMeter {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    border: #000000 2px solid;
}

#accuracyFill {
    height: 100%;
    width: 0;
    background-color: #000000;
    transition: width 0.5s ease;
}

#accuracyText {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    font-family: 'Jockey One', sans-serif;
    color: #e9e9e9;
    text-shadow: 
        -1px -1px 0 #000000,  
         1px -1px 0 #000000,
        -1px  1px 0 #000000,
         1px  1px 0 #000000,
        -2px  0px 0 #000000,
         2px  0px 0 #000000,
         0px -2px 0 #000000,
         0px  2px 0 #000000;
}

.controls {
    background-color: #f0f0f0;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    border: #000000 2px solid;
}

.settings-section {
    display: flex;
    gap: 20px;
}

.loading-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-background {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.loading-text {
    font-size: 1.2rem;
    color: #000000;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Jockey One', sans-serif;
    z-index: 5001;
}

.modal-content {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
}

.modal-footer {
    margin-top: 10px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
}

.modal-header h2 {
        font-family: 'Bungee', cursive;
}
.modal-content h3 {
        font-family: 'Bungee', cursive;
}
.stat-btn {
    background-color: #000000;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Jockey One', sans-serif;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    width: 150px;
}
.stat-btn:hover {
    background-color: #ec0000;
}
.btn {
    background-color: #000000;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Jockey One', sans-serif;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.btn:hover {
    background-color: #ec0000;
}

.btn.secondary {
    background-color: #000000;
}

.btn.secondary:hover {
    background-color: #414141;
}

#newGameBtn {
    font-family: 'Bungee', cursive;
    font-size: 1.8rem;
}

#submitBtn, #shareBtn {
    background-color: #000000;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Bungee', cursive;
    font-size: 1.9rem;
    transition: all 0.2s ease;
}
#submitBtn:hover, #shareBtn:hover {
    background-color: #ec0000;
    transform: translateY(-1px);
}
.capital-marker {
    background: #ff0000;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
    position: relative;
}

.capital-ping {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: ping 1.5s infinite;
}

@keyframes ping {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.5); opacity: 0.2; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
}

.stats-config {
    margin: 15px 0;
}

.game-mode-selection {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.game-mode-selection .btn.active {
    background-color: #e70d0d;
    color: white;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.stats-table th,
.stats-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}

.stats-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.stats-overview {
    margin-bottom: 20px;
}
#statsRegionToggles {
    justify-content: flex-start;
}
#statsRegionToggles .toggle-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

#statsRegionToggles .toggle-switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
    background-color: #ccc;
    border-radius: 34px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#statsRegionToggles .toggle-switch.active {
    background-color: #e90000;
}

#statsRegionToggles .toggle-slider {
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

#statsRegionToggles .toggle-switch.active .toggle-slider {
    transform: translateX(14px);
}

#notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #4CAF50;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 1000;
    opacity: 0;
    font-family: 'Jockey One', sans-serif;
    transition: opacity 0.3s ease;
}
#logoWhite {
    width: 30px; /* Adjust size as needed */
    height: auto;
    transition: transform 0.3s ease;
}

#logoWhite:hover {
    transform: scale(1.05);
}
.header-left {
    display: flex;
    align-items: center;
    gap: 5px; /* Space between logo and title */
}

#allGamesModal .modal-content {
    max-width: 600px;
    background: #ffffff;
    color: #000000;
    border: 2px solid;
    border-radius: 12px;
    padding: 20px;
    margin: 5px;
}

#allGamesModal .modal-header {
    display: flex;
    justify-content: center; /* Changed from space-between to center */
    align-items: center;
    margin-bottom: 10px;
    position: relative; /* Added to allow absolute positioning of close button */
}

#allGamesModal .modal-header h2 {
    font-family: 'Bungee', cursive;
    font-size: 1.8rem;
    color: #000000;
    margin: 0; /* Ensure no extra margins disrupt centering */
}

#allGamesModal .modal-close {
    background: none;
    border: none;
    color: #000000;
    font-size: 1.5rem;
    cursor: pointer;
    position: absolute; /* Position close button absolutely */
    right: 10px; /* Adjust as needed */
    top: 50%; /* Center vertically */
    transform: translateY(-50%); /* Adjust for vertical centering */
}

#allGamesModal .modal-close:hover {
    color: #e74c3c;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns for desktop */
    grid-template-rows: repeat(2, auto); /* 2 rows for desktop */
    gap: 20px;
    justify-items: center;
}

.game-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #000000;
    font-family: 'Jockey One', sans-serif;
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.game-item:hover {
    transform: translateY(-2px);
}

.game-item svg {
    margin-bottom: 10px;
    transition: stroke 0.3s ease;
        margin-bottom: 10px;
    fill: #000000;
    stroke: #000000;
    transition: stroke 0.3s ease;
}

.game-item:hover svg {
    stroke: #e90000;
    fill: #e90000;
}
/* Mobile media query fix for controls */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        /* align-items: flex-start; */
    }

    header h1 {
        font-size: 1.5rem;
    }

    .region-selection {
        justify-content: flex-start;
        gap: 5px;
    }

    .toggle-group span {
        font-size: 0.8rem;
    }

    .toggle-switch {
        width: 30px;
        height: 18px;
    }

    .toggle-slider {
        height: 14px;
        width: 14px;
        left: 2px;
        bottom: 2px;
    }

    .toggle-switch.active .toggle-slider {
        transform: translateX(12px);
    }

    #button-row1 {
        flex-wrap: wrap;
        gap: 5px;
        right: 5px;
        top: 5px;
    }

    #button-row1 button {
        padding: 6px 12px;
        font-size: 0.9rem;
    }

    .map-container {
        height: 60vh;
    }

    .game-container {
        padding: 20px 10px;
    }

    .controls {
        padding: 10px;
        margin: 0 auto;
        max-width: none;
        width: calc(100% - 0px);
        box-sizing: border-box;
    }

    #accuracyMeter {
        width: 300px;
    }
    .maplibregl-ctrl-bottom-right {
    display: none;
    }

    #accuracyText {
        font-size: 0.8rem;
    }
    .games-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns for mobile */
        grid-template-rows: repeat(3, auto); /* 3 rows for mobile */
        gap: 15px; /* Slightly smaller gap for mobile */
    }
}