@keyframes headerFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ticker {
    0% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(-100%);
    }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.horizontal-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: auto;
    padding-bottom: 10px;
    transform: translateY(-20px);
}

#orientation-prompt {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 20px;
    border-radius: 8px;
    z-index: 2000;
    width: 80%;
    max-width: 300px;
    text-align: center;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.pillar {
    display: none; /* Default state */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0;
    bottom: 0;
    width: 25%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 100;
}

.pillar button.control-button {
    width: 60px;
    height: 60px;
    font-size: 12px;
    font-family: 'Press Start 2P', monospace;
    border-radius: 50%;
    border: 2px solid #fff;
    margin: 5px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.pillar-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-bottom: 0;
}

.pillar-right {
    right: 0;
}

#btn-thrust {
    background: radial-gradient(circle, #ff6600, #ff3300);
    height: 80px;
    width: 80px;
    bottom: 10%; /* Adjust placement */
    left: 50%;
    margin-bottom: 40px;
    transform: translateX(20px);
}

#btn-left {
    bottom: 10%;
    left: 10%;
}

#btn-right {
    bottom: 10%;
    right: 10%;
}

#btn-fire, #btn-shield {
    width: 75px;
    height: 75px;
    font-size: 11px;
    margin: 10px 5px;
}

#btn-fire {
    background: radial-gradient(circle, #ff4444, #ff0000);
    color: white;
    font-size: 11px;
}

#btn-fire:hover {
    background-color: #ff0000;
}

#btn-shield {
    background: radial-gradient(circle, #44ff44, #00ff00);
    color: white;
    font-size: 11px;
}

#btn-shield:hover {
    background-color: #00ff00;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 100vw;
    max-height: 100vh;
    margin: 0 auto;
}


#speaker-icon, #music-icon {
    position: absolute;
    z-index: 1001;
}

#site-header {
    text-align: center;
    margin-top: 0;
    padding-top: 5px;
    padding-bottom: 5px;
    background-color: #f0f8ff;
    animation: headerFadeIn 3s ease-out;
}

#ascii-wrapper, #ascii-wrapper-modal {
    display: inline-block;
    text-align: left;
    margin: 0 auto;
    /* Add these to ensure the ASCII art scales properly */
    max-width: 100%;
    overflow-x: hidden;
}

#header-title, #modal-title {
    font-family: 'Courier New', Courier, monospace;
    font-size: 28px;
    font-weight: bold;
    color: #0339A6;
    white-space: pre;
    line-height: 1.1;
    margin: 0;
    overflow: visible;
}

.game-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid #ffffff;
    padding: 20px;
    z-index: 1000;
    color: #ffffff;
    text-align: center;
    opacity: 1;
}

.control-button {
    font-family: 'Press Start 2P', monospace;
    color: #fff;
    background: radial-gradient(circle, #ff9900, #ff6600);
    border: 2px solid #fff;
    border-radius: 50%;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    margin: 5px;
    text-align: center;
    box-shadow: 0 4px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s, background-color 0.3s;
    touch-action: none;
    width: 60px;
    height: 60px;
}

.control-button:hover {
    background-color: #0339A6;
    transform: scale(1.1);
}

.control-button:active {
    transform: scale(0.9);
    box-shadow: 0 2px rgba(0, 0, 0, 0.3);
}

.scoreboard {
    font-family: "lores-12", sans-serif;
    font-weight: 400;
    font-style: normal;
    font-size: 30px;
    color: #fcf;
}

#ascii-wrapper-modal {
    display: inline-block; /* Keeps width tight around ASCII art */
    text-align: left; /* Left-align ASCII art inside this wrapper */
    margin: 0 auto; /* Center wrapper within the modal content */
}

#welcome-text {
    color: #FFFFFF; /* Bright white for visibility */
    font-family: 'Courier New', Courier, monospace; /* Match the ASCII font style */
    font-size: 16px; /* Adjust as needed */
    text-align: center; /* Center align the text */
    margin-top: 10px; /* Add spacing above */
    margin-bottom: 10px; /* Add spacing below */
    padding: 5px; /* Optional: Add padding for extra spacing */
}

#game-over-text {
    text-align: center; /* Center-align the game over text */
    margin-top: 10px;
    font-family: 'Courier New', Courier, monospace;
    color: #fff;
}

