/* ===========================================
   Narrio — Premium Theme
   Blue → Purple gradient brand
   =========================================== */

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

/* --- Base --- */
body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.15), transparent 60%),
        radial-gradient(circle at bottom right, rgba(139, 92, 246, 0.15), transparent 55%),
        #EEF0FA;
    color: #111827;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 56px;
    overflow-x: hidden;
    position: relative;
}

body > .container {
    margin: auto;
}

/* --- Decorative Background Blobs --- */
.blob {
    position: fixed;
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
    filter: blur(2px);
}

.blob-1 {
    width: 380px;
    height: 380px;
    background: rgba(59, 130, 246, 0.07);
    top: -100px;
    left: -80px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: rgba(139, 92, 246, 0.06);
    bottom: -60px;
    right: -60px;
}

.blob-3 {
    width: 220px;
    height: 220px;
    background: rgba(99, 102, 241, 0.06);
    top: 35%;
    right: -90px;
}

/* --- Top Navigation --- */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 32px;
    background: #FFFFFF;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    z-index: 10000;
}

.top-nav .auth-section {
    width: 100%;
    max-width: 540px;
    justify-content: flex-end;
}

/* --- Card Container --- */
.container {
    background: #FFFFFF;
    border-radius: 30px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    padding: 48px 44px;
    max-width: 580px;
    width: 100%;
    box-shadow:
        0 0 0 1px rgba(59, 130, 246, 0.05),
        0 12px 40px rgba(15, 23, 42, 0.10);
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.5s ease both;
}

/* --- Logo Header --- */
.logo-header {
    text-align: center;
    margin-bottom: 20px;
}

.logo {
    width: 100%;
    max-width: 420px;
    height: auto;
}

/* --- Auth Section (Top Nav) --- */
.auth-section {
    display: flex !important;
    align-items: center;
    gap: 16px;
}

.auth-buttons {
    display: flex !important;
    gap: 16px;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3B82F6, #8B5CF6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: #FFFFFF;
    text-transform: uppercase;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.premium-badge {
    background: linear-gradient(90deg, #8B5CF6, #6D28D9);
    color: #FFFFFF;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-btn-text,
.nav-btn-premium {
    background: none;
    border: none;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    font-family: "Inter", sans-serif;
    transition: opacity 0.15s ease;
    text-decoration: none;
}

.nav-btn-text:hover,
.nav-btn-premium:hover {
    opacity: 0.7;
}

.premium-link {
    color: #8B5CF6;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
}

.premium-link:hover {
    color: #6D28D9;
}

body.modal-open {
    overflow: hidden;
}

/* --- Typography --- */
h1 {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.subtitle {
    text-align: center;
    color: #6B7280;
    font-size: 0.95rem;
    margin-bottom: 10px;
    line-height: 1.55;
    font-weight: 400;
}

.free-tier-note {
    text-align: center;
    font-size: 0.82rem;
    color: #8B5CF6;
    font-weight: 600;
    margin-bottom: 28px;
    line-height: 1.5;
}

/* --- Drop Zone --- */
.drop-zone {
    border: 2px dashed rgba(59, 130, 246, 0.35);
    border-radius: 20px;
    padding: 24px 24px;
    text-align: center;
    cursor: pointer;
    background: rgba(59, 130, 246, 0.03);
    transition: all 0.3s ease;
}

.drop-zone:hover {
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.55);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.10);
}

.drop-zone.dragover {
    background: rgba(59, 130, 246, 0.08);
    border-color: #3B82F6;
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
}

.drop-zone-icon {
    font-size: 2.8rem;
    margin-bottom: 12px;
    line-height: 1;
}

.drop-zone p {
    color: #374151;
    font-size: 0.95rem;
    font-weight: 600;
}

.drop-zone-hint {
    font-size: 0.82rem !important;
    color: #9CA3AF !important;
    margin-top: 6px;
    font-weight: 400 !important;
}

/* --- Segment Checkbox --- */
#segment-option {
    margin-top: 14px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    color: #374151;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(139, 92, 246, 0.04);
    border: 1px solid rgba(139, 92, 246, 0.12);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.checkbox-label:hover {
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.25);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #8B5CF6;
    cursor: pointer;
    flex-shrink: 0;
}

/* --- Segment Type Options (Radio Buttons) --- */
.segment-type-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
    padding: 10px 14px;
    background: rgba(139, 92, 246, 0.03);
    border: 1px solid rgba(139, 92, 246, 0.10);
    border-radius: 12px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
    padding: 6px 4px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.radio-label:hover {
    background: rgba(139, 92, 246, 0.06);
}

.radio-label input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #8B5CF6;
    cursor: pointer;
    flex-shrink: 0;
}

