/* =========================================================
   RESET
========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;

    --text: #172033;
    --text-soft: #667085;
    --text-light: #98a2b3;

    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-soft: #eef2ff;

    --green: #16a34a;
    --green-soft: #ecfdf3;

    --red: #dc2626;
    --red-soft: #fef2f2;

    --border: #e5e7eb;

    --shadow-sm:
        0 2px 8px rgba(15, 23, 42, 0.05);

    --shadow:
        0 12px 35px rgba(15, 23, 42, 0.08);

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;

    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: var(--bg);
    color: var(--text);

    line-height: 1.6;
}


/* =========================================================
   BUTTON
========================================================= */

button {
    font: inherit;
}

button:focus-visible {
    outline: 3px solid rgba(79, 70, 229, 0.25);
    outline-offset: 3px;
}


/* =========================================================
   APP
========================================================= */

#app {
    min-height: 100vh;

    display: flex;
    flex-direction: column;
}


/* =========================================================
   HEADER
========================================================= */

.app-header {
    height: 78px;

    padding: 0 42px;

    background: rgba(255, 255, 255, 0.92);

    border-bottom: 1px solid var(--border);

    display: flex;
    align-items: center;
    justify-content: space-between;

    position: sticky;
    top: 0;
    z-index: 100;

    backdrop-filter: blur(16px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
}


/* =========================================================
   HOME BUTTON
========================================================= */

.icon-button {
    width: 42px;
    height: 42px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: var(--surface);

    color: var(--text);

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 22px;

    transition:
        transform 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease;
}

.icon-button:hover {
    background: var(--primary-soft);
    border-color: #c7d2fe;
    transform: translateY(-2px);
}


/* =========================================================
   BRAND
========================================================= */

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 42px;
    height: 42px;

    border-radius: 12px;

    background: var(--primary);

    color: white;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 21px;
    font-weight: 800;

    box-shadow:
        0 8px 18px rgba(79, 70, 229, 0.25);
}

.brand-text h1 {
    font-size: 17px;
    font-weight: 750;

    line-height: 1.2;
}

.brand-text p {
    margin-top: 2px;

    color: var(--text-soft);

    font-size: 12px;
}


/* =========================================================
   GLOBAL PROGRESS
========================================================= */

.global-progress {
    min-width: 260px;

    display: grid;
    grid-template-columns: auto 130px auto;

    align-items: center;
    gap: 10px;

    font-size: 12px;
}

.progress-label {
    color: var(--text-soft);
    font-weight: 600;
}

.global-progress > span:last-child {
    color: var(--text);
    font-weight: 700;
    white-space: nowrap;
}


/* =========================================================
   PROGRESS BAR
========================================================= */

.progress-track {
    width: 100%;
    height: 7px;

    background: #e9edf5;

    border-radius: 999px;
}

.progress-track.large {
    height: 9px;
}

.progress-fill {
    width: 0%;
    height: 100%;

    background: var(--primary);

    border-radius: inherit;

    transition: width 0.35s ease;
}


/* =========================================================
   MAIN
========================================================= */

.main-content {
    width: min(1240px, calc(100% - 48px));

    margin: 0 auto;

    flex: 1;

    padding: 46px 0 60px;
}


/* =========================================================
   SCREEN
========================================================= */

.screen {
    display: none !important;
    animation: screenIn 0.3s ease;
}

.screen.active {
    display: block !important;
}

.screen.hidden {
    display: none !important;
}

@keyframes screenIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* =========================================================
   PAGE HEADING
========================================================= */

.page-heading {
    margin-bottom: 34px;

    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
}

.eyebrow {
    display: inline-block;

    margin-bottom: 7px;

    color: var(--primary);

    font-size: 11px;
    font-weight: 800;

    letter-spacing: 0.12em;
}

.heading-content h2 {
    font-size: clamp(28px, 4vw, 40px);

    line-height: 1.15;

    letter-spacing: -0.025em;
}

.heading-content p {
    max-width: 680px;

    margin-top: 10px;

    color: var(--text-soft);

    font-size: 15px;
}

.total-info {
    min-width: 110px;

    padding: 18px;

    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: var(--radius);

    text-align: center;

    box-shadow: var(--shadow-sm);
}

.total-info strong {
    display: block;

    color: var(--primary);

    font-size: 30px;
    line-height: 1;
}

.total-info span {
    display: block;

    margin-top: 5px;

    color: var(--text-soft);

    font-size: 12px;
}


/* =========================================================
   PART GRID
========================================================= */

.part-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 18px;
}


/* =========================================================
   PART CARD
========================================================= */

.part-card {
    min-height: 190px;

    padding: 25px;

    position: relative;

    overflow: hidden;

    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-sm);

    display: flex;
    flex-direction: column;

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        border-color 0.25s ease;
}

.part-card::after {
    content: "";

    position: absolute;

    width: 150px;
    height: 150px;

    right: -55px;
    top: -55px;

    background: var(--primary-soft);

    border-radius: 50%;

    pointer-events: none;
}

.part-card:hover {
    transform: translateY(-4px);

    border-color: #c7d2fe;

    box-shadow: var(--shadow);
}

.part-number {
    color: #d7dcf0;

    position: absolute;

    right: 20px;
    bottom: 12px;

    font-size: 70px;
    font-weight: 900;

    line-height: 1;

    pointer-events: none;
}

