*{
    margin: 0;
    padding: 0;
    box-sizing: border-box; /* Added for better layout control */
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    font-family: 'Arial', sans-serif; /* Default font for better legibility */
    line-height: 1.6; /* Improved line spacing */
}

.banner{
    height: 100vh;
    width: 100%;
    background-image: linear-gradient(rgb(0,0,0,0.25),rgb(0,0,0,0.25)), url(hexagonalbg.jpg);
    padding-bottom: 160px; /* Add space for fixed bottom bar */
}

.menubar{
    background-color: rgb(0, 0, 64);
    text-align: center;
    /* padding: 15px 0; */
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    position: relative;
    z-index: 2000; /* Higher z-index for menubar */
}

.menubar ul{
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.menubar ul li{
    position: relative;
    /* margin: 0 25px; */
    border-radius: 30px;
    transition: all 0.3s ease;
}

.menubar ul li a{
    text-decoration: none;
    color: #d4ac0d;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 15px 25px; /* Move padding from li to a to make entire area clickable */
    border-radius: 30px;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.active, .menubar ul li:hover{
    background: linear-gradient(135deg, #8a2be2, #9370db);
    cursor: pointer;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(138, 43, 226, 0.4);
}

.menubar ul li a:hover{
    background: linear-gradient(135deg, #8a2be2, #9370db);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(138, 43, 226, 0.4);
}

.menubar .fa{
    font-size: 16px;
}

.img {
    margin-right: 40px;
}

/* Modern Dropdown/Submenu Styling - Fixed z-index and interaction */
.sub-menu1{
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.95), rgba(75, 0, 130, 0.95));
    border-radius: 15px;
    min-width: 220px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    z-index: 9999; /* Very high z-index to appear above everything */
    overflow: hidden;
    margin-top: 0; /* Remove gap completely */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    pointer-events: auto; /* Ensure dropdown is interactive */
}

/* Show dropdown on hover and maintain visibility when hovering over submenu */
.menubar ul li:hover .sub-menu1,
.sub-menu1:hover {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.sub-menu1 ul{
    display: block;
    padding: 15px 0;
    list-style: none;
    margin: 0;
}

.sub-menu1 ul li{
    width: 100%;
    margin: 0;
    padding: 0; /* Remove padding from li, add to a instead */
    border-radius: 0;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: relative;
}

.sub-menu1 ul li:last-child{
    border-bottom: none;
}

.sub-menu1 ul li:hover{
    background: linear-gradient(135deg, rgba(147, 112, 219, 0.8), rgba(138, 43, 226, 0.8));
}

.sub-menu1 ul li a{
    color: #ffffff !important;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none !important;
    display: flex; /* Use flex to align icon and text */
    align-items: center; /* Center align vertically */
    gap: 10px; /* Add space between icon and text */
    padding: 15px 25px; /* Move padding to anchor */
    width: 100%;
    transition: all 0.3s ease;
    cursor: pointer;
}

.sub-menu1 ul li a:hover{
    color: #ffffff !important;
    transform: translateX(5px);
    background: rgba(255,255,255,0.1);
}

/* Ensure Font Awesome icons work properly in dropdown */
.sub-menu1 .fa{
    margin-right: 10px;
    color: #ffffff !important;
}

.introduction{
    background-image: linear-gradient(rgba(0, 0, 0, 0.75),rgb(0,0,0,0.75));
    position: absolute;
    padding: 25px;
    font-size: 2vw;
    text-align: center;
    color: white;
    top: 60%;
    width: 100%;
    border-radius: 15px;
    margin: 0 auto;
}

.doctor4 img{
    height: 100%;
    max-height: 400px;
    object-fit: contain;
}

.doctor4{
    position: relative;
    float: left;
    height: 50%;
    padding: 20px;
}

/* Tutorial Video - Much larger size */
.toturial{
    position: relative;
    padding: 15px;
    width: 50%;
    height: 70%; 
    float: left;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toturial video{
    width: 100%;
    max-width: 650px;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    border: 3px solid rgba(255,255,255,0.2);
}

/* Answer Scale - Fixed overlap issue and improved clickability */
.emote{
    position: relative;
    padding: 15px;
    width: 45%;
    height: auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    float: right;
    gap: 12px;
    align-items: center;
    margin-bottom: 180px; /* Prevent overlap with bottom bar */
    z-index: 100; /* Lower z-index than dropdown */
}

.emote p{
    background-color: rgb(0, 0, 75) !important; /* Dark blue instead of purple */
    color: white !important; /* White text */
    font-size: 1.6vw !important;
    margin: 0 !important;
    padding: 15px 20px;
    border-radius: 15px;
    width: 95%;
    max-width: 380px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.1);
    position: relative; /* Ensure proper positioning */
}

.emote p:hover{
    background-color: rgb(0, 0, 100) !important;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    border-color: rgba(255,255,255,0.3);
}

/* Ensure videos inside emote p are clickable */
.emote video{
    width: 80px !important;
    height: 80px !important;
    object-fit: cover;
    border-radius: 12px;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.2);
    pointer-events: none; /* Allow clicks to pass through to parent */
    background-color: rgba(0, 0, 0, 0.3); /* Fallback background while loading */
}

/* Video loading state */
.video-loading {
    position: relative;
    display: inline-block;
}

.video-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.video-loaded .video-loading::before {
    display: none;
}

/* Ensure tutorial videos also have proper loading states */
.toturial video {
    background-color: rgba(0, 0, 0, 0.5);
}

/* Make emotion class clickable */
.emotion {
    cursor: pointer;
    pointer-events: auto;
}

/* Bottom Speech Box - Modern and Sticky */
.SpeechBox{
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 100%;
    min-height: 140px;
    display: flex;
    align-items: center;
    box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    padding: 25px;
    gap: 25px;
    backdrop-filter: blur(10px);
}

.npc-portrait {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background-image: url('doctor4.png');
    background-color: #999;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    border: 4px solid rgba(255,255,255,0.3);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

#gamespeech, #speech {
    flex: 1;
    font-size: 1.4vw;
    color: white;
    line-height: 1.6;
    padding: 15px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    cursor: pointer;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    font-weight: 500;
}

/* Modern Button Styling */
button{
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 30px;
    color: white;
    padding: 18px 35px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    margin: 10px;
    min-width: 140px;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    background: linear-gradient(135deg, #5a67d8 0%, #667eea 100%);
}

.congrats {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 48px;
    font-family: 'Arial', sans-serif;
    margin: 50px auto;
    padding: 40px;
    text-align: center;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 800px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .banner {
        padding-bottom: 200px; /* More space for mobile bottom bar */
    }
    
    .menubar {
        padding: 8px 0; /* More condensed padding */
    }
    
    .menubar ul {
        flex-direction: row; /* Keep horizontal layout but condensed */
        flex-wrap: wrap;
        gap: 4px; /* Smaller gap for condensed look */
        justify-content: center; /* Center items */
    }
    
    .menubar ul li {
        width: auto; /* Auto width instead of fixed 65% */
        margin: 2px; /* Smaller margins for condensed look */
        flex-shrink: 0; /* Prevent shrinking */
    }
    
    .menubar ul li a {
        padding: 8px 12px; /* More condensed padding */
        font-size: 14px; /* Smaller font for mobile */
        text-align: center; /* Center align text */
        justify-content: center; /* Center content in flex */
    }
    
    /* Logo adjustment for mobile */
    .img {
        width: 80px !important; /* Smaller logo for condensed header */
        margin-right: 15px; /* Less margin */
    }
    
    .sub-menu1 {
        position: static;
        display: none;
        width: 100%;
        margin-top: 10px;
        transform: none;
        left: auto;
        border-radius: 10px;
        z-index: 9999; /* Maintain high z-index on mobile */
    }
    
    .menubar ul li:hover .sub-menu1 {
        display: block;
    }
    
    .introduction {
        font-size: 4vw;
        /* padding: 20px; */
        top: 45%;
    }
    
    .toturial {
        float: none;
        width: 100%;
        padding: 15px;
        height: auto;
        margin-bottom: 20px;
    }
    
    .toturial video {
        max-width: 95%;
        border-width: 2px;
    }
    
    .emote {
        float: none;
        width: 100%;
        padding: 15px;
        margin-bottom: 280px; /* Further increased space to prevent overlap with sticky bottom bar */
    }
    
    .emote p {
        font-size: 4vw !important;
        width: 100%;
        flex-direction: row;
        text-align: center;
        gap: 12px;
        padding: 18px 15px;
    }
    
    .emote video {
        width: 60px !important;
        height: 60px !important;
    }
    
    .SpeechBox {
        flex-direction: column;
        min-height: 180px;
        padding: 20px;
        gap: 15px;
        text-align: center;
    }
    
    .npc-portrait {
        width: 70px;
        height: 70px;
        border-width: 3px;
    }
    
    #gamespeech, #speech {
        font-size: 4vw; /* Larger text for mobile */
        text-align: center;
        padding: 10px;
        line-height: 1.5;
    }
    
    .congrats {
        font-size: 32px;
        margin: 15px;
        padding: 25px;
    }
    
    .doctor4 {
        float: none;
        width: 100%;
        text-align: center;
        height: auto;
        margin-bottom: 20px;
        padding: 15px;
    }
    
    .doctor4 img {
        height: auto;
        max-width: 70%;
    }
    
    button {
        font-size: 16px;
        padding: 15px 25px;
        margin: 8px;
        min-width: 120px;
        border-radius: 25px;
    }
}

/* Additional responsive breakpoint for very small screens */
@media (max-width: 480px) {
    .banner {
        padding-bottom: 240px;
    }
    
    .emote {
        height: 900px; /* Further increased for very small screens to ensure no overlap */
    }
    
    .emote p {
        font-size: 4.5vw !important;
        padding: 15px 12px;
        flex-direction: column;
        gap: x 0px;
    }
    
    #gamespeech, #speech {
        font-size: 4.5vw; /* Even larger for very small screens */
        padding: 12px;
    }
    
    .SpeechBox {
        min-height: 200px;
        padding: 15px;
    }
    
    button {
        font-size: 14px;
        padding: 12px 20px;
        min-width: 100px;
    }
    
    .npc-portrait {
        width: 60px;
        height: 60px;
    }
}
