:root {
    --bg-color: #0f172a;
    --primary-color: #f43f5e;
    --secondary-color: #8b5cf6;
    --accent-color: #06b6d4;
    --text-color: #f8fafc;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    padding: 2rem 0;
}

/* Layout Utilities */
.flex-col { display: flex; flex-direction: column; }
.flex-center { align-items: center; justify-content: center; text-align: center; }


/* Dynamic Animated Background */
.background-animated {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.15), rgba(15, 23, 42, 1) 50%);
    z-index: -1;
    animation: rotateBg 30s linear infinite;
}

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

.container {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
    text-align: center;
    z-index: 10;
}

header {
    margin-bottom: 3rem;
}

.glow-text {
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(244, 63, 94, 0.3);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.2rem;
    color: #cbd5e1;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.view-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.active-state {
    display: flex;
}

/* THE BOX CSS ART */
.box-wrapper {
    position: relative;
    width: 150px;
    height: 150px;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 2rem;
}

.box-wrapper:hover {
    transform: scale(1.1);
}

.box-body {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 120px;
    background: linear-gradient(135deg, #fbbf24, #d97706);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 -10px rgba(0,0,0,0.2), 0 10px 20px rgba(0,0,0,0.3);
    border: 4px solid #b45309;
}

.box-lid {
    position: absolute;
    top: 5px;
    left: -10px;
    width: 170px;
    height: 40px;
    background: linear-gradient(135deg, #fcd34d, #f59e0b);
    border-radius: 8px;
    border: 4px solid #b45309;
    box-shadow: 0 5px 10px rgba(0,0,0,0.2);
    z-index: 2;
    transform-origin: bottom center;
    transition: transform 0.3s;
}

.question-mark {
    font-size: 4rem;
    font-weight: 900;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    animation: floatMark 2s ease-in-out infinite;
}

.box-shadow {
    position: absolute;
    bottom: -15px;
    left: 10%;
    width: 80%;
    height: 20px;
    background: rgba(0,0,0,0.4);
    border-radius: 50%;
    filter: blur(5px);
    z-index: -1;
}

@keyframes floatMark {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Box Click Animations */
.shake {
    animation: shakeBox 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shakeBox {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1.1); }
    10%, 30%, 50%, 70%, 90% { transform: translate3d(-5px, 0, 0) scale(1.1) rotate(-5deg); }
    20%, 40%, 60%, 80% { transform: translate3d(5px, 0, 0) scale(1.1) rotate(5deg); }
}

.instruction {
    font-size: 1.2rem;
    color: #94a3b8;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Glassmorphism Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

/* Joke State Specifics */
.joke-content {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-bottom: 2rem;
}

#joke-setup {
    font-size: 1.8rem;
    font-weight: 400;
    color: #e2e8f0;
    margin-bottom: 1rem;
}

.punchline {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-shadow: 0 0 20px rgba(244, 63, 94, 0.4);
}

.hidden {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    pointer-events: none;
}

.visible {
    opacity: 1;
    visibility: visible;
    position: relative;
    animation: punchlinePop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes punchlinePop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Buttons */
.btn-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.action-btn {
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    outline: none;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary-color), #be123c);
    color: white;
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.4);
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(244, 63, 94, 0.6);
}

.secondary-btn {
    background: transparent;
    color: #cbd5e1;
    border: 2px solid rgba(255,255,255,0.2);
}

.secondary-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* Troll Button State */
#troll-area {
    width: 100%;
    height: 300px;
    position: relative;
    margin-top: 2rem;
    border: 2px dashed rgba(255,255,255,0.1);
    border-radius: 16px;
}

.troll-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    transition: left 0.2s linear, top 0.2s linear;
}

/* Squishy Pet State */
.jelly-arena {
    height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

.jelly-body {
    width: 120px;
    height: 110px;
    background: radial-gradient(circle at 30% 30%, #a78bfa, #7c3aed);
    border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
    box-shadow: inset -10px -10px 20px rgba(0,0,0,0.2), 0 0 30px rgba(124, 58, 237, 0.4);
    position: relative;
    cursor: pointer;
    transform-origin: bottom center;
    transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: jellyIdle 3s ease-in-out infinite;
}

.jelly-body:active {
    transform: scaleX(1.3) scaleY(0.7) translateY(10px);
}

.jelly-eyes {
    position: absolute;
    top: 35%;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.eye {
    width: 12px;
    height: 12px;
    background: #1e1b4b;
    border-radius: 50%;
    position: relative;
}

.eye::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
}

.jelly-mouth {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 10px;
    border-bottom: 3px solid #1e1b4b;
    border-radius: 0 0 10px 10px;
}

.jelly-body:active .jelly-mouth {
    height: 15px;
    border-bottom: 0px;
    background: #1e1b4b;
    border-radius: 50%;
}

.jelly-shadow {
    width: 80px;
    height: 15px;
    background: rgba(0,0,0,0.3);
    border-radius: 50%;
    filter: blur(4px);
    margin-top: 10px;
    animation: jellyShadowIdle 3s ease-in-out infinite;
}

@keyframes jellyIdle {
    0%, 100% { transform: scale(1) translateY(0); }
    50% { transform: scaleX(1.05) scaleY(0.95) translateY(5px); }
}

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

.counter-text {
    font-size: 1.2rem;
    color: var(--accent-color);
    font-weight: 700;
}

.mt-large {
    margin-top: 2rem;
}

#fireworks-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

/* Animations */
.bounce-in {
    animation: bounceIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.pop-in {
    animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); opacity: 1; }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
    0% { transform: rotate(-5deg) scale(0.5); opacity: 0; }
    100% { transform: rotate(0deg) scale(1); opacity: 1; }
}
