@import url('https://fonts.googleapis.com/css2?family=Zhi+Mang+Xing&display=swap');

/* --- General & Theme Switcher --- */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

.theme-switcher {
    position: fixed;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.8);
    padding: 5px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 100;
}

.theme-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}
.theme-icon.active {
    border-color: #66bb6a;
    transform: scale(1.1);
}

/* --- Comic Theme Styles --- */
.theme-comic header h1 {
    font-family: 'Zhi Mang Xing', cursive;
    font-size: 4em;
    color: #2e7d32; /* Fresh Green */
    text-shadow: 2px 2px 0 #fff;
    margin: 0.2em 0;
}

.theme-comic .divider {
    height: 3px;
    background: linear-gradient(90deg, #81c784, #a5d6a7, #c8e6c9, #66bb6a);
    border-radius: 3px;
    margin: 20px auto;
    width: 80%;
}

.theme-comic .joke-card {
    background: rgba(248, 255, 248, 0.9); /* Light green tinted white */
    backdrop-filter: blur(5px);
    border-radius: 15px;
    padding: 40px;
    min-height: 200px;
    box-shadow: 0 8px 25px rgba(102, 187, 106, 0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 20px;
    transform: rotate(-1deg);
    transition: transform 0.2s ease;
    border: 1px solid rgba(129, 199, 132, 0.3);
}
.theme-comic .joke-card:hover {
    transform: rotate(1deg) scale(1.02);
}

.theme-comic .joke-text {
    font-family: 'Zhi Mang Xing', cursive;
    font-size: 2em;
    line-height: 1.6;
    color: #1b5e20;
}

.theme-comic .new-joke-btn {
    background: linear-gradient(135deg, #66bb6a, #81c784); /* Fresh Green Gradient */
    color: white;
    font-family: 'Zhi Mang Xing', cursive;
    font-size: 2.5em;
    border: none;
    border-radius: 50px;
    padding: 10px 30px;
    cursor: pointer;
    box-shadow: 0 5px 0 #388e3c; /* Darker Green */
    transition: all 0.1s ease-in-out;
}
.theme-comic .new-joke-btn:active {
    transform: translateY(5px);
    box-shadow: none;
}

/* --- Loading Animation --- */
.loading-container { display: none; }
.loading-container.visible { display: block; }
.loading-anim {
    height: 60px;
    width: 80px;
    margin: 0 auto 10px;
}
.book {
    transform-style: preserve-3d;
    transform: rotateY(-30deg);
    animation: flip 3s infinite;
}
.book, .book-page {
    width: 40px;
    height: 55px;
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -20px;
    margin-top: -27.5px;
}
.book-page {
    background: #a5d6a7;
    border: 1px solid #66bb6a;
    border-radius: 3px;
    transform-origin: left;
}
.book-page:nth-child(1) { animation: flip-page 3s infinite; }
.book-page:nth-child(2) { animation: flip-page 3s -1s infinite; }
.book-page:nth-child(3) { animation: flip-page 3s -2s infinite; }

@keyframes flip { 50% { transform: rotateY(30deg); } }
@keyframes flip-page { 30%, 100% { transform: rotateY(180deg); } }

/* --- Feedback Buttons & Animations --- */
.feedback-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}
.feedback-btn {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.feedback-btn:hover { transform: scale(1.2); }

#animation-container {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 999;
}
.confetti, .snowflake {
    position: absolute;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}
.confetti {
    width: 10px; height: 10px;
    animation-name: fall;
}
.snowflake {
    font-size: 20px; color: #fff;
    animation-name: fall;
}
@keyframes fall {
    from { transform: translateY(-10vh) rotate(0deg); }
    to { transform: translateY(110vh) rotate(360deg); }
}

.joke-card.absurd {
    animation: absurd-flash 0.5s 2;
}
@keyframes absurd-flash {
    0%, 100% { border: 2px solid transparent; }
    50% { border: 5px solid red; }
}

/* --- General Joke Text Visibility --- */
.joke-text {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.joke-text.visible {
    opacity: 1;
    transform: scale(1);
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .theme-comic header h1 { font-size: 3em; }
    .theme-comic .joke-card { padding: 25px; transform: rotate(0); }
    .theme-comic .joke-card:hover { transform: rotate(0); }
    .theme-comic .joke-text { font-size: 1.5em; }
}