﻿body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
    font-family: 'Cinzel', serif;
    color: #fff;
}

#game-viewport {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: #000;
}

/* Mobile safety border */
@media screen and (max-width: 768px) {
    #game-viewport {
        border: 2px solid rgba(255, 255, 255, 0.1);
        box-sizing: border-box;
    }
}

#landscape-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    text-align: center;
}

#landscape-warning img {
    width: 100px;
    filter: invert(1);
    margin-bottom: 20px;
}

@media screen and (orientation: portrait) and (max-width: 1024px) {
    #landscape-warning {
        display: flex;
    }
    #mobile-controls {
        display: none !important;
    }
}

#eye-blinking-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    z-index: 1000;
    pointer-events: none;
}

.eyelid {
    position: absolute;
    width: 100%;
    height: 50%;
    background-color: #000;
}

.eyelid.top {
    top: 0;
}

.eyelid.bottom {
    bottom: 0;
}

#story-container {
    width: 100%;
    height: 100%;
    transition: filter 2s ease;
}

#story-container.blurred {
    filter: blur(20px);
}

.stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
}

.stage.active {
    display: flex;
}

/* Start Screen Styles */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    background: #000;
}

#start-screen.active {
    display: flex;
}

.start-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000 100%);
    opacity: 0.8;
}

.start-content {
    position: relative;
    text-align: center;
    z-index: 10;
}

.game-title {
    font-size: 5rem;
    letter-spacing: 15px;
    margin-bottom: 10px;
    background: linear-gradient(to bottom, #fff, #888);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.game-subtitle {
    font-size: 1.2rem;
    letter-spacing: 5px;
    color: #ffd700;
    margin-bottom: 50px;
}

.mobile-hint {
    margin-top: 30px;
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

/* Cinematic Stage Styles */
#cinematic-stage {
    background: #050505;
    z-index: 1500;
}

#log-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

#log {
    width: 120px;
    height: 250px;
    background: linear-gradient(to right, #3d2b1f, #5c4033, #3d2b1f);
    border-radius: 10px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    cursor: pointer;
    position: relative;
}

#log::after {
    content: '';
    position: absolute;
    top: 20%;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(0, 0, 0, 0.2);
    box-shadow: 0 40px rgba(0, 0, 0, 0.2), 0 80px rgba(0, 0, 0, 0.2);
}

#axe {
    width: 80px;
    height: 40px;
    background: #777;
    position: absolute;
    top: 30%;
    left: -100px;
    border-radius: 5px 20px 20px 5px;
    transform: rotate(-45deg);
    pointer-events: none;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

#click-counter {
    font-size: 2rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

#cinematic-instruction {
    font-size: 1.2rem;
    letter-spacing: 2px;
    color: #666;
    text-transform: uppercase;
}

#cave-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 5s ease, opacity 2s ease;
}

.cave-exit {
    position: absolute;
    cursor: pointer;
    /* border: 2px solid red; /* for debug */
}

.cave-exit.left {
    top: 30%;
    left: 15%;
    width: 25%;
    height: 50%;
}

.cave-exit.right {
    top: 30%;
    right: 15%;
    width: 25%;
    height: 50%;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(100, 100, 100, 0.4);
    /* Medium gray for contrast */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    z-index: 500;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.narrative-text {
    font-size: 2rem;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.8);
    text-align: center;
}

#bats-container {
    position: relative;
    width: 85vw;
    height: 70vh;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    margin: auto;
}

@media screen and (max-width: 768px) {
    #bats-container {
        width: 95vw;
        height: 60vh;
        margin-top: 10vh;
    }
}

.bat {
    position: absolute;
    width: 80px;
    height: auto;
    cursor: pointer;
    user-select: none;
}

#vines-bg-container {
    position: relative;
    width: 100%;
    height: 100%;
}

#exit-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-cinematic-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: pulseGlow 2s infinite alternate;
}

@keyframes pulseGlow {
    from {
        filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.5));
    }

    to {
        filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.8));
    }
}

#vines-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}

#vines-overlay-img-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#loading-screen {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 2s linear infinite;
    margin-bottom: 20px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

#three-container {
    width: 100%;
    height: 100%;
}

#mobile-controls {
    position: absolute;
    bottom: 30px;
    left: 0;
    width: 100%;
    height: 150px;
    display: none;
    z-index: 2000;
    pointer-events: none;
}

#joystick-container {
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    position: absolute;
    bottom: 20px;
    left: 40px;
    pointer-events: auto;
}

#joystick {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

#action-buttons {
    position: absolute;
    bottom: 20px;
    right: 40px;
    display: flex;
    gap: 20px;
    pointer-events: auto;
}

.mobile-btn {
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
}

.mobile-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 50px;
}

