/* Base Variables - Cinematic Dark Theme */
:root {
    --bg-color: #0d0d0d;
    --text-color: #e0e0e0;
    --accent-color: #a89f91;
    /* Muted gold/beige */
    --accent-color-hover: #c5bba8;
    --secondary-bg: #1a1a1a;
    --overlay-bg: rgba(0, 0, 0, 0.85);
    --font-main: 'Helvetica Neue', 'Arial', sans-serif;
    --font-serif: 'Georgia', serif;
    --transition-speed: 0.4s;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

/* Container */
.game-container {
    width: 100%;
    max-width: 600px;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 4px;
    background-color: var(--secondary-bg);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
}

.progress-bar {
    height: 100%;
    background-color: var(--accent-color);
    width: 0%;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(168, 159, 145, 0.5);
}

/* Visual Area */
.scene-visual {
    width: 100%;
    height: 40vh;
    background-color: #000;
    position: relative;
    overflow: hidden;
}

.scene-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.scene-visual img.visible {
    opacity: 1;
}

/* Dialog Box */
.dialog-box {
    padding: 20px 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Align top */
}

.speaker-name {
    font-family: var(--font-serif);
    color: var(--accent-color);
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 15px;
    opacity: 0.8;
}

/* Dialog Text Animation */
.dialog-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #dcdcdc;
    margin-bottom: 30px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.dialog-text.visible {
    opacity: 1;
}

.dialog-text b {
    color: #fff;
    font-weight: 600;
}

.dialog-text em {
    color: #888;
    font-style: italic;
    font-family: var(--font-serif);
}

/* Choices */
.choices-container {
    padding: 20px 25px 40px;
    /* Extra padding at bottom for controls */
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.choice-btn {
    background: transparent;
    border: 1px solid #333;
    color: #aaa;
    padding: 15px 20px;
    text-align: left;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
    font-family: var(--font-main);
}

.choice-btn:hover {
    border-color: var(--accent-color);
    color: #fff;
    background-color: rgba(168, 159, 145, 0.05);
}

.choice-btn:active {
    transform: scale(0.98);
}

/* Skip Button Style (if needed in future) */
.choice-btn.skip-btn {
    border-color: transparent;
    color: #bbb;
    text-align: center;
    font-size: 0.9rem;
}

.choice-btn.skip-btn:hover {
    color: #fff;
    background: transparent;
    text-decoration: underline;
}

/* Reflection Overlay */
.reflection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-bg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 9999 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    overflow-y: auto; /* Allow scrolling within the overlay container */
}

.reflection-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.reflection-content {
    background-color: var(--secondary-bg);
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh; /* Prevent content from being taller than screen */
    overflow-y: auto; /* Scroll inside the modal if content is huge */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
    border-radius: 8px;
    position: relative;
    margin: 20px auto; /* Center with margin for scrolling context */
}

.close-reflection-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
    transition: color 0.3s;
}

.close-reflection-btn:hover {
    color: #fff;
}

.reflection-content h2 {
    font-family: var(--font-serif);
    color: var(--accent-color);
    margin-top: 0;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.reflection-content ul {
    list-style: none;
    padding: 0;
    margin-bottom: 30px;
}

.reflection-content li {
    margin-bottom: 15px;
    color: #ccc;
    line-height: 1.5;
    border-left: 2px solid #333;
    padding-left: 15px;
}

.reflection-input {
    width: 100%;
    background: #000;
    border: 1px solid #333;
    color: #fff;
    padding: 10px;
    font-family: var(--font-main);
    font-size: 1.1rem;
    /* Increased size */
    resize: vertical;
    min-height: 60px;
    margin-bottom: 15px;
    border-radius: 4px;
}

.reflection-input:focus {
    border-color: var(--accent-color);
    outline: none;
}

.continue-btn {
    background-color: var(--accent-color);
    color: #000;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    width: 100%;
}

.continue-btn:hover {
    background-color: var(--accent-color-hover);
}

/* Controls */
.game-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    left: auto;
    display: flex;
    gap: 10px;
    z-index: 90;
    opacity: 0.7;
    /* Faded by default */
    transition: opacity 0.3s;
}

.game-controls:hover {
    opacity: 1;
}

.game-controls button,
.game-controls a {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #444;
    color: #888;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.2rem;
    position: relative; /* For badges */
    transition: all 0.2s;
}

