:root {
    --background-color: #000000;
    --primary-accent-color: #BB86FC;
    --secondary-accent-color: #333333; /* For subtle borders or backgrounds */
    --text-color: #E0E0E0;
    --text-color-darker: #AAAAAA;
    --dropzone-bg: #121212;
    --dropzone-border: #292929; /* Darker border for dropzones */
    --dropzone-highlight-bg: #1F1F1F;
    --dropzone-highlight-border: var(--primary-accent-color);
    --button-bg: var(--primary-accent-color);
    --button-text-color: #000000;
    --slider-thumb-color: var(--primary-accent-color);
    --slider-track-color: #444444;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120vh;
    top: 0px;
    margin-bottom: 150px;
    overflow-x: hidden;
    overflow-y: auto;
}

#app-container {
    width: 100%;
    max-width: 600px; /* Max width for larger screens */
    min-height: 100vh; /* Ensure it takes full viewport height on mobile */
    display: flex; /* This will be controlled by JS to show one view at a time */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    top: 0px;

}

/* Upload View */
#upload-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    padding-bottom: 80px; /* Added to lift content above bottom nav */
    width: 100%;
    box-sizing: border-box;
    min-height: 100vh;
}

#upload-view h1 {
    color: #9D46FF;
    font-weight: 300;
    font-size: 2.5em;
    margin-bottom: 40px;
}

.master-dropzone {
    width: 100%;
    max-width: 800px;
    margin-bottom: 40px;
    background-color: #181818;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
}

.master-dropzone i {
    color: #9D46FF;
    font-size: 2em;
    margin-bottom: 15px;
}

.master-dropzone p {
    color: #fff;
    margin: 0;
    font-size: 1em;
}

.dropzone-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 800px;
}

.dropzone {
    background-color: #181818;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.dropzone:hover, .master-dropzone:hover {
    background-color: #202020;
    border-color: #9D46FF;
}

.dropzone.drag-over, .master-dropzone.drag-over {
    background-color: #202020;
    border-color: #9D46FF;
}

.dropzone.file-dropped {
    border-color: #9D46FF;
    background-color: #202020;
}

.dropzone i {
    color: #9D46FF;
    font-size: 2em;
    margin-bottom: 15px;
}

.dropzone p {
    color: #fff;
    margin: 0 0 5px 0;
    font-size: 1em;
}

.file-name {
    font-size: 0.8em;
    color: #888;
    margin-top: 10px;
}

.file-name {
    font-size: 0.8em;
    color: var(--text-color-darker);
    word-break: break-all;
}

.action-button {
    background-color: var(--button-bg);
    color: var(--button-text-color);
    border: none;
    border-radius: 8px;
    padding: 12px 25px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    margin-top: 30px;
}

.action-button:hover {
    background-color: #A065E0; /* Slightly darker purple */
    transform: scale(1.05);
}

/* Player View */
#player-view {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh; /* Full viewport height for player */
    box-sizing: border-box;
    overflow: hidden; /* Prevent main scrollbars if content overflows slightly */
}

#player-title {
    color: #9D46FF;
    font-weight: bold;
    font-size: 2.2em;
    text-align: center;
    padding: 15px 20px;
    margin: 0 auto;
    background-color: #0A0A0A;
    border-bottom: 1px solid var(--secondary-accent-color);
    width: 100%;
    max-width: 800px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
}

#player-image-container {
    background-color: black; 
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    position: relative;
    margin: 0 auto;
    overflow: hidden;
}

#scene-image {
     width: 95%;
    max-width: 600px;
    height: auto;
    display: block;
    object-fit: contain;
    margin: 0 auto;
}

#text-content-area {
    padding: 20px;
    overflow-y: auto;
    background-color: var(--background-color); 
    font-size: 1.1em;
    line-height: 1.6;
    color: var(--text-color);
    max-width: 600px;
    height: calc(100vh - 450px); /* Adjust for header, image, and controls */
    margin: 0 auto;
    margin-bottom: 80px;
}