/* --- Manual Segment Section --- */
.manual-segment-header {
    text-align: center;
    margin-bottom: 16px;
}

.manual-segment-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
    line-height: 1.3;
}

.manual-segment-subtitle {
    font-size: 0.85rem;
    color: #6B7280;
    font-weight: 500;
}

.manual-segment-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

.manual-segment-rows::-webkit-scrollbar {
    width: 5px;
}

.manual-segment-rows::-webkit-scrollbar-track {
    background: transparent;
}

.manual-segment-rows::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.2);
    border-radius: 999px;
}

.manual-segment-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
    background: rgba(59, 130, 246, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
}

.segment-name-input,
.segment-page-input {
    width: 100%;
    background: #FFFFFF;
    color: #111827;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.85rem;
    font-family: "Inter", sans-serif;
    font-weight: 500;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.segment-name-input:focus,
.segment-page-input:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.segment-name-input::placeholder,
.segment-page-input::placeholder {
    color: #9CA3AF;
    font-weight: 400;
}

.btn-remove-row {
    background: none;
    border: none;
    color: #9CA3AF;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
    line-height: 1;
}

.btn-remove-row:hover {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.08);
}

/* --- EPUB Segment Section --- */
.epub-segment-header {
    text-align: center;
    margin-bottom: 16px;
}

.epub-segment-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
    line-height: 1.3;
}

.epub-segment-subtitle {
    font-size: 0.85rem;
    color: #6B7280;
    font-weight: 500;
}

.epub-stats-row {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.epub-stat {
    flex: 1;
    text-align: center;
    padding: 14px 10px;
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.10);
    border-radius: 14px;
}

.epub-stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 2px;
}

.epub-stat-label {
    font-size: 0.72rem;
    color: #6B7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.epub-segment-methods {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    background: rgba(139, 92, 246, 0.04);
    border: 1px solid rgba(139, 92, 246, 0.10);
    border-radius: 14px;
}

.epub-segment-suboption {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0 8px 28px;
    font-size: 0.85rem;
    color: #374151;
    font-weight: 500;
}

.epub-segment-suboption label {
    white-space: nowrap;
    font-size: 0.82rem;
    color: #6B7280;
    font-weight: 500;
}

.epub-segment-select {
    background: #FFFFFF;
    color: #111827;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-family: "Inter", sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-width: 0;
    flex: 1;
}

.epub-segment-select:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* --- Confirm Section --- */
#confirm-section {
    text-align: center;
}

#confirm-section h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 14px;
}

.confirm-detail {
    font-size: 0.92rem;
    color: #374151;
    line-height: 1.7;
    margin-bottom: 8px;
    font-weight: 500;
}

.confirm-detail strong {
    color: #111827;
    font-weight: 700;
}

/* --- Feature Chips --- */
.feature-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-top: 36px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #1E3A5F;
    color: #FFFFFF;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    white-space: nowrap;
}

/* --- File Info --- */
.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(59, 130, 246, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: 12px 16px;
    margin-top: 14px;
    font-size: 0.9rem;
    color: #111827;
    font-weight: 600;
}