.game-controls button:hover,
.game-controls a:hover {
    color: #fff;
    border-color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.game-controls button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: #333;
    color: #555;
}

/* Exit Button (Top Right) */
.exit-btn {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    bottom: auto !important;
    left: auto !important;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #444;
    color: #888;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    font-size: 1.2rem;
    z-index: 200; /* Increased z-index */
    transition: all 0.2s ease;
}

.exit-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #fff;
    color: #fff;
    transform: scale(1.1);
}

/* Journal Notification Badge */
.journal-notify::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background-color: #d4af37; /* Gold accent */
    border-radius: 50%;
    border: 2px solid var(--bg-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(212, 175, 55, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(212, 175, 55, 0); }
}

/* Choice Effect Icons */
.choice-effect-icon {
    margin-left: 8px;
    font-size: 0.9em;
}

/* Debug Stats Panel (Styled as Rectangle matching Menu) */
.stats-panel {
    display: flex;
    position: fixed;
    bottom: auto;
    top: 20px;
    /* Moved to top */
    right: 70px; /* Shifted left to avoid Exit Button overlap */
    left: auto;

    /* Style matching .game-controls button */
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #444;
    color: #888;
    padding: 10px 15px;
    gap: 15px;
    z-index: 95;

    /* Rectangle Shape */
    border-radius: 8px;
    box-shadow: none;
    backdrop-filter: blur(2px);
    justify-content: center;
    align-items: center;
    /* Ensure vertical centering */
    min-width: 80px;
    transition: all 0.2s;
}

.stats-panel:hover {
    color: #fff;
    border-color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Journal Modal */
.journal-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 200;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.journal-modal.active {
    display: flex;
    opacity: 1;
}

.journal-content {
    background: var(--secondary-bg);
    width: 90%;
    max-width: 600px;
    height: 80vh;
    border: 1px solid #444;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

.journal-header {
    padding: 20px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.journal-header h2 {
    margin: 0;
    font-family: var(--font-serif);
    color: var(--accent-color);
}

.close-journal {
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
}

.close-journal:hover {
    color: #fff;
}

.journal-tabs {
    display: flex;
    border-bottom: 1px solid #333;
}

.tab-btn {
    flex: 1;
    background: rgba(40, 44, 56, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    color: #888;
    cursor: pointer;
    transition: all 0.3s;
    font-family: var(--font-main);
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.tab-btn.active {
    color: #fff;
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--accent-color);
}

.journal-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
}

.journal-section {
    display: none;
}

.journal-section.active {
    display: block;
}

.journal-item {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #333;
}

.journal-item h4 {
    color: var(--accent-color);
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    opacity: 0.7;
}

.journal-choice {
    color: #fff;
    font-style: italic;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-left: 2px solid var(--accent-color);
    margin-top: 5px;
}

.journal-note {
    background: #000;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #333;
}

.journal-note .question {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.journal-note .answer {
    color: #e0e0e0;
}

.empty-state {
    color: #555;
    text-align: center;
    margin-top: 50px;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .dialog-text {
        font-size: 1rem;
    }

    .choice-btn {
        padding: 12px 15px;
        font-size: 0.95rem;
    }

    .reflection-content {
        padding: 15px;
        width: 90%;
        max-height: calc(100vh - 40px);
        /* Leave room for bars */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-direction: column;
        /* Ensure scrolling doesn't get stuck */
        margin-top: 10px;
        padding-bottom: 50px;
        /* Extra space at bottom */
    }

    .journal-content {
        width: 100%;
        height: 100vh;
        border: none;
    }
}

/* Cookie Banner Styles */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    right: 20px;
    max-width: 350px;
    background: #4E4F73;
    color: #ffffff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 20000 !important;
    font-size: 0.9rem;
    line-height: 1.6;
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
    /* Hidden by default */
    transition: all 0.4s ease-out;
}

.cookie-banner.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.cookie-banner-content {
    position: relative;
}

.cookie-banner-close {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cookie-banner-text {
    margin-bottom: 15px;
}

.cookie-banner-accept {
    width: 100%;
    padding: 10px 20px;
    background-color: #ffffff;
    color: #4E4F73;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 15px;
    display: block;
}

.cookie-banner-accept:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

@media (max-width: 600px) {
    .cookie-banner {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}