/**
 * Main CSS for Workshop Portfolio
 * Complete styling for all interactive elements and systems
 */

/* Reset and Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    height: 100%;
    font-family: 'Courier New', monospace;
    background: #000;
    color: #fff;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Workshop Container */
.workshop-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow-y: auto;
}

/* Background Layer */
.background-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    transition: opacity 0.5s ease-out;
    z-index: 1;
}

.background-layer.loading {
    opacity: 0.7;
}

.background-layer.loaded {
    opacity: 1;
}

.background-layer.error {
    background: linear-gradient(45deg, #001122 0%, #003366 50%, #001122 100%);
}

/* Background Fallback */
.background-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #001122 0%, #003366 50%, #001122 100%);
    z-index: 0;
}

/* Hotspots Container */
.hotspots-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

/* Individual Hotspot */
.hotspot {
    position: absolute;
    width: 40px;
    height: 40px;
    cursor: pointer;
    pointer-events: auto;
    transform: translate(-50%, -50%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.hotspot:focus {
    outline: 2px solid #00ffff;
    outline-offset: 4px;
}

.hotspot:hover,
.hotspot.hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.hotspot.focused {
    transform: translate(-50%, -50%) scale(1.05);
}

.hotspot.dragging {
    z-index: 1000;
    transform: translate(-50%, -50%) scale(1.2);
    transition: none;
}

/* Hotspot Content */
.hotspot-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hotspot Icon */
.hotspot-icon {
    width: 20px;
    height: 20px;
    background: #00ffff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.6);
    transition: all 0.3s ease;
}

.hotspot:hover .hotspot-icon,
.hotspot.hover .hotspot-icon {
    background: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

/* Hotspot States */
.hotspot-disabled {
    opacity: 0.3;
    pointer-events: none;
}

.hotspot-disabled .hotspot-pulse {
    animation-play-state: paused;
    opacity: 0.2;
}

.hotspot-disabled .hotspot-icon {
    box-shadow: none;
}

.hotspot-active {
    z-index: 1001;
}

/* Hotspot Pulse Animation */
.hotspot-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    background: rgba(0, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Hotspot Tooltip */
.hotspot-tooltip {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    color: #00ffff;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #00ffff;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
    pointer-events: none;
}

/* Dynamic positioning classes */
.hotspot-tooltip.tooltip-above {
    bottom: 60px;
    top: auto;
}

.hotspot-tooltip.tooltip-below {
    bottom: auto;
    top: 60px;
}

.hotspot-tooltip.tooltip-below::after {
    top: -5px;
    bottom: auto;
    border-top-color: transparent;
    border-bottom-color: #00ffff;
}

/* Device-specific positioning */
.hotspot-tooltip.tooltip-mobile {
    padding: 14px 18px;
    font-size: 14px;
    border-radius: 6px;
}

.hotspot-tooltip.tooltip-desktop {
    padding: 12px 16px;
    font-size: 12px;
    border-radius: 8px;
}

.hotspot-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border: 5px solid transparent;
    border-top-color: #00ffff;
}

.hotspot:hover .hotspot-tooltip,
.hotspot.hover .hotspot-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-10px);
    z-index: 1000;
}

.hotspot-tooltip h3 {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 4px;
    color: #00ffff;
}

.hotspot-tooltip p {
    font-size: 12px;
    color: #ccc;
    line-height: 1.4;
    max-width: 200px;
    white-space: normal;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Loading Spinner */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 255, 255, 0.3);
    border-top: 4px solid #00ffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: #00ffff;
    font-size: 16px;
    text-align: center;
    font-weight: bold;
    letter-spacing: 1px;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #00ffff;
    color: #000;
    padding: 8px 12px;
    text-decoration: none;
    z-index: 1000;
    border-radius: 4px;
    font-weight: bold;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 6px;
}

/* Screen Reader Only */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Error Message */
.error-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 0, 0, 0.95);
    color: white;
    padding: 30px;
    border-radius: 12px;
    z-index: 10000;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.error-message h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #fff;
}

.error-message p {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.error-message button {
    background: #fff;
    color: #d32f2f;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.3s ease;
}

.error-message button:hover {
    background: #f5f5f5;
}

/* Hotspot Feedback */
.hotspot-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    color: #00ffff;
    padding: 30px;
    border: 2px solid #00ffff;
    border-radius: 12px;
    z-index: 1000;
    text-align: center;
    max-width: 350px;
    box-shadow: 0 10px 30px rgba(0, 255, 255, 0.3);
    animation: feedbackAppear 0.3s ease-out;
}

