/**
 * L.F.QUEL - WebNovels
 * Estilos globais - Dark Theme
 * 
 * MELHORIAS:
 * - Fonte unificada (sem Courier New no input de ticket, sem drop-cap)
 * - Navegacao de capitulos (painel lateral slide-in)
 * - Colagem mobile mais acessivel
 * - Tipografia consistente no painel de leitura
 */

/* Reset & Base */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0a0a0f;
    color: #d4d4d8;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Views */
.view { display: none; min-height: 100vh; }
.view.active { display: block; }

/* ---- LANDING PAGE ---- */
.landing-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
}

.landing-hero {
    text-align: center;
    max-width: 700px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.hero-glow {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(124,58,237,0.15) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.hero-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.5px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(124,58,237,0.35);
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    background: linear-gradient(135deg, #a78bfa, #7c3aed, #c4b5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
    letter-spacing: 2px;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: #a78bfa;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.hero-desc {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 40px;
}

/* Ticket Input — fonte unificada, sem Courier New */
.ticket-input-area {
    max-width: 520px;
    margin: 0 auto 60px;
}

.ticket-input-row {
    display: flex;
    gap: 0;
}

.ticket-input-row .ticket-input-wrapper {
    flex: 1;
    border-radius: 14px 0 0 14px;
}

.ticket-input-row .btn-paste {
    border-radius: 0;
    border-left: none;
}

.ticket-input-row .btn-primary {
    border-radius: 0 13px 13px 0;
}

.ticket-input-wrapper {
    display: flex;
    gap: 0;
    background: #16162a;
    border: 1px solid #2a2a4a;
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.3s;
}

.ticket-input-wrapper:focus-within {
    border-color: #a78bfa;
    box-shadow: 0 0 0 4px rgba(167,139,250,0.1);
}

/* MELHORIA (b): Fonte unificada — mesmo font-family do body */
.ticket-input-wrapper input {
    flex: 1;
    padding: 16px 20px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.05rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    outline: none;
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

.ticket-input-wrapper input::placeholder {
    color: #555;
    letter-spacing: 0.5px;
    text-transform: none;
    font-size: 0.95rem;
}

.btn-primary {
    padding: 16px 28px;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    border: none;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    border-radius: 0 13px 13px 0;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-paste {
    padding: 16px 20px;
    background: rgba(167,139,250,0.15);
    border: 1px solid #3a3a5a;
    color: #a78bfa;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-paste:hover { background: rgba(167,139,250,0.25); }
.btn-paste:active { transform: scale(0.97); }

/* MELHORIA (c): Em mobile, botao de colar maior e mais visivel */
@media (max-width: 768px) {
    .btn-paste {
        padding: 14px 20px;
        font-size: 1rem;
        flex: 1;
    }
}

.align-btn {
    padding: 6px 12px;
    background: rgba(167,139,250,0.1);
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.align-btn:hover, .align-btn.active {
    background: rgba(167,139,250,0.2);
    color: #a78bfa;
    border-color: #a78bfa;
}

.error-text {
    color: #f87171;
    font-size: 0.85rem;
    margin-top: 12px;
    text-align: center;
}

/* Info Cards */
.info-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 60px;
}

.info-card {
    background: rgba(22, 22, 42, 0.6);
    border: 1px solid #222244;
    border-radius: 16px;
    padding: 28px 20px;
    transition: all 0.3s;
}

.info-card:hover {
    border-color: #3a3a5a;
    transform: translateY(-2px);
}

.info-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.info-card h3 {
    font-size: 0.95rem;
    color: #e0e0e0;
    margin-bottom: 6px;
    font-weight: 600;
}

.info-card p {
    font-size: 0.82rem;
    color: #777;
    line-height: 1.5;
}

/* Footer */
.landing-footer {
    text-align: center;
    color: #444;
    font-size: 0.8rem;
    padding-top: 20px;
}

.landing-footer a {
    color: #666;
    text-decoration: none;
    margin-left: 16px;
}

.landing-footer a:hover { color: #a78bfa; }

/* ---- TERMS PAGE ---- */
.terms-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 60px 20px;
}

.terms-container h2 {
    font-size: 1.8rem;
    color: #a78bfa;
    margin-bottom: 32px;
    text-align: center;
}

.terms-content {
    background: #16162a;
    border: 1px solid #222244;
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 24px;
}

.terms-content h3 {
    font-size: 1rem;
    color: #c4b5fd;
    margin: 24px 0 12px;
}

.terms-content h3:first-child { margin-top: 0; }

.terms-content p {
    font-size: 0.9rem;
    color: #999;
    line-height: 1.7;
    margin-bottom: 8px;
}

/* ---- READING VIEW ---- */
.reading-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid #1a1a2e;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reading-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.novel-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #a78bfa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.chapter-indicator {
    font-size: 0.8rem;
    color: #666;
    white-space: nowrap;
}

.reading-progress {
    font-size: 0.85rem;
    color: #a78bfa;
    font-weight: 600;
    white-space: nowrap;
}

/* Reading Content */
.reading-content {
    max-width: 750px;
    margin: 0 auto;
    padding: 40px 28px 120px;
}

.chapter-block {
    margin-bottom: 0;
}

.chapter-block + .chapter-block {
    padding-top: 60px;
    border-top: 1px solid #1a1a2e;
}

.chapter-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #e0e0e0;
    margin-bottom: 36px;
    padding-bottom: 18px;
    border-bottom: 2px solid #2a2a4a;
    text-align: center;
    letter-spacing: 0.3px;
}

/* MELHORIA (b): Corpo do capitulo com fonte unificada e consistente */
.chapter-body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1.15rem;
    line-height: 2;
    color: #c8c8d0;
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
}

.chapter-body p {
    margin-bottom: 1.4em;
    text-indent: 2.5em;
}

.chapter-body p:first-child {
    text-indent: 0;
}

/* MELHORIA (b): REMOVIDO o drop-cap (::first-letter estilizado)
   Agora todos os paragrafos tem a mesma aparencia uniforme. */

.chapter-meta {
    text-align: right;
    color: #444;
    font-size: 0.75rem;
    margin-top: 28px;
    padding-top: 14px;
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    color: #555;
    font-size: 0.85rem;
    gap: 16px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #222;
    border-top-color: #a78bfa;
    border-radius: 50%;
    animation: lfqspin 0.8s linear infinite;
}

@keyframes lfqspin {
    to { transform: rotate(360deg); }
}

/* Reading Complete */
.reading-complete {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.complete-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
    margin-bottom: 24px;
}

.reading-complete h2 {
    font-size: 1.5rem;
    color: #e0e0e0;
    margin-bottom: 8px;
}

.reading-complete p {
    color: #666;
    margin-bottom: 32px;
}

.reading-complete .btn-primary {
    border-radius: 10px;
    padding: 14px 36px;
}

/* ---- CHAPTER NAVIGATION PANEL ---- */
.chapter-nav-toggle {
    padding: 6px 12px;
    background: rgba(167,139,250,0.1);
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.chapter-nav-toggle:hover,
.chapter-nav-toggle.active {
    background: rgba(167,139,250,0.2);
    color: #a78bfa;
    border-color: #a78bfa;
}

.chapter-nav-panel {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    max-width: 85vw;
    height: 100vh;
    background: rgba(12, 12, 20, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-left: 1px solid #2a2a4a;
    z-index: 200;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.chapter-nav-panel.open {
    right: 0;
}

.chapter-nav-header {
    padding: 16px 20px;
    border-bottom: 1px solid #1a1a2e;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chapter-nav-header h3 {
    font-size: 1rem;
    color: #a78bfa;
    font-weight: 600;
}

.chapter-nav-close {
    background: none;
    border: none;
    color: #666;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.chapter-nav-close:hover { color: #fff; }

.chapter-nav-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
}

.chapter-nav-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 20px;
    background: none;
    border: none;
    color: #888;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.4;
    border-left: 3px solid transparent;
}

.chapter-nav-item:hover {
    background: rgba(167,139,250,0.08);
    color: #ccc;
}

.chapter-nav-item.current {
    color: #a78bfa;
    background: rgba(167,139,250,0.12);
    font-weight: 600;
    border-left-color: #a78bfa;
}

.chapter-nav-item .ch-num {
    display: inline-block;
    width: 36px;
    color: #555;
    font-size: 0.8rem;
}

.chapter-nav-item.current .ch-num {
    color: #a78bfa;
}

.chapter-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
}

.chapter-nav-overlay.open {
    display: block;
}

/* ---- WATERMARK ---- */
.watermark {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

/* MELHORIA (b): Fonte unificada no watermark tambem */
.watermark span {
    position: absolute;
    font-size: 0.7rem;
    color: rgba(167, 139, 250, 0.06);
    white-space: nowrap;
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: 2px;
    user-select: none;
}

/* ---- PROTECTION LAYER ---- */
.protection-layer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: transparent;
    pointer-events: none;
}

/* ---- PRINT BLOCK ---- */
@media print {
    body { display: none !important; }
    * { display: none !important; }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .info-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .info-card {
        display: flex;
        align-items: center;
        gap: 16px;
        padding: 20px;
        text-align: left;
    }
    
    .info-icon { font-size: 1.5rem; margin-bottom: 0; }
    .info-card h3 { margin-bottom: 2px; font-size: 0.9rem; }
    .info-card p { font-size: 0.8rem; }
    
    .reading-header {
        padding: 10px 16px;
    }
    
    .novel-title {
        max-width: 160px;
        font-size: 0.82rem;
    }
    
    .reading-content {
        padding: 24px 18px 80px;
    }
    
    .chapter-title {
        font-size: 1.3rem;
        text-align: left;
    }
    
    /* MELHORIA (b): Mobile com texto a esquerda, sem hifenizacao */
    .chapter-body {
        font-size: 1.05rem;
        line-height: 1.85;
        text-align: left;
        hyphens: none;
        -webkit-hyphens: none;
    }
    
    .chapter-body p {
        text-indent: 1.5em;
    }
    
    .ticket-input-row {
        flex-direction: column;
    }

    .ticket-input-row .ticket-input-wrapper {
        border-radius: 14px 14px 0 0;
    }

    .ticket-input-row .btn-paste {
        border-radius: 0;
        border-left: 1px solid #2a2a4a;
        border-bottom: 1px solid #2a2a4a;
        padding: 14px;
    }

    .ticket-input-row .btn-primary {
        border-radius: 0 0 13px 13px;
        padding: 14px;
    }

    .btn-paste { padding: 14px; }
    .hero-desc { margin-bottom: 32px; }
    .ticket-input-area { margin-bottom: 40px; }
    .align-btn { padding: 5px 8px; font-size: 11px; }
    .chapter-indicator { display: none; }

    /* Chapter nav — full width em mobile */
    .chapter-nav-panel {
        width: 100%;
        max-width: 100vw;
        right: -100%;
    }

    .chapter-nav-toggle {
        font-size: 11px;
        padding: 5px 8px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .info-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
    
    .reading-content {
        max-width: 650px;
    }
}