/* --- Variables --- */
:root {
    --primary: #0066cc;
    --primary-dark: #004d99;
    --success: #28a745;
    --error: #dc3545;
    --bg: #f8f9fa;
    --bg-white: #ffffff;
    --text: #333333;
    --text-light: #666666;
    --border: #dee2e6;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --radius: 8px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Navbar --- */
.navbar {
    background: var(--primary);
    color: white;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    height: 56px;
    box-shadow: var(--shadow);
}
.nav-brand a {
    color: white;
    text-decoration: none;
    font-size: 1.4rem;
    font-weight: 700;
    margin-right: 2rem;
}
.nav-links {
    list-style: none;
    display: flex;
    gap: 1rem;
}
.nav-links a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: background 0.2s;
}
.nav-links a:hover, .nav-links a.active {
    color: white;
    background: rgba(255,255,255,0.15);
}

/* --- Nav Auth --- */
.nav-auth {
    margin-left: auto;
}
.nav-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.nav-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}
.nav-username {
    color: rgba(255,255,255,0.9);
    font-size: 0.9rem;
}
.nav-logout-form {
    display: inline;
}
.nav-logout-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: rgba(255,255,255,0.8);
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.nav-logout-btn:hover {
    background: rgba(255,255,255,0.25);
    color: white;
}
.nav-login-btn {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,0.3);
    font-size: 0.9rem;
    transition: background 0.2s;
}
.nav-login-btn:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* --- Layout --- */
.container {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
}
.footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* --- Home --- */
.home { text-align: center; padding-top: 3rem; }
.home h1 { font-size: 3rem; color: var(--primary); margin-bottom: 0.5rem; }
.subtitle { font-size: 1.2rem; color: var(--text-light); margin-bottom: 2rem; }
.feature-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* --- Card --- */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    text-align: left;
}
.card h2 { font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--primary); }
.card p { color: var(--text-light); font-size: 0.95rem; }

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    cursor: pointer;
    background: var(--primary);
    color: white;
    transition: background 0.2s;
    text-decoration: none;
}
.btn:hover { background: var(--primary-dark); }

/* --- Reading Layout --- */
.reading-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
.text-panel {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.analysis-panel {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.analysis-panel h3 { color: var(--primary); margin-bottom: 1rem; }

/* --- Text Controls --- */
.text-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* --- Article Select --- */
#article-select select {
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--bg-white);
    min-width: 300px;
}

/* --- Article Text --- */
.article-body { min-height: 200px; }
.article-title { color: var(--primary); margin-bottom: 1rem; font-size: 1.3rem; }
.placeholder-text { color: var(--text-light); font-style: italic; }
.tokenized-text { line-height: 2; }

/* --- Word Tokens --- */
.word {
    cursor: pointer;
    padding: 2px 1px;
    border-radius: 3px;
    transition: background 0.15s;
}
.word:hover {
    background: #d4edff;
}
.word.selected {
    background: #a8d4ff;
}
.punct { /* punctuation tokens render inline naturally */ }

/* --- Paste Area --- */
.paste-area {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.paste-area textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 0.5rem;
}

/* --- Morphology Table --- */
.morph-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.morph-table th, .morph-table td {
    padding: 0.5rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.morph-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-light);
}
.morph-table .unrecognized {
    color: var(--error);
    font-style: italic;
}
.morph-english {
    color: var(--text-light);
    font-size: 0.85em;
}

/* --- Selected Text --- */
.selected-text {
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: #f0f7ff;
    border-radius: var(--radius);
    font-size: 0.95rem;
}

/* --- Translation --- */
.translation {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f0f7ff;
    border-radius: var(--radius);
}
.translation h4 { color: var(--primary); margin-bottom: 0.5rem; }
.translation p { font-size: 1.1rem; line-height: 1.6; }

/* --- Explanation --- */
.explanation {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.explanation h4 { color: var(--primary); margin-bottom: 0.5rem; }
.explanation p { line-height: 1.7; }

/* --- Error --- */
.error-msg {
    color: var(--error);
    padding: 0.5rem;
    background: #fdf0f0;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
.explanation-error { margin-top: 1rem; }

/* --- Loading --- */
.loading { text-align: center; padding: 2rem; color: var(--text-light); }
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 0.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.htmx-indicator { display: none; color: var(--text-light); font-size: 0.9rem; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }

/* --- Login Page --- */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}
.login-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 400px;
    width: 100%;
}
.login-card h1 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}
.login-subtitle {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}
.login-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: opacity 0.2s;
}
.oauth-btn:hover { opacity: 0.9; }
.oauth-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.oauth-google {
    background: var(--bg-white);
    color: var(--text);
    border: 1px solid var(--border);
}
.oauth-github {
    background: #24292e;
    color: white;
}
.login-notice {
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    color: var(--text-light);
    font-size: 0.9rem;
}
.login-guest {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}
.login-guest a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.9rem;
}
.login-guest a:hover {
    color: var(--primary);
}

