@font-face {
    font-family: "Bowlby";
    src: url("../fonts/BowlbyOne-Regular.ttf") format("truetype");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "DM Sans", sans-serif;
}

body {
    background-color: #1a73e8;
    display: flex;
    flex-direction: column; 
    min-height: 100vh;
    padding: 10px;
    margin: 0;
    overflow-x: hidden;
}

.game-container {
    background: #1a73e8;
    overflow: hidden;
    width: 100%;
    max-width: 1000px;
    position: relative;
    flex: 1 0 auto; 
    margin: 0 auto;
    padding: 0 10px;
    box-sizing: border-box;
}

header {
    background: #1a73e8;
    color: #fff;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 8px;
}

#real-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-right: 8px;
    min-width: 0;
}

#real-header h1 {
    white-space: nowrap;
    font-size: clamp(1.5rem, 5vw, 2.8rem);
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

#globe {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
}

h1 {
    font-size: 2.5rem;
    margin: 0;
    font-family: "Bowlby";
}

header .score,
header .round {
    margin-left: 10px;
    font-weight: 600;
    white-space: nowrap;
    font-size: 1rem;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    padding: 3px 8px;
    border-radius: 12px;
    line-height: 1.2;
}

@media (max-width: 768px) {
    header {
        padding: 6px 8px;
        gap: 6px;
        align-items: center;
    }
    
    #real-header {
        flex: 1;
        min-width: 0;
        display: flex;
        align-items: center;
    }
    
    #real-header h1 {
        white-space: normal;
        word-break: break-word;
        font-size: clamp(2rem, 6vw, 2.2rem);
        line-height: 1.2;
        margin: 0;
    }
    
    #globe {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
    }
    
    .mode-controls {
        order: 3;
        width: 100%;
        margin-top: 4px;
        justify-content: space-between;
        gap: 6px;
        padding: 6px;
    }
    
    .mode-controls select {
        max-width: 100%;
        flex: 1;
    }
    
    header .score,
    header .round {
        font-size: 0.8rem;
        margin-left: 4px;
        white-space: nowrap;
    }
}

.mode-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-around;
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 10px;
    border-radius: 8px;
}

.mode-controls label {
    font-weight: 600;
}

.mode-controls select {
    cursor: pointer;
}

.mode-controls select,
.mode-controls input {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #dadce0;
    background: #fff;
    color: #202124;
}

.input-group {
    position: relative;
}

.suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    max-height: 240px;
    overflow-y: auto;
    z-index: 3000;
}

.suggestions.hidden { display: none; }

.suggestion-item {
    padding: 8px 10px;
    cursor: pointer;
    font-size: 0.95rem;
}

.suggestion-item:hover,
.suggestion-item.active {
    background: #e8f0fe; 
}

.mode-input {
    min-width: 220px;
}

.hidden {
    display: none;
}

.map-wrapper {
    position: relative;
    width: 100%;
    height: clamp(320px, 60vh, 600px);
}

#map {
    width: 100%;
    height: 100%;
    background: #e0e0e0;
    position: absolute;
    inset: 0;
    display: block;
}

#map > div { height: 100% !important; }
#map .gm-style { height: 100% !important; }
#map .gm-style > div { height: 100% !important; }

.overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    pointer-events: auto;
}

.overlay.hidden {
    display: none !important;
}

.pac-container {
    z-index: 3000 !important;
}

.overlay-content {
    background: #fff;
    padding: 24px 20px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 420px;
    width: 90%;
    position: relative;
    z-index: 2200;
}

.current-selection {
    font-weight: 700;
    color: #1a73e8;
    margin-bottom: 12px;
}

.selection-banner {
    position: absolute;
    width: 90%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 500px;
    bottom: 16px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 8px 14px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    z-index: 2100;
}

.selection-banner .current-selection {
    margin: 0;
}

@media (max-width: 768px) {
    .selection-banner {
        width: 90%;
        max-width: 400px;
    }
}

.selection-inner {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(26, 115, 232, 0.10);
    border: 1px solid rgba(26, 115, 232, 0.25);
    color: #1a73e8;
    border-radius: 8px;
}

.chip-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    opacity: 0.9;
}

.chip-value {
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
}

.overlay-content h2 {
    margin-bottom: 8px;
    color: #1a73e8;
}

.overlay-content p {
    margin-bottom: 16px;
    color: #202124;
}

.play-btn {
    background-color: #1a73e8;
    color: #fff;
}

.play-btn:hover {
    scale: 1.05;
}

.play-btn:active {
    scale: 0.95;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: #1a73e8;
    border-top: none;
}

.btn {
    padding: 10px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

#guess-btn {
    background-color: #fff;
    color: #1a73e8;
}

#guess-btn:hover {
    scale: 1.05;
}

#guess-btn:active {
    scale: 0.95;
}

#next-round {
    background-color: #fbbc05;
    color: #202124;
}

#next-round:disabled {
    background-color: #dadce0;
    color: #9aa0a6;
    cursor: not-allowed;
}

#next-round:not(:disabled):hover {
    background-color: #e8ac04;
    scale: 1.05;
}

#next-round:not(:disabled):active {
    scale: 0.95;
}

.result {
    font-weight: bold;
    color: #fff;
    padding: 20px;
    text-align: center;
    font-size: 1.1rem;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
}

footer {
    color: #fff;
    text-align: center;
    padding: 16px 0;
    flex: 0 0 auto; 
}
footer p { color: inherit; }

.distance {
    font-weight: bold;
    color: #fff;
}

.points {
    font-weight: bold;
    color: #34a853;
}

footer a {
    color: #fff;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

footer a:hover {
    opacity: 0.8;
}

/* Game Controls Section */
.game-controls {
    width: 100%;
    max-width: 800px;
    margin: 20px auto 0;
    padding: 0 16px;
}

.controls {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 16px;
}

.controls .btn {
    flex: 1;
    max-width: 200px;
    padding: 12px 16px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.controls .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Results Container */
#result {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #bbdefb;
    transition: all 0.3s ease;
    text-align: center;
    line-height: 1.5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#result .final-score {
    width: 100%;
}

#result .final-score h2 {
    margin: 0 0 12px 0;
    color: #fff;
}

#result .final-score p {
    margin: 8px 0;
    color: #333;
}

#result .distance {
    font-weight: bold;
    color: #fff;
    font-size: 1.1em;
}

#result .points {
    font-weight: bold;
    color: lime;
    font-size: 1.1em;
}

@media (max-width: 768px) {
    .game-container {
        margin: 10px;
        width: calc(100% - 20px);
    }

    header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .mode-controls {
        flex-wrap: wrap;
        justify-content: center;
        background: rgba(255, 255, 255, 0.2);
    }

    .controls {
        flex-direction: column;
        align-items: center;
    }
}