#text-content-area p {
    margin-top: 0;
    margin-bottom: 150px;
}

#text-content-area h1 {
text-align: center;
color: #9D46FF;
}

#epubLanguage {
text-align: center;
}

#player-controls {
    background-color: #0A0A0A; 
    padding: 15px 20px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 15px;
    border-top: 1px solid var(--secondary-accent-color);
    align-items: center;
    margin: 0 auto;
    width: 100%;
    max-width: 600px;
}

.control-button {
    background-color: transparent;
    color: var(--primary-accent-color);
    border: none;
    border-radius: 0;
    padding: 5px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
    min-width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.control-button:hover {
    color: #A065E0;
    background-color: transparent;
}

.slider-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 150px; 
}

.slider-container label {
    font-size: 0.8em;
    color: var(--text-color-darker);
    margin-bottom: 5px;
}

.slider-container label span { 
    color: var(--text-color);
    font-weight: bold;
    margin-left: 5px;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--slider-track-color);
    border-radius: 5px;
    cursor: pointer;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--slider-thumb-color);
    border-radius: 50%;
    border: 2px solid var(--background-color); 
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--slider-thumb-color);
    border-radius: 50%;
    border: 2px solid var(--background-color);
    cursor: pointer;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #upload-view h1 {
        font-size: 2em;
    }
    #player-title {
        font-size: 1.8em; /* Adjust responsive title size */
        padding: 10px;
    }
    .dropzone-grid {
        grid-template-columns: 1fr; 
        max-width: 100%;
        padding: 0 10px; 
    }
    .dropzone {
        padding: 20px;
        min-height: 120px;
    }
    .dropzone-icon {
        font-size: 2.2em; /* Slightly smaller on mobile */
    }
    #player-controls {
        flex-direction: row; 
        justify-content: space-around;
        gap: 10px;
        padding: 10px;
    }
    .slider-container {
        width: 100%; 
        flex-basis: calc(50% - 40px); 
    }
    #text-content-area {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
     #player-view {
        height: auto; 
        min-height: 100vh;
    }
    #player-title {
        font-size: 1.5em; /* Further adjust for very small screens */
    }
    #scene-image {
        /* For very small screens, maybe reduce max height of image or adjust layout more drastically if needed */
    }
    #text-content-area {
        min-height: 200px; 
        font-size: 0.9em;
    }
    #player-controls {
        flex-direction: column; 
        gap: 15px;
    }
    .slider-container {
        width: 100%;
        flex-basis: auto;
    }
    .control-button {
        width: 100%; 
    }
    .control-button.icon-button {
        width: auto; 
        align-self: center;
    }
}

/* Ensure player view takes up the screen correctly */
#player-view {
    position: fixed; 
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10; 
}

.bottom-nav {
       position: fixed;
       bottom: 0px;
       left: 0;
       width: 100%;
       background: rgba(18, 18, 18, 0.95);
       padding: 10px;
       overflow-x: auto;
       white-space: nowrap;
       border-top: 1px solid rgba(186, 77, 245, 0.1);
       z-index: 999;
       }

       .bottom-nav::-webkit-scrollbar {
       height: 3px;
       }

       .bottom-nav::-webkit-scrollbar-thumb {
       background: #ba4df5;
       border-radius: 10px;
       }

       .bottom-nav-links {
       display: flex;
       gap: 15px;
       padding: 0;
       justify-content: flex-start;
       min-width: max-content;
       }

       .bottom-nav-link {
       color: #fff;
       text-decoration: none;
       padding: 8px 15px;
       border-radius: 6px;
       white-space: nowrap;
       transition: all 0.3s ease;
       }

       .bottom-nav-link:hover {
       background: rgba(186, 77, 245, 0.1);
       color: #ba4df5;
       }

       .bottom-nav-link.active {
       background: rgba(186, 77, 245, 0.15);
       color: #ba4df5;
       }