/* public/css/about-game.css */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');
@import url('https://fonts.googleapis.com/css?family=Raleway:400,700,900,400italic,700italic,900italic');

:root {
    --vn-bg: rgba(15, 23, 42, 0.9);
    --vn-border: #10b981;
    --vn-text: #f8fafc;
    --vn-name-bg: #047857;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #020617;
    font-family: 'Poppins', sans-serif;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#game-container::-webkit-scrollbar {
    display: none;
}

#office-environment {
    position: relative;
    height: 100vh;
    width: max(100vw, 154.64vh);
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    transform-origin: center center;
}

/* Character Styling */
.interactive-character {
    position: absolute;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 3px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    transform: translate(-50%, -50%);
    animation: floatChar 3s ease-in-out infinite alternate;
    z-index: 10;
}

.interactive-character img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.interactive-character::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 15px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    filter: blur(5px);
    z-index: -1;
}

.interactive-character:hover {
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 0 30px 10px rgba(16, 185, 129, 0.5);
    border-color: #10b981;
    z-index: 20;
}

.interactive-character.visited {
    border-color: #fbbf24;
}

.interactive-character.visited::before {
    content: '\2713';
    position: absolute;
    top: -5px;
    right: -5px;
    background: #fbbf24;
    color: #000;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    border: 2px solid #000;
    z-index: 5;
}

@keyframes floatChar {
    0% {
        top: calc(var(--base-top) - 8px);
    }

    100% {
        top: calc(var(--base-top) + 8px);
    }
}

/* UI Overlay Layer */
#ui-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

/* Back Button */
#back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    pointer-events: auto;
    backdrop-filter: blur(5px);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

#back-btn:hover {
    border-color: #10b981;
    color: #10b981;
    transform: translateX(-5px);
}

/* Progress HUD */
#progress-hud {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid #10b981;
    padding: 12px 20px;
    border-radius: 12px;
    color: white;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.progress-bar-container {
    width: 100px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

#progress-bar-fill {
    height: 100%;
    background: #10b981;
    width: 0%;
    transition: width 0.4s ease;
}

/* Dialog Box */
#dialog-box {
    position: absolute;
    bottom: -300px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 850px;
    background: var(--vn-bg);
    border: 3px solid var(--vn-border);
    border-radius: 16px;
    padding: 25px;
    display: flex;
    gap: 25px;
    color: var(--vn-text);
    transition: bottom 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
    backdrop-filter: blur(15px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(16, 185, 129, 0.1);
}

#dialog-box.active {
    bottom: 40px;
}

#dialog-avatar {
    width: 140px;
    height: 140px;
    border-radius: 12px;
    border: 3px solid #cbd5e1;
    object-fit: cover;
    background: #000;
    flex-shrink: 0;
}

.dialog-content {
    flex-grow: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

#dialog-name {
    position: absolute;
    top: -45px;
    left: -15px;
    background: var(--vn-name-bg);
    color: white;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: bold;
    border: 2px solid var(--vn-border);
    font-size: 20px;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
    letter-spacing: 1px;
}

#dialog-role {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 12px;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

#dialog-text {
    font-size: 17px;
    line-height: 1.7;
    min-height: 80px;
}

.typewriter-cursor::after {
    content: '▼';
    margin-left: 8px;
    animation: blink 1s infinite;
    color: #10b981;
    font-size: 14px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.dialog-controls {
    display: flex;
    gap: 12px;
    align-self: flex-end;
    margin-top: 15px;
}

.btn-game {
    background: #1e293b;
    border: 2px solid #10b981;
    color: white;
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 14px;
}

.btn-game:hover {
    background: #10b981;
    color: #020617;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
}

/* Intro Overlay */
#intro-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.95);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease;
    pointer-events: auto;
    backdrop-filter: blur(8px);
}

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

.intro-mascot {
    width: 180px;
    height: 180px;
    margin-bottom: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #10b981;
    box-shadow: 0 0 40px rgba(16, 185, 129, 0.6);
    animation: floatIntro 3.5s ease-in-out infinite alternate;
}

