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

body {
    font-family: 'Lora', 'Georgia', serif;
    background: linear-gradient(135deg, #065f46, #0f766e);
    min-height: 100vh;
    padding: 5rem 2rem 2rem;
}

/* ===== TOPBAR ===== */
#kviz-topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
    height: 44px;
    background: rgba(4, 47, 35, 0.97);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 0 1.2rem;
    font-family: 'Lora', 'Georgia', serif;
    font-size: 0.82rem;
}
#kviz-topbar .tb-left {
    display: flex; align-items: center; gap: 0.4rem;
    color: rgba(255,255,255,0.7);
    min-width: 0; overflow: hidden;
}
#kviz-topbar .tb-left a {
    color: #fbbf24; text-decoration: none;
    font-weight: 600; white-space: nowrap;
}
#kviz-topbar .tb-left a:hover { text-decoration: underline; }
#kviz-topbar .tb-sep { margin: 0 2px; opacity: 0.5; }
#kviz-topbar .tb-current {
    color: rgba(255,255,255,0.85); font-weight: 600;
    white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; max-width: 220px;
}
#kviz-topbar .tb-right {
    display: flex; align-items: center;
    gap: 0.5rem; flex-shrink: 0; margin-left: 1rem;
    color: rgba(255,255,255,0.85);
}
#kviz-topbar .tb-name { color: #fbbf24; font-weight: 700; white-space: nowrap; }
#kviz-topbar .tb-score {
    color: #92400e;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border: 1px solid #f59e0b;
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}
#kviz-topbar .tb-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.85);
    padding: 3px 12px; border-radius: 20px;
    font-size: 0.78rem; cursor: pointer;
    text-decoration: none; transition: all 0.2s;
    font-family: inherit; white-space: nowrap;
}
#kviz-topbar .tb-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
#kviz-topbar .tb-btn.gold { border-color: #fbbf24; color: #fbbf24; }
#kviz-topbar .tb-btn.gold:hover { background: rgba(251,191,36,0.15); }
@media (max-width: 500px) {
    #kviz-topbar .tb-current { max-width: 110px; }
    #kviz-topbar .tb-btn { padding: 3px 8px; }
}

.book-container,
.quiz-container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 25px;
    padding: 3rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.quiz-container {
    max-width: 800px;
}

.book-header,
.quiz-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 3px solid #e5e7eb;
}

.book-title {
    font-size: 2.5rem;
    color: #065f46;
    margin-bottom: 1rem;
}

.quiz-title {
    font-size: 2rem;
    color: #065f46;
    margin-bottom: 0.5rem;
}

.quiz-subtitle {
    color: #6b7280;
    font-size: 1.1rem;
}

.book-meta {
    display: flex;
    gap: 2rem;
    justify-content: center;
    color: #6b7280;
    font-size: 0.95rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.progress-bar {
    background: #e5e7eb;
    height: 12px;
    border-radius: 10px;
    overflow: hidden;
    margin: 2rem 0;
}

.progress-fill {
    background: linear-gradient(90deg, #059669, #10b981);
    height: 100%;
    transition: width 0.3s;
}

.progress-text {
    text-align: center;
    color: #6b7280;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.book-content {
    line-height: 1.8;
    font-size: 1.1rem;
    color: #374151;
}

.book-content h2 {
    color: #065f46;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.book-content h3 {
    color: #047857;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    font-size: 1.3rem;
}

.book-content p {
    margin-bottom: 1.2rem;
}

.highlight {
    background: #fef3c7;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
}

.important {
    border-left: 4px solid #fbbf24;
    margin: 1.5rem 0;
    background: #fef3c7;
    padding: 1rem 1rem 1rem 1.5rem;
    border-radius: 5px;
}

.page-number {
    text-align: center;
    color: #9ca3af;
    font-size: 0.9rem;
    margin: 2rem 0;
}

.navigation,
.nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 3px solid #e5e7eb;
}

.nav-buttons {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.nav-btn,
.btn {
    padding: 1rem 2rem;
    border-radius: 15px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    font-size: 1rem;
}

.nav-btn {
    background: white;
    border: 2px solid #059669;
    color: #065f46;
}

.nav-btn:hover {
    background: #059669;
    color: white;
    transform: translateY(-3px);
}

.nav-btn:disabled,
.btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.finish-btn,
.btn-primary {
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
    border: none;
}

.finish-btn {
    width: 100%;
    padding: 1.5rem;
    border-radius: 20px;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 2rem;
    transition: all 0.3s;
    box-shadow: 0 10px 30px rgba(5, 150, 105, 0.3);
}

.finish-btn:hover,
.btn-primary:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(5, 150, 105, 0.35);
}

.btn-secondary {
    background: white;
    border: 2px solid #e5e7eb;
    color: #374151;
}

.timer {
    background: #fef3c7;
    border: 2px solid #fbbf24;
    border-radius: 15px;
    padding: 1rem;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #92400e;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f3f4f6;
    border-radius: 10px;
}

.question-card {
    background: #f9fafb;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.question-number {
    color: #059669;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.question-text {
    font-size: 1.3rem;
    color: #1f2937;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.answers {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.answer-btn {
    padding: 1.2rem 1.5rem;
    background: white;
    border: 3px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    font-size: 1.05rem;
    color: #374151;
    font-weight: 500;
}

.answer-btn:hover {
    border-color: #059669;
    background: #ecfdf5;
    transform: translateX(5px);
}

.answer-btn.selected {
    border-color: #059669;
    background: #ecfdf5;
}

.answer-btn.correct {
    border-color: #10b981;
    background: #d1fae5;
}

.answer-btn.wrong {
    border-color: #ef4444;
    background: #fee2e2;
}

.results-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 999;
    align-items: center;
    justify-content: center;
}

.results-content {
    background: white;
    border-radius: 25px;
    padding: 3rem;
    max-width: 600px;
    text-align: center;
}

.results-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.results-title {
    font-size: 2.5rem;
    color: #065f46;
    margin-bottom: 1rem;
}

.results-score {
    font-size: 4rem;
    font-weight: 700;
    color: #059669;
    margin: 1rem 0;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.stat-box {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #059669;
}

.stat-label {
    color: #6b7280;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.badges {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 2rem 0;
}

.badge {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    padding: 0.8rem 1.5rem;
    border-radius: 20px;
    font-weight: 700;
    color: #78350f;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .book-container,
    .quiz-container,
    .results-content {
        padding: 2rem 1.5rem;
    }

    .book-title {
        font-size: 1.8rem;
    }

    .quiz-title {
        font-size: 1.6rem;
    }

    .navigation,
    .nav-buttons,
    .progress-info {
        flex-direction: column;
    }

    .results-stats {
        grid-template-columns: 1fr;
    }
}

