/* Reset and base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --void-black: #000000;
    --void-purple: #1a0a2e;
    --void-blue: #0d0d1a;
    --accent-purple: #6b21a8;
    --accent-pink: #ec4899;
    --accent-cyan: #22d3ee;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Space Mono', monospace;
    background: radial-gradient(ellipse at center, var(--void-purple) 0%, var(--void-blue) 50%, var(--void-black) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Starfield background */
.stars, .twinkling {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.stars {
    background: 
        radial-gradient(1px 1px at 20px 30px, white, transparent),
        radial-gradient(1px 1px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 50px 160px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 90px 40px, white, transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.7), transparent),
        radial-gradient(2px 2px at 160px 120px, white, transparent),
        radial-gradient(1px 1px at 200px 150px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 250px 200px, white, transparent),
        radial-gradient(1px 1px at 300px 250px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 350px 100px, white, transparent),
        radial-gradient(2px 2px at 400px 300px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 450px 350px, white, transparent),
        radial-gradient(1px 1px at 500px 50px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 550px 400px, white, transparent),
        radial-gradient(1px 1px at 600px 200px, rgba(255,255,255,0.5), transparent);
    background-repeat: repeat;
    background-size: 600px 450px;
    animation: drift 120s linear infinite;
    opacity: 0.5;
}

.twinkling {
    background: 
        radial-gradient(2px 2px at 100px 200px, white, transparent),
        radial-gradient(2px 2px at 300px 100px, white, transparent),
        radial-gradient(2px 2px at 500px 300px, white, transparent);
    background-repeat: repeat;
    background-size: 600px 450px;
    animation: twinkle 4s ease-in-out infinite;
    opacity: 0.3;
}

@keyframes drift {
    from { transform: translate(0, 0); }
    to { transform: translate(-600px, -450px); }
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* Main layout */
main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* The Void */
.void-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin-bottom: 2rem;
}

.void {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.singularity {
    width: 60px;
    height: 60px;
    background: var(--void-black);
    border-radius: 50%;
    position: absolute;
    box-shadow: 
        0 0 60px 30px rgba(0,0,0,0.8),
        0 0 100px 60px rgba(0,0,0,0.6),
        0 0 140px 90px rgba(0,0,0,0.4);
    z-index: 3;
}

.event-horizon {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    position: absolute;
    background: radial-gradient(circle, transparent 40%, rgba(107, 33, 168, 0.3) 70%, transparent 100%);
    animation: pulse 3s ease-in-out infinite;
    z-index: 2;
}

.accretion-disk {
    width: 280px;
    height: 280px;
    border-radius: 50%;
    position: absolute;
    background: conic-gradient(
        from 0deg,
        transparent,
        rgba(236, 72, 153, 0.2),
        rgba(107, 33, 168, 0.3),
        rgba(34, 211, 238, 0.2),
        transparent,
        rgba(236, 72, 153, 0.15),
        rgba(107, 33, 168, 0.2),
        transparent
    );
    animation: rotate 20s linear infinite;
    z-index: 1;
    filter: blur(8px);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

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

/* Absorbed words animation */
.absorbed-words {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.absorbed-word {
    position: absolute;
    color: var(--text-secondary);
    font-size: 0.75rem;
    white-space: nowrap;
    animation: absorb 3s ease-in forwards;
    opacity: 0;
    text-shadow: 0 0 10px var(--accent-purple);
}

@keyframes absorb {
    0% {
        opacity: 1;
        transform: translate(var(--start-x), var(--start-y)) scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(0, 0) scale(0) rotate(720deg);
    }
}

/* Content */
.content {
    text-align: center;
    max-width: 500px;
    width: 100%;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-purple), var(--accent-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

/* Input area */
.input-area {
    margin-bottom: 2rem;
}

textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    font-size: 0.875rem;
    resize: none;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 20px rgba(107, 33, 168, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

textarea::placeholder {
    color: var(--text-muted);
}

button {
    margin-top: 1rem;
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
    border: none;
    border-radius: 8px;
    color: white;
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(107, 33, 168, 0.4);
}

button:not(:disabled):active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.25rem;
    transition: transform 0.3s ease;
}

button:not(:disabled):hover .btn-icon {
    transform: rotate(180deg);
}

/* Counter */
.counter {
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.counter-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    display: block;
    margin-bottom: 0.25rem;
}

.counter-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-cyan);
    font-variant-numeric: tabular-nums;
}

/* Rules */
.rules {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.rules p {
    margin-bottom: 0.25rem;
}

.rules strong {
    color: var(--accent-pink);
}

/* Footer */
footer {
    position: fixed;
    bottom: 1rem;
    left: 0;
    right: 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    z-index: 1;
}

footer a {
    color: var(--accent-purple);
    text-decoration: none;
}

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

/* Responsive */
@media (max-width: 600px) {
    main {
        padding: 1rem;
    }
    
    .void-container {
        width: 200px;
        height: 200px;
    }
    
    .accretion-disk {
        width: 180px;
        height: 180px;
    }
    
    .singularity {
        width: 40px;
        height: 40px;
    }
    
    .event-horizon {
        width: 80px;
        height: 80px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
}

/* Release animation */
.releasing {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Void pulse on absorb */
.void.absorbing .singularity {
    animation: absorb-pulse 0.5s ease-out;
}

@keyframes absorb-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}
