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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f4f8;
    color: #2d3748;
    min-height: 100vh;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== HOME PAGE ===== */
.home-container {
    text-align: center;
    padding-top: 40px;
}

.home-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #4299e1, #3182ce);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: white;
    margin: 0 auto 20px;
}

h1 {
    font-size: 32px;
    color: #1a365d;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 18px;
    color: #718096;
    margin-bottom: 30px;
}

.info-cards {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.info-card {
    background: white;
    border-radius: 12px;
    padding: 20px 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    min-width: 160px;
}

.info-label {
    display: block;
    font-size: 12px;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.info-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: #2b6cb0;
}

.home-rules {
    background: white;
    border-radius: 12px;
    padding: 24px 30px;
    text-align: left;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 30px;
}

.home-rules h3 {
    font-size: 16px;
    color: #2d3748;
    margin-bottom: 12px;
}

.home-rules ul {
    list-style: none;
    padding: 0;
}

.home-rules li {
    padding: 6px 0;
    padding-left: 24px;
    position: relative;
    color: #4a5568;
    font-size: 15px;
}

.home-rules li::before {
    content: '+';
    position: absolute;
    left: 0;
    color: #48bb78;
    font-weight: bold;
}

/* ===== BUTTONS ===== */
.btn-primary {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    border: none;
    padding: 14px 40px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 153, 225, 0.5);
}

.btn-secondary {
    background: white;
    color: #4299e1;
    border: 2px solid #4299e1;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #ebf8ff;
}

.btn-back {
    background: white;
    color: #4299e1;
    border: 2px solid #4299e1;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-back:hover {
    background: #ebf8ff;
}

