:root {
    --primary-neon: #00f2ff;
    --secondary-neon: #7000ff;
    --bg-dark: #05070a;
    --glass-bg: rgba(15, 18, 25, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-dim: #a0a0a0;
    --transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: white;
    font-family: 'Poppins', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Animated Background --- */
.animated-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 50% 50%, #1a1b2e 0%, #05070a 100%);
    z-index: -1;
}

.animated-bg::before {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    background: var(--primary-neon);
    filter: blur(150px);
    opacity: 0.15;
    top: 10%; left: 10%;
    animation: float 10s infinite alternate;
}

@keyframes float {
    to { transform: translate(100px, 100px); }
}

/* --- Main Glass Container --- */
.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 3rem;
    width: 95%;
    max-width: 700px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
}

h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.8rem;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

h1 span {
    color: var(--primary-neon);
    text-shadow: 0 0 20px rgba(0, 242, 255, 0.5);
}

header p {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

/* --- Input Area --- */
.input-group {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    padding: 8px;
    border-radius: 16px;
    transition: var(--transition);
    margin-bottom: 2rem;
}

.input-group:focus-within {
    border-color: var(--primary-neon);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.2);
}

input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 20px;
    color: white;
    font-size: 1rem;
    outline: none;
}

/* --- BUTTONS: The "Cool" Parts --- */

/* Generate Button */
.btn-primary {
    background: var(--primary-neon);
    color: #000;
    border: none;
    padding: 12px 30px;
    border-radius: 12px;
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 242, 255, 0.4);
    filter: brightness(1.1);
}

.btn-primary:active { transform: translateY(0); }

/* Download Button */
.action-buttons { margin-top: 25px; }

.btn-secondary {
    display: inline-block;
    background: transparent;
    color: var(--secondary-neon);
    border: 2px solid var(--secondary-neon);
    padding: 14px 40px;
    border-radius: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--secondary-neon);
    color: white;
    box-shadow: 0 0 30px rgba(112, 0, 255, 0.4);
    transform: scale(1.02);
}

/* --- Results & Loader --- */
.img-frame {
    width: 100%;
    aspect-ratio: 1/1;
    background: rgba(0,0,0,0.2);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#output-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: fadeIn 1s ease;
}

@keyframes fadeIn {
    from { opacity: 0; filter: blur(10px); }
    to { opacity: 1; filter: blur(0); }
}

.badge {
    background: var(--primary-neon);
    color: black;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    margin-right: 10px;
}

#used-prompt {
    color: var(--text-dim);
    font-style: italic;
    font-size: 0.9rem;
}

/* --- Loading Spinner --- */
.spinner {
    width: 50px; height: 50px;
    border: 4px solid rgba(255,255,255,0.05);
    border-top: 4px solid var(--primary-neon);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    margin: 0 auto 15px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none; }

#error-box {
    background: rgba(255, 77, 77, 0.1);
    color: #ff4d4d;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(255, 77, 77, 0.3);
    margin-bottom: 20px;
}

/* Mobile Responsive */
@media (max-width: 500px) {
    .input-group { flex-direction: column; background: transparent; border: none; }
    input { background: rgba(0,0,0,0.4); border-radius: 12px; margin-bottom: 10px; border: 1px solid var(--glass-border); }
    .btn-primary { width: 100%; }
    .glass-container { padding: 1.5rem; }
}