#narrative-box {
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 40px 50px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    max-width: 800px;
    width: 85%;
    font-size: 1.1rem;
    display: none;
    pointer-events: auto;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    color: #f0f0f0;
    font-family: 'Outfit', sans-serif;
    line-height: 1.6;
}

@media screen and (max-width: 768px) {
    #narrative-box {
        padding: 20px 30px;
        font-size: 1rem;
        bottom: 20px;
    }
}

#compass-container {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.4);
    padding: 15px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

#compass {
    width: 60px;
    height: 60px;
    border: 2px solid #fff;
    border-radius: 50%;
    position: relative;
    background: rgba(255, 255, 255, 0.1);
}

#compass-pointer {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 30px;
    background: linear-gradient(to top, #ff4757 50%, #fff 50%);
    transform-origin: center;
    transform: translate(-50%, -50%) rotate(0deg);
    border-radius: 2px;
}

#distance-text {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    color: #fff;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.narrative-text {
    font-size: 1.25rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 30px;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.story-choice-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 24px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.story-choice-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

@media screen and (max-width: 768px) {
    .story-choice-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
}

#bats-text {
    margin-bottom: 20px;
    font-family: 'Bangers', cursive;
    letter-spacing: 2px;
    font-size: 3rem;
    color: #ff4757;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    animation: pulseText 1.5s infinite;
}

@media screen and (max-width: 768px) {
    #bats-text {
        font-size: 1.8rem;
    }
}

@keyframes pulseText {
    0% {
        transform: scale(1);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.9;
    }
}

#notification {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #ffd700;
    padding: 15px 30px;
    border-radius: 10px;
    border: 1px solid #ffd700;
    font-size: 1.5rem;
    z-index: 3000;
    text-transform: uppercase;
    letter-spacing: 2px;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#quest-ui {
    position: absolute;
    top: 30px;
    left: 30px;
    background: rgba(0, 0, 0, 0.6);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #ff4757;
    backdrop-filter: blur(5px);
    z-index: 2000;
}

.quest-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #ff4757;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.quest-count {
    font-size: 1.2rem;
    font-weight: bold;
}

.hidden {
    display: none !important;
    opacity: 0;
}

#crosshair {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 5000;
    display: none;
}

#crosshair::before,
#crosshair::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

#crosshair::before {
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    margin-top: -1px;
}

#crosshair::after {
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    margin-left: -1px;
}

/* HP Bar Styles */
#hp-bar-container {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 250px;
    height: 30px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 15px;
    overflow: hidden;
    z-index: 4000;
    backdrop-filter: blur(10px);
}

#hp-bar-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #ff4d4d, #ff8080);
    transition: width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#hp-text {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.9);
    pointer-events: none;
}

/* Portal Transition Effect */
.portal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: white;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    mix-blend-mode: overlay;
}

#genjutsu-three-container {
    width: 100%;
    height: 100%;
    background: #000;
}

.cinematic-video-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.cinematic-video-small {
    width: 40%;
    max-width: 600px;
    height: auto;
    /* Removed borders and box-shadow for a clean, borderless look */
}

.akatsuki-banner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    text-align: center;
    width: 100%;
    pointer-events: none;
}

.akatsuki-banner .banner-content {
    background: rgba(0, 0, 0, 0.7);
    padding: 40px;
    border-top: 2px solid #ff0000;
    border-bottom: 2px solid #ff0000;
}

.akatsuki-banner h1 {
    font-size: 1.2rem;
    letter-spacing: 5px;
    color: #888;
    margin-bottom: 20px;
}

.akatsuki-banner .akatsuki-text {
    font-size: 6rem;
    letter-spacing: 20px;
    color: #ff0000;
    text-shadow: 0 0 30px rgba(255, 0, 0, 0.8);
    font-family: 'Cinzel', serif;
    font-weight: 700;
    margin: 0;
}

@media screen and (max-width: 768px) {
    .akatsuki-banner .akatsuki-text {
        font-size: 3rem;
        letter-spacing: 10px;
    }
}

#genjutsu-stage {
    background: transparent !important;
}

#genjutsu-three-container {
    width: 100%;
    height: 100%;
    background: transparent !important;
}

#genjutsu-stage {
    background: transparent !important;
}

#genjutsu-three-container {
    width: 100%;
    height: 100%;
    background: transparent !important;
}

#intermission-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 5000;
    opacity: 0;
    transition: opacity 1s ease;
}

#intermission-text {
    font-family: 'Cinzel', serif;
    font-size: 3rem;
    color: #fff;
    letter-spacing: 10px;
    text-align: center;
    text-transform: uppercase;
}

@media screen and (max-width: 768px) {
    #intermission-text {
        font-size: 1.5rem;
        letter-spacing: 5px;
    }
}