/**
 * Quiz Interface Styles
 * Exam header, questions, answers, navigation
 */

/* === Quiz Header === */
.quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bs-primary);
    color: var(--bs-white);
    padding: 0.25rem 0.5rem 0.25rem 0.75rem;
    min-height: 48px;
    overflow: hidden;
}

@media (min-width: 576px) {
    .quiz-header {
        padding: 0.25rem 1rem;
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 1;
    min-width: 0;
}

@media (min-width: 576px) {
    .header-left {
        gap: 0.75rem;
    }
}

.header-tafel {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
}

/* Shared muted label style */
.header-tafel-label,
.header-user-exam,
.header-timer-label,
.header-timer-unit {
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.8;
    letter-spacing: 0.05em;
}

.header-timer-label,
.header-timer-unit {
    font-size: 0.65rem;
    line-height: 1;
}

.header-tafel-number {
    font-size: 1.5rem;
    font-weight: 700;
}

@media (min-width: 576px) {
    .header-tafel-number {
        font-size: 1.75rem;
    }
}

.header-divider {
    font-size: 2rem;
    opacity: 0.5;
    font-weight: 300;
    align-self: stretch;
    display: flex;
    align-items: center;
}

.header-user {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
}

.header-user-name {
    font-size: 1.125rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 576px) {
    .header-user-name {
        font-size: 1.5rem;
    }

    .header-user-exam {
        font-size: 1rem;
    }
}

.header-timer {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

@media (min-width: 576px) {
    .header-timer {
        font-size: 1.5rem;
    }
}

.header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    line-height: 1;
    gap: 0;
    flex-shrink: 1;
    min-width: 0;
}

.header-right {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin: -0.25rem -0.5rem;
    margin-left: 0;
    flex-shrink: 0;
}

@media (min-width: 576px) {
    .header-right {
        margin: -0.25rem -1rem;
        margin-left: 0;
    }
}

.header-icon-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.125rem;
    background: var(--bs-gradient-btn-overlay), var(--bs-primary);
    border: none;
    color: var(--bs-white);
    cursor: pointer;
    padding: 0.375rem 0.5rem;
    font-size: 0.625rem;
    text-transform: uppercase;
    transition: background var(--quiz-transition-speed);
    min-width: var(--quiz-touch-target);
}

@media (min-width: 576px) {
    .header-icon-btn {
        gap: 0.25rem;
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
}

.header-icon-btn:hover {
    background: var(--bs-gradient-btn-overlay-hover), var(--quiz-info-hover);
}

/* Header Icon Buttons - Active State */
.header-icon-btn.active,
.header-icon-btn[aria-pressed="true"] {
    background: var(--bs-gradient-btn-overlay-hover), var(--quiz-feature-active-bg);
}

/* Mobile header: compact layout */
@media (max-width: 575.98px) {
    .quiz-header {
        justify-content: flex-start;
    }
    .header-center {
        align-items: flex-start;
        text-align: left;
        margin-left: 0.5rem;
    }
    .header-right {
        margin-left: auto;
        align-self: stretch;
        margin-right: -0.5rem;
    }
    .header-icon-btn {
        min-width: 40px;
        height: 100%;
    }
    .header-icon-btn span {
        display: none;
    }
    .header-timer-label-full,
    .header-timer-unit-full {
        display: none;
    }
    .header-user {
        display: none;
    }
}

@media (min-width: 576px) {
    .header-timer-unit-short {
        display: none;
    }
}

/* === Question Content Column === */
.question-content-column {
    background-color: var(--quiz-content-bg);
}

/* Below lg the picture and the question stack. The .row is as tall as the
   screen, and a wrapping row shares its spare height out between its lines,
   which put a pale band between the picture and the question. A column
   instead: the picture keeps its own height, the question column takes what
   is left (blue to the bottom of the screen). */
@media (max-width: 991.98px) {
    #question-content > .row {
        flex-direction: column;
        flex-wrap: nowrap;
    }

    #question-content > .row > .question-content-column {
        flex: 1 0 auto;
    }
}