@keyframes feedbackAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.hotspot-feedback h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: #00ffff;
    font-weight: bold;
}

.hotspot-feedback p {
    font-size: 14px;
    line-height: 1.5;
    color: #ccc;
}

/* Cookie Consent Banner */
#cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    color: #fff;
    padding: 20px;
    z-index: 10000;
    border-top: 2px solid #00ffff;
    font-family: 'Courier New', monospace;
}

.consent-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.consent-content p {
    flex: 1;
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.consent-buttons {
    display: flex;
    gap: 12px;
}

.consent-btn {
    padding: 10px 20px;
    border: 2px solid #00ffff;
    background: transparent;
    color: #00ffff;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-weight: bold;
}

.consent-btn:hover {
    background: #00ffff;
    color: #000;
}

.consent-btn.accept {
    background: #00ffff;
    color: #000;
}

.consent-btn.accept:hover {
    background: transparent;
    color: #00ffff;
}

/* Editing Mode Styles */
.hotspot-editing .hotspot {
    border: 2px dashed #ff6b6b;
    background: rgba(255, 107, 107, 0.2);
}

.hotspot-editing .hotspot::before {
    content: 'EDIT';
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff6b6b;
    color: white;
    padding: 2px 8px;
    font-size: 10px;
    border-radius: 4px;
    font-weight: bold;
}

/* Mobile Responsive Styles */
@media (max-width: 767px) {
    .hotspot {
        width: 50px;
        height: 50px;
    }
    
    .hotspot-icon {
        width: 25px;
        height: 25px;
    }
    
    .hotspot-pulse {
        width: 50px;
        height: 50px;
    }
    
    .hotspot-tooltip {
        max-width: calc(100vw - 40px);
        left: 50%;
    }
    
    .hotspot-tooltip.tooltip-above {
        bottom: 70px;
    }
    
    .hotspot-tooltip.tooltip-below {
        top: 70px;
    }
    
    .hotspot-tooltip h3 {
        font-size: 16px;
    }
    
    .hotspot-tooltip p {
        font-size: 14px;
        white-space: normal;
    }
    
    .consent-content {
        flex-direction: column;
        text-align: center;
    }
    
    .consent-buttons {
        justify-content: center;
    }
    
    .loading-text {
        font-size: 14px;
    }
}

/* Tablet Styles */
@media (min-width: 768px) and (max-width: 1023px) {
    .hotspot {
        width: 45px;
        height: 45px;
    }
    
    .hotspot-icon {
        width: 22px;
        height: 22px;
    }
}

/* Desktop Styles */
@media (min-width: 1024px) {
    .hotspot:hover {
        transform: translate(-50%, -50%) scale(1.15);
    }
    
    .hotspot-tooltip.tooltip-above {
        bottom: 65px;
    }
    
    .hotspot-tooltip.tooltip-below {
        top: 65px;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .background-layer {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .hotspot-pulse {
        animation: none;
        opacity: 0.5;
    }
    
    .loading-spinner {
        animation: none;
        border: 4px solid #00ffff;
    }
    
    .hotspot {
        transition: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .background-layer {
        filter: contrast(1.5);
    }
    
    .hotspot-icon {
        background: #fff;
        border: 2px solid #000;
    }
    
    .hotspot-tooltip {
        background: #000;
        border: 2px solid #fff;
        color: #fff;
    }
}

/* Print Styles */
@media print {
    .loading-overlay,
    .hotspots-container,
    #cookie-consent-banner {
        display: none !important;
    }
    
    .workshop-container {
        background: #fff !important;
    }
    
    .background-layer {
        opacity: 0.3 !important;
    }
}

/* Dark Mode Support (for future implementation) */
@media (prefers-color-scheme: dark) {
    /* Already using dark theme by default */
}

/* Focus Management */
.workshop-container:focus-within .hotspot:not(:focus) {
    opacity: 0.7;
}

/* Character Hotspot Special Styling */
.character-hotspot {
    width: 60px;
    height: 60px;
}

.character-hotspot .hotspot-icon {
    width: 35px;
    height: 35px;
    background: #ffaa00;
    box-shadow: 0 0 15px rgba(255, 170, 0, 0.8);
    animation: characterGlow 2s ease-in-out infinite alternate;
}

@keyframes characterGlow {
    from {
        box-shadow: 0 0 15px rgba(255, 170, 0, 0.8);
        background: #ffaa00;
    }
    to {
        box-shadow: 0 0 25px rgba(255, 170, 0, 1), 0 0 35px rgba(255, 170, 0, 0.6);
        background: #ffcc33;
    }
}

.character-hotspot .hotspot-pulse {
    background: rgba(255, 170, 0, 0.4);
    animation: characterPulse 1.5s infinite;
}

@keyframes characterPulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
}

.character-hotspot:hover .hotspot-icon,
.character-hotspot.hover .hotspot-icon {
    background: #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 1);
}

/* Touch Device Optimizations */
.touch-device .hotspot {
    width: 55px;
    height: 55px;
}

.touch-device .hotspot-icon {
    width: 30px;
    height: 30px;
}

.touch-device .character-hotspot {
    width: 70px;
    height: 70px;
}

.touch-device .character-hotspot .hotspot-icon {
    width: 40px;
    height: 40px;
}

/* Page Hidden State */
.page-hidden .hotspot-pulse {
    animation-play-state: paused;
}

.page-hidden .loading-spinner {
    animation-play-state: paused;
}

/* Welcome Overlay */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 17, 34, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.8s ease-out;
}

.welcome-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.welcome-content {
    max-width: 600px;
    width: 90%;
    padding: 20px;
}

.welcome-text-box {
    background: rgba(0, 0, 0, 0.9);
    border: 3px solid #00ffff;
    border-radius: 8px;
    padding: 40px 30px;
    text-align: center;
    position: relative;
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.3),
        inset 0 0 20px rgba(0, 255, 255, 0.1);
}

