/* ========== MAIN APPLICATION STYLES - CRT TERMINAL THEME ========== */
/* Applied from contact theme for consistent UI experience */

/* Contact page specific body styling - CRT Terminal Theme */
@font-face {
    font-family: 'press-start';
    src: url('asset/font/press-start.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

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

body.contact-page {
    font-family: 'press-start', 'Inter', monospace !important;
    background: rgb(9,3,44) !important; /* Animated background base color */
    color: #00ff41 !important; /* Terminal green text */
    overflow: hidden !important;
    /* Ensure full viewport for centering */
    margin: 0 !important;
    padding: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    cursor: url('https://dwvo2npct47gg.cloudfront.net/images/cursor.png') 11 32, auto;
}

/* Dark mode support for contact page */
body.dark.contact-page {
    background: #000000 !important;
    color: #00ff41 !important;
}

/* ASCII Swirl Animation Background */
#text-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
  overflow: hidden;
    background: black; /* Dark background for swirl animation */
}

/* Swirl animation container styling */
#text-grid > div {
    position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
    overflow: hidden;
    background: black;
    z-index: -1;
    pointer-events: none;
}

/* Contact wrapper - main container - Perfect centering with title clearance */
.contact-wrapper {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2;
    /* Account for 3D title and header */
    padding-top: 120px; /* Increased for title space */
}

/* Chat and Game Boy container - Horizontal layout */
.chat-gameboy-container {
    display: flex;
    width: 95vw;
    max-width: 1600px;
    height: calc(100vh - 140px);
    gap: 20px;
    align-items: flex-start;
    justify-content: center;
}

/* Main chat container - CRT Monitor Frame */
.contact-container {
    width: 60vw;
    max-width: 800px;
    min-width: 500px;
    height: 75vh;
    min-height: 500px;
    max-height: 700px;
    flex-shrink: 0;
    /* CRT Monitor appearance */
    background: rgba(215, 214, 214, 0.95); /* Gray terminal background with slight transparency */
    border: 5px solid #000000; /* Black border like terminal */
    border-radius: 4px; /* Slight rounding like CRT monitors */
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.4),
        inset 0 0 20px rgba(0, 0, 0, 0.2); /* CRT-like inner shadow */
  display: flex;
  flex-direction: column;
    overflow: hidden;
    position: relative;
    /* CRT filter effects */
    filter: contrast(1.075) brightness(1.14) saturate(1.3);
    /* No margin needed - parent handles centering */
    backdrop-filter: blur(2px); /* Subtle blur effect for glassmorphism */
}

body.dark .contact-container {
    background: rgba(20, 20, 20, 0.95); /* Darker terminal background */
    border: 5px solid;
    border-image: linear-gradient(45deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3) 1;
    animation: rainbowBorder 8s linear infinite;
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.6),
        inset 0 0 20px rgba(255, 100, 200, 0.1), /* Rainbow inner glow */
        0 0 40px rgba(100, 200, 255, 0.2); /* Outer rainbow glow */
}

/* ========== GAME BOY AVATAR CONTAINER ========== */
.gameboy-avatar-container {
    width: 35vw;
    max-width: 500px;
    min-width: 380px;
    height: 75vh;
    min-height: 500px;
    max-height: 700px;
    background: rgba(20, 20, 20, 0.9);
    border: 3px solid #00ff41;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.4),
        inset 0 0 20px rgba(0, 255, 65, 0.1),
        0 0 30px rgba(0, 255, 65, 0.2);
    backdrop-filter: blur(2px);
    position: relative;
}

.gameboy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #00ff41;
}

.gameboy-title {
    font-family: 'press-start', monospace;
    font-size: 12px;
    color: #00ff41;
    margin: 0;
    text-shadow: 0 0 10px #00ff41;
}

.avatar-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar-name {
    font-family: 'press-start', monospace;
    font-size: 10px;
    color: #00ff41;
    text-shadow: 0 0 5px #00ff41;
}

.avatar-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
    box-shadow: inset 0 0 3px rgba(0,0,0,0.5);
}

.avatar-indicator.active {
    background: #00ff41;
    box-shadow: 0 0 10px #00ff41, inset 0 0 3px rgba(0,255,65,0.8);
    animation: pulse 2s infinite;
}

.gameboy-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Game Boy component scaling */
.gameboy-wrapper gameboy-console {
    transform: scale(0.9);
    transform-origin: center;
}

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