.file-info .btn-icon {
    background: none;
    border: none;
    color: #9CA3AF;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.2s ease, transform 0.2s ease;
    line-height: 1;
}

.file-info .btn-icon:hover {
    color: #EF4444;
    transform: scale(1.2);
}

/* --- Options --- */
.options {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 22px;
}

.option-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.option-group label {
    font-size: 0.78rem;
    color: #6B7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.option-group select {
    background: #FFFFFF;
    color: #111827;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: 12px 14px;
    font-size: 0.9rem;
    font-family: "Inter", sans-serif;
    font-weight: 500;
    cursor: pointer;
    appearance: auto;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.option-group select:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

/* --- Button Row --- */
.btn-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 22px;
}

.btn-row .btn-secondary,
.btn-row .btn-primary {
    margin-top: 0;
    flex: 1;
    max-width: 240px;
}

/* --- Buttons --- */
.btn-primary {
    display: block;
    width: 100%;
    padding: 16px;
    margin-top: 22px;
    background: linear-gradient(90deg, #2563EB 0%, #4F46E5 50%, #6D28D9 100%);
    color: #FFFFFF;
    border: none;
    border-radius: 999px;
    font-size: 0.95rem;
    font-family: "Inter", sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.25);
    letter-spacing: 0.01em;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(59, 130, 246, 0.35);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0) scale(0.99);
}

.btn-primary:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    display: block;
    width: 100%;
    padding: 14px;
    margin-top: 12px;
    background: #FFFFFF;
    color: #1E2D50;
    border: 1.5px solid #3B82F6;
    border-radius: 999px;
    font-size: 0.95rem;
    font-family: "Inter", sans-serif;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    border-color: #3B82F6;
    color: #3B82F6;
    background: rgba(59, 130, 246, 0.04);
    transform: translateY(-1px);
}

/* --- Progress --- */
.progress-bar-container {
    background: #F1F5F9;
    border-radius: 999px;
    height: 14px;
    overflow: hidden;
    margin-bottom: 14px;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3B82F6, #6366F1, #8B5CF6);
    background-size: 200% 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
    animation: shimmer 2s ease-in-out infinite;
}

.progress-text {
    text-align: center;
    color: #6B7280;
    font-size: 0.9rem;
    font-weight: 500;
}

.progress-prompt {
    text-align: center;
    color: #8B5CF6;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 8px;
    min-height: 1.4em;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.progress-prompt.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Done --- */
.done-icon {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 10px;
    line-height: 1;
    animation: popIn 0.4s ease;
}

.done-text {
    text-align: center;
    font-size: 1.25rem;
    color: #111827;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.done-subtext {
    text-align: center;
    font-size: 0.9rem;
    color: #6B7280;
    margin-bottom: 8px;
}

/* --- Premium Modal Features --- */
.modal-features {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
    text-align: left;
}

.modal-features li {
    font-size: 0.92rem;
    color: #374151;
    padding: 6px 0;
    padding-left: 24px;
    position: relative;
    line-height: 1.5;
}

.modal-features li::before {
    content: "\2714";
    position: absolute;
    left: 0;
    color: #8B5CF6;
    font-weight: 700;
}

.modal-pricing {
    font-size: 1rem;
    color: #6B7280;
    margin-bottom: 20px;
    text-align: center;
}

.modal-pricing strong {
    color: #111827;
    font-size: 1.15rem;
}

.modal-cta-btn {
    display: block;
    width: 100%;
    background: linear-gradient(90deg, #2563EB, #8B5CF6);
    color: #FFFFFF;
    border: none;
    padding: 14px 32px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    font-family: "Inter", sans-serif;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 10px;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.25);
}

.modal-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(59, 130, 246, 0.35);
}

.modal-cta-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.modal-close-link {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: #9CA3AF;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    font-family: "Inter", sans-serif;
    padding: 8px;
    transition: color 0.2s ease;
}