.part-content {
    position: relative;
    z-index: 2;
}

.part-label {
    color: var(--primary);

    font-size: 11px;
    font-weight: 800;

    letter-spacing: 0.1em;
}

.part-content h3 {
    margin-top: 5px;

    font-size: 22px;
}

.part-content p {
    margin-top: 2px;

    color: var(--text-soft);

    font-size: 14px;
}

.part-start {
    width: fit-content;

    margin-top: auto;

    position: relative;
    z-index: 3;

    padding: 10px 17px;

    border: none;
    border-radius: 11px;

    background: var(--primary);

    color: white;

    cursor: pointer;

    font-size: 13px;
    font-weight: 700;

    display: flex;
    align-items: center;
    gap: 8px;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.part-start:hover {
    background: var(--primary-dark);
    transform: translateX(3px);
}


/* =========================================================
   TOPBAR
========================================================= */

.screen-topbar,
.quiz-topbar {
    display: grid;

    grid-template-columns: 1fr auto 1fr;

    align-items: center;

    gap: 20px;

    margin-bottom: 28px;
}

.screen-title {
    text-align: center;
}

.screen-title span,
.quiz-section-title span {
    color: var(--primary);

    font-size: 11px;
    font-weight: 800;

    letter-spacing: 0.1em;
}

.screen-title h2 {
    margin-top: 2px;

    font-size: 28px;
}

.screen-title p {
    color: var(--text-soft);

    font-size: 13px;
}

.back-button {
    width: fit-content;

    padding: 10px 15px;

    border: 1px solid var(--border);
    border-radius: 11px;

    background: var(--surface);

    color: var(--text);

    cursor: pointer;

    font-weight: 650;

    transition:
        background 0.2s ease,
        border-color 0.2s ease;
}

.back-button:hover {
    background: var(--surface-soft);
    border-color: #cbd5e1;
}

.list-score {
    justify-self: end;

    padding: 10px 16px;

    background: var(--green-soft);

    border: 1px solid #bbf7d0;

    border-radius: 12px;

    display: flex;
    align-items: baseline;
    gap: 5px;
}

.list-score span {
    color: #15803d;
    font-size: 12px;
}

.list-score strong {
    color: var(--green);
    font-size: 20px;
}

.list-score small {
    color: #15803d;
}


/* =========================================================
   SECTION PROGRESS
========================================================= */

.section-progress {
    margin-bottom: 28px;

    padding: 18px 20px;

    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: var(--radius);

    box-shadow: var(--shadow-sm);
}

.progress-info {
    margin-bottom: 9px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    color: var(--text-soft);

    font-size: 13px;
}
/* =========================================================
   TIẾN ĐỘ TỪNG CÂU - DẠNG CỤC
   ========================================================= */

#sectionProgressBar {
    width: 100% !important;
    height: 9px !important;

    display: flex !important;
    gap: 4px;

    overflow: visible !important;

    background: transparent !important;
    border-radius: 0 !important;
}

#sectionProgressBar .section-progress-segment {
    flex: 1 1 0;
    min-width: 0;
    height: 9px;

    background: #e9edf5;
    border-radius: 3px;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

#sectionProgressBar .section-progress-segment.done {
    background: #22c55e;
}

.progress-info strong {
    color: var(--text);
}


/* =========================================================
   QUESTION LIST
========================================================= */

.question-list {
    display: grid;

    grid-template-columns:
        repeat(6, minmax(0, 1fr));

    gap: 13px;
}

.question-item {
    min-height: 74px;

    border: 1px solid var(--border);
    border-radius: 14px;

    background: var(--surface);

    cursor: pointer;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 2px;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease;
}

.question-item:hover {
    transform: translateY(-2px);
    border-color: #c7d2fe;
}

.question-item-number {
    font-size: 17px;
    font-weight: 800;
}

.question-item-status {
    color: var(--text-light);

    font-size: 10px;
}

.question-item.correct {
    background: var(--green-soft);
    border-color: #86efac;
}

.question-item.correct .question-item-number {
    color: var(--green);
}

.question-item.correct .question-item-status {
    color: #15803d;
}

.question-item.wrong {
    background: var(--red-soft);
    border-color: #fecaca;
}

.question-item.wrong .question-item-number {
    color: var(--red);
}

.question-item.wrong .question-item-status {
    color: #b91c1c;
}

.question-item.current {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px var(--primary-soft);
}


/* =========================================================
   QUIZ TOP
========================================================= */

.quiz-section-title {
    text-align: center;

    display: flex;
    flex-direction: column;
}

.quiz-section-title strong {
    font-size: 17px;
}

.quiz-counter {
    justify-self: end;

    padding: 8px 14px;

    border-radius: 12px;

    background: var(--primary-soft);

    color: var(--primary);

    font-size: 13px;
}

.quiz-counter strong {
    font-size: 20px;
}


/* =========================================================
   QUIZ PROGRESS
========================================================= */

.quiz-progress {
    margin-bottom: 4px !important;
}
.quiz-progress-info {
    margin-top: 8px;

    display: flex;
    justify-content: space-between;

    color: var(--text-soft);

    font-size: 12px;
}


/* =========================================================
   QUESTION CONTAINER
========================================================= */