/* --- Save Flashcard Button --- */
.btn-save-card {
    margin-top: 1rem;
    background: var(--success);
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}
.btn-save-card:hover { background: #218838; }
.fc-save-success {
    color: var(--success);
    font-weight: 500;
    padding: 0.5rem;
    margin-top: 0.5rem;
}

/* --- Flashcards Page --- */
.flashcards-page { max-width: 1000px; margin: 0 auto; }
.fc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.fc-header h1 { color: var(--primary); font-size: 1.8rem; }
.fc-stats { display: flex; gap: 1rem; }
.fc-stat {
    background: var(--bg-white);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    box-shadow: var(--shadow);
}
.fc-stat-due { color: var(--primary); font-weight: 600; }

/* --- Flashcard Actions Bar --- */
.fc-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.btn-review {
    background: var(--success);
}
.btn-review:hover { background: #218838; }
.fc-add-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.fc-input {
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    min-width: 200px;
}

/* --- Filters --- */
.fc-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.fc-filter-btn {
    background: var(--bg-white);
    border: 1px solid var(--border);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.fc-filter-btn:hover { background: var(--bg); }
.fc-filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* --- Card Table --- */
.fc-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    font-size: 0.9rem;
}
.fc-table th, .fc-table td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.fc-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-light);
}
.fc-finnish { font-weight: 600; }
.fc-class {
    background: var(--bg);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-light);
}
.fc-date { font-size: 0.85rem; color: var(--text-light); }
.fc-empty {
    text-align: center;
    color: var(--text-light);
    font-style: italic;
    padding: 2rem;
}
.fc-focused { background: #fffbeb; }
.fc-actions-cell {
    display: flex;
    gap: 0.3rem;
}
.fc-btn-focus, .fc-btn-delete {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: background 0.2s;
}
.fc-btn-focus { color: var(--border); }
.fc-btn-focus:hover { color: #f59e0b; background: #fffbeb; }
.fc-btn-focus.focused { color: #f59e0b; }
.fc-btn-delete { color: var(--text-light); }
.fc-btn-delete:hover { color: var(--error); background: #fdf0f0; }

/* --- Review Card --- */
.fc-review-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
.fc-review-front { display: block; }
.fc-review-back { display: none; }
.fc-review-card.revealed .fc-review-front button { display: none; }
.fc-review-card.revealed .fc-review-back { display: block; }
.fc-review-word {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
}
.fc-focus-badge {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 1rem;
}
.fc-review-answer { text-align: left; margin-bottom: 1.5rem; }
.fc-review-translation {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}
.fc-review-explanation {
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}
.fc-review-meta {
    font-size: 0.85rem;
    color: var(--text-light);
}
/* --- Focus Button (Review) --- */
.fc-btn-focus-review {
    background: none;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0.4rem 1rem;
    border-radius: var(--radius);
    color: var(--border);
    transition: background 0.2s, color 0.2s;
    margin-bottom: 1rem;
}
.fc-btn-focus-review:hover {
    color: #f59e0b;
    background: #fffbeb;
    border-color: #f59e0b;
}
.fc-btn-focus-review.focused {
    color: #f59e0b;
    border-color: #f59e0b;
    background: #fffbeb;
}

.fc-rating-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}
.fc-rate { padding: 0.5rem 1.2rem; font-size: 0.9rem; }
.fc-rate-again { background: var(--error); }
.fc-rate-again:hover { background: #c82333; }
.fc-rate-hard { background: #e67e22; }
.fc-rate-hard:hover { background: #d35400; }
.fc-rate-good { background: var(--success); }
.fc-rate-good:hover { background: #218838; }
.fc-rate-easy { background: var(--primary); }
.fc-rate-easy:hover { background: var(--primary-dark); }

/* --- Review Done --- */
.fc-review-done {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
}
.fc-review-done h2 { color: var(--success); margin-bottom: 0.5rem; }

/* --- Validate Preview --- */
.fc-validate-preview {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.fc-validate-preview h3 { color: var(--primary); margin-bottom: 0.5rem; }
.fc-validate-preview .morph-table { margin-bottom: 1rem; }
.fc-already-saved {
    color: var(--text-light);
    font-style: italic;
}

/* --- Books Page --- */
.books-page { max-width: 1000px; margin: 0 auto; }
.books-header { margin-bottom: 1.5rem; }
.books-header h1 { color: var(--primary); font-size: 1.8rem; margin-bottom: 0.25rem; }
.books-subtitle { color: var(--text-light); font-size: 0.95rem; }

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}
.book-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.2rem;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.2s, transform 0.1s;
    display: block;
}
.book-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}
.book-card-title {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 0.3rem;
}
.book-card-author {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
}
.book-card-meta {
    font-size: 0.85rem;
    color: var(--text-light);
}
.book-badge-continue {
    display: inline-block;
    margin-top: 0.5rem;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* --- Gutenberg Search --- */
.gutenberg-search {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 1.2rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}
.gutenberg-search h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}
.search-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.search-results-list { margin-top: 0.75rem; }
.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-author { color: var(--text-light); font-size: 0.9rem; }
.search-result-id { color: var(--text-light); font-size: 0.8rem; }
.btn-import {
    background: var(--success);
    font-size: 0.85rem;
    padding: 0.3rem 0.8rem;
}
.btn-import:hover { background: #218838; }

/* --- Book Reader --- */
.book-nav-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.btn-back {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-back:hover { background: var(--border); }
.book-title-bar { flex: 1; }
.book-title-bar .article-title { margin-bottom: 0; font-size: 1.2rem; }
.book-author-label { color: var(--text-light); font-size: 0.9rem; }

.chapter-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}
.chapter-nav-bottom {
    margin-top: 1.5rem;
    margin-bottom: 0;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.btn-chapter-nav {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
}
.btn-chapter-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.chapter-select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg-white);
    min-width: 200px;
}
.chapter-indicator {
    color: var(--text-light);
    font-size: 0.9rem;
}
.chapter-title {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* --- Paragraph & Bookmark --- */
.paragraph {
    margin-bottom: 1em;
    position: relative;
    padding-left: 2rem;
}
.bookmark-btn {
    position: absolute;
    left: 0;
    top: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 0;
    line-height: 1;
}
.paragraph:hover .bookmark-btn {
    opacity: 0.5;
}
.bookmark-btn:hover {
    opacity: 1 !important;
}
.bookmark-btn.saved {
    opacity: 1;
    color: var(--success);
}
.bookmarked {
    border-left: 3px solid var(--primary);
    padding-left: calc(2rem - 3px);
    background: #f0f7ff;
    border-radius: 0 var(--radius) var(--radius) 0;
}

/* --- Quiz Page --- */
.quiz-page { max-width: 1000px; margin: 0 auto; }
.quiz-header { margin-bottom: 1.5rem; }
.quiz-header h1 { color: var(--primary); font-size: 1.8rem; margin-bottom: 0.25rem; }
.quiz-subtitle { color: var(--text-light); font-size: 0.95rem; }

.quiz-types {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.quiz-type-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.2s, transform 0.1s;
    display: block;
}
.quiz-type-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}
.quiz-type-card h2 {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 0.3rem;
}
.quiz-type-card p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0;
}
.quiz-type-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.quiz-type-locked {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}
.quiz-coming-soon {
    display: inline-block;
    margin-top: 0.5rem;
    background: var(--bg);
    color: var(--text-light);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* --- Quiz Session --- */
.quiz-session { max-width: 700px; margin: 0 auto; }
.quiz-session-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.quiz-session-header h2 {
    color: var(--primary);
    font-size: 1.5rem;
}

/* --- Quiz Question --- */
.quiz-question {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    text-align: center;
}
.quiz-progress {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}
.quiz-prompt {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 1rem;
}
.quiz-word {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}
.quiz-hint {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}
.quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.quiz-option-btn {
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    background: var(--bg-white);
    color: var(--text);
    border: 2px solid var(--border);
    transition: border-color 0.2s, background 0.2s;
}
.quiz-option-btn:hover {
    border-color: var(--primary);
    background: #f0f7ff;
}

/* --- Quiz Answer Feedback --- */
.quiz-answer {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    text-align: center;
    border-left: 4px solid var(--border);
}
.quiz-correct { border-left-color: var(--success); }
.quiz-incorrect { border-left-color: var(--error); }
.quiz-feedback-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.quiz-feedback-text {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.quiz-correct .quiz-feedback-text { color: var(--success); }
.quiz-incorrect .quiz-feedback-text { color: var(--error); }
.quiz-feedback-detail {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}
.quiz-next-btn {
    margin-top: 1rem;
}

/* --- Quiz Results --- */
.quiz-results-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    text-align: center;
}
.quiz-results-card h2 {
    color: var(--primary);
    margin-bottom: 1rem;
}
.quiz-score-num {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}
.quiz-score-pct {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}
.quiz-score-message {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 1.5rem;
}
.quiz-results-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* --- Quiz Recent Results --- */
.quiz-recent {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}
.quiz-recent h3 {
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}
.quiz-results-recent {
    margin-top: 1.5rem;
    text-align: left;
}
.quiz-results-recent h3 {
    color: var(--text);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}
.quiz-recent-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.quiz-recent-table th, .quiz-recent-table td {
    padding: 0.5rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.quiz-recent-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-light);
}
.quiz-recent-date {
    color: var(--text-light);
    font-size: 0.85rem;
}

/* --- Quiz Error --- */
.quiz-error {
    text-align: center;
    padding: 2rem;
}
.quiz-error .error-msg {
    margin-bottom: 1rem;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .reading-layout {
        grid-template-columns: 1fr;
    }
    .analysis-panel {
        position: static;
        max-height: none;
    }
    .fc-header { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
    .fc-actions { flex-direction: column; align-items: stretch; }
    .fc-rating-buttons { flex-wrap: wrap; }
    .book-grid { grid-template-columns: 1fr; }
    .book-nav-bar { flex-direction: column; align-items: flex-start; }
    .chapter-nav { flex-wrap: wrap; }
    .quiz-types { grid-template-columns: 1fr; }
    .quiz-options { grid-template-columns: 1fr; }
    .quiz-session-header { flex-direction: column; align-items: flex-start; }
    .quiz-results-actions { flex-direction: column; }
}