.modal-close-link:hover {
    color: #6B7280;
}

/* --- Premium Trial Page --- */
.premium-trial-header {
    text-align: center;
    margin-bottom: 20px;
}

.premium-trial-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
    line-height: 1;
}

.premium-trial-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 6px;
}

.premium-trial-subtitle {
    font-size: 0.9rem;
    color: #6B7280;
    font-weight: 500;
}

.premium-trial-features {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
    background: rgba(139, 92, 246, 0.04);
    border: 1px solid rgba(139, 92, 246, 0.12);
    border-radius: 16px;
    margin-bottom: 18px;
}

.premium-feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #374151;
    line-height: 1.5;
}

.premium-feature-item strong {
    color: #111827;
}

.premium-feature-check {
    color: #8B5CF6;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.premium-trial-pricing {
    text-align: center;
    font-size: 0.92rem;
    color: #6B7280;
    margin-bottom: 18px;
}

.premium-trial-pricing strong {
    color: #111827;
    font-size: 1.05rem;
}

/* --- Error --- */
.error-icon {
    text-align: center;
    font-size: 2.8rem;
    margin-bottom: 10px;
    line-height: 1;
}

.error-text {
    text-align: center;
    color: #EF4444;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.5;
}

.error-hint {
    text-align: center;
    font-size: 0.85rem;
    color: #6B7280;
    margin-bottom: 8px;
}

/* --- Premium Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: #FFFFFF;
    border-radius: 20px;
    padding: 40px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.3s ease;
    text-align: center;
}

.modal-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
    line-height: 1;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 12px;
    line-height: 1.3;
}

.modal-message {
    font-size: 1rem;
    color: #6B7280;
    line-height: 1.6;
    margin-bottom: 24px;
}

.modal-close-btn {
    background: linear-gradient(90deg, #2563EB, #8B5CF6);
    color: #FFFFFF;
    border: none;
    padding: 14px 32px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    font-family: "Inter", sans-serif;
    transition: transform 0.2s ease;
}

.modal-close-btn:hover {
    transform: translateY(-1px);
}

/* --- Chapter List --- */
.chapters-header {
    text-align: center;
    margin-bottom: 20px;
}

.chapters-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
    line-height: 1.3;
    word-break: break-word;
}

.chapters-count {
    font-size: 0.85rem;
    color: #6B7280;
    font-weight: 500;
}

.chapters-detection-note {
    font-size: 0.8rem;
    color: #F59E0B;
    font-weight: 500;
    margin-top: 6px;
    padding: 8px 12px;
    background: rgba(245, 158, 11, 0.08);
    border-radius: 10px;
    line-height: 1.4;
}

.chapters-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    padding-right: 4px;
}

.chapters-list::-webkit-scrollbar {
    width: 5px;
}

.chapters-list::-webkit-scrollbar-track {
    background: transparent;
}

.chapters-list::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.2);
    border-radius: 999px;
}

