:root {
    --black: #0a0a0f;
    --deep: #100820;
    --purple: #6b21ff;
    --violet: #9b4dff;
    --neon: #c084fc;
    --glow: #e879f9;
    --white: #f0e6ff;
    --muted: #8b7aa0;
    --ball-size: 150px;
}

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

body {
    background: var(--black);
    color: var(--white);
    font-family: 'VT323', monospace;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Starfield background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
    radial-gradient(1px 1px at 10% 15%, rgba(200, 150, 255, 0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 40%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 50% 10%, rgba(200,150,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 60%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 85% 25%, rgba(200,150,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 20% 75%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 60% 85%, rgba(200,150,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 40% 55%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 80%, rgba(200,150,255,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 5% 95%, rgba(255,255,255,0.3) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

.page-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px 60px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
}
header .eyebrow {
    font-family: 'VT323', monospace;
    font-size: 1.1rem;
    letter-spacing: 0.4em;
    color: var(--neon);
    text-transform: uppercase;
    margin-bottom: 6px;
    opacity: 0.8;
}
header h1 {
    font-family: 'Creepster', cursive;
    font-size: clamp(3rem, 8vw, 5.5rem);
    line-height: 1;
    color: var(--white);
    text-shadow:
    0 0 20px var(--purple),
    0 0 60px rgba(107, 33, 255, 0.4),
    2px 2px 0 rgba(0,0,0,0.8);
    letter-spacing: 0.02em;
}
header h1 span {
    color: var(--glow);
    text-shadow:
    0 0 20px var(--glow),
    0 0 60px rgba(232, 121, 249, 0.5);
}
header .subtitle {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    color: var(--muted);
    margin-top: 8px;
    letter-spacing: 0.1em;
}

/* 8-Ball */
.ball-container {
    visibility: hidden;
    display: none;
    position: relative;
    width: var(--ball-size);
    height: var(--ball-size);
    /* margin: 0 auto 40px; */
    cursor: pointer;
}

.ball {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #2a2a3e, #000 70%);
    box-shadow:
    0 0 0 4px rgba(107, 33, 255, 0.3),
    0 0 40px rgba(107, 33, 255, 0.4),
    0 0 80px rgba(107, 33, 255, 0.2),
    inset 0 -10px 40px rgba(0,0,0,0.8),
    inset 10px -10px 60px rgba(107, 33, 255, 0.15);
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ball:hover {
    box-shadow:
    0 0 0 4px rgba(155, 77, 255, 0.5),
    0 0 60px rgba(155, 77, 255, 0.6),
    0 0 120px rgba(107, 33, 255, 0.3),
    inset 0 -10px 40px rgba(0,0,0,0.8),
    inset 10px -10px 60px rgba(107, 33, 255, 0.2);
}

/* Shine on ball */
.ball::before {
    content: '';
    position: absolute;
    top: 12%;
    left: 20%;
    width: 30%;
    height: 20%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.18) 0%, transparent 70%);
    border-radius: 50%;
    transform: rotate(-30deg);
}

/* The circle window on the ball */
.ball-window {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 45%;
    height: 45%;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #1a0a3e, #08001a);
    border: 3px solid rgba(155, 77, 255, 0.5);
    box-shadow:
    inset 0 0 20px rgba(107, 33, 255, 0.4),
    0 0 10px rgba(155, 77, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ball-number {
    font-family: 'Creepster', cursive;
    font-size: 4rem;
    color: var(--neon);
    text-shadow: 0 0 15px var(--purple);
    line-height: 1;
    transition: opacity 0.3s;
}

/* Shaking animation */
@keyframes shake {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    10% { transform: translate(-8px, -6px) rotate(-3deg); }
    20% { transform: translate(8px, 6px) rotate(3deg); }
    30% { transform: translate(-10px, 4px) rotate(-2deg); }
    40% { transform: translate(10px, -4px) rotate(2deg); }
    50% { transform: translate(-6px, 8px) rotate(-4deg); }
    60% { transform: translate(6px, -8px) rotate(4deg); }
    70% { transform: translate(-8px, -4px) rotate(-2deg); }
    80% { transform: translate(8px, 4px) rotate(2deg); }
    90% { transform: translate(-4px, 6px) rotate(-1deg); }
}

@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(107,33,255,0.3), 0 0 40px rgba(107,33,255,0.4), 0 0 80px rgba(107,33,255,0.2), inset 0 -10px 40px rgba(0,0,0,0.8); }
    50% { box-shadow: 0 0 0 6px rgba(232,121,249,0.5), 0 0 80px rgba(232,121,249,0.6), 0 0 140px rgba(107,33,255,0.4), inset 0 -10px 40px rgba(0,0,0,0.8); }
}

.ball.shaking {
    animation: shake 0.6s ease-in-out, glow-pulse 0.6s ease-in-out;
}

/* Form */
.oracle-form {
    width: 100%;
    max-width: 560px;
    margin: 0 auto 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-wrapper {
    position: relative;
}

.question-input {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 2px solid rgba(107, 33, 255, 0.4);
    border-radius: 12px;
    padding: 18px 24px;
    font-family: 'VT323', monospace;
    font-size: 1.4rem;
    color: var(--white);
    letter-spacing: 0.05em;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.question-input::placeholder {
    color: var(--muted);
    opacity: 0.7;
}

.question-input:focus {
    border-color: var(--violet);
    background: rgba(107, 33, 255, 0.07);
    box-shadow: 0 0 0 3px rgba(107, 33, 255, 0.15), 0 0 20px rgba(107, 33, 255, 0.1);
}

.ask-btn {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--purple), var(--violet));
    color: #fff;
    font-family: 'Creepster', cursive;
    font-size: 1.8rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 30px rgba(107, 33, 255, 0.4);
}

.ask-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--violet), var(--glow));
    opacity: 0;
    transition: opacity 0.2s;
}

.ask-btn:hover::before { opacity: 1; }
.ask-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 40px rgba(107, 33, 255, 0.6); }
.ask-btn:active { transform: translateY(0px); }
.ask-btn span { position: relative; z-index: 1; }
.ask-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Answer / Meme reveal */
.answer-zone {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    min-height: 60px;
}

.answer-card {
    background: rgba(107, 33, 255, 0.06);
    border: 2px solid rgba(107, 33, 255, 0.3);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    opacity: 0;
    transform: translateY(30px) scale(0.96);
    transition: opacity 0.5s ease, transform 0.5s ease;
    overflow: hidden;
}

.answer-card.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.answer-label {
    font-family: 'VT323', monospace;
    font-size: 1rem;
    letter-spacing: 0.4em;
    color: var(--neon);
    text-transform: uppercase;
    margin-bottom: 16px;
    opacity: 0.8;
}

.meme-title {
    font-family: 'Permanent Marker', cursive;
    font-size: 1.3rem;
    color: var(--glow);
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(232, 121, 249, 0.4);
}

.meme-frame {
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid rgba(155, 77, 255, 0.5);
    box-shadow: 0 0 30px rgba(107, 33, 255, 0.3), 0 20px 40px rgba(0,0,0,0.5);
    position: relative;
}

.meme-frame img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease;
}
.meme-frame:hover img { transform: scale(1.02); }