/* ========== CHAT HEADER ========== */
.chat-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 0px;
    border-bottom: 4px solid #000000; /* Terminal-style thick border */
    background: rgba(215, 214, 214, 0.95); /* Match container background with transparency */
    position: relative;
    z-index: 1;
}

body.dark .chat-header {
    background: rgba(20, 20, 20, 0.95); /* Match container background */
    border-bottom: 4px solid;
    border-image: linear-gradient(90deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3) 1;
    animation: rainbowBorder 6s linear infinite;
}

/* Contact avatar section */
.contact-avatar {
  display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.avatar-circle {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    position: relative;
}

body.dark .avatar-circle {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.avatar-text {
  color: white;
    font-weight: 600;
  font-size: 18px;
    letter-spacing: 0.5px;
}

/* Status indicator */
.contact-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: statusPulse 2s infinite;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
}

@keyframes statusPulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.status-text {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

body.dark .status-text {
    color: #94a3b8;
}

/* Contact info */
.contact-info {
    flex: 1;
}

.contact-name {
    font-family: 'press-start', monospace !important;
    font-size: 16px;
    font-weight: normal;
    color: #9B9B9B; /* Terminal gray text */
    margin: 0 0 4px 0;
    letter-spacing: 1px;
    text-transform: uppercase;
    /* Rainbow text effect */
    background: linear-gradient(124deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #dd00f3);
    background-size: 1800% 1800%;
    animation: rainbow 13s ease infinite;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent !important;
}

body.dark .contact-name {
    /* Keep the rainbow animation in dark mode too */
    background: linear-gradient(124deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #dd00f3);
    background-size: 1800% 1800%;
    animation: rainbow 13s ease infinite;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent !important;
}

.contact-subtitle {
    font-family: 'press-start', monospace !important;
    font-size: 10px;
    color: #9B9B9B;
    margin: 0;
    font-weight: normal;
    line-height: 1.4em;
    letter-spacing: 0.5px;
}

body.dark .contact-subtitle {
    color: #94a3b8;
}

/* Eye animations for ExE */
.eye-container {
  display: inline-block;
  position: relative;
}

.eye-left, .eye-right {
  display: inline-block;
    font-weight: bold;
    animation: blink 3s infinite;
    transition: all 0.3s ease;
}

.eye-right {
    animation-delay: 0.1s;
}

@keyframes blink {
    0%, 90%, 100% { 
    transform: scaleY(1);
    opacity: 1;
  }
    95% { 
    transform: scaleY(0.1);
    opacity: 0.8;
  }
}

.exclamation {
    color: #ff4444;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
        transform: scale(1);
  }
  50% {
        opacity: 0.7; 
        transform: scale(1.05);
    }
}

/* ========== CHAT MESSAGES AREA ========== */
.chat-messages-container {
    flex: 1;
    overflow: hidden; /* Container clips content, child handles scrolling */
    background: rgba(215, 214, 214, 0.9); /* Terminal gray background with transparency */
    position: relative;
    /* Add subtle CRT scanlines */
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.15) 50%);
    background-size: 100% 2px;
    /* Ensure proper height constraints for scrolling */
    min-height: 0;
}

body.dark .chat-messages-container {
    background: rgba(15, 15, 15, 0.95); /* Very dark terminal background */
    /* Enhanced CRT scanlines for dark mode */
    background-image: 
        linear-gradient(rgba(0, 255, 65, 0.05) 50%, rgba(0, 0, 0, 0.3) 50%);
    background-size: 100% 2px;
}

.chat-messages {
    height: 100%; /* Take full height of container */
    overflow-y: auto; /* Enable vertical scrolling */
    overflow-x: hidden; /* Prevent horizontal scroll */
    padding: 24px;
  display: flex;
  flex-direction: column;
    justify-content: flex-start;
    gap: 16px;
    scroll-behavior: smooth;
    /* Essential for proper scrolling */
    min-height: 0;
    /* Enable momentum scrolling on iOS */
    -webkit-overflow-scrolling: touch;
    /* Ensure smooth scrolling on all devices */
    overscroll-behavior-y: contain;
}

/* Add proper spacing for the first message */
.chat-messages::before {
    content: '';
    height: 40px; /* More generous top spacing */
    flex-shrink: 0;
}

/* Enhanced scrollbar styling for better visibility */
.chat-messages::-webkit-scrollbar {
    width: 8px; /* Slightly wider for easier grabbing */
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(155, 155, 155, 0.6); /* Terminal gray with transparency */
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background-color: rgba(155, 155, 155, 0.8);
    transform: scaleX(1.2);
}

.chat-messages::-webkit-scrollbar-thumb:active {
    background-color: #00ff41; /* Terminal green when dragging */
}

body.dark .chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(100, 116, 139, 0.6);
}