.chapter-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(59, 130, 246, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 14px;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.chapter-card:hover {
    background: rgba(59, 130, 246, 0.07);
    border-color: rgba(59, 130, 246, 0.15);
}

.chapter-number {
    flex-shrink: 0;
    padding: 6px 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, #3B82F6, #8B5CF6);
    color: #FFFFFF;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.chapter-number:empty {
    display: none;
}

.chapter-info {
    flex: 1;
    min-width: 0;
}

.chapter-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chapter-meta {
    font-size: 0.75rem;
    color: #9CA3AF;
    margin-top: 2px;
}

.chapter-action {
    flex-shrink: 0;
}

.btn-chapter-convert {
    background: linear-gradient(90deg, #2563EB, #6D28D9);
    color: #FFFFFF;
    border: none;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    font-family: "Inter", sans-serif;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}

.btn-chapter-convert:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-chapter-convert:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-chapter-download {
    background: linear-gradient(90deg, #10B981, #059669);
    color: #FFFFFF;
    border: none;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    font-family: "Inter", sans-serif;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-chapter-download:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.chapter-progress {
    width: 80px;
    height: 6px;
    background: #F1F5F9;
    border-radius: 999px;
    overflow: hidden;
}

.chapter-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3B82F6, #8B5CF6);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.chapter-status-text {
    font-size: 0.7rem;
    color: #6B7280;
    white-space: nowrap;
}

.chapter-action-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-chapter-cancel {
    background: none;
    border: 1px solid #EF4444;
    color: #EF4444;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.btn-chapter-cancel:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-chapter-cancel:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.chapter-error-text {
    font-size: 0.7rem;
    color: #EF4444;
    font-weight: 600;
}

.chapter-cancelled-text {
    font-size: 0.7rem;
    color: #9CA3AF;
    font-weight: 600;
}

/* --- Chapters Button Group --- */
.chapters-btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.chapters-btn-group .btn-primary,
.chapters-btn-group .btn-secondary {
    margin-top: 0;
    padding: 14px;
}

/* --- Progress Controls --- */
.progress-controls {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

.btn-cancel {
    display: inline-block;
    padding: 12px 28px;
    background: #FFFFFF;
    color: #EF4444;
    border: 1.5px solid #EF4444;
    border-radius: 999px;
    font-size: 0.9rem;
    font-family: "Inter", sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel:hover {
    background: rgba(239, 68, 68, 0.06);
    transform: translateY(-1px);
}

.btn-cancel:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* --- Utility --- */
.hidden {
    display: none !important;
}

/* --- Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Responsive --- */
@media (max-width: 600px) {
    body {
        padding-top: 56px;
    }

    .top-nav {
        padding: 0 16px;
        height: 56px;
    }

    .auth-section {
        gap: 12px;
    }

    .auth-buttons {
        gap: 12px;
    }

    .user-avatar {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }

    .user-name {
        font-size: 0.8rem;
    }

    .nav-btn-text,
    .nav-btn-premium {
        font-size: 0.8rem;
    }

    .premium-badge {
        font-size: 0.6rem;
        padding: 2px 6px;
    }

    .container {
        padding: 32px 24px;
        border-radius: 24px;
        margin: 24px auto;
    }

    .modal-content {
        padding: 32px 24px;
        width: 85%;
    }

    .modal-title {
        font-size: 1.25rem;
    }

    .modal-message {
        font-size: 0.9rem;
    }

    .logo {
        max-width: 300px;
    }

    h1 {
        font-size: 1.25rem;
    }

    .drop-zone {
        padding: 36px 18px;
    }

    .feature-chips {
        gap: 6px;
    }

    .chip {
        font-size: 0.75rem;
        padding: 5px 10px;
    }

    .btn-row {
        flex-direction: column;
        align-items: center;
    }

    .btn-row .btn-secondary,
    .btn-row .btn-primary {
        max-width: 100%;
    }

    .options {
        gap: 12px;
    }

    .blob-1 {
        width: 220px;
        height: 220px;
    }

    .blob-2 {
        width: 180px;
        height: 180px;
    }

    .blob-3 {
        display: none;
    }

    .epub-stats-row {
        flex-direction: column;
        gap: 8px;
    }

    .epub-segment-suboption {
        flex-direction: column;
        align-items: flex-start;
        padding-left: 28px;
        gap: 6px;
    }

    .epub-segment-select {
        width: 100%;
    }

    .manual-segment-row {
        grid-template-columns: 1fr;
    }

    .manual-segment-rows {
        max-height: 350px;
    }

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

    .chapter-card {
        gap: 8px;
        padding: 10px 12px;
    }

    .chapter-number {
        padding: 5px 8px;
        font-size: 0.65rem;
    }

    .chapter-title {
        font-size: 0.8rem;
    }
}
