/* ========== CSS VARIABLES ========== */
:root {
    /* Professional "Bio-Digital" Palette */
    --primary-color: #00ff9d;
    --secondary-color: #00b8ff;
    --glass-bg: rgba(5, 20, 10, 0.7);
    --glass-border: rgba(0, 255, 157, 0.2);
    --text-glow: 0 0 15px rgba(0, 255, 157, 0.4);
}

/* ========== LIQUID GLASS EFFECT ========== */
.liquid-glass {
    position: relative;
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.1) 0%,
            rgba(255, 255, 255, 0.02) 50%,
            rgba(255, 255, 255, 0.08) 100%);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        inset 0 -1px 0 rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* Animated shine sweep */
.liquid-glass::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -100%;
    width: 60%;
    height: 200%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.2) 50%, transparent 100%);
    transform: skewX(-25deg);
    animation: liquidShine 5s ease-in-out infinite;
    pointer-events: none;
    z-index: 10;
}

@keyframes liquidShine {
    0% {
        left: -100%;
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    80% {
        opacity: 1;
    }

    100% {
        left: 200%;
        opacity: 0;
    }
}

/* Chromatic aberration border */
.liquid-glass::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    background: linear-gradient(45deg,
            rgba(0, 255, 157, 0.5) 0%,
            rgba(0, 184, 255, 0.4) 25%,
            rgba(180, 100, 255, 0.4) 50%,
            rgba(0, 184, 255, 0.4) 75%,
            rgba(0, 255, 157, 0.5) 100%);
    background-size: 400% 400%;
    z-index: -1;
    opacity: 0.7;
    animation: chromaticPulse 6s ease infinite;
    filter: blur(6px);
}

@keyframes chromaticPulse {

    0%,
    100% {
        background-position: 0% 50%;
    }

    25% {
        background-position: 100% 0%;
    }

    50% {
        background-position: 100% 100%;
    }

    75% {
        background-position: 0% 100%;
    }
}

/* ========== RESET ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    width: 100vw;
    width: 100vw;
    height: 100vh;
    /* Fallback for older browsers */
    height: 100dvh;
    /* Dynamic viewport height for mobile browsers */
    overflow: hidden;
    background-color: black;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
    color: white;
    -webkit-user-select: none;
    /* Safari */
    -ms-user-select: none;
    /* IE 10 and IE 11 */
    user-select: none;
    /* Standard syntax */
    -webkit-tap-highlight-color: transparent;
    /* Remove tap highlight on mobile */
    touch-action: none;
    /* Prevent default touch actions like scroll/zoom */
}

/* ========== LAYOUT ========== */
.black-square {
    position: absolute;
    width: 42vh;
    height: 72vh;
    background-color: #050505;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    overflow: hidden;
    border-radius: 3vh;
    /* Rounded corners like a phone screen */
    box-shadow: 0 0 50px rgba(0, 243, 255, 0.15);
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #050505;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    z-index: 1;
    /* Map Filter: Deep Black BG + Cool Mint/Green Roads 
       Using a hue-rotate around 110deg on sepia creates a nice minty green.
    */
    filter: brightness(2) contrast(1.4) sepia(100%) hue-rotate(110deg) saturate(3.5);
}

#loading-gif {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 500;
    background: black;
    transition: opacity 0.6s ease-out;
}

/* FULL HEIGHT FLEX CONTAINER */
.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    flex-direction: column;
    /* Center everything vertically to reduce huge gaps */
    justify-content: center;
    /* Reduced horizontal padding to fit text better */
    padding: clamp(1vh, 2vh, 3vh) clamp(1vh, 1.5vh, 2vh) clamp(1vh, 2vh, 3vh);
    pointer-events: auto;
    overflow: hidden;
    /* Prevent any overflow */
    gap: clamp(1vh, 2vh, 3vh);
    /* Use gap to control spacing instead of flex-grow */
}

/* ========== HEADER ========== */
.header {
    text-align: center;
    flex-shrink: 0;
    margin-bottom: 0;
    /* Let gap handle spacing */
}

.logo-img {
    height: clamp(6vh, 9vh, 10vh);
    /* Slightly smaller */
    width: auto;
    filter: drop-shadow(0 0 5px rgba(0, 243, 255, 0.8));
    animation: pulse 3s infinite alternate;
    margin-bottom: clamp(0.3vh, 0.5vh, 0.8vh);
}

@keyframes pulse {
    to {
        transform: scale(1.05);
        filter: drop-shadow(0 0 10px rgba(0, 255, 136, 0.6));
    }
}

