/* Base styles and variables */
:root {
    --max-content-width: 800px;
    --form-width: min(90%, 500px);
    --base-font-size: clamp(16px, 3vw, 32px);
    --footer-height: 40px;
    --spacing-sm: 10px;
    --spacing-md: 20px;
    --primary-color: #65db32;
    --disabled-color: #4a4a4a;
}

@font-face {
    font-family: 'VT323';
    src: url('/fonts/VT323-Regular.woff2') format('woff2'),
         url('/fonts/VT323-Regular.woff') format('woff');
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'VT323', monospace;
}

/* Layout */
body {
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    background: #9DC2F6;
    overflow-x: hidden;
    position: relative;
}

.container {
    flex: 1;
    width: 100%;
    margin: 0 auto;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--footer-height);
    min-height: fit-content;
    position: relative;
}

/* Logo */
.logo {
    width: min(98%, 1200px);
    height: auto;
    margin-bottom: var(--spacing-sm);
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: nearest-neighbor;
    image-rendering: optimize-contrast;
}

/* Form elements */
.form-container {
    width: var(--form-width);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    position: relative;
    margin-top: var(--spacing-sm);
    height: auto;
    min-height: calc(var(--base-font-size) * 4);
    backdrop-filter: blur(4px);
}

.email-input-wrapper {
    position: relative;
    width: 100%;
}

.email-input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    padding-right: calc(var(--base-font-size) * 3); /* Increased from 2.2 to 3 for more space */
    border: 2px solid rgba(0, 0, 0, 0.3);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    border-radius: 4px;
    font-size: var(--base-font-size);
    transition: all 0.3s ease;
}

.email-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(101, 219, 50, 0.3);
    background: rgba(0, 0, 0, 0.9);
}

.email-input::placeholder {
    color: var(--primary-color);
    opacity: 0.9;
}

.button-container {
    display: flex;
    gap: var(--spacing-sm);
    width: 100%;
}

.submit-btn {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: var(--base-font-size);
    cursor: pointer;
    position: relative;
    top: 0;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.submit-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.95);
    transform: translateY(1px);
}

.submit-btn:active:not(:disabled) {
    transform: translateY(2px);
}

.submit-btn img {
    height: calc(var(--base-font-size) * 1.2);
    width: auto;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: nearest-neighbor;
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.6);
    color: #808080;
}

.play-btn {
    background: #5865F2; /* Discord brand color */
}

.play-btn:hover:not(:disabled) {
    background: #4752C4; /* Darker shade of Discord color */
}

