body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background-color: #2c3e50;
    color: white;
    padding: 5px 0;
    margin-bottom: 5px;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

h1 {
    margin: 0;
    font-size: 1.6em;
    flex: 1 1 auto;
    min-width: 0;
}

/* Scores button in header */
.scores-header-btn {
    background: #f1c40f;
    color: #2c3e50;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.95em;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.scores-header-btn:hover {
    background: #f39c12;
}
.scores-header-btn:active {
    transform: scale(0.97);
}
.scores-header-btn i {
    margin-right: 4px;
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.1em;
        flex: 1 1 100%;
        text-align: center;
    }
    .header-inner {
        justify-content: center;
    }
}

/* ── Scores panel (sidebar on desktop, modal on mobile) ─────────────────── */

/* Dim overlay — mobile only */
.scores-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 900;
}
.scores-overlay.active { display: block; }

.scores-panel {
    position: fixed;
    top: 0;
    right: -340px;
    width: 320px;
    height: 100%;
    background: #fff;
    box-shadow: -4px 0 16px rgba(0,0,0,0.18);
    z-index: 950;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}
.scores-panel.open { right: 0; }

.scores-panel-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.scores-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #2c3e50;
    color: #fff;
    padding: 14px 18px;
    flex-shrink: 0;
}
.scores-panel-header h3 {
    margin: 0;
    font-size: 1.1em;
}
.scores-panel-header i { color: #f1c40f; margin-right: 6px; }

.scores-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5em;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.scores-close-btn:hover { color: #e74c3c; }

.scores-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.scores-empty {
    text-align: center;
    color: #999;
    margin-top: 40px;
    font-size: 0.95em;
}

.score-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-left: 4px solid #3498db;
}
.score-entry.gold   { border-left-color: #f1c40f; background: #fffde7; }
.score-entry.silver { border-left-color: #95a5a6; background: #f5f5f5; }
.score-entry.bronze { border-left-color: #cd7f32; background: #fdf3e3; }

.score-rank {
    font-size: 1.3em;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}
.score-details { flex: 1; min-width: 0; }
.score-value {
    font-weight: bold;
    font-size: 1.1em;
    color: #2c3e50;
}
.score-date {
    font-size: 0.78em;
    color: #888;
    margin-top: 2px;
}

.scores-clear-btn {
    margin: 12px;
    padding: 8px;
    background: none;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}
.scores-clear-btn:hover {
    background: #e74c3c;
    color: #fff;
}

/* Mobile: full-width panel from bottom */
@media (max-width: 768px) {
    .scores-panel {
        top: auto;
        bottom: -100%;
        right: 0;
        width: 100%;
        height: 70vh;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
        transition: bottom 0.3s ease;
    }
    .scores-panel.open {
        right: 0;
        bottom: 0;
    }
}
.image-attribution {
            position: absolute;
            left: 0;
            top: 0;
            margin: 20px;
            color: white;
            text-shadow: 0px 0px 4px #000;
}
.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.game-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.image-container {
    position: relative;
    height: 500px;
    background-color: #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}


.image-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    border: 2px solid rgb(203, 203, 203);
    padding: 10px;
    border-radius: 10px;
}

.nav-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.nav-btn:hover {
    background-color: #2980b9;
}

.nav-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}
#imageCounter {
    display: flex;
    align-items: center;
    font-weight: bold;
}
.map-container {
    height: 500px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #dfe0ff;
}

.guess-controls {
        display: flex;
        justify-content: space-evenly;
        align-items: center;
        border: 2px solid #0c1bf9;
        border-radius: 10px;
}
.guess-controls p{ 
    font-weight: bold;
    color:rgb(11, 116, 20);
}

.score-display,
.round-display {
    font-size: 1.2em;
    font-weight: bold;
    padding: 8px 15px;
    background-color: #ecf0f1;
    border-radius: 4px;
}

.guess-btn {
    background-color: #fa092b;
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.3s;
}

.guess-btn:hover {
    background-color: #500a13;
}

.guess-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.game-over-screen {
    text-align: center;
    padding: 40px;
    border: 4px solid #ccc;
    border-radius: 20px;
    margin: 10px;
    color: green;
    font-size: 2.5em;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

/* ── Result card ────────────────────────────────────────────────────────── */
/* Docks at bottom on mobile, floats top-right on desktop; keeps the map
   line + markers visible instead of covering everything with a big modal. */

.result-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    pointer-events: none; /* let the underlying map still receive events */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}
.result-modal.active { display: block; }

.result-content {
    pointer-events: auto;
    position: absolute;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    /* Desktop default: top-right dock */
    top: 20px;
    right: 20px;
    width: 340px;
    max-width: calc(100vw - 40px);
    animation: result-slide-in 0.35s ease-out;
}

@keyframes result-slide-in {
    from { transform: translateY(-10px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

.result-content h2 {
    margin: 0;
    padding: 12px 18px;
    background: linear-gradient(135deg, #3498db, #2c3e50);
    color: #fff;
    font-size: 1em;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

#resultDistance {
    padding: 18px 20px 0;
    text-align: center;
}
#resultDistance h2 {
    /* Location name — override the gradient header style used by the label */
    background: none;
    color: #2c3e50;
    padding: 0 0 8px 0;
    font-size: 1.3em;
    text-transform: none;
    letter-spacing: normal;
}

.result-distance {
    font-size: 1em;
    color: #555;
    line-height: 1.5;
    margin: 8px 0 0;
}
.result-distance strong {
    color: #e74c3c;
    font-size: 1.15em;
    font-weight: bold;
}

.result-score {
    font-size: 2.2em;
    font-weight: bold;
    color: #27ae60;
    margin: 10px 0 4px;
    letter-spacing: -0.5px;
}

#resultMessage {
    font-size: 0.95em;
    margin: 10px 20px 14px;
    padding: 8px 12px;
    background: #f4f6f8;
    color: #444;
    border-radius: 8px;
    text-align: center;
}

.next-round-btn {
    display: block;
    width: calc(100% - 40px);
    margin: 0 20px 18px;
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.05em;
    font-weight: bold;
    transition: background 0.2s, transform 0.1s;
}
.next-round-btn:hover  { background: #2980b9; }
.next-round-btn:active { transform: scale(0.98); }

/* Mobile: dock to the bottom as a sheet, full width */
@media (max-width: 768px) {
    .result-content {
        top: auto;
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        max-width: none;
        border-radius: 16px 16px 0 0;
        animation: result-slide-up 0.35s ease-out;
    }
    @keyframes result-slide-up {
        from { transform: translateY(100%); }
        to   { transform: translateY(0);    }
    }
    #resultDistance h2 { font-size: 1.15em; }
    .result-score      { font-size: 1.9em; }
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    font-size: 1.5em;
}

.game-footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 30px 0 0;
    margin-top: 40px;
    font-size: 0.9em;
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-section {
    flex: 1;
    min-width: 250px;
    margin-bottom: 30px;
    padding: 0 15px;
}

.footer-section h3,
.footer-section h4 {
    color: #3498db;
    margin-bottom: 15px;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #ecf0f1;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: #3498db;
}

.footer-links i {
    margin-right: 8px;
    width: 20px;
    text-align: center;
}

.footer-bottom {
    text-align: center;
    padding: 15px 0;
    background-color: rgba(0, 0, 0, 0.2);
    font-size: 13px;
}

a.footer-link {
    text-decoration: underline;
    color: rgb(238, 201, 201);
}

@media (max-width: 768px) {
    .footer-section {
        flex: 100%;
        text-align: center;
    }

    .footer-links {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}

.error-message {
    color: #e74c3c;
    text-align: center;
    margin: 20px 0;
    font-weight: bold;
}

/* Add Loading animation into the image background */
.image-container {
    position: relative;
    height: 500px;
    background-color: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.image-container.loading::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(45deg,
            rgba(200, 200, 200, 0.5),
            rgba(200, 200, 200, 0.5) 10px,
            rgba(180, 180, 180, 0.5) 10px,
            rgba(180, 180, 180, 0.5) 20px);
    background-size: 28px 28px;
    animation: barberpole 1s linear infinite;
    z-index: 0;
}

@keyframes barberpole {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 28px 0;
    }
}

.loading-content {
    position: relative;
    z-index: 1;
    height: 35%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(245, 245, 245, 0.8);
    color: #333;
    font-size: 0.9em;
    text-align: center;
    padding: 20px 40px;
    border-radius: 20px;
}

.loading-spinner {
    font-size: 2em;
    margin-bottom: 15px;
    color: #3498db;
}

.loading-progress {
    width: 80%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    margin-top: 15px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    width: 50%;
    background: #3498db;
    border-radius: 2px;
    animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(200%);
    }
}

/* Game progress bar */
.progress-container {
    width: 100%;
    height: 20px;
    background-color: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    height: 100%;
    width: 0%;
    border-radius: 10px;
    transition: width 0.3s ease, background-color 0.3s ease;
    background: linear-gradient(to right, #4caf50, #8bc34a);
}

.progress-text {
    text-align: center;
    margin-top: 5px;
    font-size: 0.9em;
    color: #555;
}

/* Slideshow styles */
.slideshow-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background-color: #000;
}

.slideshow-slide {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Progress bar strip along the bottom of the slideshow */
.slideshow-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    z-index: 20;
}

.slideshow-progress-bar {
    height: 100%;
    width: 0%;
    background: #3498db;
}

@keyframes slideshow-tick {
    from { width: 0%; }
    to   { width: 100%; }
}

/* Pause / resume button overlaid bottom-right of the slideshow */
.slideshow-pause-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 21;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.slideshow-pause-btn:hover {
    background: rgba(0, 0, 0, 0.85);
}

.slideshow-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* For landscape images (wider than tall) */
.slideshow-slide img.landscape {
    width: 100%;
    height: auto;
    max-height: 100%;
}

/* For portrait images (taller than wide) */
.slideshow-slide img.portrait {
    width: auto;
    height: 100%;
    max-width: 100%;
}
/* Gallery styles */
.gallery-container {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    padding: 10px;
    overflow-y: auto;
}

.gallery-thumbnail {
    aspect-ratio: 1 / 1;
    cursor: pointer;
    transition: transform 0.2s;
    border: 2px solid transparent;
}

.gallery-thumbnail:hover {
    transform: scale(1.05);
}

.gallery-thumbnail.active {
    border-color: #3498db;
}

.gallery-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* View mode toggle */
.view-mode-toggle {
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.view-mode-toggle i {
    font-size: 16px;
}

/* Image counter */
#imageCounter {
    font-weight: bold;
    margin: 0 10px;
}