.question-container {
    max-width: 900px;

    margin: 0 auto;
}

.question-card {
    padding: 38px;

    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow);
}

.question-meta {
    display: flex;
    align-items: center;
    gap: 10px;

    margin-bottom: 20px;
}

.question-badge {
    padding: 5px 9px;

    border-radius: 7px;

    background: var(--primary-soft);

    color: var(--primary);

    font-size: 10px;
    font-weight: 800;

    letter-spacing: 0.08em;
}

.question-id {
    color: var(--text-light);

    font-size: 12px;
    font-weight: 650;
}

.question-text {
    margin-bottom: 30px;

    font-size: clamp(20px, 2.5vw, 27px);

    line-height: 1.45;

    letter-spacing: -0.01em;
}


/* =========================================================
   ANSWERS
========================================================= */

.answers-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.answer-option {
    width: 100%;

    padding: 16px 18px;

    border: 1px solid var(--border);
    border-radius: 14px;

    background: var(--surface);

    color: var(--text);

    cursor: pointer;

    text-align: left;

    display: flex;
    align-items: flex-start;
    gap: 13px;

    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        transform 0.2s ease;
}

.answer-option:hover:not(:disabled) {
    border-color: #a5b4fc;

    background: #fafaff;

    transform: translateX(3px);
}

.answer-letter {
    width: 31px;
    height: 31px;

    flex: 0 0 31px;

    border-radius: 9px;

    background: #f1f5f9;

    color: #475569;

    display: flex;
    align-items: center;
    justify-content: center;

    font-weight: 800;
    font-size: 13px;
}

.answer-text {
    flex: 1;

    padding-top: 3px;

    font-size: 15px;
    line-height: 1.5;
}


/* =========================================================
   ANSWER STATES
========================================================= */

.answer-option.correct {
    background: var(--green-soft);

    border-color: #4ade80;

    color: #166534;
}

.answer-option.correct .answer-letter {
    background: var(--green);
    color: white;
}

.answer-option.wrong {
    background: var(--red-soft);

    border-color: #f87171;

    color: #991b1b;
}

.answer-option.wrong .answer-letter {
    background: var(--red);
    color: white;
}

.answer-option:disabled {
    cursor: default;
}


/* =========================================================
   FEEDBACK
========================================================= */

.answer-feedback {
    margin-top: 22px;

    padding: 14px 16px;

    border-radius: 13px;

    display: flex;
    align-items: center;
    gap: 12px;
}

.answer-feedback.success {
    background: var(--green-soft);

    border: 1px solid #bbf7d0;
}

.answer-feedback.error {
    background: var(--red-soft);

    border: 1px solid #fecaca;
}

.feedback-icon {
    width: 34px;
    height: 34px;

    flex: 0 0 34px;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    font-weight: 900;
}

.answer-feedback.success .feedback-icon {
    background: var(--green);
    color: white;
}

.answer-feedback.error .feedback-icon {
    background: var(--red);
    color: white;
}

.feedback-content strong {
    display: block;
    font-size: 14px;
}

.feedback-content p {
    margin-top: 1px;

    color: var(--text-soft);

    font-size: 12px;
}


/* =========================================================
   COUNTDOWN
========================================================= */

.next-countdown {
    margin-top: 18px;

    color: var(--text-soft);

    font-size: 12px;

    text-align: center;
}

.next-countdown strong {
    color: var(--primary);

    font-size: 17px;

    margin: 0 3px;
}


/* =========================================================
   NEXT ACTION
========================================================= */

.next-action {
    margin-top: 18px;

    display: flex;
    justify-content: center;
}


/* =========================================================
   BUTTONS
========================================================= */

.primary-button,
.secondary-button {
    border-radius: 12px;

    padding: 11px 18px;

    cursor: pointer;

    font-weight: 700;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    transition:
        transform 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease;
}

.primary-button {
    border: none;

    background: var(--primary);

    color: white;

    box-shadow:
        0 7px 16px rgba(79, 70, 229, 0.2);
}

.primary-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.secondary-button {
    border: 1px solid var(--border);

    background: var(--surface);

    color: var(--text);
}

.secondary-button:hover {
    background: var(--surface-soft);

    border-color: #cbd5e1;

    transform: translateY(-2px);
}


/* =========================================================
   QUIZ NAVIGATION
========================================================= */

.quiz-navigation {
    max-width: 900px;

    margin: 20px auto 0;

    display: flex;
    justify-content: space-between;
    gap: 10px;
}


/* =========================================================
   RESULT
========================================================= */

.result-card {
    max-width: 720px;

    margin: 30px auto 0;

    padding: 45px;

    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow);

    text-align: center;
}

.result-icon {
    width: 68px;
    height: 68px;

    margin: 0 auto 20px;

    border-radius: 20px;

    background: var(--green-soft);

    color: var(--green);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 32px;
    font-weight: 900;
}

.result-card h2 {
    font-size: 29px;

    line-height: 1.25;
}

.result-subtitle {
    margin-top: 7px;

    color: var(--text-soft);

    font-size: 14px;
}

.result-score {
    margin: 28px 0;

    display: flex;
    align-items: baseline;
    justify-content: center;
}

.result-score strong {
    color: var(--primary);

    font-size: 68px;

    line-height: 1;

    letter-spacing: -0.04em;
}