body.dark .chat-messages::-webkit-scrollbar-thumb:hover {
    background-color: rgba(100, 116, 139, 0.8);
}

body.dark .chat-messages::-webkit-scrollbar-thumb:active {
    background-color: #00ff41;
}

/* Scroll to bottom button */
.scroll-to-bottom {
    position: absolute;
    bottom: 80px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: #1a1a1a;
    border: 1px solid;
    border-image: linear-gradient(45deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3) 1;
    animation: rainbowBorder 6s linear infinite;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #00ff41;
    font-size: 18px;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 
        inset 1px 1px 2px rgba(0, 0, 0, 0.3),
        0 2px 8px rgba(255, 100, 200, 0.2);
}

.scroll-to-bottom:hover {
    background: #2a2a2a;
    border: 1px solid;
    border-image: linear-gradient(45deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3) 1;
    animation: rainbowBorder 3s linear infinite; /* Faster on hover */
    transform: scale(1.05);
    box-shadow: 
        inset 1px 1px 2px rgba(0, 0, 0, 0.3),
        0 4px 12px rgba(255, 100, 200, 0.4);
}

.scroll-to-bottom.visible {
    display: flex;
}

/* ========== MESSAGE STYLES ========== */
.message {
    display: flex;
  max-width: 70%;
    animation: messageSlideIn 0.3s ease-out;
}

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

/* Assistant messages (left side) */
.assistant-message {
    align-self: flex-start;
}

.assistant-message .message-content {
    background: #CECBCB; /* Terminal input field color */
    border: 1px solid #9B9B9B; /* Terminal border color */
    border-radius: 5px; /* Less rounded, more terminal-like */
    padding: 12px 16px;
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.2); /* Inset shadow for depth */
    position: relative;
    font-family: 'press-start', monospace !important;
}

body.dark .assistant-message .message-content {
    background: #2a2a2a; /* Dark gray for assistant messages */
    border: 1px solid;
    border-image: linear-gradient(135deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3) 1;
    animation: rainbowBorder 10s linear infinite;
    color: #00ff41; /* Keep terminal green text */
    box-shadow: 
        inset 1px 1px 3px rgba(0, 0, 0, 0.3),
        0 0 8px rgba(255, 100, 200, 0.1); /* Rainbow glow */
}

/* User messages (right side) */
.user-message {
  align-self: flex-end;
}

.user-message .message-content {
    background: #545454; /* Dark terminal background */
    color: #00ff41; /* Terminal green text */
    border: 1px solid #9B9B9B;
    border-radius: 5px;
    padding: 12px 16px;
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.3);
    position: relative;
    font-family: 'press-start', monospace !important;
}