/* === Question Text (inside question box) === */
.question-text {
    font-size: 1.125rem;
    font-weight: 400;
    color: var(--bs-body-color);
    margin: 0;
    line-height: 1.4;
    padding: 0.875rem 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@media (min-width: 576px) {
    .question-text {
        font-size: 1.25rem;
        padding: 1rem 1.25rem;
    }
}

/* === Question Box Container === */
.question-box {
    background-color: var(--bs-white);
    box-shadow: var(--bs-box-shadow-sm);
    position: relative;
    margin-bottom: 1.5rem;
    max-width: 100%;
    overflow: hidden;
}

.question-box::before {
    content: "";
    position: absolute;
    bottom: -12px;
    left: 30px;
    border-width: 12px 12px 0 0;
    border-style: solid;
    border-color: var(--bs-white) transparent transparent transparent;
}

/* === Multiple Choice Hint (inside question box) === */
.multiple-hint {
    background-color: var(--quiz-hint-bg);
    color: var(--bs-body-color);
    font-weight: 600;
    font-style: italic;
    padding: 0.5rem 1rem;
    margin: 0;
}

/* === Question Image === */
.question-image {
    max-height: 50vh;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    /* A flex item never shrinks below its picture's natural width; without
       this the picture overflowed its column from lg up and was cut off. */
    min-width: 0;
}

@media (min-width: 992px) {
    .question-image {
        max-height: 60vh;
        max-width: 900px;
    }
}

.question-image-wrapper {
    min-height: 200px;
}

/* While the next question's image loads, hide the <img> (it would still show
   the previous question's picture) and show the Bootstrap placeholder that
   follows it, sized like the picture will be. */
.image-loading {
    opacity: 0;
}

.question-image.image-loading {
    display: none !important;
}

.question-image-placeholder {
    display: none;
    width: min(100%, 75vh);
    aspect-ratio: 3 / 2;
}

.question-image.image-loading + .question-image-placeholder {
    display: block;
}

/* No picture (a text-only question, or its file is gone): the same space as a
   picture, but empty like on the real CBR exam, so the answers and buttons do
   not move. */
.question-image.no-image + .question-image-placeholder {
    display: block;
}

.question-image.no-image + .question-image-placeholder .placeholder {
    /* Bootstrap's .placeholder means "loading" (cursor: wait); nothing loads here */
    cursor: default;
    animation: none;
    background-color: transparent;
}

@media (min-width: 992px) {
    .question-image-placeholder {
        width: min(100%, 900px, 90vh);
    }
}

/* === Answer Options === */
.answer-option {
    display: flex;
    align-items: stretch;
    width: calc(100% - 40px);
    text-align: left;
    cursor: pointer;
    border: none;
    margin-bottom: 0.375rem;
    margin-left: 40px;
    padding: 0.75rem 1rem;
    background-color: var(--bs-white);
    font-size: 1rem;
    transition: background-color var(--quiz-transition-speed);
    position: relative;
    min-height: var(--quiz-touch-target);
}

.answer-option::before {
    content: "";
    position: absolute;
    left: -40px;
    top: 0;
    bottom: 0;
    width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bs-white);
    font-size: 1.25rem;
    font-weight: 700;
    color: transparent;
    box-shadow: var(--bs-box-shadow-sm);
}

@media (min-width: 576px) {
    .answer-option {
        width: calc(100% - 48px);
        margin-left: 48px;
    }

    .answer-option::before {
        left: -48px;
        width: var(--quiz-touch-target);
        font-size: 1.5rem;
    }
}

.answer-option:hover {
    background-color: var(--bs-tertiary-bg);
}

.answer-option:focus {
    outline: 2px solid var(--quiz-feature-active-bg);
    outline-offset: 2px;
}

.answer-option.selected {
    background-color: var(--quiz-feature-active-bg);
    color: var(--bs-white);
    font-weight: 500;
}

.answer-option.selected::before {
    content: "\2713";
    background-color: var(--quiz-feature-active-bg);
    color: var(--bs-white);
}

.answer-option.selected:hover,
.answer-option.selected:hover::before {
    background-color: var(--quiz-feature-active-hover);
}

.answer-option.text-bg-success::before {
    content: "\2713";
    background-color: inherit;
    color: inherit;
}

.answer-option.text-bg-danger::before {
    content: "\2717";
    background-color: inherit;
    color: inherit;
}

/* === Numeric Input === */
#numeric-answer-input {
    max-width: 200px;
    font-size: 1.5rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

