.map {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.tile-container {
    position: absolute;
    transition: all 0.4s ease;
    width: 150px;
    height: 150px;
    pointer-events: auto;
    font-size: large;
}

/* Tile states */
.tile-container.expanded {
    width: 300px;
    height: 400px;
    z-index: 100;
}

.tile-container:hover {
    width: 160px;
    height: 160px;
}

.tile-container.expanded:hover {
    width: 310px;
    height: 410px;
}

.tile-container.connected {
    z-index: 50;
}

.tile-container.dimmed {
    opacity: 0.3;
}

/* Prevent text realignment on hover */
.tile-container:hover > .tile,
.tile-container.expanded:hover > .tile {
    padding: 5px;
}

/* Basic tile styling */
.tile {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0077AA, #004477);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.4s ease;
    overflow: hidden;
}

/* Content layout */
.tile, .tile-contents {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.tile-contents {
    text-align: center;
    transition: all 0.3s ease;
}

/* Text elements */
.tile-title {
    visibility: block;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
}

.tile-text {
    color: #EEEEEE;
    display: none;
    margin: 10;
    margin-bottom: 0 !important;
    padding: 0;
}

.expanded .tile-text {
    display: block;
}

/* Button styling */
.button {
    display: none;
    background: linear-gradient(135deg, #FFFFFF, #CCC);
    color: #006699;
    padding: 20px 40px;
    border-radius: 10px;
    border: 2px solid #000000;
    font-weight: 900;
    font-size: xx-large;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: inherit;
    margin-left: 10px;
    margin-right: 10px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.expanded .button {
    display: block;
}

.button:hover, .button:active {
    background: linear-gradient(135deg, #EEEEEE, #BBB);
    padding: 22px 42px;
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.2);
}


/* Mini window */

.mini-window-container {
    position: relative;
    top: 7%;
    left: 5%;
    width: 90%;
    height: 86%;
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
    transition: all .2s ease;
}

.mini-window {
    width: 100%;
    height: 100%;
    box-shadow: 15px 10px 5px #444;

    margin-top: 20px;
    object-fit: contain;
    border-radius: 15px;
    border-style: none;
    overflow: scroll;
}

.close-button, .back-button {
    position: absolute;
    top: 30px;
    width: 50px;
    height: 50px;
    background: #eee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1001;
    transition: all 0.4s ease;
}

.close-button {
    right: 10px;
}

.back-button {
    left: 10px;
}

.close-button svg, .back-button svg {
    width: 24px; /* Set a fixed width */
    height: 24px; /* Set a fixed height */
}

.close-button:hover, .back-button:hover {
    background: #ddd;
    transform: scale(1.1);
}

/* Secret Dev Tile - Dynamic Swipe Flip Animation */
/* Transforms are applied dynamically via JS during drag */
/* CSS only provides 3D context and initial state */

.tile-container[data-title="Dev"] {
    z-index: 0 !important; /* Behind Home initially */
    opacity: 0;
    transform: translate(-50%, -50%) rotateY(180deg);
    transform-style: preserve-3d;
    backface-visibility: hidden;
    pointer-events: none;
}

.tile-container[data-title="Home"] {
    z-index: 10 !important; /* Above Dev initially */
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

/* State classes for proper state management (classes set after animation completes) */
.tile-container[data-title="Home"].flipped-out {
    pointer-events: none;
}

.tile-container[data-title="Dev"].flipped-in {
    pointer-events: auto;
}

/* Disable hover effect when tapping (mobile) - but not when expanded */
.tile-container:not(.expanded):active {
    width: 150px !important;
    height: 150px !important;
}



@media (max-width: 1000px) {
    .tile-container.expanded {
        width: 50% !important;
        height: 300px !important;
    }

    .tile-title {
        font-size: 1.3rem;
    }

    .tile-text {
        margin: 0 10px 10px;
    }
}

@media (max-width: 700px) {
    .tile-container {
        width: 120px;
        height: 120px;
        font-size: small;
    }
    
    .tile-container.expanded {
        width: 75% !important;
        height: 250px !important;
    }

    .tile-title {
        font-size: 1.1rem;
    }

    .button {
        padding: 10px 20px;
        font-size: x-large;
    }
    
    .button:hover {
        padding: 10px 18px;
    }
}