.result-score span {
    margin-left: 5px;

    color: var(--text-soft);

    font-size: 20px;
}


/* =========================================================
   RESULT STATS
========================================================= */

.result-stats {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 12px;

    margin-bottom: 22px;
}

.result-stat {
    padding: 15px;

    border-radius: 14px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 9px;
}

.result-stat.correct {
    background: var(--green-soft);
}

.result-stat.wrong {
    background: var(--red-soft);
}

.result-stat.total {
    background: #f1f5f9;
}

.stat-icon {
    font-size: 20px;
    font-weight: 900;
}

.result-stat.correct .stat-icon,
.result-stat.correct strong {
    color: var(--green);
}

.result-stat.wrong .stat-icon,
.result-stat.wrong strong {
    color: var(--red);
}

.result-stat.total .stat-icon,
.result-stat.total strong {
    color: #475569;
}

.result-stat strong,
.result-stat span:last-child {
    display: block;
}

.result-stat strong {
    font-size: 18px;
}

.result-stat div span {
    color: var(--text-soft);

    font-size: 11px;
}


/* =========================================================
   RESULT MESSAGE
========================================================= */

.result-message {
    padding: 12px;

    border-radius: 12px;

    background: var(--surface-soft);

    color: var(--text-soft);

    font-size: 13px;
}


/* =========================================================
   RESULT ACTIONS
========================================================= */

.result-actions {
    margin-top: 25px;

    display: flex;
    flex-wrap: wrap;

    justify-content: center;

    gap: 10px;
}


/* =========================================================
   FOOTER
========================================================= */

.app-footer {
    min-height: 58px;

    padding: 15px 30px;

    border-top: 1px solid var(--border);

    background: var(--surface);

    color: var(--text-light);

    font-size: 11px;

    display: flex;
    justify-content: center;
    align-items: center;

    gap: 8px;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 900px) {

    .app-header {
        padding: 0 20px;
    }

    .global-progress {
        min-width: 190px;

        grid-template-columns:
            auto 80px auto;
    }

    .question-list {
        grid-template-columns:
            repeat(5, 1fr);
    }
}


@media (max-width: 700px) {

    .app-header {
        height: auto;

        padding: 14px 16px;

        align-items: flex-start;

        gap: 12px;
    }

    .header-right {
        display: none;
    }

    .main-content {
        width: min(100% - 28px, 600px);

        padding-top: 30px;
    }

    .page-heading {
        align-items: flex-start;
    }

    .total-info {
        min-width: 80px;
    }

    .part-grid {
        grid-template-columns: 1fr;
    }

    .screen-topbar,
    .quiz-topbar {
        grid-template-columns:
            1fr auto;
    }

    .screen-title,
    .quiz-section-title {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .back-button {
        grid-row: 2;
    }

    .list-score,
    .quiz-counter {
        grid-row: 2;
    }

    .question-list {
        grid-template-columns:
            repeat(4, 1fr);
    }

    .question-card {
        padding: 24px 18px;
    }

    .quiz-navigation {
        flex-wrap: wrap;
    }

    .quiz-navigation button {
        flex: 1;
    }

    .result-card {
        padding: 30px 20px;
    }
}


@media (max-width: 480px) {

    .brand-text p {
        display: none;
    }

    .brand-text h1 {
        font-size: 15px;
    }

    .page-heading {
        display: block;
    }

    .total-info {
        margin-top: 18px;
    }

    .question-list {
        grid-template-columns:
            repeat(3, 1fr);
    }

    .result-stats {
        grid-template-columns: 1fr;
    }

    .result-score strong {
        font-size: 56px;
    }

    .quiz-navigation {
        display: grid;

        grid-template-columns: 1fr 1fr;
    }

    .quiz-navigation button:nth-child(2) {
        grid-column: 1 / -1;
    }
}
/* =========================================================
   MODERN ANSWER CARDS
   ========================================================= */

#answersContainer {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    margin-top: 22px;
}


/* =========================================================
   ANSWER BUTTON
   ========================================================= */

#answersContainer .answer-btn {
    position: relative;

    display: flex;
    align-items: center;

    width: 100%;
    min-height: 72px;

    padding: 14px 18px;

    border: 1.5px solid #e5e7eb;
    border-radius: 18px;

    background: #ffffff;

    cursor: pointer;

    text-align: left;

    font-size: 16px;
    font-weight: 500;

    color: #1f2937;

    box-shadow:
        0 3px 10px rgba(15, 23, 42, 0.04);

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}


/* =========================================================
   HOVER
   ========================================================= */

#answersContainer .answer-btn:hover:not(:disabled) {
    transform: translateY(-2px);

    border-color: #6366f1;

    background: #fafaff;

    box-shadow:
        0 8px 22px rgba(99, 102, 241, 0.12);
}


/* =========================================================
   CLICK / ACTIVE
   ========================================================= */

#answersContainer .answer-btn:active:not(:disabled) {
    transform: translateY(0);
}


/* =========================================================
   A B C D BADGE
   ========================================================= */

#answersContainer .answer-label {
    flex: 0 0 42px;

    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-right: 15px;

    border-radius: 13px;

    background: #f1f3f9;

    color: #4f46e5;

    font-size: 15px;
    font-weight: 800;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}


/* =========================================================
   ANSWER TEXT
   ========================================================= */