/* === Bottom Navigation Bar === */
.quiz-nav {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    background-color: var(--bs-primary);
    padding: 0;
    margin: 0;
    border: none;
    box-shadow: none;
    min-height: var(--quiz-nav-height);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    /* Safe area for mobile devices with home indicator */
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Add padding to main content to account for fixed footer (the review's bar sits there too) */
#quiz-view,
#results-view {
    padding-bottom: calc(var(--quiz-nav-height) + env(safe-area-inset-bottom, 0));
}

/* Keyboard focus on the bottom bar's buttons: a light ring inside the blue bar */
.nav-btn:focus-visible {
    outline: 3px solid var(--bs-white);
    outline-offset: -4px;
}

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    background: var(--bs-gradient-btn-overlay), var(--bs-primary);
    border: none;
    color: var(--bs-white);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    /* .nav-btn is used on both <button> and <a> (the retry link), so the
       anchor's default underline has to be cleared here. */
    text-decoration: none;
    padding: 0 0.75rem;
    transition: background var(--quiz-transition-speed);
    min-width: 0;
    min-height: var(--quiz-nav-height);
    flex-shrink: 0;
}

@media (min-width: 576px) {
    .nav-btn {
        font-size: 1rem;
        padding: 0 1.5rem;
        gap: 0.5rem;
        min-width: 120px;
    }
}

.nav-btn:hover:not(:disabled) {
    background: var(--bs-gradient-btn-overlay-hover), var(--quiz-info-hover);
}

.nav-btn:disabled {
    background: var(--bs-gradient-btn-overlay), var(--bs-primary);
    opacity: 0.5;
    cursor: not-allowed;
}

/* Push next button to right when back/progress are hidden */
.nav-btn-next {
    margin-left: auto;
}

/* Submit Exam Button (red danger style) */
.nav-btn.nav-btn-danger {
    background: var(--bs-gradient-btn-overlay), var(--quiz-danger-bg);
}

.nav-btn.nav-btn-danger:hover:not(:disabled) {
    background: var(--bs-gradient-btn-overlay-hover), var(--quiz-danger-hover);
}

/* CTA Button (green style for shared question page) */
.nav-btn.btn-success-subtle {
    background: var(--bs-gradient-btn-overlay), var(--bs-secondary);
}

.nav-btn.btn-success-subtle:hover:not(:disabled) {
    background: var(--bs-gradient-btn-overlay-hover), var(--bs-secondary-hover);
}

.nav-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: var(--bs-white);
    background-color: var(--bs-primary);
    padding: 0 0.5rem;
    flex: 1;
    text-align: center;
    white-space: pre;
    min-width: 0;
    overflow: hidden;
}

@media (min-width: 576px) {
    .nav-progress {
        font-size: 1rem;
        padding: 0 2rem;
    }
}

/* === Quiz Layout === */
#quiz-view {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#quiz-view > .container-fluid {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#quiz-view .row {
    flex: 1;
}

@media (min-width: 992px) {
    #quiz-view .col-lg-5 {
        display: flex;
        flex-direction: column;
    }

    #quiz-view .col-lg-5 > .flex-grow-1 {
        flex: 1;
    }
}

/* === Footer === */
.quiz-footer {
    background-color: var(--bs-primary);
    color: var(--bs-white);
    text-align: center;
}

.quiz-footer small {
    font-size: 1rem;
}

/* Site footer - accounts for fixed quiz-nav displacement */
#site-footer {
    padding: 1.5rem 0 calc(var(--displace-bottom) + 1.5rem);
}

/* === Inline Overview Panel === */
#inline-overview,
#help-panel {
    flex: 1;
    background-color: var(--bs-white);
    padding: 2rem;
    overflow-y: auto;
}

.inline-overview-content {
    max-width: 900px;
    margin: 0 auto;
}

.overview-title,
.help-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--bs-body-color);
    margin-bottom: 0.5rem;
}

.help-title {
    margin-bottom: 1.5rem;
}

.overview-description {
    font-size: 1.125rem;
    color: var(--bs-secondary-color);
    margin-bottom: 1.5rem;
}

.overview-divider {
    border: none;
    border-top: 1px solid var(--bs-border-color);
    margin: 1.5rem 0;
}

.overview-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-box {
    width: 20px;
    height: 20px;
    border: 2px solid var(--bs-gray-500);
}

.legend-unanswered {
    background-color: var(--bs-white);
}

.legend-answered,
.overview-grid-item.answered,
.overview-grid-item.info {
    background-color: var(--bs-gray-500);
    border-color: var(--bs-gray-500);
    color: var(--bs-white);
}

.legend-unavailable {
    background-color: var(--bs-gray-400);
    border-color: var(--bs-gray-400);
}

.legend-star {
    font-size: 1.25rem;
    color: var(--quiz-feature-active-bg);
}

/* === Overview Grid (Inline) === */
.overview-grid-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Preview image in the overview popovers; aspect-ratio keeps the popover from
   changing height (and jumping) when the image arrives. */