body.dark .user-message .message-content {
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

/* Message text - Enhanced for scramble compatibility */
.message-content p,
.message-text {
    margin: 0;
    font-size: 15px !important;
    line-height: 1.5 !important;
    word-wrap: break-word;
    color: inherit !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: inherit !important;
    /* Prevent scramble effect from overriding styles */
    display: inline !important;
    text-decoration: none !important;
    background: transparent !important;
}

.assistant-message .message-content p,
.assistant-message .message-text {
    color: #1e293b !important;
}

body.dark .assistant-message .message-content p,
body.dark .assistant-message .message-text {
    color: #00ff41 !important; /* Terminal green text for all assistant messages */
}

/* User message text color preservation */
.user-message .message-content p,
.user-message .message-text {
    color: white !important;
}

/* Message time */
.message-time {
    display: block;
    font-size: 11px;
    opacity: 0.7;
    margin-top: 6px;
    font-weight: 500;
}

.assistant-message .message-time {
    color: #64748b;
}

body.dark .assistant-message .message-time {
    color: #94a3b8;
}

.user-message .message-time {
    color: rgba(255, 255, 255, 0.8);
    text-align: right;
}

/* ========== TYPING INDICATOR ========== */
.typing-message {
  align-self: flex-start;
}

.typing-dots {
  display: flex;
    gap: 4px;
    align-items: center;
    padding: 8px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64748b;
    animation: typingDot 1.4s infinite ease-in-out both;
}

body.dark .typing-dots span {
    background: #94a3b8;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes typingDot {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========== CHAT INPUT AREA ========== */
.chat-input-container {
    padding: 8px 12px;
    background: rgba(215, 214, 214, 0.95);
    border-top: 2px solid #000000; /* Terminal border */
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

body.dark .chat-input-container {
    background: rgba(20, 20, 20, 0.95); /* Match container background */
    border-top: 2px solid;
    border-image: linear-gradient(90deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3) 1;
    animation: rainbowBorder 7s linear infinite;
}

/* Left side - Attachment buttons */
.chat-input-left {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Center - Input wrapper */
.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #E7E5E6; /* Terminal input background */
    border: 1px solid #9B9B9B; /* Terminal border */
    border-radius: 5px;
    padding: 8px 12px;
    transition: all 0.2s ease;
  position: relative;
    flex: 1; /* Take remaining space */
    min-width: 0; /* Allow shrinking */
}

/* Right side - Send button */
.chat-input-right {
    flex-shrink: 0;
}

body.dark .chat-input-wrapper {
    background: #1a1a1a; /* Dark input field background */
    border: 1px solid;
    border-image: linear-gradient(45deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3) 1;
    animation: rainbowBorder 5s linear infinite;
}

.chat-input-wrapper:focus-within {
    border-color: #00ff41; /* Terminal green on focus */
    box-shadow: 0 0 0 3px rgba(0, 255, 65, 0.2);
}

body.dark .chat-input-wrapper:focus-within {
    border: 1px solid;
    border-image: linear-gradient(45deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3) 1;
    animation: rainbowBorder 3s linear infinite; /* Faster animation on focus */
    box-shadow: 0 0 0 3px rgba(255, 100, 200, 0.3);
}

/* Input buttons */
.attachment-btn,
.image-btn,
.voice-btn {
  display: flex;
  align-items: center;
  justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 6px;
}

body.dark .attachment-btn,
body.dark .image-btn,
body.dark .voice-btn {
    color: #94a3b8;
}

.attachment-btn:hover,
.image-btn:hover,
.voice-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

body.dark .attachment-btn:hover,
body.dark .image-btn:hover,
body.dark .voice-btn:hover {
    background: #334155;
    color: #f1f5f9;
}

/* Main input field */
.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: 'press-start', monospace !important;
    font-size: 12px;
    color: #000000;
    padding: 10px 12px;
    border-radius: 5px;
    outline: none;
    line-height: 1em;
    min-height: 20px;
    resize: none;
    /* Rainbow text effect for input */
    background: linear-gradient(124deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #dd00f3);
    background-size: 1800% 1800%;
    animation: rainbow 13s ease infinite;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.dark .chat-input {
    /* Keep the rainbow text animation in dark mode */
    background: linear-gradient(124deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #dd00f3);
    background-size: 1800% 1800%;
    animation: rainbow 13s ease infinite;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.chat-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

body.dark .chat-input::placeholder {
    color: #64748b;
}

/* Send button - Terminal themed */
.send-btn {
    font-family: 'press-start', monospace !important;
    font-size: 12px;
    background: #1a1a1a; /* Dark background when enabled */
    border: 1px solid;
    border-image: linear-gradient(45deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3) 1;
    animation: rainbowBorder 4s linear infinite;
    border-radius: 6px; /* Less rounded for terminal look */
    padding: 7px 15px;
    cursor: pointer;
    color: #00ff41; /* Terminal green text */
    transition: all 0.2s ease;
    flex-shrink: 0;
    user-select: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 
        inset 1px 1px 2px rgba(0, 0, 0, 0.3),
        0 0 4px rgba(255, 100, 200, 0.2); /* Rainbow glow */
}

.send-btn:hover:not(:disabled) {
    background: #2a2a2a; /* Slightly lighter on hover */
    border: 1px solid;
    border-image: linear-gradient(45deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3) 1;
    animation: rainbowBorder 2s linear infinite; /* Faster animation on hover */
    color: #00ff41;
    transform: scale(1.02);
    box-shadow: 
        inset 1px 1px 2px rgba(0, 0, 0, 0.3),
        0 0 12px rgba(255, 100, 200, 0.4); /* Enhanced rainbow glow */
}

.send-btn:active:not(:disabled) {
    transform: scale(0.98);
    background: #0d2d0d;
}

.send-btn:disabled {
    background: #1a1a1a; /* Very dark gray when disabled */
    border-color: #333333;
    color: #666666; /* Muted gray text */
    cursor: not-allowed;
    transform: none;
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.5);
}

body.dark .send-btn:disabled {
    background: #0f0f0f;
    border-color: #2a2a2a;
    color: #444444;
}

/* Rainbow animation */
@keyframes rainbow {
    0% { background-position: 0% 82%; }
    50% { background-position: 100% 19%; }
    100% { background-position: 0% 82%; }
}

/* Rainbow border animation */
@keyframes rainbowBorder {
    0% { 
        border-image: linear-gradient(45deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3) 1;
    }
    14% { 
        border-image: linear-gradient(45deg, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #ff2400) 1;
    }
    28% { 
        border-image: linear-gradient(45deg, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #ff2400, #e81d1d) 1;
    }
    42% { 
        border-image: linear-gradient(45deg, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #ff2400, #e81d1d, #e8b71d) 1;
    }
    57% { 
        border-image: linear-gradient(45deg, #1de840, #1ddde8, #2b1de8, #dd00f3, #ff2400, #e81d1d, #e8b71d, #e3e81d) 1;
    }
    71% { 
        border-image: linear-gradient(45deg, #1ddde8, #2b1de8, #dd00f3, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840) 1;
    }
    85% { 
        border-image: linear-gradient(45deg, #2b1de8, #dd00f3, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8) 1;
    }
    100% { 
        border-image: linear-gradient(45deg, #dd00f3, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8) 1;
    }
}

/* CRT Flicker effect */
@keyframes flicker {
    0% { opacity: 0.18; }
    5% { opacity: 0.34; }
    10% { opacity: 0.96; }
    15% { opacity: 0.72; }
    20% { opacity: 0.24; }
    25% { opacity: 0.70; }
    30% { opacity: 0.004; }
    35% { opacity: 0.66; }
    40% { opacity: 0.51; }
    45% { opacity: 0.88; }
    50% { opacity: 0.047; }
    55% { opacity: 0.33; }
    60% { opacity: 0.36; }
    65% { opacity: 0.69; }
    70% { opacity: 0.78; }
    75% { opacity: 0.76; }
    80% { opacity: 0.61; }
    85% { opacity: 0.77; }
    90% { opacity: 0.91; }
    95% { opacity: 0.023; }
    100% { opacity: 0.15; }
}

/* Add subtle flicker to entire container */
.contact-container::after {
    content: " ";
    display: block;
  position: absolute;
    top: 0;
    left: 0;
  bottom: 0;
    right: 0;
    background: rgba(18, 16, 16, 0.1);
    opacity: 0;
    z-index: 999;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 1200px) {
    .chat-gameboy-container {
        flex-direction: column;
        height: auto;
        max-height: none;
        gap: 15px;
        align-items: center;
    }
    
    .contact-container {
        width: 90vw;
        max-width: 600px;
        min-width: auto;
        height: 60vh;
        min-height: 400px;
    }
    
    .gameboy-avatar-container {
        width: 90vw;
        max-width: 500px;
        min-width: 320px;
        height: 50vh;
        min-height: 400px;
        max-height: 500px;
    }
    
    .gameboy-wrapper gameboy-console {
        transform: scale(0.7);
    }
}

@media (max-width: 768px) {
    .contact-wrapper {
        padding-top: var(--header-total-clearance-height, 80px);
        padding-left: 8px;
        padding-right: 8px;
    }
    
    .chat-gameboy-container {
        width: 95vw;
        gap: 10px;
    }
    
    .contact-container {
        height: 50vh;
        min-height: 350px;
        border-radius: 16px;
    }
    
    .gameboy-avatar-container {
        height: 45vh;
        min-height: 300px;
        padding: 15px;
    }
    
    .gameboy-title {
        font-size: 10px;
    }
    
    .avatar-name {
        font-size: 8px;
    }
    
    .gameboy-wrapper gameboy-console {
        transform: scale(0.6);
    }
    
    .chat-header {
        padding: 16px 20px;
    }
    
    .avatar-circle {
        width: 40px;
        height: 40px;
    }
    
    .avatar-text {
        font-size: 16px;
    }
    
    .contact-name {
        font-size: 18px;
    }
    
    .contact-subtitle {
        font-size: 13px;
    }
    
    .chat-messages {
        padding: 16px 20px;
        gap: 12px;
  }
  
  .message {
    max-width: 85%;
  }
    
    .message-content {
        padding: 10px 14px;
    }
    
    .message-content p {
        font-size: 14px;
    }
    
    /* Mobile Input Area Optimization */
    .chat-input-container {
        padding: 8px;
        gap: 6px;
    }
    
    .chat-input-left {
        gap: 2px;
    }
    
    .chat-input-wrapper {
        padding: 6px 10px;
        gap: 6px;
    }
    
    .chat-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 8px 6px;
        min-width: 0;
    }
    
    /* Smaller buttons on mobile */
    .attachment-btn,
    .image-btn,
    .voice-btn {
        width: 28px;
        height: 28px;
        padding: 4px;
    }
    
    .send-btn {
        padding: 6px 12px;
        font-size: 10px;
        border-radius: 4px;
    }
    
    /* Keep all buttons visible on mobile */
    .voice-btn {
        display: flex; /* Override any previous hiding */
    }
    
    /* Mobile scroll to bottom button */
    .scroll-to-bottom {
        width: 36px;
        height: 36px;
        bottom: 70px;
        right: 16px;
        font-size: 16px;
    }
}

/* ========== LEGACY CHAT STYLES (for backward compatibility) ========== */
/* Keep existing jQuery-based chat working until fully migrated */
.bot-message, .user-message span {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
}

.bot-message {
    color: #1e293b;
    background: #CECBCB;
    padding: 10px;
    border-radius: 8px;
    margin: 8px 0;
}

.user-message span {
    color: #00ff41;
    background: #545454;
    padding: 10px;
    border-radius: 8px;
    margin: 8px 0;
    display: block;
}

/* ========== 3D TITLE LOGO ========== */
@font-face {
    font-family: 'newtown700';
    src: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/17575/newtown700.eot');
    src: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/17575/newtown700.eot?#iefix') format('embedded-opentype'),
         url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/17575/newtown700.woff') format('woff'),
         url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/17575/newtown700.ttf') format('truetype'),
         url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/17575/newtown700.woff#newtownbold') format('svg');
    font-weight: normal;
    font-style: normal;
}

#logo-title {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 100px;
    perspective: 200px;
    z-index: 100;
    pointer-events: none;
}

.letters-title {
    position: absolute;
    width: 100px;
    height: 100px;
    opacity: 0;
    transform-style: preserve-3d;
    transition: opacity 2s ease-out .25s, transform 3s ease-out;
}

.letters-title div {
    position: absolute;
}

.loaded .letters-title {
    opacity: 1;
    transform: scale(.3) rotateY(-30deg);
}

.text-title {
    position: absolute;
    left: 20%;
    bottom: -25px;
    display: inline-block;
    width: 60px;
    font-size: 10px;
    line-height: 10px;
    font-family: 'newtown700', 'press-start', sans-serif;
    color: white;
    text-transform: uppercase;
    margin: 0;
    transition: color .25s ease-out, text-shadow .25s ease-out;
}

.text-title:hover {
    color: #EDFCFF;
    text-shadow: 0 0 8px #10DAFF;
}

.text-title span {
    display: inline-block;
    width: 60px;
    font-size: 18px;
    line-height: 18px;
    transform: translateZ(1px);
    clip-path: url(#title-mask);
}

/* F Letter - Small Scale */
.f-title {
    z-index: 3;
    transform: translateZ(50px);
}

.f-title [class |= 'y'] {
    position: absolute;
    left: 0;
    height: 1px;
}

.f-title .y-0, .f-title .y-1, .f-title .y-2, .f-title .y-3 {
    width: 100px;
}

.f-title .y-4, .f-title .y-5 {
    width: 60px;
}

.f-title .y-0 { top: 0; background-image: linear-gradient(to right, #ca1707, #bf0001); }
.f-title .y-1 { top: 20px; background-image: linear-gradient(to right, #d1260a, #c10402); }
.f-title .y-2 { top: 40px; background-image: linear-gradient(to right, #da390f, #c60e05); }
.f-title .y-3 { top: 60px; background-image: linear-gradient(to right, #e44e14, #ce1e09); }
.f-title .y-4 { top: 80px; background-image: linear-gradient(to right, #f1681b, #e34b13); }
.f-title .y-5 { top: 100px; background-image: linear-gradient(to right, #fe8421, #f1681b); }

.f-title [class |= 'x'] {
    position: absolute;
    top: 0;
    width: 1px;
}

.f-title .x-0, .f-title .x-1, .f-title .x-2, .f-title .x-3 {
    height: 100px;
}

.f-title .x-4, .f-title .x-5, .f-title .x-6, .f-title .x-7 {
    height: 20px;
}

.f-title .x-0 { left: 0; background-image: linear-gradient(to bottom, #ca1807, #fe8421); }
.f-title .x-1 { left: 20px; background-image: linear-gradient(to bottom, #c71105, #fa7b1f); }
.f-title .x-2 { left: 40px; background-image: linear-gradient(to bottom, #c40b04, #f5711d); }
.f-title .x-3 { left: 60px; background-image: linear-gradient(to bottom, #c20602, #f1681b); }
.f-title .x-4 { left: 80px; background-image: linear-gradient(to bottom, #c00201, #c30903); }
.f-title .x-5 { top: 40px; left: 80px; background-image: linear-gradient(to bottom, #ca1707, #d2280b); }
.f-title .x-6 { left: 100px; background-image: linear-gradient(to bottom, #bf0001, #c10402); }
.f-title .x-7 { top: 40px; left: 100px; background-image: linear-gradient(to bottom, #c60e05, #cd1e08); }

/* E Letter - Small Scale */
.e-title {
    z-index: 2;
}

.e-title [class |= 'y'] {
    position: absolute;
    left: 0;
    height: 1px;
}

.e-title .y-0, .e-title .y-1, .e-title .y-2, .e-title .y-3, .e-title .y-4, .e-title .y-5 {
    width: 100px;
}

.e-title .y-0 { top: 0; background-image: linear-gradient(to right, #c740d1, #b801b3); }
.e-title .y-1 { top: 20px; background-image: linear-gradient(to right, #cb51d9, #bb0db9); }
.e-title .y-2 { top: 40px; background-image: linear-gradient(to right, #d065e2, #bf1fc1); }
.e-title .y-3 { top: 60px; background-image: linear-gradient(to right, #d578eb, #c433cb); }
.e-title .y-4 { top: 80px; background-image: linear-gradient(to right, #da8df5, #ca4ad5); }
.e-title .y-5 { top: 100px; background-image: linear-gradient(to right, #dfa1fe, #cf62e1); }

.e-title [class |= 'x'] {
    position: absolute;
    top: 0;
    width: 1px;
}

.e-title .x-0, .e-title .x-1, .e-title .x-2, .e-title .x-3 {
    height: 100px;
}

.e-title .x-4, .e-title .x-5, .e-title .x-6, .e-title .x-7, .e-title .x-8, .e-title .x-9 {
    height: 20px;
}

.e-title .x-0 { left: 0; background-image: linear-gradient(to bottom, #c740d1, #dfa1fe); }
.e-title .x-1 { left: 20px; background-image: linear-gradient(to bottom, #c433cb, #dc96f9); }
.e-title .x-2 { left: 40px; background-image: linear-gradient(to bottom, #c128c5, #d98af3); }
.e-title .x-3 { left: 60px; background-image: linear-gradient(to bottom, #be18be, #d67eee); }
.e-title .x-4 { left: 80px; background-image: linear-gradient(to bottom, #bb0cb8, #bf1bc0); }
.e-title .x-5 { left: 100px; background-image: linear-gradient(to bottom, #b801b3, #bb0db9); }
.e-title .x-6 { top: 40px; left: 80px; background-image: linear-gradient(to bottom, #c32ec9, #c842d2); }
.e-title .x-7 { top: 40px; left: 100px; background-image: linear-gradient(to bottom, #bf1fc1, #c433cb); }
.e-title .x-8 { top: 80px; left: 80px; background-image: linear-gradient(to bottom, #cd59dd, #d371e8); }
.e-title .x-9 { top: 80px; left: 100px; background-image: linear-gradient(to bottom, #ca4ad5, #cf61e0); }

/* R Letter - Small Scale */
.r-title {
    z-index: 1;
    transform: translateZ(-50px);
}

.r-title [class |= 'y'] {
    position: absolute;
    left: 0;
    height: 1px;
}

.r-title .y-0, .r-title .y-1, .r-title .y-2, .r-title .y-3 {
    width: 100px;
}

.r-title .y-4, .r-title .y-5, .r-title .y-6 {
    width: 40px;
}

.r-title .y-7 {
    width: 20px;
}

.r-title .y-0 { top: 0; background-image: linear-gradient(to right, #3a76c6, #007aef); }
.r-title .y-1 { top: 20px; background-image: linear-gradient(to right, #149eb3, #0481e4); }
.r-title .y-2 { top: 40px; background-image: linear-gradient(to right, #1bac9d, #0a8cd1); }
.r-title .y-3 { top: 60px; background-image: linear-gradient(to right, #24bb84, #119abb); }
.r-title .y-4 { top: 80px; background-image: linear-gradient(to right, #2dcb69, #26bf7d); }
.r-title .y-5 { top: 100px; background-image: linear-gradient(to right, #36dd4c, #30d15f); }
.r-title .y-6 { top: 80px; left: 60px; background-image: linear-gradient(to right, #22b988, #1bac9d); }
.r-title .y-7 { top: 100px; left: 80px; background-image: linear-gradient(to right, #29c573, #25be7f); }

.r-title [class |= 'x'] {
    position: absolute;
    top: 0;
    width: 1px;
}

.r-title .x-0, .r-title .x-1, .r-title .x-2, .r-title .x-4 {
    height: 100px;
}

.r-title .x-3 {
    height: 80px;
}

.r-title .x-5 {
    height: 60px;
}

.r-title .x-6 {
    height: 20px;
}

.r-title .x-0 { left: 0; background-image: linear-gradient(to bottom, #0d92c7, #37dd4b); }
.r-title .x-1 { left: 20px; background-image: linear-gradient(to bottom, #0a8dd0, #34d854); }
.r-title .x-2 { left: 40px; background-image: linear-gradient(to bottom, #0787da, #30d15f); }
.r-title .x-3 { left: 60px; background-image: linear-gradient(to bottom, #0482e2, #20ad81); }
.r-title .x-4 { left: 80px; background-image: linear-gradient(to bottom, #027dea, #29c573); }
.r-title .x-5 { left: 100px; background-image: linear-gradient(to bottom, #007aef, #129aba); }
.r-title .x-6 { top: 80px; left: 100px; background-image: linear-gradient(to bottom, #1bab9e, #25be7f); }

/* Mobile responsiveness for title */
@media (max-width: 768px) {
    #logo-title {
        width: 80px;
        height: 80px;
        top: 15px;
        perspective: 160px;
    }
    
    .letters-title {
        width: 80px;
        height: 80px;
    }
    
    .loaded .letters-title {
        transform: scale(.25) rotateY(-30deg);
    }
    
    .text-title {
        font-size: 8px;
        line-height: 8px;
        bottom: -20px;
        width: 50px;
    }
    
    .text-title span {
        font-size: 14px;
        line-height: 14px;
        width: 50px;
    }
    
    /* Adjust contact wrapper padding for mobile */
    .contact-wrapper {
        padding-top: 100px; /* Reduced for mobile */
    }
}

@media (max-width: 480px) {
    #logo-title {
        width: 60px;
        height: 60px;
        top: 10px;
        perspective: 120px;
    }
    
    .letters-title {
        width: 60px;
        height: 60px;
    }
    
    .loaded .letters-title {
        transform: scale(.2) rotateY(-30deg);
    }
    
    .text-title {
        font-size: 6px;
        line-height: 6px;
        bottom: -15px;
        width: 40px;
    }
    
    .text-title span {
        font-size: 12px;
        line-height: 12px;
        width: 40px;
    }
    
    /* Further adjust contact wrapper padding for small mobile */
    .contact-wrapper {
        padding-top: 80px; /* Further reduced for small screens */
    }
}

/* ========== ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
    .message,
    .typing-dots span,
    .status-dot,
    .send-btn,
    .eye-left,
    .eye-right,
    .exclamation {
        animation: none;
        transition: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .contact-container {
        border: 2px solid #1e293b;
    }
    
    body.dark .contact-container {
        border-color: #f1f5f9;
    }
    
    .chat-input-wrapper:focus-within {
        border-width: 2px;
    }
}