@import url("https://fonts.googleapis.com/css2?family=Reddit+Mono:wght@200..900&display=swap");

body {
	width: 100vw;
	height: 100vh;

	display: flex;
	justify-content: center;
	align-items: center;

	background-color: black;
	overflow: hidden; /* Prevent scrolling on mobile */
	touch-action: none; /* Prevent default browser touch behaviors like scrolling and zooming */
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10+ */
    user-select: none; /* Standard syntax */
}

#holder {
	display: flex;
	justify-content: center;
	align-items: center;

	flex-direction: column;

	position: relative;

	transform-style: preserve-3d;

	/* The transform property will now be controlled by JavaScript */
	transition: transform 0.05s ease-out; /* Keep transition for smooth reset animation, made faster for responsiveness */
	transform-origin: center center; /* Keep transform origin in CSS */
}

#daceFloor {
	width: 600px;
	aspect-ratio: 1 / 1;
	background-color: black;

	transform: rotateX(82deg);

	display: flex;
	justify-content: center;
	align-items: center;

	flex-wrap: wrap;
}

.tile {
	border: 1px solid black;

	width: 13.9%;
	aspect-ratio: 1 / 1;

	background-color: black;

	box-shadow: inset 4px 4px 4px white, inset -4px -4px 4px white;
	filter: blur(1px) brightness(90%);
}

.dancer {
	width: 60px;
	aspect-ratio: 1 / 1;

	position: absolute;
	background-size: 71%;
	background-position: center;
	background-repeat: no-repeat;
}

/* New fixed control bar styles */
#controlBar {
    position: fixed;
    bottom: 60px; /* Positioned above app-footer (which is at 10px from bottom) */
    left: 0;
    width: 100%;
    height: 50px; /* Consistent height */
    background-color: white;
    display: flex;
    justify-content: space-evenly; /* Distribute items evenly */
    align-items: center;
    z-index: 999; /* Ensure it's above main content but below modals */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}

#reset {
	width: 40px;
	height: 40px;

	background-image: url("./restart.png");
	background-size: 70%;
	background-position: center;
	background-repeat: no-repeat;
	transition: 0.5s all;
}

#audio {
	width: 40px;
	height: 40px;

	background-image: url("./mute.png");
	background-size: 70%;
	background-position: center;
	background-repeat: no-repeat;
	transition: 0.5s all;
}

#plus {
	width: 40px;
	height: 40px;

	background-image: url("./plus.png");
	background-size: 70%;
	background-position: center;
	background-repeat: no-repeat;

	transition: 0.5s all;
}

#reset:hover,
#audio:hover,
#plus:hover {
	cursor: pointer;
	width: 55px;
	height: 55px;
}

#title {
	font-family: "Reddit Mono", monospace;
	font-optical-sizing: auto;
	font-weight: 600;
	font-style: normal;
	font-size: 16px;
	white-space: nowrap; /* Prevent title from wrapping onto multiple lines */
    flex-grow: 1; /* Allow the title to take available space */
    text-align: center; /* Center the text within its allocated space */
}

#startButtonOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Ensure it's on top */
}

#startButton {
    padding: 20px 40px;
    font-family: "Reddit Mono", monospace;
    font-size: 24px;
    font-weight: bold;
    color: #A2D120; /* GLaDOS green */
    background-color: #333;
    border: 2px solid #A2D120;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

#startButton:hover {
    background-color: #A2D120;
    color: #333;
    border-color: #333;
}

#coordinatesDisplay {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1001;
    color: #A2D120;
    font-family: "Reddit Mono", monospace;
    font-size: 14px;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 8px 12px;
    border-radius: 5px;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none; /* Allows clicks/touches to pass through */
}

/* Custom Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000; /* Higher than other elements */
    visibility: hidden; /* Hidden by default */
    opacity: 0;
    transition: visibility 0s, opacity 0.3s ease-in-out;
}

.modal-overlay.visible {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background-color: #1a1a1a;
    border: 2px solid #A2D120;
    border-radius: 10px;
    padding: 30px;
    max-width: 80%;
    text-align: center;
    box-shadow: 0 0 20px rgba(162, 209, 32, 0.5);
    font-family: "Reddit Mono", monospace;
    color: #A2D120;
}

#modalMessage {
    margin-bottom: 20px;
    font-size: 1.2em;
}

#modalConfirmButton {
    padding: 10px 25px;
    font-family: "Reddit Mono", monospace;
    font-size: 1em;
    font-weight: bold;
    color: #1a1a1a;
    background-color: #A2D120;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

#modalConfirmButton:hover {
    background-color: #88B21D;
    color: #000;
}

#app-footer {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-family: "Reddit Mono", monospace;
    font-size: 12px;
    color: #A2D120;
    text-align: center;
    z-index: 500; /* Below overlays, but above main content */
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 5px;
}

#app-footer a {
    color: #0D52E0; /* A distinct blue for links */
    text-decoration: none;
}

#app-footer a:hover {
    text-decoration: underline;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    #holder {
        /* Less dramatic 3D effect for mobile, more front-on */
        /* transform property is now controlled by JavaScript */
        width: 100vw; /* Take full width */
        height: 100vh; /* Take full height */
        position: absolute; /* Allow flexible positioning within body */
        top: 0;
        left: 0;
    }

    #daceFloor {
        width: min(90vw, 400px); /* Make dance floor responsive, max 400px */
        transform: rotateX(75deg); /* Adjust angle if holder transform changed */
    }

    .tile {
        box-shadow: inset 2px 2px 2px white, inset -2px -2px 2px white;
        filter: blur(0.5px) brightness(90%);
    }

    .dancer {
        width: 45px; /* Smaller dancers */
        height: 45px;
        background-size: 70%; /* Adjust background size for smaller width */
    }

    /* Control bar mobile adjustments */
    #controlBar {
        height: 45px; /* Slightly shorter for mobile */
        bottom: 50px; /* Adjust as needed for smaller screens, ensure it's above the footer */
    }

    #reset, #audio, #plus {
        width: 35px; /* Smaller buttons */
        height: 35px;
        background-size: 60%; /* Adjust background size for smaller buttons */
    }

    #reset:hover, #audio:hover, #plus:hover {
        width: 40px; /* Slightly smaller hover effect */
        height: 40px;
    }

    #title {
        font-size: 14px; /* Smaller title */
        text-align: center;
        flex-grow: 1;
    }

    #startButton {
        padding: 15px 30px; /* Smaller start button */
        font-size: 20px;
    }

    #app-footer {
        font-size: 10px;
        padding: 3px 8px;
        bottom: 5px;
    }
}