#game-over-text textarea {
    width: 100%;
    font-size: 14px;
    margin-top: 10px;
    border: 1px solid #fff;
    background-color: #333;
    color: #fff;
    padding: 5px;
    border-radius: 5px;
}

#game-over-text button {
    display: block;
    margin: 10px auto;
    background-color: #20D91A;
    border: none;
    padding: 10px 20px;
    font-family: 'Press Start 2P', monospace;
    color: #fff;
    cursor: pointer;
    border-radius: 5px;
}

#game-over-text button:hover {
    background-color: #17B514;
}

.game-over-title {
    font-size: 32px;
    font-weight: bold;
    color: #FFFFFF;
    margin-bottom: 20px;
    font-family: 'Press Start 2P', monospace; /* Match game font */
    text-align: center;
}

header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: linear-gradient(45deg, #1D77CF, #25C2BD, #1EADD9, #1ED99E, #1DCF64);
    animation: gradientShift 45s ease infinite;
    background-size: 200% 200%;
}

.animated-header {
    font-family: "uniwars", sans-serif;
    font-size: 4rem;
    font-weight: 400;
    color: #FFFFFF;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
}

body {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    margin: 0;
    padding: 0;
    font-family: "uniwars", sans-serif;
    background-color: #121230;
    background-size: cover;
    background-repeat: repeat;
    background-position: center center;
    background-attachment: fixed;
    color: #E0E0FF;
}

.game-wrapper {
    display: flex;
    position: relative;
    justify-content: center;
    align-items: center;
    margin: 20px auto; /* Center the game wrapper and add vertical spacing */
    background-color: #333; /* Arcade chrome background */
    border-radius: 15px;
    padding: 10px; /* Adjust padding as needed */
    width: 1044px; /* Game width + padding */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); /* Optional: Add a shadow for depth */
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px; /* Limit width on desktop */
    height: auto;
    max-height: 90vh;
    margin: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background-color: #111;
    padding: 10px;
    border: 2px solid #fff;
    border-radius: 8px;
    text-align: center;
    width: 100%;     /* Changed from 90% */
    max-width: 800px;/* Changed from 90% to fixed value */
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.game-modal, .controls-modal {
    position: fixed;  /* Changed from absolute - this is key */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    border: 2px solid #fff;
    border-radius: 8px;
    padding: 20px;
    z-index: 2000;   /* Increased to ensure it's above everything */
    color: #ffffff;
    text-align: center;
    width: 80%;
    max-width: 650px;
}

/* Adjust the input container to stack rows vertically */
.input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px; /* You can adjust this as needed */
}

/* Style each input row */
.input-row {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 15px; /* Space between rows */
}

/* Style inputs within input rows */
.input-row input,
.input-row select {
    width: 90%; /* Default width for inputs and select */
    max-width: 300px; /* Optional: Limit the max width */
    padding: 10px;
    font-size: 12px;
    font-family: 'Press Start 2P', monospace;
    color: #fff;
    background-color: #000;
    border: 2px solid #fff;
    border-radius: 4px;
    text-align: center;
    margin: 0 auto; /* Center the input */
    caret-color: #fff;
}

/* Adjust inputs in the first row to be side by side */
.input-row:first-child input {
    width: 48%;
    margin: 0 1%;
}

/* Style for the select dropdown to match inputs */
.input-row select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #000;
    background-image: url('data:image/svg+xml;base64,PHN2ZyBmaWxsPSIjZmZmIiBoZWlnaHQ9IjEyIiB2aWV3Qm94PSIwIDAgMTIgMTIiIHdpZHRoPSIxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNNiA5bC00LjItNC4yIDEuNC0xLjQgMi44IDIuOCAyLjgtMi44IDEuNCAxLjQtNC4yIDQuMnoiLz48L3N2Zz4=');
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px; /* Space for the arrow */
}

/* Optional: Adjust placeholder color for select */
.input-row select option[disabled] {
    color: #888;
}

.input-container input,
.input-container select {
    padding: 10px;
    font-family: 'Press Start 2P', monospace;
    color: #fff;
    background-color: #000;
    border: 2px solid #fff;
    border-radius: 4px;
    text-align: center;
    caret-color: #fff;
    box-sizing: border-box;
    width: 100%; /* Default width */
}

/* Special case for side-by-side inputs */
.input-container.side-by-side input {
    width: 48%;
}

/* Placeholder styling */
.input-container input::placeholder {
    color: #fff;
    opacity: 0.5;
    font-family: 'Press Start 2P', monospace;
}

