* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }

:root {
    --primary: #667eea;
    --primary-dark: #556cd6;
    --secondary: #764ba2;
    --success: #48bb78;
    --warning: #f6ad55;
    --danger: #f56565;
    --bg-light: #f5f5f5;
    --bg-card: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border: #e2e8f0;
    --shadow: 0 10px 30px rgba(0,0,0,0.1);
}

[data-theme="dark"] {
    --bg-light: #1a202c;
    --bg-card: #2d3748;
    --text-primary: #f7fafc;
    --text-secondary: #a0aec0;
    --border: #4a5568;
    --shadow: 0 10px 30px rgba(0,0,0,0.3);
}

body {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    transition: background 0.3s;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 25px 30px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: var(--text-primary);
    font-size: 2rem;
    margin-bottom: 5px;
}

.header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.theme-toggle {
    background: var(--border);
    border: none;
    padding: 10px 15px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.theme-toggle:hover {
    background: var(--primary);
    color: white;
}

/* Main Content */
.main-content { flex: 1; }
.view { display: none; }
.view.active { display: block; }

/* Welcome Section */
.welcome-section {
    text-align: center;
    margin-bottom: 30px;
}

.welcome-section h2 {
    color: white;
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.welcome-section p {
    color: rgba(255,255,255,0.9);
}

/* Study Tips */
.study-tips {
    margin-bottom: 25px;
}

.tip-card {
    background: rgba(255,255,255,0.95);
    border-radius: 12px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow);
}

.tip-icon { font-size: 1.5rem; }
.tip-card p { color: var(--text-primary); margin: 0; }

/* Subjects Grid */
.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.subject-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.subject-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.subject-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.subject-icon { font-size: 2.5rem; margin-bottom: 12px; }
.subject-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    margin: 10px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--primary));
    transition: width 0.3s;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.mock-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.mock-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 5px 20px rgba(245, 87, 108, 0.4);
}

.works-offline {
    color: var(--success);
    font-size: 0.8rem;
    margin-top: 8px;
    font-weight: 500;
}

/* Progress Summary */
.progress-summary {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.progress-summary h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.progress-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.progress-item:last-child { border-bottom: none; }
.progress-item-name { font-weight: 500; color: var(--text-primary); }
.progress-item-value { color: var(--text-secondary); font-size: 0.9rem; }

/* Quiz View */
.quiz-header {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px 25px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.back-btn {
    background: var(--border);
    color: var(--text-primary);
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.back-btn:hover { background: var(--primary); color: white; }

.quiz-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.timer {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quiz-container {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.question-card { margin-bottom: 25px; }

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.question-number {
    font-weight: 700;
    color: var(--primary);
    font-size: 1rem;
}

.question-count {
    color: var(--text-secondary);
    font-weight: 500;
}

.bookmark-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    transition: all 0.3s;
}

.bookmark-btn.active { color: var(--warning); }
.bookmark-btn:hover { transform: scale(1.2); }

.question-text {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 20px;
    line-height: 1.6;
    font-weight: 500;
}

.options-container { display: flex; flex-direction: column; gap: 10px; }

.option-item {
    background: var(--border);
    border: 2px solid transparent;
    padding: 15px 18px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.option-item:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.1);
}

.option-item.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.option-letter {
    font-weight: 700;
    min-width: 28px;
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 6px;
}

/* Quiz Controls */
.quiz-controls {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    flex-wrap: wrap;
}

.btn {
    padding: 13px 25px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover { background: var(--primary); color: white; }

.btn-success {
    background: linear-gradient(135deg, var(--success), #38a169);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(72, 187, 120, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

/* Results View */
.results-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: var(--shadow);
    max-width: 500px;
    margin: 0 auto;
}

.results-icon { font-size: 4rem; margin-bottom: 15px; }
.results-card h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.results-subject {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 25px;
}

.score-display { margin: 25px 0; }

.score-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.score-number {
    font-size: 2.8rem;
    font-weight: 700;
    color: white;
}

.score-label {
    color: rgba(255,255,255,0.9);
    font-size: 1rem;
    margin-top: 3px;
}

.score-message {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 25px;
    font-weight: 500;
}

.results-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Review View */
.review-header {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px 25px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.review-header h3 {
    color: var(--text-primary);
    margin: 10px 0;
    font-size: 1.3rem;
}

.review-stats {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
}

.stat.correct { color: var(--success); }
.stat.wrong { color: var(--danger); }

.review-container {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.review-item {
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 10px;
    border-left: 4px solid var(--border);
}

.review-item.correct {
    background: rgba(72, 187, 120, 0.1);
    border-left-color: var(--success);
}

.review-item.wrong {
    background: rgba(245, 101, 101, 0.1);
    border-left-color: var(--danger);
}

.review-question {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1rem;
}

.review-answer {
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.review-answer.user { color: var(--text-secondary); }
.review-answer.correct { color: var(--success); font-weight: 600; }

.review-explanation {
    background: rgba(102, 126, 234, 0.1);
    padding: 10px 15px;
    border-radius: 8px;
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.review-explanation strong { color: var(--primary); }

.review-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* History View */
.history-header {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px 25px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.history-header h3 {
    color: var(--text-primary);
    margin: 10px 0;
}

.history-container {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 12px;
    background: var(--border);
    border-radius: 10px;
}

.history-subject { font-weight: 600; color: var(--text-primary); }
.history-score { font-weight: 700; color: var(--primary); }
.history-date { font-size: 0.85rem; color: var(--text-secondary); }

/* Footer */
.footer {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    margin-top: 25px;
    box-shadow: var(--shadow);
}

.footer p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.disclaimer {
    color: var(--text-secondary);
    font-size: 0.8rem;
    opacity: 0.8;
}

.footer-links {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 10px;
}

.footer-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 5px 10px;
    border-radius: 6px;
    transition: all 0.3s;
}

.footer-link:hover {
    background: var(--primary);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .header h1 { font-size: 1.6rem; }
    
    .subjects-grid {
        grid-template-columns: 1fr;
    }
    
    .quiz-header {
        flex-direction: column;
        text-align: center;
    }
    
    .quiz-title { font-size: 1.1rem; }
    
    .question-text { font-size: 1rem; }
    
    .quiz-controls {
        flex-direction: column;
    }
    
    .btn { width: 100%; }
    
    .score-circle {
        width: 130px;
        height: 130px;
    }
    
    .score-number { font-size: 2.2rem; }
    
    .results-card { padding: 30px 20px; }
    
    .review-stats {
        justify-content: center;
    }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--border); }
::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--secondary); }