/* ===== EXAM HEADER ===== */
.exam-header {
    background: linear-gradient(135deg, #2b6cb0, #2c5282);
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.exam-title {
    font-weight: 700;
    font-size: 16px;
}

#question-counter {
    background: rgba(255,255,255,0.2);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
}

/* ===== EXAM CONTAINER ===== */
.exam-container {
    padding-top: 30px;
    padding-bottom: 100px;
}

.question-area {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.question-number {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
}

.question-text {
    font-size: 18px;
    line-height: 1.6;
    color: #2d3748;
    flex: 1;
}

/* ===== OPTIONS ===== */
.options-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.option-btn {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    text-align: left;
}

.option-btn:hover {
    border-color: #4299e1;
    background: #ebf8ff;
}

.option-btn.selected {
    border-color: #4299e1;
    background: #ebf8ff;
}

.option-btn.selected .option-letter {
    background: #4299e1;
    color: white;
}

.option-letter {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: #edf2f7;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #4a5568;
    transition: all 0.2s;
}

.option-text {
    flex: 1;
    color: #2d3748;
}

/* ===== NAVIGATION ===== */
.exam-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.btn-nav {
    padding: 10px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-prev {
    background: #edf2f7;
    color: #4a5568;
}

.btn-prev:hover {
    background: #e2e8f0;
}

.btn-next {
    background: #4299e1;
    color: white;
}

.btn-next:hover {
    background: #3182ce;
}

.btn-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.question-dots {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    flex: 1;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.dot:hover {
    background: #cbd5e0;
}

.dot.active {
    background: #4299e1;
    border-color: #2b6cb0;
}

.dot.answered {
    background: #48bb78;
}

.dot.answered.active {
    background: #4299e1;
}

.btn-finish {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

.btn-finish:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.5);
}

/* ===== RESULT PAGE ===== */
.result-container {
    text-align: center;
    padding-top: 40px;
}

.result-icon {
    font-size: 60px;
    margin-bottom: 16px;
}

.result-score-box {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin: 20px 0 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.result-score-label {
    display: block;
    font-size: 14px;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.result-score-value {
    display: block;
    font-size: 64px;
    font-weight: 800;
    background: linear-gradient(135deg, #4299e1, #3182ce);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-details {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.result-detail {
    background: white;
    border-radius: 12px;
    padding: 16px 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 120px;
}

.detail-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.correct-icon {
    background: #c6f6d5;
    color: #276749;
}

.correct-icon::after {
    content: '+';
    font-size: 24px;
}

.wrong-icon {
    background: #fed7d7;
    color: #9b2c2c;
}

.wrong-icon::after {
    content: '-';
    font-size: 24px;
}

.empty-icon {
    background: #e2e8f0;
    color: #4a5568;
}

.empty-icon::after {
    content: '?';
    font-size: 20px;
}

.detail-label {
    font-size: 12px;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 24px;
    font-weight: 700;
    color: #2d3748;
}

.result-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== REVIEW PAGE ===== */
.review-container {
    padding-top: 30px;
    padding-bottom: 40px;
}

.review-item {
    background: white;
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.review-item.review-correct {
    border-left: 4px solid #48bb78;
}

.review-item.review-wrong {
    border-left: 4px solid #fc8181;
}

.review-item.review-empty {
    border-left: 4px solid #a0aec0;
}

.review-question {
    display: flex;
    gap: 14px;
    margin-bottom: 16px;
    align-items: flex-start;
}

.review-q-num {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: #edf2f7;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #4a5568;
}

.review-q-text {
    font-size: 16px;
    line-height: 1.5;
    color: #2d3748;
    flex: 1;
}

.review-answer {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.review-your-answer {
    background: #fed7d7;
    color: #9b2c2c;
}

.review-correct-answer {
    background: #c6f6d5;
    color: #276749;
}

.review-not-answered {
    background: #e2e8f0;
    color: #4a5568;
}

.home-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== MANAGE PAGE ===== */
.manage-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 28px 24px 24px;
    color: white;
}

.manage-header-inner {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.manage-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.manage-header p {
    font-size: 14px;
    opacity: 0.85;
}

.manage-header .btn-back {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.4);
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.manage-header .btn-back:hover {
    background: rgba(255,255,255,0.3);
}

.manage-container {
    padding-top: 24px;
    padding-bottom: 40px;
}

.manage-stats {
    background: white;
    border-radius: 14px;
    padding: 18px 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 24px;
    text-align: center;
    font-size: 15px;
    color: #64748b;
    border: 1px solid #f1f5f9;
}

.manage-stats strong {
    color: #667eea;
    font-weight: 700;
}

.form-card {
    background: white;
    border-radius: 16px;
    padding: 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 28px;
    border: 1px solid #f1f5f9;
    overflow: hidden;
}

.form-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 28px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
}

.form-card-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    font-weight: 300;
}

.form-card-header h3 {
    font-size: 18px;
    color: #1e293b;
    margin-bottom: 2px;
}

.form-card-desc {
    font-size: 13px;
    color: #94a3b8;
    margin: 0;
}

.form-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 0 28px;
}

.form-group {
    margin-bottom: 18px;
    padding: 0 28px;
}

.form-group:first-of-type {
    padding-top: 24px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    color: #1e293b;
    transition: all 0.2s;
    background: #f8fafc;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.answer-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.answer-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    font-weight: 600;
    color: #475569;
    background: #f8fafc;
}

.answer-radio:hover {
    border-color: #667eea;
    background: #f0f0ff;
}

.answer-radio input[type="radio"] {
    accent-color: #667eea;
    width: 16px;
    height: 16px;
}

.answer-radio:has(input:checked) {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1));
    color: #667eea;
}

.form-actions {
    display: flex;
    gap: 12px;
    padding: 20px 28px 24px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

.form-actions .btn-primary {
    padding: 12px 32px;
    font-size: 15px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

.form-actions .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-cancel {
    background: white;
    color: #64748b;
    border: 2px solid #e2e8f0;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.section-title {
    font-size: 18px;
    color: #1e293b;
    font-weight: 700;
    margin: 0;
}

.section-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.question-list-item {
    background: white;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: flex;
    gap: 16px;
    align-items: flex-start;
    border: 1px solid #f1f5f9;
    transition: all 0.2s;
}

.question-list-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border-color: #e2e8f0;
}

.ql-num {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
}

.ql-body {
    flex: 1;
    min-width: 0;
}

.ql-question {
    font-size: 15px;
    color: #1e293b;
    line-height: 1.5;
    margin-bottom: 8px;
    word-break: break-word;
}

.ql-answer {
    font-size: 13px;
    color: #10b981;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #ecfdf5;
    padding: 3px 10px;
    border-radius: 6px;
}

.ql-answer::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
}

.ql-actions {
    display: flex;
    gap: 8px;
    min-width: fit-content;
}

.btn-edit,
.btn-delete {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-edit {
    background: #eff6ff;
    color: #3b82f6;
}

.btn-edit:hover {
    background: #dbeafe;
}

.btn-delete {
    background: #fef2f2;
    color: #ef4444;
}

.btn-delete:hover {
    background: #fee2e2;
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
    background: white;
    border-radius: 16px;
    border: 2px dashed #e2e8f0;
}

.empty-state-icon {
    font-size: 52px;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 15px;
    color: #94a3b8;
    margin: 0;
}

@media (max-width: 600px) {
    h1 {
        font-size: 24px;
    }

    .info-card {
        min-width: 120px;
        padding: 16px 20px;
    }

    .question-area {
        flex-direction: column;
        gap: 12px;
        padding: 20px;
    }

    .exam-nav {
        flex-wrap: wrap;
    }

    .question-dots {
        order: 3;
        width: 100%;
    }

    .result-score-value {
        font-size: 48px;
    }

    .result-details {
        gap: 12px;
    }

    .manage-header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .question-list-item {
        flex-direction: column;
        gap: 12px;
    }

    .ql-actions {
        align-self: flex-end;
    }

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

    .form-actions button {
        width: 100%;
    }

    .form-group {
        padding: 0 20px;
    }

    .form-group:first-of-type {
        padding-top: 20px;
    }

    .form-card-header {
        padding: 20px;
    }

    .form-divider {
        margin: 0 20px;
    }

    .form-actions {
        padding: 16px 20px 20px;
    }

    .answer-options {
        gap: 8px;
    }
}