.popover-thumb {
    max-height: 150px;
    object-fit: contain;
    aspect-ratio: auto 3 / 2;
}

.overview-grid-item {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bs-gray-500);
    background-color: var(--bs-white);
    font-size: 1.25rem;
    color: var(--bs-body-color);
    cursor: pointer;
    position: relative;
    transition: all var(--quiz-transition-speed);
}

.overview-grid-item:hover {
    border-color: var(--bs-primary);
    background-color: var(--quiz-grid-item-hover-bg, #f0f7ff);
}

.overview-grid-item.current {
    border-color: var(--bs-primary);
    border-width: 3px;
    background-color: var(--quiz-grid-item-current-bg, #b8c5d0);
}

.marked-indicator {
    position: absolute;
    top: -8px;
    right: -4px;
    font-size: 1.25rem;
}

.overview-grid-item.info {
    font-style: italic;
}

/* === Help Panel === */
.help-content {
    max-width: 700px;
    margin: 0 auto;
}

.help-text .help-intro {
    font-size: 1.125rem;
    color: var(--bs-secondary-color);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.help-text h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--bs-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.help-text h3:first-of-type {
    margin-top: 0;
}

.help-text p {
    font-size: 1rem;
    color: var(--bs-secondary-color);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.help-text strong {
    color: var(--bs-body-color);
}

/* === Ordering Question Styles === */

/* Order question layout - stack vertically */
#question-content[data-question-type="order"] .row {
    flex-direction: column;
}

#question-content[data-question-type="order"] .col-12.col-lg-7,
#question-content[data-question-type="order"] .col-12.col-lg-5 {
    width: 100%;
    max-width: 100%;
    flex: none;
}

#question-content[data-question-type="order"] .question-content-column {
    order: -1;
}

@media (max-width: 991.98px) {
    #question-content[data-question-type="order"] .col-12.col-lg-5 {
        flex: 1 0 auto;
    }
}

#question-content[data-question-type="order"] .question-box {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* The picture of an order question is drawn inside the answers: hide the whole
   picture column (hiding only .question-image-wrapper lost against its .d-flex
   and left an empty 200px box under the question). */
#question-content[data-question-type="order"] .col-12.col-lg-7 {
    display: none;
}

.order-instruction {
    display: none;
}

.hotspot-instruction {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background-color: var(--bs-light);
    border-left: 4px solid var(--bs-primary);
    border-radius: var(--bs-border-radius);
    color: var(--bs-secondary);
    font-style: italic;
}