#answersContainer .answer-text {
    flex: 1;

    line-height: 1.55;

    padding-right: 8px;
}


/* =========================================================
   HOVER BADGE
   ========================================================= */

#answersContainer .answer-btn:hover:not(:disabled)
.answer-label {
    background: #6366f1;

    color: #ffffff;

    transform: scale(1.05);
}


/* =========================================================
   SELECTED / CORRECT
   ========================================================= */

#answersContainer .answer-btn.correct {
    border-color: #22c55e;

    background:
        linear-gradient(
            135deg,
            #f0fdf4,
            #ffffff
        );

    color: #166534;

    box-shadow:
        0 8px 24px rgba(34, 197, 94, 0.13);
}


/* Badge đúng */

#answersContainer .answer-btn.correct
.answer-label {
    background: #22c55e;

    color: #ffffff;
}


/* =========================================================
   WRONG
   ========================================================= */

#answersContainer .answer-btn.wrong {
    border-color: #ef4444;

    background:
        linear-gradient(
            135deg,
            #fef2f2,
            #ffffff
        );

    color: #991b1b;

    box-shadow:
        0 8px 24px rgba(239, 68, 68, 0.12);

    animation: answerShake 0.35s ease;
}


/* Badge sai */

#answersContainer .answer-btn.wrong
.answer-label {
    background: #ef4444;

    color: #ffffff;
}


/* =========================================================
   DISABLED
   ========================================================= */

#answersContainer .answer-btn:disabled {
    cursor: default;
}


/* =========================================================
   DISABLED BUT NOT CORRECT
   ========================================================= */

#answersContainer .answer-btn:disabled:not(.correct):not(.wrong) {
    opacity: 0.72;

    cursor: default;
}


/* =========================================================
   FEEDBACK BOX
   ========================================================= */

#answerFeedback {
    margin-top: 20px;

    padding: 18px 20px;

    border-radius: 18px;

    border: 1px solid transparent;

    animation: feedbackAppear 0.25s ease;
}


/* Feedback đúng */

#answerFeedback.correct {
    background:
        linear-gradient(
            135deg,
            #f0fdf4,
            #ecfdf5
        );

    border-color: #bbf7d0;

    color: #166534;
}


/* Feedback sai */

#answerFeedback.wrong {
    background:
        linear-gradient(
            135deg,
            #fef2f2,
            #fff1f2
        );

    border-color: #fecaca;

    color: #991b1b;
}


/* =========================================================
   FEEDBACK ICON
   ========================================================= */

#feedbackIcon {
    width: 38px;
    height: 38px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;

    margin-right: 10px;

    font-size: 18px;
    font-weight: 900;
}


/* =========================================================
   NEXT ACTION
   ========================================================= */

#nextAction {
    margin-top: 18px;

    animation: feedbackAppear 0.3s ease;
}


/* =========================================================
   NEXT BUTTON
   ========================================================= */

#nextQuestionButton {
    border: none;

    border-radius: 15px;

    padding: 13px 22px;

    background:
        linear-gradient(
            135deg,
            #6366f1,
            #4f46e5
        );

    color: #ffffff;

    font-size: 15px;
    font-weight: 700;

    cursor: pointer;

    box-shadow:
        0 7px 18px rgba(79, 70, 229, 0.22);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}


#nextQuestionButton:hover {
    transform: translateY(-2px);

    box-shadow:
        0 10px 24px rgba(79, 70, 229, 0.28);
}


#nextQuestionButton:active {
    transform: translateY(0);
}


/* =========================================================
   QUESTION TEXT
   ========================================================= */

#questionText {
    font-size: 22px;

    line-height: 1.6;

    font-weight: 700;

    color: #111827;

    letter-spacing: -0.2px;
}


/* =========================================================
   QUESTION ID
   ========================================================= */

#questionId {
    display: inline-flex;

    align-items: center;

    padding: 5px 10px;

    border-radius: 9px;

    background: #f3f4f6;

    color: #6b7280;

    font-size: 12px;

    font-weight: 700;
}


/* =========================================================
   ANIMATIONS
   ========================================================= */

@keyframes answerShake {

    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-3px);
    }

    100% {
        transform: translateX(0);
    }

}


@keyframes feedbackAppear {

    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

    #answersContainer {
        gap: 11px;
    }


    #answersContainer .answer-btn {
        min-height: 64px;

        padding: 11px 13px;

        border-radius: 15px;

        font-size: 15px;
    }


    #answersContainer .answer-label {
        flex-basis: 38px;

        width: 38px;
        height: 38px;

        margin-right: 12px;

        border-radius: 11px;
    }


    #questionText {
        font-size: 18px;

        line-height: 1.5;
    }

}
/* =========================================================
   COUNTDOWN FIX - KEEP VISIBLE AFTER ANSWER CARD REDESIGN
   ========================================================= */
#nextCountdown {
    display: block;
    width: 100%;
    margin-top: 14px;
    text-align: center;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.5;
    visibility: visible;
    opacity: 1;
}

#nextCountdown[hidden] {
    display: none !important;
}

#countdownNumber {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    margin: 0 4px;
    padding: 0 7px;
    border-radius: 9px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
}

