:root {
    --bg-dark: #121212;
    --bg-panel: #1e1e1e;
    --accent: #00e676;
    --text: #ffffff;
    --text-muted: #888888;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg-dark);
}

/* MAP */
#map {
    height: 100%;
    width: 100%;
    z-index: 1;
}

/* UI TOP LAYER (Desktop Default) */
#ui-layer {
    position: absolute;
    top: 20px;
    left: 60px;
    z-index: 1000;
    display: flex;
    gap: 10px;
    align-items: center;
}

select {
    background: var(--bg-panel);
    color: var(--text);
    border: 1px solid #333;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

select:focus {
    outline: 2px solid var(--accent);
}

/* RECORD BUTTON (Desktop Default) */
.btn-rec {
    background: rgba(30, 30, 30, 0.85);
    color: var(--text-muted);
    border: 1px solid #444;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    /* Gap between icon and text */
    height: 40px;
    /* Consistent height */
}

.btn-rec:hover {
    color: #ef5350;
    border-color: #ef5350;
    background: rgba(239, 83, 80, 0.15);
}

/* VIEWER CONTAINER */
#viewer {
    position: absolute;
    z-index: 2000;
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.9);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    overflow: hidden;
}

/* DESKTOP LAYOUT */
@media (min-width: 769px) {
    #viewer {
        top: 20px;
        right: 20px;
        width: 480px;
        height: 90vh;
        max-height: none;
        border-radius: 12px;
    }

    #viewer.hidden {
        transform: translateX(520px);
    }
}

/* MOBILE LAYOUT & ICON BUTTON TRANSFORMATION */
@media (max-width: 768px) {
    #ui-layer {
        top: 10px;
        left: 10px;
        right: 10px;
        /* Make items sit side-by-side */
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    /* Select box fills available width */
    select {
        flex-grow: 1;
        width: auto;
    }

    /* TRANSFORM BUTTON TO ICON */
    .btn-rec span {
        display: none;
        /* Hide the text "Record" */
    }

    .btn-rec {
        width: 42px;
        /* Square/Circle width */
        height: 40px;
        /* Match select height */
        padding: 0;
        justify-content: center;
        /* Center the icon */
        border-radius: 8px;
        /* Rounded square or 50% for circle */
        background: var(--bg-panel);
        /* More opaque on mobile */
    }

    .btn-rec i {
        font-size: 1.1rem;
        /* Slightly larger icon */
        color: #ef5350;
        /* Keep it red-ish on mobile to distinguish */
    }

    /* VIEWER FULL SCREEN */
    #viewer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 92vh;
        border-radius: 20px 20px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }

    #viewer.hidden {
        transform: translateY(100%);
    }

    .btn-settings {
        width: 42px;
        height: 40px;
        padding: 0;
        justify-content: center;
        border-radius: 8px;
    }
}

.btn-settings {
    background: rgba(30, 30, 30, 0.85);
    color: var(--text-muted);
    border: 1px solid #444;
    padding: 10px 15px;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
}

.btn-settings:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(0, 230, 118, 0.1);
}

/* HEADER */
.viewer-header {
    flex: 0 0 auto;
    padding: 14px 18px;
    background: #252525;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
}

.meta-info {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}

.separator {
    margin: 0 8px;
    color: #444;
}

.close-btn {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    border: none;
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* IMAGE AREA */
.img-container {
    flex: 1 1 auto;
    position: relative;
    background: #000;
    overflow: hidden;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#street-view-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.image-data-overlay {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.65);
    padding: 8px 12px;
    border-radius: 6px;
    pointer-events: none;
    color: #e0e0e0;
    font-family: monospace;
    font-size: 11px;
    line-height: 1.5;
    backdrop-filter: blur(4px);
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.image-data-overlay span {
    color: var(--accent);
    font-weight: bold;
}

/* NAVIGATION ARROWS (Vertical Layout - Top/Bottom) */
.nav-arrow {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-arrow:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateX(-50%) scale(1.1);
}

.nav-arrow:active {
    transform: translateX(-50%) scale(0.9);
}

/* bulge effect when clicked */
@keyframes bulge {
    0% {
        transform: translateX(-50%) scale(1);
    }

    30% {
        transform: translateX(-50%) scale(1.15);
    }

    100% {
        transform: translateX(-50%) scale(1);
    }
}

.bulge-anim {
    animation: bulge 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-arrow:disabled {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) scale(0.5);
}

.nav-arrow-top {
    top: 40px;
}

.nav-arrow-bottom {
    bottom: 100px;
}

/* Image container refinements */
.img-container {
    cursor: pointer;
}

.img-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, transparent 40%, rgba(0, 0, 0, 0.3) 100%);
    pointer-events: none;
    z-index: 5;
}

/* FRAME COUNTER */
.frame-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 20px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
    pointer-events: none;
}

/* Mobile adjustments for arrows */
@media (max-width: 768px) {
    .nav-arrow {
        width: 58px;
        height: 58px;
        font-size: 1.6rem;
    }

    .nav-arrow-top {
        top: 20px;
    }

    .nav-arrow-bottom {
        bottom: 80px;
    }

    .frame-counter {
        bottom: 20px;
        font-size: 12px;
        padding: 6px 14px;
    }
}