* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    text-align: center;
    color: #183840;
    background: #eaf6f7;
}

header {
    padding: 12px 10px 8px;
    background: #003b4d;
    color: white;
}

header h1 {
    margin: 0;
    font-size: 30px;
}

.tagline {
    margin-top: 4px;
    opacity: 0.85;
    font-size: 14px;
}

#modeControls {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: #dceff1;
}

button {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    background: #006994;
    color: white;
    font-size: 17px;
    font-weight: bold;
    cursor: pointer;
}

button:hover:not(:disabled) {
    filter: brightness(1.08);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mode-button {
    padding: 9px 16px;
    background: #7899a1;
    font-size: 14px;
}

.active-mode {
    background: #006994;
}

#info {
    display: flex;
    justify-content: space-around;
    align-items: center;
    min-height: 105px;
    padding: 12px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

#roundInfo,
#scoreBox {
    width: 130px;
    font-weight: bold;
}

#scoreBox strong {
    display: block;
    margin-top: 5px;
    color: #006994;
    font-size: 26px;
}

#findBox {
    flex: 1;
}

.find-label {
    color: #667;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#target {
    margin: 5px 0;
    color: #003b4d;
    font-size: 25px;
}

#category {
    color: #667;
    font-style: italic;
}

#map {
    width: 100%;
    height: 62vh;
    min-height: 420px;
}

#result {
    min-height: 80px;
    padding: 10px;
}

#controls {
    padding: 0 10px 16px;
}

#nextButton {
    min-width: 180px;
}

.result-card {
    max-width: 620px;
    margin: 5px auto;
    padding: 18px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.14);
}

.result-card h2 {
    margin: 6px 0;
    color: #003b4d;
}

.result-category {
    color: #667;
    font-size: 15px;
}

.result-message {
    margin-top: 8px;
    font-size: 21px;
    font-weight: bold;
}

.round-score,
.final-score {
    margin: 8px 0;
    color: #006994;
    font-size: 42px;
    font-weight: bold;
}

.round-score span,
.final-score span {
    color: #667;
    font-size: 18px;
}

.distance-result {
    font-size: 17px;
}

.location-fact {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    line-height: 1.45;
}

.personal-best {
    margin: 12px auto;
    padding: 9px;
    border-radius: 8px;
    background: #fff4c2;
    color: #594900;
    font-weight: bold;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
    max-width: 430px;
    margin: 16px auto 5px;
}

.stat-box {
    padding: 11px;
    border-radius: 9px;
    background: #eef7f8;
}

.stat-label {
    display: block;
    color: #667;
    font-size: 13px;
}

.stat-value {
    display: block;
    margin-top: 4px;
    color: #003b4d;
    font-size: 20px;
    font-weight: bold;
}

.daily-label {
    margin-bottom: 8px;
    color: #815c00;
    font-weight: bold;
}

.developer-data {
    margin-top: 12px;
    color: #777;
    font-family: monospace;
    font-size: 12px;
}

.custom-map-marker {
    border: none;
    background: transparent;
}

.marker-pin {
    width: 100%;
    height: 100%;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.65);
}

.guess-pin {
    background: #1683ff;
}

.answer-pin {
    background: #12a64a;
}

@media (max-width: 650px) {

    header h1 {
        font-size: 25px;
    }

    #info {
        gap: 6px;
        min-height: 95px;
        padding: 8px;
    }

    #roundInfo,
    #scoreBox {
        width: 73px;
        font-size: 13px;
    }

    #scoreBox strong {
        font-size: 21px;
    }

    #target {
        font-size: 20px;
    }

    #category {
        font-size: 13px;
    }

    #map {
        height: 58vh;
        min-height: 350px;
    }

    .result-card {
        padding: 14px;
    }

    .round-score,
    .final-score {
        font-size: 35px;
    }

    .stats-grid {
        gap: 6px;
    }

    .stat-value {
        font-size: 17px;
    }
}

.result-modal {
    position: fixed;
    inset: 0;
    z-index: 5000;

    display: flex;
    align-items: flex-end;
    justify-content: center;

    padding: 12px;

    background: transparent;

    pointer-events: none;
    visibility: hidden;
}

.result-modal-content {
    width: min(620px, 100%);
    max-height: 42vh;
    overflow-y: auto;

    padding: 12px;

    background: #eaf6f7;

    border-radius: 18px 18px 10px 10px;

    box-shadow:
        0 -5px 25px
        rgba(0, 0, 0, 0.28);

    pointer-events: auto;
    
    transform: translateY(110%);
    opacity: 0;

    transition:
        transform 260ms ease,
        opacity 220ms ease;
}

.result-modal.visible {
    visibility: visible;
}

.result-modal.visible
.result-modal-content {
    transform: translateY(0);
    opacity: 1;
}

.result-modal .result-card {
    margin: 0 0 10px;
    padding: 12px;
    box-shadow: none;
}

.result-modal #nextButton {
    position: sticky;
    bottom: 0;

    width: 100%;
    margin: 0;
    padding: 14px;

    font-size: 18px;
}

@media (max-width: 650px) {

    .result-modal {
        align-items: flex-end;
        padding: 10px;
    }

    .result-modal-content {
        max-height: 55vh;
        border-radius: 16px 16px 8px 8px;
    }
}