/* Bo góc đáp án - chỉ tác động answer-btn */
#answersContainer .answer-btn {
    border-radius: 18px;
}
/* =========================================================
   QUESTION NUMBER LIST - MODERN STYLE
   ========================================================= */

#questionList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 10px;
    padding: 6px;
}

/* Ô số câu */
#questionList .question-number {
    width: 48px;
    height: 48px;
    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--border);
    border-radius: 14px;

    background: var(--surface);
    color: var(--text);

    font-size: 14px;
    font-weight: 700;

    cursor: pointer;

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease;
}

/* Số bên trong */
#questionList .question-number span {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;
}

/* Hover */
#questionList .question-number:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    color: var(--primary);

    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

/* Câu đang chọn */
#questionList .question-number.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;

    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

/* Câu đã trả lời đúng */
#questionList .question-number.correct {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.45);
    color: #16a34a;
}

/* Hover câu đúng */
#questionList .question-number.correct:hover {
    background: rgba(34, 197, 94, 0.18);
}

/* Câu đang chọn + đã đúng */
#questionList .question-number.active.correct {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Mobile */
@media (max-width: 600px) {
    #questionList {
        grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
        gap: 8px;
    }

    #questionList .question-number {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        font-size: 13px;
    }
}
/* =========================================================
   DANH SÁCH CÂU - 6 CỘT
   ========================================================= */

#questionList {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;

    padding: 8px;
}

/* Ô số câu */
#questionList .question-number {
    width: 100%;
    aspect-ratio: 1 / 1;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 1px solid var(--border);
    border-radius: 14px;

    background: var(--surface);
    color: var(--text);

    font-size: 14px;
    font-weight: 700;

    cursor: pointer;

    transition: all 0.18s ease;
}

/* Hover */
#questionList .question-number:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 5px 14px rgba(0,0,0,.08);
}

/* Câu đúng */
#questionList .question-number.correct {
    background: rgba(34, 197, 94, .12);
    border-color: rgba(34, 197, 94, .4);
    color: #16a34a;
}

/* Câu đang chọn */
#questionList .question-number.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
/* ẨN CHỮ PHẦN 1 NHỎ TRÊN CARD */
.part-card .part-label {
    display: none !important;
}

/* Tiêu đề phần */
.part-card .part-content h3 {
    margin-top: 0;
}
/* =========================================================
   🌌 MODERN QUIZ BACKGROUND
   ========================================================= */

body {
    background:
        radial-gradient(
            circle at 10% 10%,
            rgba(99, 102, 241, 0.16),
            transparent 32%
        ),
        radial-gradient(
            circle at 90% 15%,
            rgba(139, 92, 246, 0.14),
            transparent 30%
        ),
        radial-gradient(
            circle at 50% 100%,
            rgba(59, 130, 246, 0.12),
            transparent 35%
        ),
        linear-gradient(
            135deg,
            #f8faff 0%,
            #f3f5ff 45%,
            #f8f7ff 100%
        );

    background-attachment: fixed;
    min-height: 100vh;
}

/* Ánh sáng trang trí phía sau */
body::before {
    content: "";
    position: fixed;
    width: 420px;
    height: 420px;

    top: -180px;
    left: -150px;

    background: rgba(99, 102, 241, 0.10);
    border-radius: 50%;

    filter: blur(20px);
    pointer-events: none;
    z-index: -1;
}

body::after {
    content: "";
    position: fixed;
    width: 380px;
    height: 380px;

    right: -140px;
    bottom: -160px;

    background: rgba(139, 92, 246, 0.10);
    border-radius: 50%;

    filter: blur(25px);
    pointer-events: none;
    z-index: -1;
}


/* =========================================================
   CARD HIỆN ĐẠI
   ========================================================= */

.part-card,
.quiz-card,
.question-card {
    background: rgba(255, 255, 255, 0.88);

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    border: 1px solid rgba(255, 255, 255, 0.75);

    box-shadow:
        0 10px 35px rgba(31, 41, 55, 0.07),
        0 2px 8px rgba(31, 41, 55, 0.04);
}


/* =========================================================
   Ô ĐÁP ÁN - BO GÓC ĐẸP
   ========================================================= */

#answersContainer .answer-btn {
    border-radius: 18px;
    border: 1px solid var(--border);

    background: rgba(255, 255, 255, 0.92);

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease;
}

#answersContainer .answer-btn:hover {
    transform: translateY(-2px);

    border-color: var(--primary);

    box-shadow:
        0 8px 22px rgba(79, 70, 229, 0.12);
}


/* =========================================================
   NÚT BẮT ĐẦU
   ========================================================= */

.part-start {
    border-radius: 13px;

    box-shadow:
        0 6px 16px rgba(79, 70, 229, 0.20);

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

.part-start:hover {
    transform: translateY(-2px);

    box-shadow:
        0 9px 22px rgba(79, 70, 229, 0.25);
}


/* =========================================================
   COUNTDOWN
   ========================================================= */

#nextCountdown {
    margin-top: 18px;

    text-align: center;

    color: var(--text-soft);
    font-size: 13px;
}

#nextCountdown[hidden] {
    display: none !important;
}

#countdownNumber {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    width: 32px;
    height: 32px;

    margin: 0 5px;

    border-radius: 10px;

    background: rgba(79, 70, 229, 0.10);

    color: var(--primary);

    font-size: 18px;
    font-weight: 800;
}


