/* Import retro monospace fonts */
@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:ital,wght@0,400;0,700;1,400;1,700&family=Share+Tech+Mono&display=swap');

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

body {
    font-family: 'Courier Prime', 'Courier New', monospace;
    background: #000;
    color: #00ff00;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.4;
}

/* Terminal Container */
.terminal-container {
    background: #000;
    color: #00ff00;
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

/* ASCII Header */
.ascii-header {
    margin-bottom: 30px;
    border: 2px solid #00ff00;
    padding: 20px;
    background: #001100;
    box-shadow: 
        0 0 10px #00ff00,
        inset 0 0 10px rgba(0, 255, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

/* ASCII Art - Desktop and Mobile versions */
.ascii-art {
    font-family: 'Share Tech Mono', monospace;
    color: #00ff00;
    text-shadow: 0 0 5px #00ff00;
    animation: glow 2s ease-in-out infinite alternate;
    white-space: pre;
    text-align: center;
    display: block;
}

.ascii-art.desktop-only {
    font-size: 0.6rem;
}

.ascii-art.mobile-only {
    font-size: 1rem;
    display: none;
}

@keyframes glow {
    from { text-shadow: 0 0 5px #00ff00; }
    to { text-shadow: 0 0 20px #00ff00, 0 0 30px #00ff00; }
}

.terminal-prompt {
    margin: 20px 0 10px 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
    text-align: center;
}

.prompt-text {
    color: #00ff00;
}

.cursor {
    animation: blink 1s infinite;
    color: #00ff00;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.loading-bar {
    font-size: 1rem;
    margin: 10px 0;
    text-align: center;
    line-height: 1.6;
    width: 100%;
}

.loading-text {
    margin: 0 0 8px 0;
    text-align: center;
    color: #00ff00;
}

.progress-container {
    margin: 8px 0;
    position: relative;
    text-align: center;
    width: 100%;
    display: flex;
    justify-content: center;
}

.progress-box {
    display: inline-block;
    border: 2px solid #00ff00;
    padding: 4px 8px;
    background: #000;
    position: relative;
    width: min(300px, 90vw);
    height: 24px;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.progress {
    display: block;
    height: 12px;
    background: linear-gradient(90deg, #ffff00, #ff8800);
    width: 0;
    transition: width 0.1s ease-out;
    box-shadow: 0 0 8px rgba(255, 255, 0, 0.6);
    animation: fillBar 3s ease-out forwards;
}

.complete-text {
    margin: 8px 0 0 0;
    text-align: center;
    color: #00ff00;
    opacity: 0;
    animation: showComplete 0.5s ease-in-out 3s forwards;
}

@keyframes fillBar {
    0% { width: 0%; }
    100% { width: 100%; }
}

@keyframes showComplete {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* Jokes Terminal */
.jokes-terminal {
    background: #000011;
    border: 2px solid #00ff00;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 
        0 0 20px rgba(0, 255, 0, 0.3),
        inset 0 0 20px rgba(0, 255, 0, 0.05);
    min-height: 500px;
}

.terminal-output {
    margin-bottom: 30px;
}

.system-msg {
    color: #00ffff;
    font-size: 0.9rem;
    margin: 5px 0;
    animation: typewriter 0.5s ease-in-out;
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

.separator {
    color: #00ff00;
    margin: 20px 0;
    text-align: center;
    opacity: 0.7;
    overflow-x: auto;
    font-size: 0.8rem;
}

/* Individual Jokes */
.joke-entry {
    margin: 25px 0;
    padding: 15px;
    border: 1px solid #004400;
    background: #001100;
    border-radius: 5px;
    position: relative;
    transition: all 0.3s ease;
}

.joke-entry:hover {
    border-color: #00ff00;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
    background: #002200;
}

.joke-header {
    color: #ffff00;
    font-size: 0.8rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.joke-number {
    color: #ff00ff;
    font-weight: bold;
}

.joke-question {
    color: #00ffff;
    font-size: 1.1rem;
    margin: 10px 0;
    padding: 10px;
    border-left: 3px solid #00ffff;
    background: rgba(0, 255, 255, 0.05);
}

.joke-answer {
    color: #ffff00;
    font-size: 1rem;
    margin: 10px 0;
    padding: 10px;
    border-left: 3px solid #ffff00;
    background: rgba(255, 255, 0, 0.05);
    font-style: italic;
    /* New spoiler styles */
    background-color: #003300;
    color: #003300; /* Hide text by making it same color as background */
    border-left-color: #008800;
    user-select: none; /* Prevent highlighting the hidden text */
    cursor: pointer;
    transition: all 0.2s ease;
}

.joke-answer.visible {
    color: #ffff00; /* Reveal text color */
    background: rgba(255, 255, 0, 0.05); /* Restore original background */
    border-left-color: #ffff00;
    user-select: auto; /* Allow text selection again */
}

.joke-footer {
    border-top: 1px solid #004400;
    margin-top: 15px;
    padding-top: 10px;
    text-align: center;
}

.joke-rating {
    color: #00ff00;
    font-size: 0.8rem;
}

/* ASCII Decorations */
.ascii-divider {
    text-align: center;
    color: #00ff00;
    margin: 30px 0;
    opacity: 0.6;
    font-size: 0.8rem;
    overflow-x: auto;
}

/* Footer */
.ascii-footer {
    margin-top: 50px;
    text-align: center;
    border: 2px solid #00ff00;
    padding: 20px;
    background: #001100;
}

.footer-text {
    color: #00ff00;
    font-size: 0.9rem;
    animation: glow 3s ease-in-out infinite alternate;
    word-wrap: break-word;
    line-height: 1.4;
}

/* Riddle Link Styling */
.riddle-link {
    color: #ff00ff;
    text-decoration: none;
    font-weight: bold;
    text-shadow: 0 0 5px #ff00ff;
    transition: all 0.3s ease;
    padding: 2px 4px;
    border-radius: 3px;
}

.riddle-link:hover {
    color: #ffff00;
    text-shadow: 0 0 10px #ffff00;
    background: rgba(255, 0, 255, 0.1);
    animation: sparkle 0.5s ease-in-out;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #000;
}

::-webkit-scrollbar-thumb {
    background: #00ff00;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00cc00;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Switch to mobile ASCII art */
    .ascii-art.desktop-only {
        display: none;
    }
    
    .ascii-art.mobile-only {
        display: block;
        font-size: 0.9rem;
    }
    
    .terminal-container {
        padding: 15px;
    }
    
    .ascii-header {
        padding: 15px 10px;
    }
    
    .jokes-terminal {
        padding: 15px;
    }
    
    .joke-entry {
        padding: 12px;
        margin: 15px 0;
    }
    
    .joke-question, .joke-answer {
        font-size: 0.9rem;
        padding: 8px;
    }
    
    .progress-box {
        width: min(250px, 85vw);
        height: 20px;
    }
    
    .progress {
        height: 10px;
    }
    
    .terminal-prompt {
        font-size: 1rem;
        flex-direction: column;
        gap: 5px;
    }
    
    .loading-bar {
        font-size: 0.9rem;
    }
    
    .footer-text {
        font-size: 0.8rem;
        line-height: 1.6;
    }
    
    .separator {
        font-size: 0.7rem;
        overflow-x: scroll;
    }
}

@media (max-width: 480px) {
    .ascii-art.mobile-only {
        font-size: 0.8rem;
    }
    
    .terminal-container {
        padding: 10px;
    }
    
    .ascii-header {
        padding: 12px 8px;
    }
    
    .terminal-prompt {
        font-size: 0.85rem;
        flex-direction: column;
        gap: 8px;
    }
    
    .joke-question, .joke-answer {
        font-size: 0.85rem;
        padding: 6px;
    }
    
    .loading-bar {
        font-size: 0.8rem;
    }
    
    .progress-box {
        width: min(200px, 80vw);
        height: 18px;
    }
    
    .progress {
        height: 8px;
    }
    
    .footer-text {
        font-size: 0.75rem;
        line-height: 1.8;
    }
    
    .jokes-terminal {
        padding: 10px;
    }
    
    .joke-entry {
        padding: 10px;
        margin: 12px 0;
    }
    
    .system-msg {
        font-size: 0.8rem;
    }
}

@media (max-width: 360px) {
    .ascii-art.mobile-only {
        font-size: 0.7rem;
    }
    
    .terminal-container {
        padding: 8px;
    }
    
    .ascii-header {
        padding: 10px 6px;
    }
    
    .progress-box {
        width: min(180px, 75vw);
        height: 16px;
    }
    
    .progress {
        height: 6px;
    }
    
    .footer-text {
        font-size: 0.7rem;
    }
}

/* Retro CRT Effect */
.terminal-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        rgba(0, 255, 0, 0.03) 1px,
        transparent 2px,
        transparent 4px
    );
    pointer-events: none;
    z-index: 1000;
}

/* Typing animation for system messages */
.typing {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid #00ff00;
    animation: typing 2s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: #00ff00; }
}

/* ASCII Animation Container */
.ascii-animation-container {
    position: relative;
    height: 120px;
    overflow: hidden;
    margin-top: 20px;
    border-top: 1px solid #004400;
    background: rgba(0, 20, 0, 0.3);
}

.ascii-scene {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Walking Creatures */
.walking-creature {
    position: absolute;
    font-family: 'Courier Prime', monospace;
    font-size: 0.7rem;
    color: #00ff00;
    white-space: pre;
    animation-duration: 15s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    bottom: 10px;
}

.unicorn-1 {
    color: #ff00ff;
    animation-name: walkRight;
    animation-delay: 0s;
    text-shadow: 0 0 5px #ff00ff;
}

.unicorn-2 {
    color: #00ffff;
    animation-name: walkRight;
    animation-delay: 7s;
    text-shadow: 0 0 5px #00ffff;
}

.cat-1 {
    color: #ffff00;
    animation-name: walkRight;
    animation-delay: 12s;
    text-shadow: 0 0 5px #ffff00;
}

.robot-1 {
    color: #00ff00;
    animation-name: walkRight;
    animation-delay: 4s;
    text-shadow: 0 0 5px #00ff00;
}

/* Floating Creatures */
.floating-creature {
    position: absolute;
    font-size: 1.2rem;
    animation-duration: 8s;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

.star-1 {
    color: #ffff00;
    animation-name: float;
    animation-delay: 0s;
    top: 20px;
    text-shadow: 0 0 10px #ffff00;
}

.star-2 {
    color: #ff00ff;
    animation-name: float;
    animation-delay: 2s;
    top: 40px;
    text-shadow: 0 0 10px #ff00ff;
}

.star-3 {
    color: #00ffff;
    animation-name: float;
    animation-delay: 4s;
    top: 15px;
    text-shadow: 0 0 10px #00ffff;
}

.heart-1 {
    color: #ff0066;
    animation-name: heartbeat;
    animation-delay: 1s;
    top: 30px;
    left: 50%;
    text-shadow: 0 0 10px #ff0066;
}

/* Animation Keyframes */
@keyframes walkRight {
    0% { 
        left: -100px; 
        transform: scaleX(1);
    }
    50% { 
        left: 50%; 
        transform: scaleX(1);
    }
    100% { 
        left: calc(100% + 100px); 
        transform: scaleX(1);
    }
}

@keyframes float {
    0% { 
        left: -20px; 
        transform: translateY(0px);
    }
    25% { 
        transform: translateY(-10px);
    }
    50% { 
        left: 50%; 
        transform: translateY(0px);
    }
    75% { 
        transform: translateY(-5px);
    }
    100% { 
        left: calc(100% + 20px); 
        transform: translateY(0px);
    }
}

@keyframes heartbeat {
    0%, 100% { 
        transform: scale(1);
        opacity: 0.8;
    }
    50% { 
        transform: scale(1.3);
        opacity: 1;
    }
}

/* Mobile adjustments for animations */
@media (max-width: 768px) {
    .ascii-animation-container {
        height: 80px;
    }
    
    .walking-creature {
        font-size: 0.5rem;
        animation-duration: 12s;
    }
    
    .floating-creature {
        font-size: 1rem;
        animation-duration: 6s;
    }
}

@media (max-width: 480px) {
    .ascii-animation-container {
        height: 60px;
    }
    
    .walking-creature {
        font-size: 0.4rem;
        animation-duration: 10s;
    }
    
    .floating-creature {
        font-size: 0.8rem;
    }
}