.play-btn:disabled {
    background: rgba(88, 101, 242, 0.5); /* Semi-transparent Discord color */
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    height: var(--footer-height);
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.footer-content {
    max-width: var(--max-content-width);
    height: 100%;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-links {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
}

.footer-link, .copyright {
    color: #808080;
    text-decoration: none;
    font-size: clamp(14px, 2vw, 24px);
    white-space: nowrap;
    padding: 2px 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.footer-link:not(.disabled):hover {
    color: var(--primary-color);
    text-shadow: 0 0 5px rgba(101, 219, 50, 0.3);
}

.footer-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Cloud Backgrounds */
.cloud-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.cloud-back, .cloud-front {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%; /* Double width for seamless loop */
    height: 100%;
    background-repeat: repeat-x;
    will-change: transform;
    background-position: bottom; /* Anchor clouds to bottom */
}

.cloud-back {
    background-image: url('imgs/cloud-back.png');
    background-size: auto 100%; /* Maintain height, auto-width for aspect ratio */
    animation: moveCloudBack 120s linear infinite;
    opacity: 0.8;
}

.cloud-front {
    background-image: url('imgs/cloud-front.png');
    background-size: auto 100%;
    animation: moveCloudFront 80s linear infinite;
    opacity: 0.9;
}

/* Media query for ultra-wide screens */
@media (min-aspect-ratio: 21/9) {
    .cloud-back, .cloud-front {
        width: 300%; /* Triple width for ultra-wide screens */
    }
}

/* Media query for portrait screens */
@media (max-aspect-ratio: 9/16) {
    .cloud-back, .cloud-front {
        height: 50%; /* Reduce height in portrait mode */
        background-size: auto 200%; /* Maintain aspect ratio while filling width */
    }
}

@keyframes moveCloudBack {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%); /* Move left by half the width */
    }
}

@keyframes moveCloudFront {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

/* Background animation - adjusted to work with clouds */
body::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: max(300vw, 300vh);
    height: max(300vw, 300vh);
    background: radial-gradient(circle at center, #b8d4fa, transparent);
    animation: pulseGlow 8s ease-in-out infinite;
    z-index: -2; /* Put behind clouds */
    pointer-events: none;
}

@keyframes pulseGlow {
    0%, 100% {
        opacity: 0.28;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.62;
        transform: translate(-50%, -50%) scale(1.05);
    }
}

/* Mobile adjustments */
@media (max-width: 480px) {
    :root {
        --spacing-md: 15px;
        --spacing-sm: 8px;
    }

    .footer-content {
        padding: 0 var(--spacing-sm);
    }
}

/* Landscape mode */
@media (max-height: 500px) {
    .container {
        padding: var(--spacing-sm);
        justify-content: flex-start;
        padding-top: 20px;
    }
    
    .logo {
        width: auto;
        height: 45vh;
        min-height: 120px;
        margin-bottom: 10px;
    }
    
    .form-container {
        width: min(90%, 400px);
    }
    
    .submit-btn {
        padding: 8px 15px;
    }
}

/* Additional landscape adjustments for very small heights */
@media (max-height: 400px) {
    .logo {
        height: 40vh;
        min-height: 100px;
    }
    
    .container {
        padding-top: 15px;
    }
}

/* Add transition effects */
.email-input,
.submit-btn,
.footer-link {
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Landscape/desktop adjustments */
@media (min-width: 1200px) {
    .logo {
        width: min(98%, 1600px);
    }
    
    .container {
        padding: var(--spacing-md) 0;
    }
}

/* Update status message styles */
.status-message {
    font-size: var(--base-font-size);
    text-align: center;
    position: absolute;
    width: 100%;
    top: calc(-1.5 * var(--base-font-size));
    left: 0;
    height: var(--base-font-size);
    line-height: var(--base-font-size);
    padding: 0 var(--spacing-md);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s step-start;
    z-index: 100;
    color: #FF4444;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.5);
    transform: translateZ(0);
    will-change: opacity;
}

.status-message.show {
    opacity: 1;
    pointer-events: auto;
}

.status-message.success {
    color: #FFD700;
}

.status-message.error {
    color: #FF4444;
}

.email-input.submitted {
    color: rgba(255, 255, 255, 0.5);
}

.email-input.submitted::placeholder {
    color: rgba(101, 219, 50, 0.35);
}

.submit-arrow {
    position: absolute;
    right: calc(var(--spacing-md) * 0.8); /* Increased from spacing-sm to spacing-md * 0.8 */
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    height: calc(var(--base-font-size) * 0.9);
    cursor: pointer;
    background: var(--primary-color);
    border: none;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    padding: 0 calc(var(--spacing-md) * 1.2) 0 calc(var(--spacing-md) * 1.2);
}

.submit-arrow::before {
    content: '→';
    color: #000;
    font-size: calc(var(--base-font-size) * 0.8);
    line-height: 1;
}

.submit-arrow.show {
    opacity: 1;
    pointer-events: auto;
}

.submit-arrow:hover {
    transform: translateY(-50%) scale(1.1);
    background: #7dff3f;
}

.submit-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

/* Mobile/portrait adjustments for better legibility */
@media (max-width: 767px), (max-aspect-ratio: 1/1) {
    :root {
        /* Keep base-font-size the same but adjust components individually */
        --button-font-size: clamp(18px, 4.5vw, 28px);
        --input-font-size: clamp(18px, 4.5vw, 28px);
    }
    
    .email-input {
        font-size: var(--input-font-size);
        padding: calc(var(--spacing-sm) * 1.2) var(--spacing-md);
        padding-right: calc(var(--base-font-size) * 3);
        min-height: 50px;
    }
    
    .submit-btn {
        font-size: var(--button-font-size);
        padding: calc(var(--spacing-sm) * 1.2) calc(var(--spacing-sm) * 1.8);
        min-height: 50px;
    }
    
    .submit-btn img {
        height: calc(var(--button-font-size) * 1.1);
    }
    
    .submit-arrow {
        height: calc(var(--input-font-size) * 0.9);
        padding: 0 calc(var(--spacing-md) * 1.2) 0 calc(var(--spacing-md) * 1.2);
    }
    
    .submit-arrow::before {
        font-size: calc(var(--input-font-size) * 0.8);
    }
}

/* More extreme adjustment for very narrow screens */
@media (max-width: 480px) {
    .submit-btn {
        padding: calc(var(--spacing-sm) * 1.2) calc(var(--spacing-sm) * 1.4);
    }
    
    .button-container {
        flex-direction: column;
        gap: calc(var(--spacing-sm) * 1.3);
    }
}

/* Translation Banner */
.translation-banner {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    color: #fff;
    padding: 8px 15px;
    text-align: center;
    position: relative;
    top: 0;
    width: 100%;
    z-index: 1001;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 35px;
    font-size: clamp(14px, 2.5vw, 18px);
}

.banner-text {
    margin: 0;
    padding: 0;
}

.banner-text a {
    color: #FFD700;
    text-decoration: none;
    font-weight: bold;
}

.banner-text a:hover {
    text-decoration: underline;
}

.banner-icon {
    height: 1em;
    width: auto;
    vertical-align: middle;
    margin-left: 5px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: nearest-neighbor;
}

.close-banner-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-banner-btn img {
    height: 18px;
    width: 18px;
    transition: transform 0.2s ease-in-out;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: nearest-neighbor;
}

.close-banner-btn:hover img {
    transform: scale(1.1);
}