/* Root Variables */
:root {
    --bg-color: #1a1a1a;
    --text-color: #f0f0f0;
    --accent-color: #D4A574;
    --secondary-color: #A98467;
    --dialogue-bg: rgba(26, 26, 26, 0.9);
    --narrator-bg: rgba(26, 26, 26, 0.95);
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Game Container */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background-image: url('../attached_assets/4549480C-A433-4A35-9EDA-E4542CB568CF_1753608711802.jpeg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* Screen Management */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    z-index: 1;
}

.screen.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Loading Screen */
#loading-screen {
    background: var(--bg-color);
    text-align: center;
}

.loading-content h1 {
    font-size: 3rem;
    color: var(--accent-color);
    margin-bottom: 2rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(212, 165, 116, 0.3);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Main Menu */
#main-menu {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
}

.menu-content {
    text-align: center;
    max-width: 800px;
    padding: 2rem;
}

.game-title {
    font-size: 4rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.game-subtitle {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 3rem;
    opacity: 0.9;
}

/* Episode Selection */
.episode-selection h2 {
    color: var(--accent-color);
    margin-bottom: 2rem;
    font-size: 2rem;
}

.episode-grid {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.episode-card {
    background: var(--dialogue-bg);
    border: 2px solid var(--accent-color);
    border-radius: 12px;
    padding: 1.5rem;
    width: 200px;
    text-align: center;
    transition: all 0.3s ease;
}

.episode-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(212, 165, 116, 0.3);
}

.episode-card.coming-soon {
    opacity: 0.6;
    border-color: var(--secondary-color);
}

.episode-number {
    font-size: 2rem;
    color: var(--accent-color);
    font-weight: bold;
    margin-bottom: 1rem;
}

.episode-card h3 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.episode-card p {
    color: rgba(240, 240, 240, 0.8);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.play-btn {
    background: var(--accent-color);
    color: #000;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
}

.play-btn:hover:not(:disabled) {
    background: #b8935f;
    transform: translateY(-2px);
}

.play-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Game Screen Layout */
#game-screen {
    position: relative;
}

/* Header */
#game-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(26, 26, 26, 0.9);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--accent-color);
}

.chapter-info {
    color: var(--accent-color);
    font-weight: 600;
    font-size: 1.2rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.icon-btn {
    background: none;
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background: var(--accent-color);
    color: #000;
}

/* Character Avatar */
.character-avatar {
    position: fixed;
    width: 200px;
    height: 200px;
    right: 20px;
    bottom: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-color);
    z-index: 30;
    display: none;
}

.character-avatar.active {
    display: block;
}

/* Dialogue Box */
.dialogue-box {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 800px;
    background: var(--dialogue-bg);
    border-radius: 12px;
    padding: 1rem;
    display: none;
    align-items: flex-start;
    gap: 1rem;
    backdrop-filter: blur(10px);
    border: 2px solid var(--accent-color);
    z-index: 50;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.dialogue-box:hover {
    border-color: #b8935f;
}

.dialogue-box.active {
    display: flex;
}

.avatar {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-color);
}

.dialogue-content {
    flex: 1;
}

.speaker-name {
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.25rem;
}

.dialogue-text {
    color: var(--text-color);
    line-height: 1.6;
    font-size: 1rem;
}

/* Narrator Box */
.narrator-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    background: var(--narrator-bg);
    border: 2px solid var(--accent-color);
    border-radius: 12px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    z-index: 50;
    display: none;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.narrator-box:hover {
    border-color: #b8935f;
}

.narrator-box.active {
    display: block;
}

.narrator-text {
    color: var(--text-color);
    font-size: 1.1rem;
    line-height: 1.6;
    text-align: left;
    margin-bottom: 1rem;
}

.narrator-continue {
    position: absolute;
    top: 10px;
    right: 15px;
    background: var(--accent-color);
    color: #000;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

/* Continue button - hidden since we use click to continue */
.narrator-continue {
    display: none !important;
}

/* Choices */
.choices-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 60;
    gap: 0.75rem;
    max-width: 90%;
    width: auto;
}

