/* Visual Novel Style UI */

.vn-stage {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: 9999;
    background-color: black;
    display: none;
    margin: 0;
    padding: 0;
}

.vn-stage.active {
    display: flex;
    flex-direction: column;
}

.vn-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: background-image 1s ease-in-out;
    z-index: 1;
}

.vn-character-container {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
    height: 90vh;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    pointer-events: none;
    transition: opacity 0.5s;
}

.vn-sprite {
    height: 100%;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.5));
    animation: float 4s ease-in-out infinite;
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.4s ease-out, transform 0.6s var(--ease-out);
}

.vn-sprite.active {
    opacity: 1;
    transform: translateY(0);
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

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

/* Dialogue Box */
.vn-ui-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0 2rem 2rem 2rem;
    box-sizing: border-box;
    transition: opacity 0.3s;
    pointer-events: none;
}

.vn-dialogue-box {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    padding: 2.5rem;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    pointer-events: all;
}

.vn-speaker-tag {
    position: absolute;
    top: -20px;
    left: 30px;
    background: var(--accent-color);
    color: white;
    padding: 0.5rem 2rem;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.4);
}

.vn-text {
    font-size: 1.4rem;
    line-height: 1.6;
    color: white;
    min-height: 4.8rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.vn-text .cursor {
    display: inline-block;
    width: 10px;
    height: 1.4rem;
    background: white;
    margin-left: 5px;
    animation: blink 1s infinite;
    vertical-align: middle;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* VN Controls */
.vn-controls {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    width: 100%;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    pointer-events: all;
}

.vn-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.vn-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.vn-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

/* Log Viewer */
.vn-log-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    height: 80vh;
    background: rgba(20, 20, 25, 0.95);
    backdrop-filter: blur(20px);
    z-index: 10001;
    border-radius: 32px;
    border: 1px solid var(--glass-border);
    padding: 3rem;
    display: none;
    flex-direction: column;
}

.vn-log-overlay.active {
    display: flex;
}

.vn-log-content {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 1.5rem;
}

.log-entry {
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1.5rem;
}

.log-speaker {
    font-weight: 800;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.log-text {
    font-size: 1.1rem;
    line-height: 1.5;
}

/* Quick Corner Buttons (Settings, etc) */
.vn-top-controls {
    position: absolute;
    top: 2rem;
    right: 2rem;
    z-index: 10;
    display: flex;
    gap: 1rem;
}

.vn-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.vn-icon-btn:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: scale(1.1);
}

/* Options/Choices in VN View */
.vn-options-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 1rem;
}

.vn-options-overlay.active {
    display: flex;
}

.vn-option-choice {
    width: 600px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1.5rem 3rem;
    border-radius: 16px;
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.vn-option-choice:hover {
    background: var(--accent-color);
    transform: scale(1.05);
    border-color: white;
}