.draggable-numbers {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.draggable-number,
.dropped-number {
    width: var(--quiz-touch-target);
    height: var(--quiz-touch-target);
    background: transparent;
    color: var(--quiz-feature-active-bg);
    border: 3px solid var(--quiz-feature-active-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    cursor: grab;
    user-select: none;
    transition: transform var(--quiz-transition-speed), background-color var(--quiz-transition-speed);
}

.dropped-number {
    width: 48px;
    height: 48px;
    cursor: pointer;
}

.draggable-number:active,
.draggable-number.dragging {
    cursor: grabbing;
    transform: scale(1.1);
}

.draggable-number.keyboard-selected {
    outline: 3px solid var(--quiz-feature-active-bg);
    outline-offset: 2px;
    transform: scale(1.1);
}

.touch-drag-clone {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(1.2);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: transparent;
    color: var(--quiz-feature-active-bg);
    border: 3px solid var(--quiz-feature-active-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(var(--bs-black-rgb), 0.3);
}

/* Same size as every other question picture (see .hotspot-image-container) */
.order-image-container {
    position: relative;
    width: min(100%, 75vh);
    margin: 1rem auto;
}

@media (min-width: 992px) {
    .order-image-container {
        width: min(100%, 900px, 90vh);
    }
}

.order-question-image {
    display: block;
    width: 100%;
    height: auto;
}

/* Same size as a question picture (.question-image: 50vh / 60vh high, at
   most 900px wide; for a 3:2 picture that is 75vh / 90vh wide), so the
   layout does not jump between a hotspot question and the one before it. */
.hotspot-image-container {
    position: relative;
    width: min(100%, 75vh);
    margin: 0 auto;
    border-radius: var(--bs-border-radius-lg);
    overflow: hidden;
}

@media (min-width: 992px) {
    .hotspot-image-container {
        width: min(100%, 900px, 90vh);
    }
}

.image-drop-zone {
    position: absolute;
    width: 52px;
    height: 52px;
    border: 3px dashed var(--quiz-feature-active-bg);
    border-radius: 50%;
    background-color: rgba(var(--quiz-feature-active-bg-rgb), 0.25);
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: all var(--quiz-transition-speed);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
}

.order-image-container.is-dragging .image-drop-zone,
.image-drop-zone:focus-visible {
    opacity: 1;
    pointer-events: auto;
}

/* A shared question after "controleer": the placed number in its own colour, the right one next to it */
.image-drop-zone.order-result-right .dropped-number { box-shadow: 0 0 0 3px var(--at-exam-green); }
.image-drop-zone.order-result-wrong .dropped-number { box-shadow: 0 0 0 3px var(--quiz-danger-bg); }
.image-drop-zone .order-result-correct { position: absolute; top: -0.5rem; right: -1.25rem; }

.image-drop-zone:hover,
.image-drop-zone.drag-over {
    border-color: var(--quiz-feature-active-bg);
    background-color: rgba(var(--quiz-feature-active-bg-rgb), 0.4);
    transform: translate(-50%, -50%) scale(1.1);
}

.image-drop-zone.filled {
    border: none;
    background: transparent;
    opacity: 1;
    pointer-events: auto;
}

/* Traffic-sign thumbnails in the review (js/utils/sign-images.js): 30x30 boxes, the sign kept in proportion */
.sign-image-thumb {
    object-fit: contain;
}

/* === Hotspot Question === */
.hotspot-question-image {
    display: block;
    width: 100%;
    height: auto;
}

.hotspot-zone {
    position: absolute;
    background-color: rgba(var(--bs-white-rgb), 0.1);
    border: 4px solid rgba(var(--bs-white-rgb), 0.6);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--quiz-transition-speed);
    padding: 0;
    font: inherit;
    color: inherit;
    box-shadow: 0 0 0 2px rgba(var(--bs-black-rgb), 0.3);
}

.hotspot-zone:hover {
    border-color: var(--quiz-feature-active-bg);
    background-color: rgba(var(--quiz-feature-active-bg-rgb), 0.25);
    box-shadow: 0 0 0 3px rgba(var(--bs-black-rgb), 0.4), 0 0 20px rgba(var(--quiz-feature-active-bg-rgb), 0.5);
    transform: scale(1.02);
}

.hotspot-zone:focus {
    outline: none;
    border-color: var(--quiz-feature-active-bg);
    background-color: rgba(var(--quiz-feature-active-bg-rgb), 0.2);
    box-shadow: 0 0 0 4px rgba(var(--quiz-feature-active-bg-rgb), 0.6);
}

.hotspot-zone:focus-visible {
    outline: 4px solid var(--quiz-feature-active-bg);
    outline-offset: 2px;
    border-color: var(--bs-white);
    background-color: rgba(var(--quiz-feature-active-bg-rgb), 0.25);
}

.hotspot-zone.selected {
    border-color: var(--bs-primary);
    border-width: 5px;
    background-color: rgba(var(--bs-primary-rgb), 0.4);
    box-shadow: 0 0 0 3px rgba(var(--bs-black-rgb), 0.3), 0 0 25px rgba(var(--bs-primary-rgb), 0.7), inset 0 0 20px rgba(var(--bs-primary-rgb), 0.3);
}

/* === Hotspot Results === */
.hotspot-result-container {
    border-radius: var(--bs-border-radius-lg);
    overflow: hidden;
}

.hotspot-result-zone {
    position: absolute;
    border: 3px solid transparent;
    border-radius: 4px;
    box-sizing: border-box;
    pointer-events: none;
}

.hotspot-result-zone.border-success,
.hotspot-result-zone.border-danger {
    border-width: 4px !important;
}

.hotspot-result-label {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.875rem;
    line-height: 1.2;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--bs-white);
}

/* The label sits outside its zone: the chosen one above, the right one below, so two zones never collide
   on one label line; near a picture edge the label hugs that edge instead of running off the picture */
.hotspot-result-label.badge {
    border-radius: 4px;
    white-space: nowrap;
    bottom: 100%;
    margin-bottom: 2px;
}
.hotspot-result-label.text-bg-success { bottom: auto; top: 100%; margin-top: 2px; }
.hotspot-result-label.label-start { left: 0; transform: none; }
.hotspot-result-label.label-end { left: auto; right: 0; transform: none; }

/* === Exam Selection === */
.exam-btn {
    min-height: 88px; /* 44px touch target x 2 for stacked content */
}

.exam-btn.btn-warning {
    --bs-btn-bg: var(--quiz-feature-active-bg);
    --bs-btn-border-color: var(--quiz-feature-active-bg);
    --bs-btn-hover-bg: var(--quiz-feature-active-hover);
    --bs-btn-hover-border-color: var(--quiz-feature-active-hover);
    --bs-btn-color: var(--bs-white);
    --bs-btn-hover-color: var(--bs-white);
}

.exam-btn-locked {
    cursor: pointer; /* Still clickable to show info */
}

.exam-btn-locked:hover {
    opacity: 0.7;
}

.exam-lock-icon {
    font-size: 0.75em;
    margin-left: 0.25em;
}

/* === Pass/Fail Display === */
#pass-fail-container {
    padding: 1rem;
}