.arcade-button {
    width: 100px;
    height: 100px;
    font-size: 14px;
    font-family: 'Press Start 2P', monospace;
    color: #fff;
    background-color: #20D91A;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    transition: transform 0.2s ease-in-out;
}

.arcade-button:hover {
    background-color: #20D91A;
    transform: scale(1.1);
}

#admin-controls {
    text-align: center;
    margin: 20px;
}

#admin-controls button {
    padding: 10px 20px;
    font-size: 14px;
    font-family: 'Press Start 2P', monospace;
    color: #fff;
    background-color: #fff;
    border: none;
    cursor: pointer;
}

#admin-controls button:hover {
    background-color: #ffffff;
}

.ticker {
    position: absolute;
    bottom: 0;
    width: 100%;
    background-color: #333;
    color: #fff;
    font-family: "lores-12-bold-alt-oakland", sans-serif;
    font-weight: 400;
    font-style: normal;
    font-size: 20px;
    z-index: 1100;
    padding: 20px 0;
    overflow: hidden;
}

#ticker-content {
    white-space: nowrap;
    display: inline-block;
    padding-left: 100%;
    animation: ticker 15s linear infinite;
}

.ticker span {
    display: inline-block;
    margin-right: 40px;
}

.icon-buttons {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 20px;
}

.icon-button {
    width: 40px;
    height: 40px;
    font-size: 20px;
    font-family: 'Press Start 2P', monospace;
    color: #fff;
    background-color: #0762D9;
    border: 0px solid #fff;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, transform 0.2s;
}

.icon-button:hover {
    background-color: #0339A6;
    transform: scale(1.1);
}


.score-text {
    font-size: 16px;
    color: #FFFFFF;
    font-family: 'Press Start 2P', monospace;
    text-align: center;
    margin-bottom: 10px;
}

.global-rank {
    font-size: 16px;
    color: #FFFFFF;
    font-family: 'Press Start 2P', monospace;
    text-align: center;
}

.global-rank.top-10 {
    color: #C0C0C0;
}

.global-rank.top-5 {
    color: #FFD700;
}

.global-rank.high-score {
    color: #FF4500;
}

.trophy-icon {
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin-left: 10px;
}

#modal-title.ascii-title {
    font-size: 9px; /* Adjust this size as needed for your ASCII art */
    color: #1DCF64;
    line-height: 1;
}

.info-modal-content .close-button {
    background-color: #00FF00;
    border-radius: 5px;
    color: #000;
}

.info-modal-content .close-button:hover {
    background-color: #00CC00;
}

.controls-title {
    font-family: 'Press Start 2P', monospace;
    color: #fff;
    margin-bottom: 20px;
}

#controls-content {
    text-align: left;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
}

#controls-content ul {
    list-style: none;
    padding: 0;
}

#controls-content li {
    margin-bottom: 10px;
}

#resume-game-button {
    margin-top: 20px;
}

.level-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7); /* Semi-transparent background */
    border: 1px solid #ffffff; /* Singular border */
    padding: 15px;
    z-index: 1002;
    color: #ffffff;
    text-align: center;
    width: 300px; /* Narrower width */
    opacity: 0; /* Start transparent */
    transition: opacity 0.5s ease-in-out;
    border-radius: 5px;
}

.level-modal-content {
    padding: 10px;
    font-family: 'Press Start 2P', monospace; /* Match game font */
    font-size: 18px;
    color: #fff;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #FFFFFF;
    cursor: pointer;
    user-select: none;
    background-color: #20D91A; /* That beautiful green */
    border: none;
    border-radius: 5px;
    padding: 0px 12px;
    z-index: 1100;
    transition: background-color 0.2s ease;
}

.close-button:hover {
    background-color: #17B514; /* Subtle darker green on hover */
    color: #FFFFFF; /* Keep text white on hover */
}

#feedback-link {
    position: absolute;
    bottom: 10px;
    right: 10px;
    color: #FFFFFF;
    font-size: 14px;
    text-decoration: underline;
    cursor: pointer;
}

/* Survey Modal Styles */
#survey-modal .modal-content {
    width: 500px;
    max-width: 90%;
}

#survey-modal label {
    display: block;
    margin-top: 15px;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
}

#survey-modal input[type="range"] {
    width: 100%;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #ccc;
    margin-bottom: 10px;
}

