body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f4f7f4;
    color: #163223;
}

.auth-card {
    max-width: 460px;
    margin: 0 auto;
}

.question-card {
    border-left: 4px solid #198754;
}

.question-card-attempted {
    border-left-color: #0d6efd;
}

.question-card-bookmarked {
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.35);
}

.timer-box {
    position: sticky;
    top: 1rem;
    z-index: 10;
}

.attempt-summary {
    padding: 0.75rem 0.9rem;
    background: #f3f8f4;
    border: 1px solid #d7e5da;
    border-radius: 0.5rem;
}

.question-palette {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.55rem;
}

.question-palette-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.6rem;
    padding: 0.35rem;
    border-radius: 0.4rem;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid transparent;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.question-palette-item:hover {
    text-decoration: none;
}

.question-palette-unattempted {
    background: #fce8ea;
    border-color: #efc5cb;
    color: #8b1e2d;
}

.question-palette-attempted {
    background: #dff3e7;
    border-color: #b8e0c8;
    color: #13653b;
}

.question-palette-bookmarked {
    box-shadow: inset 0 0 0 2px #ffc107;
}

.palette-legend {
    display: grid;
    gap: 0.35rem;
    color: #4f6355;
}

.palette-dot {
    display: inline-block;
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 0.2rem;
    margin-right: 0.45rem;
    vertical-align: middle;
}

.palette-dot-attempted {
    background: #198754;
}

.palette-dot-unattempted {
    background: #dc3545;
}

.palette-dot-bookmarked {
    background: #ffc107;
}

/* Mobile-only floating mini-timer — sticks to the top of the viewport while
   the sidebar (which owns the primary timer) is off-screen. Hidden on lg+. */
.mobile-float-timer {
    position: fixed;
    top: 0.5rem;
    right: 0.75rem;
    z-index: 1030;
    background: #ffffff;
    border: 2px solid #198754;
    box-shadow: 0 6px 16px rgba(10, 57, 33, 0.25);
    border-radius: 999px;
    padding: 0.45rem 0.95rem;
    font-weight: 700;
    color: #13653b;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-float-timer .mft-label {
    font-size: 1.05rem;
}

.mobile-float-timer .mft-attempt {
    font-size: 0.85rem;
    background: #dff3e7;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    color: #13653b;
}

/* Correct-answer reveal on sample-test review. */
.sample-option-correct {
    background: #eaf7ef;
    border: 1px solid #b8e0c8;
    border-radius: 0.35rem;
    padding: 0.35rem 0.5rem;
}

.active-test-nav {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
}

.back-to-top {
    position: fixed !important;
    right: 1.25rem !important;
    bottom: 1.25rem !important;
    width: 3.25rem !important;
    height: 3.25rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 999px !important;
    background: #198754 !important;
    color: #fff !important;
    text-decoration: none !important;
    font-size: 1.6rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 10px 22px rgba(10, 57, 33, 0.28) !important;
    z-index: 9999 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.back-to-top:hover {
    background: #146c43 !important;
    color: #fff !important;
    text-decoration: none !important;
}

.hero-stat {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 1rem;
    min-height: 132px;
    backdrop-filter: blur(4px);
}

.hero-stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.hero-stat-label {
    color: rgba(255, 255, 255, 0.84);
    font-size: 0.95rem;
}

.home-hero {
    background-image:
        linear-gradient(90deg, rgba(9, 33, 23, 0.88) 0%, rgba(16, 71, 46, 0.82) 55%, rgba(17, 95, 58, 0.62) 100%),
        url('https://images.unsplash.com/photo-1532187643603-ba119ca4109e?auto=format&fit=crop&w=1600&q=80');
    background-size: cover;
    background-position: center;
    color: #fff;
}

.home-hero-overlay {
    padding: 4rem 3rem;
}

.hero-kicker {
    letter-spacing: 0;
    color: #b7f7d1;
    font-size: clamp(1.9rem, 3vw, 2.7rem);
    line-height: 1.1;
}

.hero-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.home-metric-card {
    background: #ffffff;
    border: 1px solid #198754;
    border-radius: 0.75rem;
    padding: 1.25rem 1.35rem;
    box-shadow: 0 10px 24px rgba(15, 54, 33, 0.08);
}

.home-metric-label {
    color: #3f5548;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.45rem;
}

.home-metric-count {
    color: #163223;
    font-size: clamp(2rem, 3vw, 2.6rem);
    font-weight: 800;
    line-height: 1;
}

.content-band {
    background: #fff;
    border: 1px solid #dbe6dd;
    padding: 2rem;
}

.feature-panel,
.value-block,
.home-cta {
    background: #fff;
    border: 1px solid #dbe6dd;
    padding: 1.5rem;
}

.feature-list {
    padding-left: 1.1rem;
}

.feature-list li + li {
    margin-top: 0.75rem;
}

.value-block h3 {
    margin-bottom: 0.75rem;
}

.home-cta {
    background: linear-gradient(135deg, #e8f5ec 0%, #f8fbf9 100%);
}

.admin-dashboard-link {
    border: 1px solid #198754;
    background: #fff;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.admin-dashboard-link:hover {
    background: #198754;
    border-color: #198754;
    color: #fff !important;
}

.admin-dashboard-link:hover .admin-dashboard-link-label,
.admin-dashboard-link:hover .admin-dashboard-link-count {
    color: #fff !important;
}

.admin-dashboard-action {
    background: #fff;
    border: 1px solid #198754;
    color: #198754;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.admin-dashboard-action:hover {
    background: #198754;
    border-color: #198754;
    color: #fff;
}

.admin-back-button {
    min-width: 7rem;
    font-weight: 600;
}

.dashboard-tests-table th {
    background: #eef7f0;
    color: #163223;
    font-weight: 700;
    white-space: nowrap;
}

.dashboard-tests-table td,
.dashboard-tests-table th {
    vertical-align: top;
}

.selection-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.selection-chip {
    border-radius: 999px;
    white-space: normal;
    text-align: left;
}

.rich-editor {
    min-height: 3rem;
    padding: 0.65rem 0.8rem;
    border: 1px solid #ced4da;
    border-radius: 0.5rem;
    background: #f8f9fa;
    line-height: 1.5;
}

.rich-editor:focus {
    outline: 0;
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.12);
    background: #fff;
}

.rich-editor:empty::before {
    content: attr(data-placeholder);
    color: #6c757d;
}

.difficulty-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
    border: 1px solid transparent;
}