.choice-btn {
    background: var(--dialogue-bg);
    border: 2px solid var(--accent-color);
    color: var(--text-color);
    padding: 1rem 2rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 300px;
    max-width: 500px;
    text-align: center;
    line-height: 1.4;
    backdrop-filter: blur(10px);
}

.choice-btn:hover {
    background: var(--accent-color);
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 165, 116, 0.3);
}

/* Continue Button - Hidden by default, only shown when needed */
.continue-btn {
    display: none;
}

/* Modals */
.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.8) !important;
    display: none !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 9999 !important;
}

.modal.active {
    display: flex !important;
}

.modal-content {
    background: var(--bg-color);
    border: 2px solid var(--accent-color);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    position: relative;
    z-index: 10001;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    color: var(--accent-color);
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Chapter Selection Modal */
.chapter-selection {
    margin: 20px 0;
}

.chapter-selection select {
    width: 100%;
    padding: 12px;
    background: var(--bg-color);
    border: 2px solid var(--accent-color);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 16px;
    font-family: 'Roboto', Arial, sans-serif;
}

.chapter-selection select:focus {
    outline: none;
    border-color: #b8935f;
    box-shadow: 0 0 10px rgba(212, 165, 116, 0.3);
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn.primary {
    background: var(--accent-color);
    color: #000;
}

.btn.primary:hover {
    background: #b8935f;
    transform: translateY(-2px);
}

.btn.secondary {
    background: transparent;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
}

.btn.secondary:hover {
    background: var(--accent-color);
    color: #000;
}

.menu-btn {
    background: var(--dialogue-bg) !important;
    border: 2px solid var(--accent-color) !important;
    color: var(--text-color) !important;
    padding: 0.75rem 1.5rem !important;
    margin: 0.5rem 0 !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-size: 1rem !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    transition: all 0.3s ease !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.menu-btn:hover {
    background: var(--accent-color);
    color: #000;
}

.menu-btn.primary {
    background: var(--accent-color);
    color: #000;
}

.menu-btn.primary:hover {
    background: #b8935f;
}

/* Purchase Modal Styles */
.purchase-info {
    text-align: center;
    padding: 1rem;
}

.purchase-info h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.purchase-info p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.price {
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent-color);
    margin: 1.5rem 0;
}

.purchase-btn {
    background: linear-gradient(135deg, var(--accent-color), var(--secondary-color));
    color: #000;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin: 0.5rem;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 250px;
}

.purchase-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(212, 165, 116, 0.3);
}

.purchase-btn.secondary {
    background: transparent;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
}

.purchase-btn.secondary:hover {
    background: var(--accent-color);
    color: #000;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.5rem;
    }
    
    .episode-grid {
        flex-direction: column;
        align-items: center;
    }
    
    .episode-card {
        width: 280px;
    }
    
    #game-header {
        padding: 0.75rem 1rem;
    }
    
    .user-info {
        font-size: 0.9rem;
    }
    
    .character-avatar {
        width: 120px;
        height: 120px;
        right: 10px;
        bottom: 140px;
    }
    
    .dialogue-box {
        width: 95%;
        padding: 0.75rem;
    }
    
    .avatar {
        width: 60px;
        height: 60px;
    }
    
    .narrator-box {
        width: 95%;
        padding: 1.5rem;
    }
    
    .narrator-text {
        font-size: 1rem;
    }
    
    .choice-btn {
        min-width: 250px;
        font-size: 0.9rem;
        padding: 0.6rem 1.2rem;
    }
    
    .choices-container {
        bottom: 120px;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .game-title {
        font-size: 2rem;
    }
    
    .menu-content {
        padding: 1rem;
    }
    
    .narrator-box {
        padding: 1rem;
    }
    
    .narrator-text {
        font-size: 0.9rem;
    }
    
    .character-avatar {
        width: 100px;
        height: 100px;
        bottom: 110px;
    }
}