/* =========================================================
   DANH SÁCH CÂU - 6 CỘT
   ========================================================= */

#questionList {
    display: grid;

    grid-template-columns: repeat(6, 1fr);

    gap: 10px;
    padding: 8px;
}

#questionList .question-number {
    width: 100%;
    aspect-ratio: 1 / 1;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border-radius: 14px;

    border: 1px solid var(--border);

    background: rgba(255, 255, 255, 0.85);

    color: var(--text);

    font-size: 14px;
    font-weight: 700;

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease;
}

#questionList .question-number:hover {
    transform: translateY(-2px);

    border-color: var(--primary);

    color: var(--primary);

    box-shadow:
        0 6px 16px rgba(79, 70, 229, 0.12);
}

#questionList .question-number.correct {
    background: rgba(34, 197, 94, 0.11);

    border-color: rgba(34, 197, 94, 0.35);

    color: #16a34a;
}
#questionList .question-number.wrong {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.45);
    color: #dc2626;
    opacity: 0.7;
}

#questionList .question-number.wrong:hover {
    background: rgba(239, 68, 68, 0.18);
}

/* =========================================================
   ẨN LABEL "PHẦN 1" BỊ LẶP
   ========================================================= */

.part-card .part-label {
    display: none !important;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

    #questionList {
        grid-template-columns: repeat(6, 1fr);
        gap: 7px;
    }

    #questionList .question-number {
        border-radius: 10px;
        font-size: 12px;
    }
}

/* =========================================================
   BACKGROUND - OFFICE
   ========================================================= */

body {
    background:
        linear-gradient(
            rgba(248, 250, 252, 0.48),
            rgba(248, 250, 252, 0.54)
        ),
        url("office.png") center center / cover fixed no-repeat !important;

    min-height: 100vh;
}


/* =========================================================
   CARD TRONG SUỐT NHẸ
   ========================================================= */

.part-card,
.quiz-card,
.question-card {
    background: rgba(255, 255, 255, 0.91);

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    box-shadow:
        0 12px 35px rgba(0, 0, 0, 0.10);
}
.question-number.wrong {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    opacity: 0.7;
}
#sectionProgressBar {
    display: flex !important;
    flex-direction: row !important;
    gap: 5px !important;
    width: 100% !important;
    height: 10px !important;
    background: transparent !important;
    overflow: visible !important;
}

#sectionProgressBar .section-progress-segment {
    display: block !important;
    flex: 1 1 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    height: 10px !important;
    background: #dfe3e8 !important;
    border-radius: 3px !important;
}

#sectionProgressBar .section-progress-segment.done {
    background: #22c55e !important;
}

.section-progress-segment {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: var(--border);
    transition: background 0.2s ease;
}

.section-progress-segment.done {
    background: #22c55e;
}
#sectionProgressBar {
    display: flex !important;
    gap: 4px !important;
    width: 100% !important;
    height: 8px !important;
    background: transparent !important;
}

#sectionProgressBar .section-progress-segment {
    display: block !important;
    flex: 1 1 0 !important;
    height: 8px !important;
    min-width: 0 !important;
    background: #e5e7eb !important;
    border-radius: 3px !important;
}

#sectionProgressBar .section-progress-segment.done {
    background: #22c55e !important;
}
.section-progress-bar {
    display: flex !important;
    gap: 5px !important;
    width: 100% !important;
    height: 10px !important;
    background: transparent !important;
}

.section-progress-bar .section-progress-segment {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    height: 10px !important;
    background: #dfe3e8 !important;
    border-radius: 3px !important;
}

.section-progress-bar .section-progress-segment.done {
    background: #22c55e !important;
}
#sectionProgressBar {
    display: flex !important;
    flex-direction: row !important;
    gap: 5px !important;
    width: 100% !important;
    height: 10px !important;
    background: transparent !important;
}

#sectionProgressBar .section-progress-segment {
    display: block !important;
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    height: 10px !important;
    background: #dfe3e8 !important;
    border-radius: 3px !important;
}

#sectionProgressBar .section-progress-segment.done {
    background: #22c55e !important;
}
.progress-track.large {
    height: 10px !important;
    background: transparent !important;
    overflow: visible !important;
    border-radius: 0 !important;
}

#sectionProgressBar {
    display: flex !important;
    flex-direction: row !important;
    gap: 5px !important;
    width: 100% !important;
    height: 10px !important;
    background: transparent !important;
    overflow: visible !important;
    border-radius: 0 !important;
}

#sectionProgressBar .section-progress-segment {
    display: block !important;
    flex: 1 1 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    height: 10px !important;
    background: #dfe3e8 !important;
    border-radius: 3px !important;
}

#sectionProgressBar .section-progress-segment.done {
    background: #22c55e !important;
} 
/* =========================================
   TIẾN ĐỘ TỪNG CÂU TRÊN GIAO DIỆN LÀM BÀI
   ========================================= */

#quizProgressBar.question-progress-bar {
    display: flex !important;
    flex-direction: row !important;
    gap: 5px !important;

    width: 100% !important;
    height: 10px !important;

    background: transparent !important;
    overflow: visible !important;
    border-radius: 0 !important;
}