.difficulty-badge-easy {
    background: #e8f7ee;
    border-color: #b9e4c7;
    color: #146c43;
}

.difficulty-badge-moderate {
    background: #fff3cd;
    border-color: #ffe08a;
    color: #997404;
}

.difficulty-badge-hard {
    background: #ffe5d0;
    border-color: #ffc59a;
    color: #b45309;
}

.difficulty-badge-hardest {
    background: #fbe3e8;
    border-color: #f1b8c4;
    color: #b42318;
}

[data-unit-row].dragging {
    opacity: 0.55;
}

.unit-drag-handle {
    cursor: grab;
}

.progress-chart-wrap {
    width: 100%;
    overflow-x: auto;
}

.progress-chart {
    width: 100%;
    min-width: 320px;
    height: auto;
    display: block;
}

.progress-chart-axis {
    stroke: #597363;
    stroke-width: 1.2;
}

.progress-chart-grid {
    stroke: #dbe6dd;
    stroke-width: 1;
}

.progress-chart-line {
    fill: none;
    stroke: #198754;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.progress-chart-point {
    fill: #198754;
    stroke: #ffffff;
    stroke-width: 2;
}

.progress-chart-tick,
.progress-chart-label {
    fill: #4f6355;
    font-size: 11px;
}

.question-edit-modal .modal-dialog {
    width: min(94vw, 1240px);
    max-width: min(94vw, 1240px);
    height: 94vh;
    margin: 4vh auto;
}

.question-edit-modal .modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    border: 0;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(16, 46, 30, 0.28);
}

.question-edit-modal #questionEditForm {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.question-edit-modal .modal-header {
    flex: 0 0 auto;
    padding: 1rem 1.25rem;
}

.question-edit-modal .modal-body {
    flex: 1 1 0;
    height: 0;
    min-height: 0 !important;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 1.25rem 1.25rem;
    font-size: 0.95rem;
}

.question-edit-modal .modal-footer {
    flex: 0 0 auto;
    padding: 0.9rem 1.25rem 1.1rem;
    background: #fff;
    border-top: 1px solid #dbe6dd;
    box-shadow: 0 -10px 24px rgba(18, 54, 34, 0.08);
}

.question-edit-modal .form-label {
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.question-edit-modal .rich-editor,
.question-edit-modal .form-control,
.question-edit-modal .form-select {
    font-size: 0.95rem;
}

.question-edit-modal .selection-chip {
    padding: 0.45rem 0.8rem;
}

.question-update-flash {
    animation: questionUpdateFlash 2s ease;
}

@keyframes questionUpdateFlash {
    0% {
        background: #dff5e7;
        box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.18);
        border-color: #198754;
    }
    65% {
        background: #edf9f1;
        box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.1);
        border-color: #62b685;
    }
    100% {
        background: #fff;
        box-shadow: none;
        border-color: var(--bs-border-color, #dee2e6);
    }
}

@media (max-width: 991.98px) {
    .home-hero-overlay {
        padding: 2.5rem 1.5rem;
    }

    .question-edit-modal .modal-dialog {
        width: 96vw;
        max-width: 96vw;
        height: 95vh;
        margin: 3vh auto;
    }

    .question-edit-modal .modal-content {
        height: 100%;
        max-height: 100%;
        border-radius: 0.85rem;
    }
}

@media (max-width: 575.98px) {
    .hero-stat-grid {
        grid-template-columns: 1fr;
    }

    .question-palette {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .content-band,
    .feature-panel,
    .value-block,
    .home-cta {
        padding: 1.25rem;
    }

    .question-edit-modal .modal-body {
        padding: 1rem;
    }

    .question-edit-modal .modal-dialog {
        width: 98vw;
        max-width: 98vw;
        height: 97vh;
        margin: 2vh auto;
    }
}
