/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #64748b;
    --success: #10b981;
    --error: #ef4444;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Navigation */
.nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-link {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--bg);
    color: var(--text);
}

.nav-link.active {
    background: var(--primary);
    color: white;
}

/* Screens */
.screen {
    display: block;
}

.screen.hidden,
.hidden {
    display: none !important;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Welcome Screen */
.welcome-card {
    max-width: 450px;
    margin: 4rem auto;
    text-align: center;
}

.welcome-card h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.welcome-card p {
    color: var(--text-light);
    margin-bottom: 2rem;
}

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

/* User Bar */
.user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--surface);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.date-title {
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Passage List */
.passage-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.passage-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.passage-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.passage-card.completed {
    border-color: var(--success);
}

.passage-card h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.passage-card p {
    font-size: 0.875rem;
    color: var(--text-light);
}

.passage-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.passage-status.completed {
    color: var(--success);
}

.passage-status.pending {
    color: var(--text-light);
}

/* Practice Screen */
.back-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    padding: 0;
}

.back-btn:hover {
    color: var(--text);
}

.passage-content {
    background: var(--surface);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.passage-content h2 {
    margin-bottom: 1rem;
}

.passage-text {
    text-align: justify;
    line-height: 1.8;
}

/* Quiz Form */
.quiz-form {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.question {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.question:last-of-type {
    border-bottom: none;
}

.question-text {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.option:hover {
    border-color: var(--primary);
    background: var(--bg);
}

.option input[type="radio"] {
    margin-right: 0.75rem;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-large {
    width: 100%;
    padding: 1rem;
    font-size: 1.125rem;
}

/* Results Screen */
.results-header {
    text-align: center;
    margin-bottom: 2rem;
}

.results-score {
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 700;
}

.results-container {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.result-question {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.result-question:last-child {
    border-bottom: none;
}

.result-question-text {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.result-answer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.result-answer.correct {
    color: var(--success);
}

.result-answer.incorrect {
    color: var(--error);
}

.result-correct-answer {
    color: var(--success);
    font-weight: 600;
}

.result-explanation {
    background: var(--bg);
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.results-actions {
    display: flex;
    gap: 1rem;
}

.results-actions button {
    flex: 1;
}

/* Leaderboard */
.leaderboard-list {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.leaderboard-entry:last-child {
    border-bottom: none;
}

.leaderboard-rank {
    font-weight: 700;
    width: 40px;
    color: var(--primary);
}

.leaderboard-name {
    flex: 1;
    font-weight: 600;
}

.leaderboard-score {
    font-weight: 700;
    color: var(--success);
}

.leaderboard-empty {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
}

/* Form Inputs */
input[type="text"] {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Responsive */
@media (max-width: 600px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .results-actions {
        flex-direction: column;
    }

    .passage-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .passage-content {
        padding: 1.5rem;
    }
}
