body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #1a1a1a;
    color: white;
    font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    z-index: 1;
}

/* Overlay Container */
#overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    pointer-events: none; /* Allows interacting with map through gaps */
    display: flex;
    flex-direction: column;
    padding: 10px;
    padding-bottom: env(safe-area-inset-bottom);
}

#overlay > * {
    pointer-events: auto; /* Re-enable for UI elements */
}

/* Top Stats */
#top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

#speed-container {
    background: rgba(0, 0, 0, 0.8);
    padding: 8px 15px;
    border-radius: 15px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    min-width: 70px;
}

#speed {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1;
    display: block;
}

.unit {
    font-size: 0.7rem;
    text-transform: uppercase;
    opacity: 0.7;
    letter-spacing: 1px;
}

#road-container {
    background: rgba(0, 0, 0, 0.85);
    padding: 12px 18px;
    border-radius: 15px;
    max-width: 75%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

#road-name {
    font-size: 1.4rem; /* Larger */
    font-weight: 800;
    display: block;
    color: #3498db;
    margin-bottom: 4px;
}

.upcoming-road {
    font-size: 0.9rem;
    color: #bdc3c7;
    display: block;
    font-weight: 500;
    padding-left: 10px;
    border-left: 2px solid #3498db;
    margin-top: 4px;
}

/* Style Menu */
#style-menu {
    background: rgba(0, 0, 0, 0.95);
    padding: 15px;
    border-radius: 20px;
    width: 90%;
    max-width: 320px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.style-option {
    padding: 12px;
    background: #2c3e50;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
}

.style-option:active { background: #3498db; }

/* Bottom Controls */
#bottom-section {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    flex-shrink: 0; /* Important: prevents squashing */
}

#controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding-bottom: 10px;
}

button {
    background: rgba(44, 62, 80, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
}

button:active {
    transform: scale(0.9);
    background: #3498db;
}

/* POI Panel */
#poi-panel {
    background: rgba(0, 0, 0, 0.9);
    padding: 15px;
    border-radius: 20px;
    width: 90%;
    max-width: 320px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
}

#poi-panel h3 { margin: 0 0 10px 0; font-size: 1rem; }
#poi-list { max-height: 150px; overflow-y: auto; margin-bottom: 10px; }
.poi-item { padding: 8px; border-bottom: 1px solid rgba(255,255,255,0.1); font-size: 0.9rem; }

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-content {
    background: #2c3e50;
    padding: 25px;
    border-radius: 25px;
    width: 100%;
    max-width: 350px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.setting { margin-bottom: 20px; }
.setting label { display: block; margin-bottom: 8px; font-weight: 600; }
.setting select {
    width: 100%; padding: 12px; border-radius: 10px;
    background: #1a1a1a; color: white; border: 1px solid #444;
}

.hidden { display: none !important; }

@media (max-width: 400px) {
    #speed { font-size: 2.2rem; }
    button { width: 50px; height: 50px; font-size: 1.2rem; }
}