/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    color: #ffffff;
    min-height: 100vh;
}

body.captcha-active {
    overflow: hidden;
    height: 100vh;
}

/* Screen Management */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.screen.active {
    display: flex;
}

/* Glitch Effect */
.glitch {
    position: relative;
    color: #00ff41;
    font-weight: bold;
    animation: glitch 2s infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    animation: glitch-1 0.5s infinite;
    color: #ff0040;
    z-index: -1;
}

.glitch::after {
    animation: glitch-2 0.5s infinite;
    color: #00ffff;
    z-index: -2;
}

@keyframes glitch {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
}

@keyframes glitch-1 {
    0%, 100% { transform: translate(0); }
    10% { transform: translate(-2px, -2px); }
    20% { transform: translate(2px, 2px); }
    30% { transform: translate(-2px, 2px); }
    40% { transform: translate(2px, -2px); }
}

@keyframes glitch-2 {
    0%, 100% { transform: translate(0); }
    5% { transform: translate(2px, 2px); }
    15% { transform: translate(-2px, -2px); }
    25% { transform: translate(2px, -2px); }
    35% { transform: translate(-2px, 2px); }
}

/* Loading Screen */
.loading-container {
    text-align: center;
    animation: screenShake 0.1s infinite;
}

.kaptcha-logo {
    font-size: 4rem;
    margin-bottom: 2rem;
    text-shadow: 0 0 20px #00ff41;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #333;
    border-top: 4px solid #00ff41;
    border-radius: 50%;
    animation: spin 1s linear infinite, colorChange 2s infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes colorChange {
    0% { border-top-color: #00ff41; }
    25% { border-top-color: #ff0040; }
    50% { border-top-color: #00ffff; }
    75% { border-top-color: #ffff00; }
    100% { border-top-color: #00ff41; }
}

.loading-bar {
    width: 300px;
    height: 20px;
    background: #333;
    border-radius: 10px;
    margin: 2rem auto;
    overflow: hidden;
    border: 2px solid #00ff41;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #00ff41, #00ffff, #ff0040);
    width: 0%;
    animation: loadingProgress 5s ease-in-out;
    border-radius: 8px;
}

@keyframes loadingProgress {
    0% { width: 0%; }
    20% { width: 15%; }
    40% { width: 30%; }
    60% { width: 60%; }
    80% { width: 85%; }
    100% { width: 100%; }
}

.loading-text {
    font-size: 1.2rem;
    margin-top: 1rem;
    animation: textFlicker 1s infinite;
}

@keyframes textFlicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(1px, 1px); }
    50% { transform: translate(-1px, 1px); }
    75% { transform: translate(1px, -1px); }
}

/* CAPTCHA Screen */
.captcha-container {
    max-width: 600px;
    width: 90%;
    background: #1e1e1e;
    border: 3px solid #00ff41;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.3);
    animation: containerGlow 3s infinite;
}

@keyframes containerGlow {
    0%, 100% { box-shadow: 0 0 30px rgba(0, 255, 65, 0.3); }
    50% { box-shadow: 0 0 50px rgba(0, 255, 65, 0.6); }
}

.captcha-header {
    text-align: center;
    margin-bottom: 2rem;
}

.captcha-title {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.captcha-subtitle {
    font-size: 1.1rem;
    color: #ff0040;
    font-weight: bold;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(255, 0, 64, 0.5);
}

.round-counter {
    font-size: 1.2rem;
    color: #ffff00;
    background: #333;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: inline-block;
}

.captcha-box {
    background: #2a2a2a;
    border: 2px solid #555;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.captcha-instruction {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: #00ffff;
    font-weight: bold;
}

.captcha-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 1.5rem;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.grid-item {
    aspect-ratio: 1;
    background: #444;
    border: 2px solid #666;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.grid-item:hover {
    border-color: #00ff41;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.5);
}

.grid-item.selected {
    background: #00ff41;
    color: #000;
    border-color: #00ff41;
    animation: selectedPulse 1s infinite;
}

.grid-item.moving {
    animation: itemMove 2s infinite;
}

.grid-item.rotating {
    animation: itemRotate 3s infinite;
}

.grid-item.fading {
    animation: itemFade 2s infinite;
}

@keyframes selectedPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes itemMove {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(2px, -2px); }
    50% { transform: translate(-2px, 2px); }
    75% { transform: translate(2px, 2px); }
}

@keyframes itemRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes itemFade {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.captcha-controls {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.main-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.verify-button, .refresh-button {
    padding: 0.8rem 1.2rem;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 1rem;
    min-width: 110px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.verify-button {
    background: #00ff41;
    color: #000;
}

.verify-button:disabled {
    background: #666;
    color: #999;
    cursor: not-allowed;
}

.verify-button:not(:disabled):hover {
    background: #00cc33;
    transform: scale(1.05);
}

.refresh-button {
    background: #333;
    color: #fff;
    border: 2px solid #555;
}

.refresh-button:hover {
    background: #555;
    border-color: #777;
    transform: scale(1.05);
}

.captcha-feedback {
    text-align: center;
    margin-top: 1rem;
    font-size: 1.1rem;
    min-height: 30px;
    font-weight: bold;
}

.feedback-error {
    color: #ff0040;
    animation: errorShake 0.5s;
}

.feedback-success {
    color: #00ff41;
    animation: successGlow 1s;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes successGlow {
    0%, 100% { text-shadow: 0 0 5px #00ff41; }
    50% { text-shadow: 0 0 20px #00ff41; }
}

.progress-container {
    margin-top: 2rem;
}

.progress-bar {
    width: 100%;
    height: 15px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #555;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff0040, #ffff00, #00ff41);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 10px;
}

.progress-text {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #ccc;
    font-style: italic;
}

/* Success Screen */
#success-screen {
    position: relative;
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    padding: 2rem 0;
}

.success-container {
    text-align: center;
    animation: successEntrance 1s ease-out;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

@keyframes successEntrance {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.success-animation {
    position: relative;
    margin-bottom: 2rem;
}

.checkmark {
    font-size: 5rem;
    color: #00ff41;
    animation: checkmarkBounce 1s ease-out;
}

@keyframes checkmarkBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.confetti {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, #ff0040, #ffff00, #00ff41, #00ffff);
    border-radius: 50%;
    animation: confettiExplode 2s ease-out;
    opacity: 0;
}

@keyframes confettiExplode {
    0% { transform: translateX(-50%) scale(0); opacity: 1; }
    50% { transform: translateX(-50%) scale(2); opacity: 0.8; }
    100% { transform: translateX(-50%) scale(4); opacity: 0; }
}

.success-title {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.success-message {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    color: #00ffff;
}

.tokenomics-placeholder {
    background: #1e1e1e;
    border: 2px solid #00ff41;
    border-radius: 10px;
    padding: 2rem;
    max-width: 500px;
    margin: 0 auto;
}

.tokenomics-placeholder h2 {
    color: #ffff00;
    margin-bottom: 1rem;
}

.social-links {
    margin-top: 1.5rem;
}

.social-links span {
    display: block;
    margin-bottom: 1rem;
    color: #ccc;
}

.links {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.social-link {
    color: #00ff41;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid #00ff41;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.social-link:hover {
    background: #00ff41;
    color: #000;
}

/* Sound Toggle */
.sound-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: #333;
    border: 2px solid #00ff41;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
}

.sound-toggle:hover {
    background: #00ff41;
    transform: scale(1.1);
}

.sound-toggle.muted {
    background: #666;
    border-color: #999;
}

/* Responsive Design */
@media (max-width: 768px) {
    .captcha-container {
        padding: 1rem;
        width: 95%;
    }
    
    .kaptcha-logo {
        font-size: 2.5rem;
    }
    
    .captcha-title {
        font-size: 2rem;
    }
    
    .success-title {
        font-size: 2rem;
    }
    
    .captcha-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .robot-check {
        justify-content: center;
    }
}

/* Special Effects */
.screen-flash {
    animation: screenFlash 0.1s;
}

@keyframes screenFlash {
    0%, 100% { background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460); }
    50% { background: #ffffff; }
}

.error-effect {
    animation: errorEffect 0.5s;
}

@keyframes errorEffect {
    0%, 100% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(180deg); }
}

/* Chat System Styles */
.kaptcha-chat {
    background: #1e1e1e;
    border: 2px solid #00ff41;
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #333;
}

.chat-header h3 {
    color: #00ff41;
    margin: 0;
    font-size: 1.2rem;
}

.chat-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.online-count {
    color: #ffff00;
    font-size: 0.9rem;
}

.emoji-toggle {
    background: #333;
    border: 1px solid #555;
    color: #fff;
    padding: 0.3rem 0.6rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.emoji-toggle:hover {
    background: #555;
    transform: scale(1.1);
}

.chat-messages {
    height: 300px;
    overflow-y: auto;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 5px;
    padding: 1rem;
    margin-bottom: 1rem;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #333;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #00ff41;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #00cc33;
}

.loading-messages {
    text-align: center;
    color: #888;
    font-style: italic;
    padding: 2rem;
}

.chat-message {
    margin-bottom: 1rem;
    padding: 0.8rem;
    background: #333;
    border-radius: 8px;
    border-left: 3px solid #555;
    transition: all 0.3s ease;
}

.chat-message:hover {
    background: #3a3a3a;
    border-left-color: #00ff41;
}

.chat-message.own-message {
    background: #1a4a1a;
    border-left-color: #00ff41;
    margin-left: 2rem;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
}

.username {
    font-weight: bold;
    color: #00ff41;
    font-size: 0.9rem;
}

.own-message .username {
    color: #ffff00;
}

.timestamp {
    font-size: 0.8rem;
    color: #888;
}

.message-content {
    color: #fff;
    line-height: 1.4;
    word-wrap: break-word;
}

.emoji-picker {
    background: #2a2a2a;
    border: 1px solid #555;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 100;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.5rem;
}

.emoji-item {
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 5px;
    text-align: center;
    transition: all 0.3s ease;
}

.emoji-item:hover {
    background: #444;
    transform: scale(1.2);
}

.chat-input-container {
    position: relative;
}

.username-setup {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.username-setup input {
    flex: 1;
    padding: 0.8rem;
    background: #333;
    border: 1px solid #555;
    border-radius: 5px;
    color: #fff;
    font-family: inherit;
}

.username-setup input:focus {
    outline: none;
    border-color: #00ff41;
    box-shadow: 0 0 5px rgba(0, 255, 65, 0.3);
}

.username-setup button {
    padding: 0.8rem 1.5rem;
    background: #00ff41;
    color: #000;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.username-setup button:hover {
    background: #00cc33;
    transform: scale(1.05);
}

.chat-input {
    display: flex;
    gap: 0.5rem;
}

.chat-input input {
    flex: 1;
    padding: 0.8rem;
    background: #333;
    border: 1px solid #555;
    border-radius: 5px;
    color: #fff;
    font-family: inherit;
}

.chat-input input:focus {
    outline: none;
    border-color: #00ff41;
    box-shadow: 0 0 5px rgba(0, 255, 65, 0.3);
}

.chat-input input:disabled {
    background: #222;
    color: #666;
    cursor: not-allowed;
}

.send-btn {
    padding: 0.8rem 1.5rem;
    background: #00ff41;
    color: #000;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.send-btn:hover:not(:disabled) {
    background: #00cc33;
    transform: scale(1.05);
}

.send-btn:disabled {
    background: #666;
    color: #999;
    cursor: not-allowed;
    transform: none;
}

.chat-cooldown {
    text-align: center;
    color: #ff0040;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    font-weight: bold;
}

.chat-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 5px;
    color: #fff;
    font-weight: bold;
    z-index: 10000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
    word-wrap: break-word;
}

.chat-notification.show {
    transform: translateX(0);
}

.chat-notification.error {
    background: #ff0040;
    border: 1px solid #cc0033;
}

.chat-notification.success {
    background: #00ff41;
    color: #000;
    border: 1px solid #00cc33;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .kaptcha-chat {
        margin: 1rem;
        padding: 1rem;
    }
    
    .chat-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .chat-stats {
        width: 100%;
        justify-content: space-between;
    }
    
    .chat-messages {
        height: 250px;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .chat-message.own-message {
        margin-left: 1rem;
    }
    
    .username-setup {
        flex-direction: column;
    }
    
    .chat-input {
        flex-direction: column;
    }
    
    .send-btn {
        width: 100%;
    }
}

/* Animation for new messages */
@keyframes messageSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message {
    animation: messageSlideIn 0.3s ease-out;
}