.welcome-text-box::before {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    background: linear-gradient(45deg, #00ffff, #0080ff, #00ffff);
    border-radius: 10px;
    z-index: -1;
    opacity: 0.3;
}

.welcome-title {
    font-size: 2rem;
    color: #00ffff;
    margin-bottom: 20px;
    text-shadow: 0 0 15px rgba(0, 255, 255, 0.8);
    font-weight: bold;
    letter-spacing: 2px;
    animation: titleGlow 2s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 0 0 15px rgba(0, 255, 255, 0.8); }
    to { text-shadow: 0 0 25px rgba(0, 255, 255, 1), 0 0 35px rgba(0, 255, 255, 0.6); }
}

.welcome-description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #cccccc;
    margin-bottom: 30px;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
}

.start-adventure-btn {
    position: relative;
    background: transparent;
    border: 2px solid #00ffff;
    color: #00ffff;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 15px 40px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.start-adventure-btn:hover {
    background: #00ffff;
    color: #000;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.6);
    transform: translateY(-2px);
}

.start-adventure-btn:active {
    transform: translateY(0);
}

.btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.start-adventure-btn:hover .btn-glow {
    left: 100%;
}

/* Adventure Chat Modal */
.adventure-chat-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    padding: 20px 0;
}

.adventure-chat-modal.active {
    opacity: 1;
    visibility: visible;
}

.chat-container {
    width: 90%;
    max-width: 800px;
    max-height: none;
    background: rgba(0, 17, 34, 0.95);
    border: 3px solid #00ffff;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.4);
    overflow: visible;
}