.question-progress-segment {
    display: block !important;

    flex: 1 1 0 !important;
    width: 0 !important;
    min-width: 0 !important;

    height: 10px !important;

    background: #dfe3e8 !important;

    border-radius: 3px !important;
}

.question-progress-segment.correct {
    background: #22c55e !important;
}

.question-progress-segment.wrong {
    background: #ef4444 !important;
}
.question-progress-segment {
    background: #ffffff !important;
}

.question-progress-segment.correct {
    background: #22c55e !important;
}

.question-progress-segment.wrong {
    background: #ef4444 !important;
}
/* ÉP giao diện làm bài nằm sát dưới thanh tiến độ */


#quizScreen .quiz-progress {
    margin-bottom: 10px !important;
}

#quizScreen .question-container {
    margin-top: 0 !important;
    margin-bottom: 20px !important;
    position: static !important;
    transform: none !important;
}

#quizScreen .question-card {
    position: static !important;
    transform: none !important;
}
.quiz-progress {
    margin: 0 !important;
    padding: 0 !important;
}

.quiz-progress-info {
    margin-top: 2px !important;
}

.question-container {
    margin: 0 auto !important;
    padding: 0 !important;
}

.question-card {
    margin-top: 0 !important;
}
.hidden {
    display: none !important;
}

.screen.hidden {
    display: none !important;
}

.screen.active {
    display: block !important;
}
.question-progress-bar {
    display: flex !important;
    gap: 3px;
    width: 100% !important;
    height: 12px;
}

.question-progress-segment {
    flex: 1;
    background: #fff;
    border-radius: 3px;
}

.question-progress-segment.correct {
    background: #22c55e;
}

.question-progress-segment.wrong {
    background: #ef4444;
}
#sectionProgressBar {
    display: flex !important;
    gap: 5px !important;
    width: 100% !important;
    height: 10px !important;
    background: transparent !important;
}

#sectionProgressBar .section-progress-segment {
    display: block !important;
    flex: 1 1 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    height: 10px !important;
    border-radius: 3px !important;
    opacity: 1 !important;
}

#sectionProgressBar .section-progress-segment.correct {
    background: #22c55e !important;
}

#sectionProgressBar .section-progress-segment.wrong {
    background: #ef4444 !important;
}
/* =========================================================
   LOGIN SCREEN
========================================================= */

/* =========================================================
   LOGIN SCREEN STYLES
========================================================= */
#loginScreen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg);
    padding: 20px;
}

.login-card {
    background: var(--surface);
    padding: 32px 28px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    text-align: center;
    border: 1px solid var(--border);
}

.login-card .brand-icon {
    margin: 0 auto 12px;
}

.login-card h2 {
    font-size: 1.4rem;
    color: var(--text);
    margin-bottom: 4px;
}

.login-card p {
    color: var(--text-soft);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.input-group {
    text-align: left;
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.input-group input {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--primary);
}

.full-width {
    width: 100%;
    margin-top: 8px;
}

.error-text {
    color: var(--red);
    font-size: 0.85rem;
    margin-top: 12px;
}

.auth-switch {
    margin-top: 18px;
    font-size: 0.85rem;
    color: var(--text-soft);
}

.auth-switch a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    margin-left: 4px;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* User Profile Header */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-email {
    font-size: 0.85rem;
    color: var(--text-soft);
    font-weight: 500;
}

.secondary-button.small {
    padding: 6px 12px;
    font-size: 0.8rem;
}
/* Thuộc tính ẩn màn hình bắt buộc */
.hidden {
    display: none !important;
}

/* Căn giữa màn hình đăng nhập */
#loginScreen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
}
/* Ẩn hoàn toàn app khi chưa đăng nhập */
#app.hidden {
    display: none !important;
}

/* Ẩn màn hình đăng nhập sau khi đã vào hệ thống */
#loginScreen.hidden {
    display: none !important;
}

/* Căn giữa màn hình Đăng nhập */
#loginScreen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
}
/* 1. Thiết lập chiều cao chuẩn cho trang web */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* 2. Ép khung App co dãn theo toàn bộ chiều cao màn hình */
#app {
    display: flex !important;
    flex-direction: column;
    min-height: 100vh;
}

/* 3. Đẩy phần nội dung chính dãn ra để chiếm trọn khoảng trống */
.main-content {
    flex: 1 0 auto;
}

/* 4. Đẩy Footer bám chặt xuống đáy màn hình */
.app-footer {
    flex-shrink: 0;
    margin-top: auto;
    width: 100%;
}

/* =========================================================
   FIX THEO YÊU CẦU: ẩn 2 thông báo + căn giữa màn hình đăng nhập
========================================================= */

/* 1. Ẩn badge "Đúng: X" trong lúc làm quiz */
#quizScoreText {
    display: none !important;
}

/* 2. Ẩn popup "Chính xác! / Sai rồi!" hiện ra sau khi chọn đáp án */
#answerFeedback {
    display: none !important;
}

/* 3. Fix lỗi màn hình đăng nhập bị đẩy lên góc thay vì nằm giữa.
   Nguyên nhân: ".screen.active { display: block !important; }" (2 chỗ ở trên)
   có !important nên đè mất "display: flex" của #loginScreen.
   Cách sửa: tăng độ ưu tiên bằng cách thêm ID vào selector. */
#loginScreen.screen.active {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    min-height: 100vh !important;
    width: 100% !important;
}