@keyframes floatIntro {
    0% {
        transform: translateY(-15px);
    }

    100% {
        transform: translateY(15px);
    }
}

.intro-box {
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid #10b981;
    padding: 35px;
    border-radius: 16px;
    max-width: 650px;
    width: 90%;
    text-align: center;
    color: white;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

#intro-text {
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 25px;
    min-height: 60px;
}

/* Achievement Popup */
#achievement-popup {
    position: fixed;
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #10b981, #047857);
    color: white;
    padding: 18px 35px;
    border-radius: 50px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.6);
    transition: top 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 300;
    border: 2px solid rgba(255, 255, 255, 0.4);
    font-size: 16px;
}

#achievement-popup.show {
    top: 40px;
}

.achievement-icon {
    background: white;
    color: #10b981;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* Instructions */
#click-instruction {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 16px;
    border-radius: 20px;
    color: white;
    font-size: 14px;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: pulseText 2s infinite;
}

@keyframes pulseText {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }
}

/* Neon Sign Title (3D Bouncing Shadow) */
.office-title-neon {
    position: absolute;
    top: 18%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Raleway', sans-serif;
    font-size: 3.5rem;
    font-weight: 900;
    color: #011a32;
    text-transform: uppercase;
    letter-spacing: 6px;
    text-align: center;
    white-space: nowrap;
    z-index: 5;
    animation: text-shadow-bounce 1.5s ease-in-out infinite;
    cursor: default;
    pointer-events: auto;
    /* allow hover to pause */
}

.office-title-neon:hover {
    animation-play-state: paused;
}

@keyframes text-shadow-bounce {
    0% {
        transform: translateX(-50%) translateY(0);
        text-shadow:
            0 0 0 #0c2ffb,
            0 0 0 #2cfcfd,
            0 0 0 #fb203b,
            0 0 0 #fefc4b;
    }

    20% {
        transform: translateX(-50%) translateY(-0.8em);
        text-shadow:
            0 0.125em 0 #0c2ffb,
            0 0.25em 0 #2cfcfd,
            0 -0.125em 0 #fb203b,
            0 -0.25em 0 #fefc4b;
    }

    40% {
        transform: translateX(-50%) translateY(0.4em);
        text-shadow:
            0 -0.0625em 0 #0c2ffb,
            0 -0.125em 0 #2cfcfd,
            0 0.0625em 0 #fb203b,
            0 0.125em 0 #fefc4b;
    }

    60% {
        transform: translateX(-50%) translateY(-0.2em);
        text-shadow:
            0 0.03125em 0 #0c2ffb,
            0 0.0625em 0 #2cfcfd,
            0 -0.03125em 0 #fb203b,
            0 -0.0625em 0 #fefc4b;
    }

    80% {
        transform: translateX(-50%) translateY(0);
        text-shadow:
            0 0 0 #0c2ffb,
            0 0 0 #2cfcfd,
            0 0 0 #fb203b,
            0 0 0 #fefc4b;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #office-environment {
        /* aspect ratio handled by max(100vw, 154.64vh) */
    }

    .interactive-character {
        width: 80px;
        height: 80px;
    }

    #dialog-box {
        flex-direction: column;
        align-items: center;
        text-align: center;
        bottom: -400px;
        padding: 20px;
        width: 95%;
    }

    #dialog-avatar {
        width: 90px;
        height: 90px;
        margin-top: -60px;
        border-radius: 50%;
    }

    #dialog-name {
        position: relative;
        top: 0;
        left: 0;
        display: inline-block;
        margin-bottom: 5px;
    }

    .dialog-controls {
        align-self: center;
        width: 100%;
        justify-content: center;
    }

    #progress-hud {
        top: auto;
        bottom: 20px;
        right: 20px;
    }

    #click-instruction {
        top: 20px;
        bottom: auto;
    }

    .office-title-neon {
        font-size: 1.5rem;
        top: 15%;
        letter-spacing: 3px;
    }
}

/* Prank Speech Bubble for Habi */
.speech-bubble {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid #10b981;
    color: white;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.5);
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
    opacity: 1;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #10b981 transparent transparent transparent;
}

.speech-bubble.fade-out {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
}