/* Score card - ensure text doesn't wrap */
#final-score,
#score-percentage {
    white-space: nowrap;
}

.pass-fail-icon {
    width: 80px;
    height: 80px;
    fill: currentColor;
}

.pass-fail-text {
    font-size: 2.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

@media (min-width: 768px) {
    .pass-fail-text {
        font-size: 3.5rem;
    }
}

/* === Results Review Navigation === */
/* Square arrow buttons on small screens; the labels appear from md up */
.nav-btn.nav-btn-review {
    min-width: var(--quiz-nav-height);
    padding: 0 1rem;
}

/* Land a jumped-to card below the fixed site nav, with some air */
.result-card {
    scroll-margin-top: calc(var(--displace-top) + 1rem);
}

/* === Purchase Tier Choice ===
   Selection is never shown by colour alone: a radio check and "Gekozen" mark
   it, plus a primary border and tint. The border width stays fixed (the extra
   weight is an inset shadow), so cards never shift. Focus is a separate dark
   outline outside the card, so "focused" never looks like "selected". */
.tier-option {
    cursor: pointer;
    border-width: 2px;
    border-color: var(--bs-border-color);
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    transition: border-color var(--quiz-transition-speed, 0.15s) ease;
}

.tier-option:hover {
    border-color: var(--bs-primary);
}

/* Radio circle drawn with borders only: a thick border is the filled state,
   which survives forced-colors mode where backgrounds are dropped */
.tier-option-radio {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--bs-secondary-color);
    border-radius: 50%;
    background-color: var(--bs-body-bg);
}

.tier-option-checked {
    display: none;
}

.btn-check:checked + .tier-option .tier-option-radio {
    border: 0.375rem solid var(--bs-primary);
}

.btn-check:checked + .tier-option {
    border-color: var(--bs-primary);
    box-shadow: inset 0 0 0 1px var(--bs-primary);
    background-color: color-mix(in srgb, var(--bs-primary) 7%, var(--bs-body-bg));
}

.btn-check:checked + .tier-option .tier-option-checked {
    display: inline;
}

.btn-check:checked + .tier-option .tier-option-unchecked {
    display: none;
}

.btn-check:focus-visible + .tier-option {
    outline: 3px solid var(--bs-body-color);
    outline-offset: 3px;
}

/* Windows High Contrast drops fills and shadows: keep a heavier system-colour
   border on the selected card (the border-drawn radio survives on its own) */
@media (forced-colors: active) {
    .btn-check:checked + .tier-option {
        border-color: Highlight;
        border-width: 4px;
        padding: calc(1rem - 2px) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tier-option {
        transition: none;
    }
}

/* === Results Overview Popovers === */
.overview-grid-item[data-bs-toggle="popover"] + .popover {
    max-width: 300px;
}

/* === SVG Icons (using sprite with currentColor) === */
.header-icon {
    fill: currentColor;
}

.timer-icon {
    fill: currentColor;
    opacity: 0.8;
}

/* === Visibility Toggles (JS) === */
.hidden-image,
.hidden-number {
    display: none !important;
}

.visible-image {
    display: block !important;
}

.visible-number {
    display: flex !important;
}

/* Headings that receive focus from script (question, panels) are not controls: no focus ring */
#question-text:focus,
.help-title:focus,
.overview-title:focus {
    outline: 0;
}

/* Urgent news toast (js/news-alert.js): site colours, so it reads as Atheorie and not as part of the exam */
.news-alert-toast {
    --bs-toast-border-color: var(--bs-primary);
    --bs-toast-header-bg: var(--bs-primary);
    --bs-toast-header-color: var(--bs-white);
    --bs-toast-max-width: 22rem;
}
.news-alert-toast .btn-close {
    filter: var(--bs-btn-close-white-filter);
}
