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

:root {
    --primary-color: #2d5a27;
    --primary-dark: #1e3d1a;
    --secondary-color: #8b6914;
    --accent-color: #d4a017;
    --background: #f5f0e6;
    --card-background: #ffffff;
    --text-color: #333333;
    --text-light: #666666;
    --border-radius: 12px;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, #e8dcc8 100%);
    min-height: 100vh;
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 20px 0;
}

header h1 {
    font-size: 1.5rem;
    color: var(--primary-dark);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cover-section {
    display: flex;
    justify-content: center;
}

.cover-image {
    width: 100%;
    max-width: 300px;
    height: auto;
    object-fit: contain;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.player-section {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.now-playing {
    text-align: center;
    margin-bottom: 15px;
}

.current-chapter-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 5px;
}

#current-chapter-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-dark);
}

audio {
    display: none;
}

.progress-container {
    margin-bottom: 15px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    outline: none;
}

.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progress-bar::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 5px;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.control-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: background-color 0.2s, transform 0.1s;
    color: var(--primary-color);
}

.control-btn:hover {
    background: rgba(45, 90, 39, 0.1);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn svg {
    width: 32px;
    height: 32px;
}

.play-btn {
    background: var(--primary-color);
    color: white;
}

.play-btn:hover {
    background: var(--primary-dark);
}

.play-btn svg {
    width: 40px;
    height: 40px;
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.volume-icon {
    width: 24px;
    height: 24px;
    color: var(--text-light);
}

.volume-slider {
    width: 100px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #e0e0e0;
    border-radius: 3px;
    cursor: pointer;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--secondary-color);
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--secondary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.chapter-section {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.chapter-section h2 {
    font-size: 1.2rem;
    color: var(--primary-dark);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-color);
}

.chapter-list {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
}

.chapter-list li {
    padding: 12px 15px;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chapter-list li:hover {
    background: rgba(45, 90, 39, 0.08);
}

.chapter-list li.active {
    background: rgba(45, 90, 39, 0.15);
    font-weight: 600;
}

.chapter-list li.active::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.chapter-number {
    color: var(--secondary-color);
    font-weight: 600;
    min-width: 30px;
}

.chapter-title {
    color: var(--text-color);
}

.download-section {
    text-align: center;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.download-btn svg {
    width: 24px;
    height: 24px;
}

footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Desktop styles */
@media (min-width: 768px) {
    .container {
        padding: 40px;
    }

    header h1 {
        font-size: 2rem;
    }

    main {
        display: grid;
        grid-template-columns: 300px 1fr;
        grid-template-rows: auto auto auto;
        gap: 30px;
    }

    .cover-section {
        grid-row: 1 / 3;
        align-self: start;
    }

    .cover-image {
        max-width: 100%;
        height: auto;
        object-fit: contain;
        position: sticky;
        top: 20px;
    }

    .player-section {
        grid-column: 2;
    }

    .chapter-section {
        grid-column: 2;
    }

    .download-section {
        grid-column: 1 / -1;
    }

    .chapter-list {
        max-height: 350px;
    }

    #current-chapter-title {
        font-size: 1.25rem;
    }
}

/* Scrollbar styling */
.chapter-list::-webkit-scrollbar {
    width: 8px;
}

.chapter-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chapter-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.chapter-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}