#survey-modal textarea {
    width: 100%;
    height: 100px;
    margin-top: 10px;
    font-family: 'Press Start 2P', monospace;
    background-color: #000;
    color: #fff;
    border: 1px solid #fff;
    border-radius: 4px;
    padding: 10px;
}

#survey-modal .arcade-button {
    margin-top: 20px;
}

#survey-modal .survey-title {
    color: #1DCF64;
    font-family: 'Press Start 2P', monospace;
    margin-bottom: 20px;
}

/* Survey Responses Styles */
#survey-results {
    margin: 20px;
    font-family: 'Courier New', Courier, monospace;
    color: #333;
}

#survey-results h2, #survey-results h3 {
    color: #111;
}

.survey-response {
    border: 1px solid #ccc;
    padding: 10px;
    margin-bottom: 10px;
}

footer {
    text-align: center;
    padding: 20px;
    background: #010326;
    color: #aaa;
}

footer a {
    color: #1EADD9;
    text-decoration: none;
}

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

.hidden {
    display: none;
}


/* Mobile styles - both portrait and landscape */
@media (max-width: 900px) {
    #game-container {
        width: 100%; /* Changed from 50% for better mobile layout */
        margin: 0 auto;
    }

    /* Modal adjustments for mobile */
    .game-modal, .controls-modal {
        width: 95%;    /* Wider on mobile */
        padding: 15px; /* Slightly less padding */
    }

    /* Keep your existing button styles */
    .control-button,
    .pillar button {
        width: 60px;
        height: 60px;
        min-width: 60px;
        min-height: 60px;
        margin: 10px;
    }

    .arcade-button {
        width: 70px;
        height: 70px;
        font-size: 12px;
    }

    .input-container input {
        font-size: 12px;
    }

    .pillar button.control-button {
        width: 50px;
        height: 50px;
        font-size: 10px;
    }

    #btn-fire, #btn-shield {
        width: 62.5px;  /* 25% bigger than 50px */
        height: 62.5px; /* 25% bigger than 50px */
    }

    #btn-thrust {
        margin-bottom: 5px; /* Reduced from 15px */
        transform: translateY(-5px);
    }

    #modal-title.ascii-title {
        font-size: 6px !important; /* Reduced from 9px */
        line-height: 0.8;
        /* Ensure proper centering and scaling */
        transform-origin: center;
        transform: scale(0.9);
        white-space: pre;
        text-align: center;
    }
}

@media (max-width: 900px) and (orientation: landscape) {
    /* Your existing landscape styles are good */
    header {
        display: none;
    }

    footer {
        display: none;
    }

    body {
        overflow: hidden; /* Prevent scrolling */
        position: fixed;
        width: 100%;
        height: 100%;
    }

    #game-container {
        width: auto !important;  /* Let the height determine the width */
        height: 95vh !important; /* Use most of the viewport height */
        max-height: 100vh;
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        margin: 0 !important;
        aspect-ratio: 4/3 !important;
    }

    .pillar {
        position: fixed;
        display: flex;
        height: 100vh;
        width: calc((100vw - (95vh * 4/3))/2); /* Calculate pillar width based on game size */
        padding: 20px;
        background: linear-gradient(45deg, #e6e6e6, #cccccc, #999999, #e6e6e6);
        border: 1px solid #000;
        box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
        box-sizing: border-box;
    }

    .pillar-right {
        right: 0;
        align-items: center;
        justify-content: center;
        z-index: 200;
    }

    .pillar-left {
        display: flex;
        left: 0;
        align-items: center;
        justify-content: center;
    }

    /* Add modal adjustment for landscape */
    .game-modal, .controls-modal {
        max-height: 90vh; /* Prevent overflow */
        overflow-y: auto; /* Allow scrolling if needed */
    }

    #btn-fire, #btn-shield {
        width: 75px !important;  /* Override any other styles */
        height: 75px !important;
        font-size: 11px;
    }

    .control-button {
        width: 50px;
        height: 50px;
        font-size: 10px;
    }

    #btn-thrust {
        margin-bottom: 40px;  /* Increased to push it down */
        transform: translateY(90px); /* Move down relative to center */
    }

    .horizontal-row {
        display: flex;
        justify-content: center;
        gap: 10px;
        margin-top: auto;
        padding-bottom: 10px;
        transform: translateY(-90px); /* Move up relative to center */
    }
}

@media (max-width: 380px) {
    #modal-title.ascii-title {
        font-size: 5px !important;
        transform: scale(0.8);
    }
}