.chat-header {
    background: linear-gradient(135deg, #001122, #003366);
    padding: 20px;
    border-bottom: 2px solid #00ffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    color: #00ffff;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.6);
}

.close-chat-btn {
    background: transparent;
    border: 2px solid #ff6666;
    color: #ff6666;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-chat-btn:hover {
    background: #ff6666;
    color: #000;
    box-shadow: 0 0 15px rgba(255, 102, 102, 0.6);
}

.chat-content {
    display: flex;
    flex: 1;
    min-height: 400px;
    overflow: hidden;
}

.character-portrait {
    width: 200px;
    padding: 20px;
    border-right: 2px solid #00ffff;
    background: linear-gradient(180deg, rgba(0, 255, 255, 0.1), rgba(0, 51, 102, 0.1));
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.portrait-frame {
    width: 120px;
    height: 120px;
    border: 3px solid #00ffff;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.portrait-pixel-art {
    font-size: 3rem;
    filter: sepia(1) hue-rotate(180deg) saturate(2);
}

.dialogue-area {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dialogue-text {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 8px;
    padding: 20px;
    min-height: 120px;
    color: #fff;
    font-size: 1rem;
    line-height: 1.6;
    position: relative;
    overflow: hidden;
}

.dialogue-text::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00ffff, transparent);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.dialogue-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.choice-btn {
    background: transparent;
    border: 2px solid #00ffff;
    color: #00ffff;
    padding: 12px 20px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.choice-btn:hover {
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
    transform: translateX(5px);
}

.choice-btn:active {
    background: rgba(0, 255, 255, 0.2);
}

.choice-btn::before {
    content: '▶ ';
    opacity: 0;
    transition: opacity 0.3s ease;
}


.chat-footer {
    background: linear-gradient(135deg, #001122, #003366);
    padding: 15px 20px;
    border-top: 2px solid #00ffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-btn {
    background: transparent;
    border: 2px solid #00ffff;
    color: #00ffff;
    padding: 8px 16px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
}

.back-btn {
    border-color: #ffaa00;
    color: #ffaa00;
}

.back-btn:hover {
    background: rgba(255, 170, 0, 0.1);
    box-shadow: 0 0 10px rgba(255, 170, 0, 0.4);
}

.hire-sean-btn {
    border-color: #00ff88;
    color: #00ff88;
    font-weight: bold;
}

.hire-sean-btn:hover {
    background: rgba(0, 255, 136, 0.1);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
}

.end-chat-btn {
    border-color: #ff6666;
    color: #ff6666;
}

.end-chat-btn:hover {
    background: rgba(255, 102, 102, 0.1);
    box-shadow: 0 0 10px rgba(255, 102, 102, 0.4);
}

/* Typewriter Animation */
.typewriter {
    overflow: hidden;
    white-space: nowrap;
    animation: typing 2s steps(50) 1s forwards, blink 1s linear infinite;
    width: 0;
}

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

@keyframes blink {
    0%, 50% { border-right: 2px solid #00ffff; }
    51%, 100% { border-right: 2px solid transparent; }
}

/* Mobile Responsive for Chat */
@media (max-width: 767px) {
    .welcome-title {
        font-size: 1.5rem;
    }
    
    .welcome-description {
        font-size: 1rem;
    }
    
    .start-adventure-btn {
        font-size: 1rem;
        padding: 12px 30px;
    }
    
    .chat-container {
        width: 90%;
        max-height: none;
    }
    
    .chat-content {
        flex-direction: column;
        min-height: 300px;
    }
    
    .character-portrait {
        display: none;
    }
    
    .portrait-frame {
        width: 80px;
        height: 80px;
    }
    
    .portrait-pixel-art {
        display: none;
    }
    
    .dialogue-area {
        padding: 15px;
    }
    
    .dialogue-text {
        min-height: 80px;
        font-size: 0.9rem;
        padding: 15px;
    }
    
    .choice-btn {
        font-size: 0.8rem;
        padding: 10px 15px;
    }
    
    .chat-title {
        font-size: 1.2rem;
    }
}

    /* Fix mobile button spacing and close button */
    .choice-btn {
        margin-bottom: 8px;
    }
    
    .close-chat-btn {
        width: 44px;
        height: 44px;
        border-radius: 0;
        border: 2px solid #ff6666;
        font-size: 1.2rem;
    }
    
    .nav-btn {
        padding: 12px 16px;
        margin: 5px;
        min-height: 44px;
        font-size: 0.8rem;
    }
    
    .chat-footer {
        padding: 15px;
        gap: 10px;
        flex-wrap: wrap;
    }
    
    /* Mobile-specific background adjustments for scrolling */
    .background-layer {
        min-height: 100vh;
        background-position: center;
        background-repeat: no-repeat;
        background-attachment: scroll;
    }
}

/* Name Plate */
.name-plate {
    position: absolute;
    bottom: 7%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    border: 2px solid #00ffff;
    border-radius: 6px;
    padding: 8px 16px;
    z-index: 50;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.name-text {
    color: #00ffff;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
    letter-spacing: 1px;
    text-align: center;
    display: block;
}