.error-msg {
    font-family: 'VT323', monospace;
    font-size: 1.3rem;
    color: #ff6b6b;
    text-align: center;
    padding: 16px;
    border: 1px solid rgba(255,107,107,0.3);
    border-radius: 10px;
    background: rgba(255,107,107,0.05);
}

/* Loading indicator */
.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 30px;
}
.loading-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--neon);
    animation: bounce 0.6s ease infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.1s; }
.loading-dots span:nth-child(3) { animation-delay: 0.2s; }

@keyframes bounce {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(-12px); opacity: 1; }
}

/* Footer */
footer {
    margin-top: 60px;
    text-align: center;
    font-family: 'VT323', monospace;
    font-size: 1rem;
    color: var(--muted);
    letter-spacing: 0.1em;
    opacity: 0.6;
}

/* Meme counter badge */
.meme-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(107, 33, 255, 0.15);
    border: 1px solid rgba(107, 33, 255, 0.3);
    border-radius: 20px;
    padding: 4px 14px;
    font-family: 'VT323', monospace;
    font-size: 1rem;
    color: var(--neon);
    letter-spacing: 0.05em;
    margin-top: 10px;
}

.add-meme-tip {
    font-family: 'VT323', monospace;
    font-size: 1rem;
    color: var(--muted);
    margin-top: 12px;
    opacity: 0.7;
    letter-spacing: 0.05em;
}

.add-meme-tip code {
    background: rgba(107, 33, 255, 0.2);
    border-radius: 4px;
    padding: 1px 6px;
    color: var(--neon);
}