h1 {
    font-size: clamp(2vh, 2.5vh, 3vh);
    font-weight: 800;
    margin: clamp(0.2vh, 0.4vh, 0.5vh) 0 0;
    line-height: 1;
    background: linear-gradient(to right, #fff, #ddd);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: clamp(0.9vh, 1.1vh, 1.3vh);
    font-weight: 600;
    color: var(--secondary-color);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: clamp(0.1vh, 0.2vh, 0.3vh);
    opacity: 0.9;
}

/* ========== MIDDLE SECTION ========== */
.middle-section {
    flex-grow: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(1vh, 1.5vh, 2vh);
    width: 100%;
    overflow: hidden;
}

.menu-links {
    display: flex;
    flex-direction: column;
    gap: clamp(0.8vh, 1vh, 1.2vh);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: clamp(0.8vh, 1.2vh, 1.5vh);
    /* Reduced padding to save width */
    padding: clamp(0.8vh, 1vh, 1.2vh) clamp(0.8vh, 1.2vh, 1.5vh);
    border-radius: clamp(0.8vh, 1.2vh, 1.5vh);
    /* Liquid Glass styling */
    position: relative;
    background: linear-gradient(135deg,
            rgba(5, 25, 15, 0.85) 0%,
            rgba(0, 30, 40, 0.7) 100%);
    border: 1px solid rgba(0, 255, 157, 0.3);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
    white-space: nowrap;
    /* Prevent wrapping */
}

/* Liquid Glass shine on menu items */
.menu-item::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -100%;
    width: 50%;
    height: 200%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.15) 50%, transparent 100%);
    transform: skewX(-25deg);
    animation: menuShine 6s ease-in-out infinite;
    pointer-events: none;
    z-index: 5;
}

@keyframes menuShine {
    0% {
        left: -100%;
        opacity: 0;
    }

    15% {
        opacity: 0.8;
    }

    35% {
        opacity: 0.8;
    }

    50% {
        left: 200%;
        opacity: 0;
    }

    100% {
        left: 200%;
        opacity: 0;
    }
}

/* Chromatic glow on hover */
.menu-item::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(45deg,
            rgba(0, 255, 157, 0.4),
            rgba(0, 184, 255, 0.3),
            rgba(157, 78, 255, 0.3),
            rgba(0, 255, 157, 0.4));
    background-size: 300% 300%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
    animation: glowShift 4s ease infinite;
    filter: blur(4px);
}

@keyframes glowShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.menu-item:hover::after {
    opacity: 1;
}

