@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Inter:wght@400;600&display=swap');

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(180deg, #0a0a1a 0%, #1a0a2e 50%, #0f0f1a 100%);
    color: #fff;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.space-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.stars {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #fff, transparent),
        radial-gradient(2px 2px at 40px 70px, #ffd700, transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(2px 2px at 160px 120px, #fff, transparent),
        radial-gradient(1px 1px at 230px 80px, #ffd700, transparent),
        radial-gradient(2px 2px at 300px 150px, #fff, transparent),
        radial-gradient(1px 1px at 350px 60px, #fff, transparent),
        radial-gradient(2px 2px at 420px 200px, #ffd700, transparent),
        radial-gradient(1px 1px at 500px 90px, #fff, transparent),
        radial-gradient(2px 2px at 580px 180px, #fff, transparent);
    background-size: 600px 300px;
    animation: twinkle 4s ease-in-out infinite alternate;
}

.stars-2 {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(1px 1px at 50px 100px, #fff, transparent),
        radial-gradient(2px 2px at 120px 50px, #fff, transparent),
        radial-gradient(1px 1px at 180px 180px, #ffd700, transparent),
        radial-gradient(2px 2px at 250px 30px, #fff, transparent),
        radial-gradient(1px 1px at 320px 140px, #fff, transparent),
        radial-gradient(2px 2px at 400px 80px, #ffd700, transparent),
        radial-gradient(1px 1px at 480px 200px, #fff, transparent),
        radial-gradient(2px 2px at 550px 40px, #fff, transparent);
    background-size: 600px 250px;
    animation: twinkle 3s ease-in-out infinite alternate-reverse;
}

.planet {
    position: absolute;
    border-radius: 50%;
    opacity: 0.6;
}

.planet-1 {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at 30% 30%, #ff6b6b, #c41e3a);
    top: 15%;
    right: 10%;
    animation: float 20s ease-in-out infinite;
}

.planet-2 {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle at 30% 30%, #ffd700, #ff9f43);
    top: 60%;
    right: 25%;
    animation: float 15s ease-in-out infinite reverse;
}

.planet-3 {
    width: 25px;
    height: 25px;
    background: radial-gradient(circle at 30% 30%, #74b9ff, #0984e3);
    top: 40%;
    left: 8%;
    animation: float 18s ease-in-out infinite;
}

.shooting-star {
    position: absolute;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, #ffd700, #fff, transparent);
    top: 15%;
    left: -100px;
    animation: shoot 6s linear infinite;
    opacity: 0;
}

.shooting-star-2 {
    top: 35%;
    width: 60px;
    animation-delay: 2s;
    animation-duration: 5s;
}

.shooting-star-3 {
    top: 55%;
    width: 100px;
    animation-delay: 4s;
    animation-duration: 7s;
}

.shooting-star-4 {
    top: 75%;
    width: 50px;
    animation-delay: 1s;
    animation-duration: 4s;
}

.shooting-star-5 {
    top: 25%;
    width: 70px;
    animation-delay: 5s;
    animation-duration: 5.5s;
}

.rocket {
    position: absolute;
    width: 30px;
    height: 30px;
    animation: rocketFly 12s linear infinite;
    opacity: 0;
    transform: rotate(-45deg);
}

.rocket svg {
    width: 100%;
    height: 100%;
}

.rocket-1 {
    top: 30%;
    animation-delay: 0s;
}

.rocket-2 {
    top: 60%;
    width: 20px;
    height: 20px;
    animation-delay: 6s;
    animation-duration: 15s;
}

.rocket-3 {
    top: 45%;
    width: 25px;
    height: 25px;
    animation-delay: 3s;
    animation-duration: 10s;
}

.ufo {
    position: absolute;
    font-size: 18px;
    animation: ufoFloat 20s ease-in-out infinite;
}

.ufo::after {
    content: '🛸';
}

.ufo-1 {
    top: 20%;
    right: 15%;
}

.ufo-2 {
    top: 70%;
    left: 20%;
    animation-delay: 10s;
    font-size: 14px;
}

@keyframes twinkle {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

@keyframes shoot {
    0% { left: -100px; opacity: 0; }
    5% { opacity: 1; }
    25% { left: 110%; opacity: 0; }
    100% { left: 110%; opacity: 0; }
}

@keyframes rocketFly {
    0% { left: -50px; opacity: 0; }
    5% { opacity: 0.8; }
    40% { left: 110%; opacity: 0; }
    100% { left: 110%; opacity: 0; }
}

@keyframes ufoFloat {
    0%, 100% { transform: translateX(0) translateY(0); }
    25% { transform: translateX(30px) translateY(-15px); }
    50% { transform: translateX(0) translateY(-25px); }
    75% { transform: translateX(-30px) translateY(-10px); }
}

.header {
    background: rgba(196, 30, 58, 0.9);
    padding: 10px 20px;
    position: relative;
    z-index: 1;
    border-bottom: 3px solid #ffd700;
}

.nav-links {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.nav-link {
    color: #ffd700;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 6px 12px;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    transition: background 0.2s;
}

.nav-link:hover {
    background: rgba(0,0,0,0.5);
}

.split-container {
    display: flex;
    min-height: calc(100vh - 50px);
    position: relative;
    z-index: 1;
}

.left-pane {
    width: 25%;
    min-width: 280px;
    padding: 20px;
    border-right: 3px solid #c41e3a;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.right-pane {
    width: 75%;
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.mega-title {
    font-family: 'Bangers', cursive;
    color: #ffd700;
    letter-spacing: 3px;
    line-height: 0.85;
    text-align: center;
}

.title-top {
    font-size: 42px;
    text-shadow: 3px 3px 0 #c41e3a, 4px 4px 0 #000;
    display: block;
}

.title-bottom {
    font-size: 64px;
    text-shadow: 4px 4px 0 #c41e3a, 6px 6px 0 #000;
    display: block;
}

.hero-section {
    text-align: center;
    display: flex;
    justify-content: center;
}

.retro-tv {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tv-antenna {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: -5px;
}

.antenna-left, .antenna-right {
    width: 4px;
    height: 25px;
    background: #555;
    border: 2px solid #000;
    border-radius: 2px;
}

.antenna-left {
    transform: rotate(-25deg);
    transform-origin: bottom center;
}

.antenna-right {
    transform: rotate(25deg);
    transform-origin: bottom center;
}

.antenna-left::before, .antenna-right::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -2px;
    width: 7px;
    height: 7px;
    background: #ffd700;
    border-radius: 50%;
}

.tv-body {
    background: #8b7355;
    border-radius: 15px;
    padding: 12px;
    display: flex;
    gap: 10px;
    border: 4px solid #000;
    box-shadow: 0 6px 0 #000;
}

.tv-screen {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    border: 4px solid #000;
}

.hero-image {
    display: block;
    width: 160px;
    height: auto;
}

.tv-static {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.08;
    animation: static 0.1s steps(5) infinite;
    pointer-events: none;
}

.tv-glitch {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    animation: glitchFlicker 4s infinite;
}

.tv-glitch::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    animation: scanline 3s linear infinite;
}

.tv-glitch::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 30%;
    background: rgba(255, 255, 255, 0.02);
    animation: staticBand 6s ease-in-out infinite;
}

.tv-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 2px,
        rgba(0, 0, 0, 0.15) 4px
    );
    pointer-events: none;
}

.tv-controls {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px;
    padding: 5px;
}

.tv-knob {
    width: 20px;
    height: 20px;
    background: #ffd700;
    border-radius: 50%;
    border: 3px solid #000;
}

.tv-legs {
    display: flex;
    justify-content: center;
    gap: 80px;
    margin-top: -3px;
}

.tv-leg {
    width: 10px;
    height: 15px;
    background: #5a4636;
    border: 2px solid #000;
    border-top: none;
    border-radius: 0 0 3px 3px;
}

@keyframes static {
    0% { transform: translate(0, 0); }
    20% { transform: translate(-2%, 2%); }
    40% { transform: translate(2%, -2%); }
    60% { transform: translate(-1%, 1%); }
    80% { transform: translate(1%, -1%); }
    100% { transform: translate(0, 0); }
}

@keyframes glitchFlicker {
    0%, 95%, 100% { opacity: 1; }
    96% { opacity: 0.8; transform: translateX(3px); }
    97% { opacity: 1; transform: translateX(-3px); }
    98% { opacity: 0.9; transform: translateX(1px); }
}

@keyframes scanline {
    0% { top: -5%; }
    100% { top: 105%; }
}

@keyframes staticBand {
    0%, 100% { top: -30%; opacity: 0; }
    45% { opacity: 0; }
    50% { top: 50%; opacity: 1; }
    55% { opacity: 0; }
}

.lore-text {
    font-size: 12px;
    color: #aaa;
    line-height: 1.4;
    text-align: center;
}

.form-section {
    background: rgba(196, 30, 58, 0.2);
    border: 2px solid #c41e3a;
    border-radius: 8px;
    padding: 15px;
}

.live-log {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #0f3460;
    border-radius: 8px;
    overflow: hidden;
}

.log-title {
    font-family: 'Bangers', cursive;
    font-size: 14px;
    color: #ffd700;
    padding: 8px 10px;
    background: #0f3460;
    letter-spacing: 1px;
    margin: 0;
}

.log-container {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    font-family: monospace;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-entry {
    padding: 4px 8px;
    border-radius: 3px;
    line-height: 1.3;
}

.log-requested {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
}

.log-processing {
    background: rgba(0, 168, 232, 0.2);
    color: #00a8e8;
}

.log-completed {
    background: rgba(46, 213, 115, 0.2);
    color: #2ed573;
}

.log-failed {
    background: rgba(255, 71, 87, 0.2);
    color: #ff4757;
}

.log-info {
    color: #666;
}

.flash {
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 12px;
}

.flash.error {
    background: #ff4757;
    color: #fff;
}

.flash.success {
    background: #2ed573;
    color: #000;
}

.generate-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-row {
    display: flex;
    gap: 8px;
}

.text-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 2px solid #c41e3a;
    border-radius: 4px;
    background: #1a1a2e;
    color: #fff;
    font-family: inherit;
    transition: border-color 0.2s;
}

.text-input:focus {
    outline: none;
    border-color: #ffd700;
}

.text-input::placeholder {
    color: #666;
}

.file-upload-compact {
    position: relative;
    flex-shrink: 0;
}

.file-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-label-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    background: #1a1a2e;
    border: 2px solid #c41e3a;
    border-radius: 4px;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    white-space: nowrap;
}

.file-label-compact:hover,
.file-label-compact.dragover {
    border-color: #ffd700;
    color: #ffd700;
}

.file-label-compact.has-file {
    border-color: #4CAF50;
    color: #4CAF50;
}

.submit-btn {
    font-family: 'Bangers', cursive;
    font-size: 16px;
    padding: 10px 15px;
    background: linear-gradient(135deg, #c41e3a 0%, #8b0000 100%);
    color: #ffd700;
    border: 2px solid #ffd700;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
    text-shadow: 1px 1px 0 #000;
    flex: 1;
}

.submit-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 3px 15px rgba(196, 30, 58, 0.5);
}

.gallery-title {
    font-family: 'Bangers', cursive;
    font-size: 24px;
    color: #ffd700;
    margin-bottom: 15px;
    letter-spacing: 2px;
    text-shadow: 2px 2px 0 #c41e3a;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.meme-card {
    background: #16213e;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #c41e3a;
    transition: all 0.2s;
    box-shadow: 0 3px 12px rgba(0,0,0,0.3);
}

.meme-card:hover {
    border-color: #ffd700;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.3);
}

.card-image-container {
    cursor: pointer;
    aspect-ratio: 1;
    overflow: hidden;
}

.card-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.meme-card:hover .card-image-container img {
    transform: scale(1.05);
}

.card-label {
    font-family: 'Bangers', cursive;
    font-size: 12px;
    color: #ffd700;
    padding: 8px 10px;
    background: linear-gradient(135deg, #c41e3a 0%, #8b0000 100%);
    text-align: center;
    letter-spacing: 1px;
    text-shadow: 1px 1px 0 #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pending-placeholder {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0f0f1a;
    padding: 15px;
}

.pending-prompt-text {
    font-family: 'Bangers', cursive;
    font-size: 14px;
    color: #ffd700;
    text-align: center;
    margin-bottom: 10px;
}

.pending-corner-spinner {
    width: 25px;
    height: 25px;
    border: 3px solid #c41e3a;
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #888;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #c41e3a;
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.image-viewer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.image-viewer.active {
    display: flex;
}

.viewer-content {
    text-align: center;
    max-width: 90%;
    max-height: 90%;
    cursor: default;
}

.viewer-content img {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 8px;
    border: 4px solid #ffd700;
}

.viewer-prompt {
    font-family: 'Bangers', cursive;
    font-size: 22px;
    color: #ffd700;
    margin: 15px 0;
    letter-spacing: 1px;
}

.no-memes, .empty-state {
    text-align: center;
    color: #666;
    padding: 40px;
    font-size: 14px;
}

@media (max-width: 800px) {
    .split-container {
        flex-direction: column;
    }
    
    .left-pane {
        width: 100%;
        min-width: auto;
        border-right: none;
        border-bottom: 3px solid #c41e3a;
    }
    
    .right-pane {
        width: 100%;
    }
    
    .mega-title {
        font-size: 28px;
    }
    
    .hero-image {
        width: 150px;
    }
    
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}
