/* Chapter Select Panel */
#chapter-select-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    overflow-y: auto;
    z-index: 1000;
}

#chapter-select-panel.hidden {
    display: none;
}

.chapter-select-header {
    text-align: center;
    margin-bottom: 40px;
}

.chapter-select-header h1 {
    font-size: 2.5rem;
    color: #63b3ed;
    margin-bottom: 10px;
}

.chapter-select-header p {
    color: #a0aec0;
    font-size: 1.1rem;
}

/* Chapter Grid */
.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1400px;
    padding-bottom: 40px;
}

/* Chapter Card */
.chapter-card {
    background: #2d3748;
    border: 2px solid #4a5568;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chapter-card:hover {
    border-color: #63b3ed;
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(99, 179, 237, 0.2);
}

.chapter-card-index {
    font-size: 0.85rem;
    color: #718096;
    margin-bottom: 8px;
}

.chapter-card-name {
    font-size: 1rem;
    color: #e2e8f0;
    line-height: 1.5;
}

/* Loading Overlay */
#chapter-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 32, 44, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

#chapter-loading.hidden {
    display: none;
}

#chapter-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #4a5568;
    border-top-color: #63b3ed;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#chapter-loading p {
    margin-top: 20px;
    color: #a0aec0;
    font-size: 1.1rem;
}

/* Back Button */
#back-to-chapters {
    background: #4a5568;
    color: #e2e8f0;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

#back-to-chapters:hover {
    background: #718096;
}