.menu-item:hover {
    border-color: rgba(0, 255, 157, 0.6);
    box-shadow:
        0 8px 32px rgba(0, 255, 157, 0.2),
        0 0 25px rgba(0, 255, 157, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.menu-item:active {
    transform: scale(0.97);
}

.menu-item span {
    font-size: clamp(1vh, 1.2vh, 1.4vh);
    /* Slightly reduced max size */
    font-weight: 500;
    letter-spacing: 0.5px;
}

.icon-circle {
    width: clamp(2vh, 2.5vh, 3vh);
    height: clamp(2vh, 2.5vh, 3vh);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1vh, 1.2vh, 1.4vh);
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.icon-info {
    color: var(--primary-color);
}

.icon-video {
    color: #ff4757;
}

/* ========== LEGAL SECTION ========== */
.legal-section {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: clamp(1vh, 1.5vh, 2vh);
    margin-bottom: 0;
    /* Let gap handle spacing */
    flex-shrink: 0;
}

.legal-item {
    color: rgba(255, 255, 255, 0.5);
    font-size: clamp(0.8vh, 1vh, 1.2vh);
    text-decoration: none;
    transition: color 0.3s;
    position: relative;
}

.legal-item::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 1px;
    bottom: -2px;
    left: 0;
    background-color: rgba(255, 255, 255, 0.3);
    transform: scaleX(0);
    transition: transform 0.3s;
}

.legal-item:hover {
    color: white;
}

.legal-item:hover::after {
    transform: scaleX(1);
}

/* ========== ACTION BUTTONS ========== */
.action-buttons {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: clamp(0.8vh, 1vh, 1.2vh);
    /* Standardized gap */
    margin-top: 0;
    /* Let gap handle spacing */
}

.btn {
    width: 100%;
    padding: clamp(1vh, 1.2vh, 1.5vh);
    border-radius: clamp(0.8vh, 1.2vh, 1.5vh);
    font-size: clamp(1vh, 1.4vh, 1.6vh);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn-login {
    background: linear-gradient(90deg, #00ff9d 0%, #00b8ff 100%);
    color: black;
    box-shadow: 0 4px 20px rgba(0, 255, 157, 0.4);
    font-weight: 800;
}

.btn-guest {
    background: white;
    font-size: clamp(1.2vh, 1.6vh, 2.0vh);
    font-weight: bold;
    color: black;
    border: 1px solid white;
    backdrop-filter: none;
}

/* ========== CITY LABEL ========== */
#city-label {
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: clamp(1.5vh, 2vh, 2.5vh);
    font-weight: 600;
    letter-spacing: 2px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s;
    text-transform: uppercase;
    margin-top: clamp(0.5vh, 1vh, 2vh);
    /* Reduced margin */
    flex-shrink: 0;
}

/* ========== IPHONE FRAME ========== */
img.iphone-frame {
    height: 100vh;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    pointer-events: none;
    filter: drop-shadow(0 20px 50px rgba(0, 0, 0, 0.9));
}

/* ========== RESPONSIVE: TABLET ========== */
@media (max-width: 1024px) {
    img.iphone-frame {
        display: none !important;
    }

    .black-square {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        box-shadow: none;
        background-color: black;
    }

    .ui-overlay {
        width: 100%;
        height: 100%;
        max-width: 100vw;
        max-height: 100vh;
        max-height: 100dvh;
        top: 0;
        left: 0;
        transform: none;
        padding: clamp(2vh, 3vh, 4vh) clamp(3vw, 5vw, 2.5vh) clamp(2vh, 2.5vh, 3vh);
        border-radius: 0;
        /* Inherit center alignment from base styles */
        /* justify-content: space-between; <-- REMOVED to fix huge gaps */
    }

    .logo-img {
        height: clamp(6vh, 9vh, 12vh);
        /* Reduced max height */
    }

    h1 {
        font-size: clamp(2.5vh, 3.5vh, 4vh);
        /* Reduced slightly */
    }

    h2 {
        font-size: clamp(1.2vh, 1.8vh, 2.2vh);
    }


    .btn {
        font-size: clamp(1.8vh, 2.5vh, 3vh);
        padding: clamp(1.5vh, 2vh, 2.5vh);
    }

    .menu-item span {
        font-size: clamp(1.2vh, 1.6vh, 2vh);
        /* Reduced to prevent wrapping */
    }

    .icon-circle {
        width: clamp(3vh, 4vh, 5vh);
        height: clamp(3vh, 4vh, 5vh);
        font-size: clamp(1.8vh, 2vh, 2.5vh);
    }

    .legal-item {
        font-size: clamp(1.2vh, 1.5vh, 1.8vh);
    }

    #city-label {
        font-size: clamp(2vh, 3vh, 5vh);
        margin-top: clamp(1vh, 1.5vh, 2vh);
        /* Reduced significant gap */
    }
}

/* ========== RESPONSIVE: SMALL PHONES ========== */
@media (max-height: 600px) {
    .ui-overlay {
        padding: 1vh 3vw 1vh;
    }

    .logo-img {
        height: 8vh;
        margin-bottom: 0.2vh;
    }

    h1 {
        font-size: 2.5vh;
    }

    h2 {
        font-size: 1.2vh;
        margin-top: 0;
    }

    .middle-section {
        gap: 0.5vh;
    }

    .menu-links {
        gap: 0.4vh;
    }

    .menu-item {
        padding: 0.6vh 1vh;
        gap: 0.8vh;
    }

    .menu-item span {
        font-size: 1.3vh;
    }

    .icon-circle {
        width: 2.2vh;
        height: 2.2vh;
        font-size: 1.1vh;
    }

    .legal-section {
        margin-bottom: 0.3vh;
        gap: 1vh;
    }

    .legal-item {
        font-size: 1vh;
    }

    .action-buttons {
        gap: 0.4vh;
    }

    .btn {
        padding: 1vh;
        font-size: 1.4vh;
    }

    #city-label {
        font-size: 1.5vh;
        margin-top: 1vh;
    }
}

/* ========== ERROR SCREEN ========== */
#error-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ff0033;
    /* Bright Red */
    z-index: 1000;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 5vh;
}

#error-screen h1 {
    font-size: 4vh;
    color: white;
    background: none;
    -webkit-text-fill-color: white;
    margin-bottom: 2vh;
}

#error-screen p {
    font-size: 2vh;
    color: white;
    opacity: 0.9;
    max-width: 80%;
    margin-bottom: 4vh;
}

.btn-retry {
    background: white;
    color: #ff0033;
    border: none;
    padding: 1.5vh 4vh;
    font-size: 2vh;
    font-weight: 700;
    border-radius: 1vh;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.btn-retry:active {
    transform: scale(0.95);
}
