body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f4f6f8;
    margin: 0;
}

header {
    background-color: #1e3a8a;
    color: white;
    padding: 20px;
    text-align: center;
}

/* GRID */
.grid {
    max-width: 1100px;
    margin: auto;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

/* CARD */
.card {
    background-color: white;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    transition: transform 0.2s;
}

.card:hover {
    transform: scale(1.05);
}

.card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
}

.card h3 {
    padding: 10px;
    color: #1e3a8a;
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 20px;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 10px;
    text-align: center;
}

.modal-content img {
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 6px;
    margin: 10px 0;
}

.close {
    font-size: 24px;
    float: right;
    cursor: pointer;
}

/* FORMULA CARDS */
.formula-section {
    max-width: 1100px;
    margin: auto;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 20px;
}

.formula-section h2 {
    grid-column: 1 / -1;
    text-align: center;
    color: #1e3a8a;
    margin-bottom: 10px;
}

.formula-card {
    background-color: white;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    text-align: center;
}

.formula-card h3 {
    color: #1e3a8a;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.formula-card .formula {
    font-size: 1.8rem;
    color: #333;
    background-color: #f0f4ff;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-family: 'Times New Roman', serif;
}

.formula-card .variables {
    text-align: left;
    margin-top: 15px;
    padding: 10px;
    background-color: #fafafa;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #444;
}

.formula-card .variables strong {
    color: #1e3a8a;
}

footer {
    text-align: center;
    padding: 15px;
    background-color: #e5e7eb;
}

/* QUIZ STYLES */
.quiz-btn {
    background-color: #22c55e;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 15px;
    transition: background-color 0.2s, transform 0.2s;
}

.quiz-btn:hover {
    background-color: #16a34a;
    transform: scale(1.05);
}

.quiz-modal {
    max-width: 600px;
    text-align: left;
}

.quiz-modal h2 {
    color: #1e3a8a;
    text-align: center;
    margin-bottom: 20px;
}

.quiz-modal h3 {
    color: #333;
    margin-bottom: 20px;
}

.quiz-modal h3 strong {
    color: #1e3a8a;
}

#quizProgress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f0f4ff;
    border-radius: 6px;
}

.quiz-progress {
    font-weight: bold;
    color: #1e3a8a;
}

.quiz-score {
    color: #22c55e;
    font-weight: bold;
}

.quiz-option {
    display: block;
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    background-color: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.quiz-option:hover:not(.disabled) {
    background-color: #e0e7ff;
    border-color: #1e3a8a;
}

.quiz-option.disabled {
    cursor: not-allowed;
}

.quiz-option.correct {
    background-color: #dcfce7;
    border-color: #22c55e;
    color: #166534;
}

.quiz-option.incorrect {
    background-color: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

#quizFeedback {
    text-align: center;
    margin: 15px 0;
}

.feedback {
    font-size: 1.2rem;
    font-weight: bold;
    padding: 10px;
    border-radius: 6px;
}

.feedback.correct {
    color: #166534;
    background-color: #dcfce7;
}

.feedback.incorrect {
    color: #991b1b;
    background-color: #fee2e2;
}

.quiz-next-btn {
    display: block;
    margin: 20px auto 0;
    padding: 12px 30px;
    background-color: #1e3a8a;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.quiz-next-btn:hover {
    background-color: #1e40af;
}

.quiz-close-btn {
    display: inline-block;
    margin: 20px 10px 0;
    padding: 12px 30px;
    background-color: #6b7280;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.quiz-close-btn:hover {
    background-color: #4b5563;
}

#quizResults {
    text-align: center;
}

.score-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin: 30px 0;
}

.score-number {
    font-size: 3rem;
    font-weight: bold;
    color: #1e3a8a;
}

.score-percent {
    font-size: 2.5rem;
    color: #22c55e;
    font-weight: bold;
}

.score-message {
    font-size: 1.2rem;
    color: #333;
    margin: 20px 0;
}