html {
    scroll-behavior: auto;
    scroll-padding-top: 88px;
}

.concept-link {
    color: var(--mac-maroon, #7A003C);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.concept-link:hover {
    color: #5A002D;
}

/* Student-facing references use the same visual treatment whether they
   point to the skill tree or an external documentation page. */
main a[href]:not(:is(
    .portal-button,
    .lab-card,
    .stage-btn,
    .nav-button,
    .utility-button,
    .sidebar-handle,
    .tab-button,
    .code-tab,
    [role="button"],
    [role="tab"]
)) {
    color: var(--mac-maroon, #7A003C);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

main a[href]:not(:is(
    .portal-button,
    .lab-card,
    .stage-btn,
    .nav-button,
    .utility-button,
    .sidebar-handle,
    .tab-button,
    .code-tab,
    [role="button"],
    [role="tab"]
)):hover {
    color: #5A002D;
}

/* These structural regions receive programmatic focus when a view opens.
   Suppress the browser's large default outline without affecting controls. */
.stage-panel[tabindex="-1"]:focus,
.skill-view-panel[tabindex="-1"]:focus {
    outline: none;
}

.lab-page-title {
    color: #000000 !important;
}

.lab-title-prefix {
    color: #000000;
    -webkit-text-fill-color: #000000;
}

.lab-title-gradient {
    display: inline;
    color: var(--mac-maroon, #7A003C);
    background-image: linear-gradient(
        90deg,
        var(--mac-maroon, #7A003C) 0%,
        var(--mac-maroon-80, #A0195B) 52%,
        var(--mac-gold, #FDBF57) 100%
    );
    background-repeat: no-repeat;
    background-size: 100% 100%;
    -webkit-box-decoration-break: slice;
    box-decoration-break: slice;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

@media (forced-colors: active) {
    .lab-title-prefix,
    .lab-title-gradient {
        color: CanvasText;
        background: none;
        -webkit-text-fill-color: CanvasText;
    }
}

.skill-map-section {
    margin-top: 1rem;
}

.skill-tree-embed {
    overflow: hidden;
    margin-top: 1rem;
    border: 1px solid rgba(73, 89, 101, 0.16);
    border-radius: 14px;
    background: #F4F5F8;
}

.skill-tree-embed iframe {
    display: block;
    width: 100%;
    height: min(820px, calc(100vh - 120px));
    min-height: 680px;
    border: 0;
}

.skill-tree-fallback {
    margin: 1rem 0 0;
}

.learning-outcome-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.8rem;
    margin-top: 1rem;
}

.learning-outcome-card {
    border: 1px solid rgba(73, 89, 101, 0.14);
    border-left: 4px solid var(--mac-maroon);
    border-radius: 12px;
    background: #fff;
    padding: 0.9rem 1rem;
}

.learning-outcome-card strong {
    display: block;
    color: var(--mac-maroon);
    margin-bottom: 0.35rem;
}

.learning-outcome-card ul {
    margin: 0;
    padding-left: 1.15rem;
}

.subsection-title,
.section-card h3:not(.skill-node-title):not(.section__h) {
    border-left: 4px solid var(--mac-gold);
    padding-left: 0.65rem;
}

/* Section labels introduce the purpose of each card (for example, Scenario or Overview). */
.section-card > .eyebrow,
.section-card > p.uppercase {
    margin: 0 0 0.7rem;
    color: var(--mac-maroon);
    font-size: clamp(0.9rem, 1.1vw, 1.05rem) !important;
    font-weight: 800 !important;
    letter-spacing: 0.13em !important;
    line-height: 1.2;
    text-transform: uppercase;
}

/* Direct card headings identify the purpose of each lab section. */
.section-card > h2 {
    margin: 0 0 0.9rem;
    color: var(--mac-maroon, #7A003C);
    font-size: clamp(1.35rem, 2vw, 1.7rem) !important;
    font-weight: 800 !important;
    letter-spacing: -0.015em;
    line-height: 1.18;
}

/* Number every lab stage from the first visible Prepare/Overview page onward. */
.stage-panel[data-checkpoint-number] {
    position: relative;
}

.stage-panel[data-checkpoint-number]::before {
    content: attr(data-checkpoint-number);
    position: absolute;
    left: -17px;
    top: 0;
    z-index: 2;
    display: flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border: 4px solid white;
    border-radius: 999px;
    color: white;
    background: var(--mac-maroon, #7A003C);
    font-size: 0.84rem;
    font-weight: 700;
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.18);
}

.activity-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin-top: 1.35rem;
    margin-bottom: 0.75rem;
    border-left: 0 !important;
    padding-left: 0 !important;
    color: var(--lab-text);
    font-size: clamp(1.18rem, 1.6vw, 1.42rem) !important;
    line-height: 1.2;
}

.activity-heading__label {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    border-radius: 999px;
    background: var(--mac-maroon);
    color: #FFFFFF;
    padding: 0.28rem 0.62rem;
    font-family: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.activity-heading__title {
    min-width: 12rem;
    color: var(--lab-text);
    font-weight: 800;
}

.hint-lock-message {
    margin: 0.4rem 0 0.8rem;
    color: #5B3900;
    font-size: 0.88rem;
    font-weight: 700;
}

.stage-gate-message {
    display: none;
    width: 100%;
    margin: 1rem 0;
    border: 1px solid rgba(196, 154, 108, 0.52);
    border-radius: 10px;
    background: var(--mac-gold-20);
    color: #5B3900;
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
    font-weight: 750;
}

.stage-gate-message.show {
    display: block;
}

.stage-gate-message.locked {
    border-color: rgba(122, 0, 60, 0.22);
    background: #FBF7F9;
    color: var(--mac-maroon);
}

/* Shared completion badge for every lab-manual stage, including the active stage. */
.stage-bar .stage-bar-inner .stage-btn.completed::after {
    content: "\2713";
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin-left: 0.45rem;
    border: 0;
    border-radius: 50%;
    background: #DDF5E7;
    color: #16794A;
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
    vertical-align: -0.18em;
}

.stage-panel-locked article,
.stage-panel-locked .section-card {
    position: relative;
}

.stage-panel-locked input,
.stage-panel-locked select,
.stage-panel-locked textarea,
.stage-panel-locked button:not(.nav-button.secondary):not(.code-tab):not([role="tab"]) {
    cursor: not-allowed;
}

.stage-panel-locked .drag-order-card {
    cursor: not-allowed;
    opacity: 0.62;
}

.stage-panel[tabindex="-1"]:focus,
.tab-content[tabindex="-1"]:focus {
    outline: none;
}

/* A subpage that is not selected must never leak its questions or controls
   through a lab-specific display rule. */
.tab-content[hidden],
[role="tabpanel"][hidden],
.tab-content[aria-hidden="true"] {
    display: none !important;
}

.code-tab:focus-visible {
    outline: 3px solid rgba(253, 191, 87, 0.82);
    outline-offset: -3px;
}

.nav-button:disabled,
.utility-button:disabled,
.quiz-check-button:disabled {
    cursor: not-allowed !important;
    opacity: 0.52;
}

details[data-gated-hint].is-locked summary {
    color: var(--mac-grey-80);
}

.drag-order-note {
    margin: 0.25rem 0 0.75rem;
    color: var(--mac-grey);
    font-size: 0.92rem;
    font-weight: 700;
}

.order-grid[data-dnd-order] {
    display: block !important;
    width: 100%;
}

.drag-order-wide-column {
    grid-column: 1 / -1;
    min-width: 0;
}

.order-grid-fallback[hidden] {
    display: none !important;
}

.drag-order-shell {
    position: relative;
    --drag-shell-section-bleed: 1.75rem;
    margin: 1rem calc(-1 * var(--drag-shell-section-bleed));
    --wrap-entry-offset: 5rem;
    border-top: 1px solid rgba(73, 89, 101, 0.14);
    border-right: 0;
    border-bottom: 1px solid rgba(73, 89, 101, 0.14);
    border-left: 0;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.72);
    padding: 2.15rem calc(1.35rem + var(--drag-shell-section-bleed)) 1.35rem;
    overflow: visible;
}

.drag-order-shell-label {
    position: absolute;
    top: 0.65rem;
    right: 0.8rem;
    border: 1px solid rgba(122, 0, 60, 0.16);
    border-radius: 999px;
    background: #FFFFFF;
    color: var(--mac-maroon);
    padding: 0.16rem 0.5rem;
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.drag-order-list {
    position: relative;
    z-index: 2;
    display: grid;
    gap: 2.05rem 2.4rem;
    margin: 0;
}

/* Multi-row snake layouts need a dedicated lane for the long return arrow.
   This adds vertical clearance without changing any individual card width. */
.drag-order-snake.has-wrap-connector {
    row-gap: 3rem;
}

.drag-order-list + .utility-button {
    margin-top: 1rem;
}

.drag-order-wrap-connectors {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.drag-order-wrap-path {
    fill: none;
    stroke: rgba(122, 0, 60, 0.42);
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.drag-order-wrap-arrowhead {
    fill: rgba(122, 0, 60, 0.58);
}

.drag-order-snake {
    position: relative;
    grid-template-columns: repeat(var(--snake-columns, 4), minmax(0, 1fr));
    grid-auto-rows: var(--drag-card-height, minmax(4.3rem, auto));
}

.drag-order-card {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.7rem;
    grid-column: var(--snake-col);
    grid-row: var(--snake-row);
    align-self: stretch;
    width: 100%;
    height: var(--drag-card-height, auto);
    min-height: 4.2rem;
    box-sizing: border-box;
    border: 1px solid rgba(73, 89, 101, 0.13);
    border-radius: 10px;
    background: white;
    padding: 0.72rem 0.85rem;
    cursor: grab;
    font-weight: 700;
    box-shadow: 0 6px 14px rgba(73, 89, 101, 0.045);
    user-select: none;
    transition: border-color 120ms ease, box-shadow 120ms ease, opacity 120ms ease, transform 120ms ease;
}

.drag-order-card.is-wrap-entry {
    width: 100%;
    margin-left: 0;
}

.drag-order-card::before,
.drag-order-card::after {
    content: "";
    position: absolute;
    z-index: 2;
    pointer-events: none;
}

.drag-order-card[data-snake-direction="right"]::before {
    top: 50%;
    left: 100%;
    width: 2.4rem;
    height: 2px;
    transform: translateY(-50%);
    background: rgba(122, 0, 60, 0.42);
}

.drag-order-card[data-snake-direction="right"]::after {
    top: 50%;
    right: -2.43rem;
    width: 0;
    height: 0;
    transform: translateY(-50%);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 8px solid rgba(122, 0, 60, 0.58);
}

.drag-order-card[data-snake-direction="down-stack"]::before {
    bottom: -1.35rem;
    width: 2px;
    height: 1.35rem;
    background: rgba(122, 0, 60, 0.42);
}

.drag-order-card[data-snake-direction="down-stack"]::before {
    left: 50%;
    transform: translateX(-50%);
}

.drag-order-card[data-snake-direction="down-stack"]::after {
    bottom: -1.46rem;
    width: 0;
    height: 0;
    border-top: 8px solid rgba(122, 0, 60, 0.58);
    border-right: 5px solid transparent;
    border-left: 5px solid transparent;
}

.drag-order-card[data-snake-direction="down-stack"]::after {
    left: 50%;
    transform: translateX(-50%);
}

.drag-order-card[data-snake-direction="wrap"]::before,
.drag-order-card[data-snake-direction="wrap"]::after,
.drag-order-card[data-snake-direction="end"]::before,
.drag-order-card[data-snake-direction="end"]::after {
    display: none;
}

.drag-order-card.is-snake-start {
    border-color: rgba(40, 122, 75, 0.3);
}

.drag-order-card.is-snake-end {
    border-color: rgba(122, 0, 60, 0.26);
}

.drag-order-card:active {
    cursor: grabbing;
}

.drag-order-shell.is-drag-active {
    border-color: rgba(122, 0, 60, 0.34);
    background: rgba(253, 191, 87, 0.08);
    box-shadow: inset 0 0 0 2px rgba(122, 0, 60, 0.06);
}

.drag-order-shell.is-drag-active .drag-order-card {
    cursor: grabbing;
}

.drag-order-card.is-dragging {
    opacity: 0.48;
    border-color: rgba(122, 0, 60, 0.46);
    box-shadow: 0 10px 22px rgba(73, 89, 101, 0.12);
    transform: scale(0.985);
}

.drag-order-card.is-drop-preview {
    border-color: rgba(122, 0, 60, 0.55);
}

.drag-order-card.is-drop-preview[data-drop-axis="horizontal"][data-drop-side="before"] {
    box-shadow: inset 5px 0 0 var(--mac-maroon), 0 8px 18px rgba(73, 89, 101, 0.08);
}

.drag-order-card.is-drop-preview[data-drop-axis="horizontal"][data-drop-side="after"] {
    box-shadow: inset -5px 0 0 var(--mac-maroon), 0 8px 18px rgba(73, 89, 101, 0.08);
}

.drag-order-card.is-drop-preview[data-drop-axis="vertical"][data-drop-side="before"] {
    box-shadow: inset 0 5px 0 var(--mac-maroon), 0 8px 18px rgba(73, 89, 101, 0.08);
}

.drag-order-card.is-drop-preview[data-drop-axis="vertical"][data-drop-side="after"] {
    box-shadow: inset 0 -5px 0 var(--mac-maroon), 0 8px 18px rgba(73, 89, 101, 0.08);
}

.drag-order-card:focus,
.drag-order-card:focus-within {
    outline: 3px solid rgba(253, 191, 87, 0.72);
    outline-offset: 3px;
}

.drag-order-index {
    display: inline-grid;
    place-items: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 999px;
    background: var(--mac-maroon);
    color: white;
    font-size: 0.82rem;
    font-weight: 900;
}

.drag-order-card-label {
    min-width: 0;
    color: var(--lab-text);
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.evidence-upload {
    display: block;
    width: 100%;
    box-sizing: border-box;
    clear: both;
    border: 1px dashed rgba(122, 0, 60, 0.32);
    border-radius: 12px;
    background: #fff;
    padding: 0.85rem;
}

.evidence-upload > small {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
    line-height: 1.45;
}

.evidence-upload input[type="file"] {
    display: block;
    width: 100%;
    margin-top: 0.45rem;
}

.file-name-preview {
    display: block;
    margin-top: 0.35rem;
    color: var(--mac-grey);
    font-size: 0.85rem;
    font-weight: 700;
}

.file-name-preview.is-success {
    color: #1F623E;
}

.file-name-preview.is-error {
    color: #9F1239;
}

.evidence-upload:has(input[aria-invalid="true"]) {
    border-color: #BE123C;
    background: #FFF7F8;
}

.evidence-upload input[type="file"]:focus-visible {
    outline: 3px solid rgba(253, 191, 87, 0.72);
    outline-offset: 3px;
}

.task-banner-heading {
    margin: 0 0 1rem;
    border-left: 5px solid var(--mac-gold);
    border-radius: 0 10px 10px 0;
    background: linear-gradient(90deg, rgba(253, 191, 87, 0.2), rgba(253, 191, 87, 0.04));
    color: var(--lab-text);
    padding: 0.85rem 1rem;
    font-size: clamp(1.2rem, 2.3vw, 1.65rem);
    font-weight: 850;
    line-height: 1.25;
}

.screenshot-placeholder {
    width: 100%;
    margin: 1rem 0;
}

.screenshot-placeholder__box {
    display: grid;
    min-height: 11rem;
    place-items: center;
    border: 2px dashed rgba(122, 0, 60, 0.4);
    border-radius: 12px;
    background:
        linear-gradient(135deg, rgba(122, 0, 60, 0.025) 25%, transparent 25%) 0 0 / 22px 22px,
        linear-gradient(315deg, rgba(253, 191, 87, 0.08) 25%, transparent 25%) 0 0 / 22px 22px,
        #FCFCFD;
    color: var(--lab-text);
    padding: clamp(1rem, 3vw, 2rem);
    text-align: center;
    font-weight: 750;
    line-height: 1.5;
}

.screenshot-placeholder figcaption {
    margin-top: 0.45rem;
    color: var(--mac-grey);
    font-size: 0.82rem;
}

.resource-placeholder {
    border: 1px solid rgba(196, 154, 108, 0.5);
    border-left: 5px solid var(--mac-gold);
    border-radius: 10px;
    background: var(--mac-gold-20);
    color: #5B3900;
    padding: 1rem;
}

.learning-outcomes-achieved {
    margin-top: 1.5rem;
    border: 1px solid rgba(40, 122, 75, 0.24);
    border-left: 5px solid #287A4B;
    border-radius: 10px;
    background: #F4FAF6;
    padding: clamp(1rem, 2vw, 1.4rem);
}

.learning-outcomes-achieved h2,
.learning-outcomes-achieved h3 {
    margin-top: 0;
    color: var(--lab-text);
}

.classification-table td {
    vertical-align: middle;
}

.classification-table td:first-child {
    width: min(58%, 34rem);
    font-weight: 700;
}

.classification-table select {
    min-width: 11rem;
}

.skill-map-toolbar,
.skill-view-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin: 1rem 0;
}

.skill-map-control,
.skill-view-tab {
    min-height: 42px;
    border: 1px solid #DCE2E8;
    border-radius: 9px;
    background: white;
    color: var(--mac-grey);
    padding: 0.58rem 0.85rem;
    font-weight: 800;
    cursor: pointer;
}

.skill-map-control:hover,
.skill-view-tab:hover {
    background: var(--mac-grey-20);
}

.skill-view-tab[aria-selected="true"],
.skill-map-control.primary {
    border-color: var(--mac-maroon);
    background: var(--mac-maroon);
    color: white;
}

.skill-view-panel[hidden] {
    display: none;
}

.skill-map-search {
    display: grid;
    gap: 0.75rem;
    margin: 1rem 0;
}

.skill-map-search input,
.skill-map-search select {
    min-height: 46px;
    width: 100%;
    border: 1px solid #CBD5E1;
    border-radius: 10px;
    background: white;
    padding: 0.7rem 0.85rem;
    color: var(--lab-text);
}

.skill-map-search-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
    gap: 0.75rem;
}

.skill-map-status {
    min-height: 1.4rem;
    color: var(--mac-grey);
    font-size: 0.86rem;
    font-weight: 700;
}

.skill-map-no-results {
    display: none;
    border-radius: 12px;
    border: 1px solid var(--mac-gold-60);
    background: var(--mac-gold-20);
    color: #5B3900;
    padding: 0.9rem 1rem;
}

.skill-map-no-results.show {
    display: block;
}

.skill-tree,
.skill-tree ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.skill-root-system,
.skill-preview-root-system {
    position: relative;
    margin-top: 1.2rem;
}

.course-root-card {
    position: relative;
    z-index: 2;
    width: min(100%, 560px);
    margin: 0 auto;
    border: 2px solid var(--mac-maroon);
    border-radius: 999px;
    background:
        radial-gradient(circle at 22% 22%, rgba(253, 191, 87, 0.32), transparent 34%),
        linear-gradient(135deg, #FFFFFF 0%, #FFF8EA 100%);
    box-shadow: 0 18px 38px rgba(122, 0, 60, 0.13);
    padding: 1.1rem 1.4rem;
    text-align: center;
}

.course-root-card h3 {
    margin: 0.12rem 0 0.25rem;
    color: var(--mac-maroon);
    font-size: clamp(1.25rem, 2.2vw, 1.7rem);
    line-height: 1.15;
}

.course-root-card p {
    margin: 0 auto 0.5rem;
    max-width: 44rem;
    color: var(--mac-grey);
}

.course-root-label {
    color: var(--mac-maroon) !important;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.skill-tree {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.15rem;
    margin-top: 3.8rem;
    padding-top: 2.2rem;
}

.skill-root-system::before {
    content: "";
    position: absolute;
    top: calc(100px + 0.8rem);
    left: 50%;
    width: 3px;
    height: 3.2rem;
    transform: translateX(-50%);
    border-radius: 999px;
    background: linear-gradient(#7A003C, #C49A6C);
}

.skill-tree::before {
    content: "";
    position: absolute;
    top: 0;
    left: 9%;
    right: 9%;
    height: 2rem;
    border-top: 3px solid rgba(196, 154, 108, 0.55);
    border-radius: 48% 48% 0 0;
}

.skill-tree::after {
    content: "";
    position: absolute;
    top: -2.2rem;
    left: 50%;
    width: 3px;
    height: 2.35rem;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(196, 154, 108, 0.7);
}

.skill-tree > .skill-node {
    position: relative;
    min-width: 0;
}

.skill-tree > .skill-node::before {
    content: "";
    position: absolute;
    top: -2.15rem;
    left: 50%;
    width: 3px;
    height: 2.15rem;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(196, 154, 108, 0.55);
}

.skill-tree ul {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 1.05rem;
    padding-left: 1.15rem;
}

.skill-tree ul[hidden] {
    display: none;
}

.skill-tree ul::before {
    content: "";
    position: absolute;
    left: 0.28rem;
    top: 0.25rem;
    bottom: 0.25rem;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(rgba(196, 154, 108, 0.78), rgba(122, 0, 60, 0.2));
}

.skill-node-card {
    position: relative;
    display: grid;
    gap: 0.65rem;
    border-radius: 22px;
    border: 1px solid rgba(73, 89, 101, 0.12);
    border-left: 6px solid var(--mac-maroon);
    background:
        radial-gradient(circle at top left, rgba(253, 191, 87, 0.14), transparent 32%),
        #FFFFFF;
    padding: 1rem;
}

.skill-tree > .skill-node > .skill-node-card {
    border-radius: 26px;
    border: 1px solid rgba(122, 0, 60, 0.18);
    border-bottom: 6px solid var(--mac-maroon);
    background: linear-gradient(180deg, #FFFFFF 0%, #FBF7F9 100%);
    box-shadow: 0 16px 32px rgba(73, 89, 101, 0.08);
}

.skill-tree ul .skill-node-card::before {
    content: "";
    position: absolute;
    left: -0.92rem;
    top: 1.2rem;
    width: 0.9rem;
    height: 3px;
    border-radius: 999px;
    background: rgba(196, 154, 108, 0.68);
}

.skill-node-card[data-type="Tool"] {
    border-left-color: var(--mac-grey);
}

.skill-node-card[data-type="Skill"] {
    border-left-color: var(--success);
}

.skill-node-card[data-type="Practice"] {
    border-left-color: var(--warning);
}

.skill-node-card[data-type="Reference"] {
    border-left-color: var(--mac-gold);
}

.skill-node-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.skill-node-title {
    margin: 0;
    font-size: 1.05rem;
}

.skill-node-description {
    margin: 0;
    color: var(--mac-grey);
    font-size: 0.92rem;
}

.skill-node-meta,
.skill-node-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.38rem;
}

.skill-node-pill,
.skill-match-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid #DCE2E8;
    background: #F8FAFC;
    color: var(--mac-grey);
    padding: 0.2rem 0.48rem;
    font-size: 0.72rem;
    font-weight: 800;
}

.skill-match-pill {
    display: none;
    border-color: var(--mac-gold-60);
    background: var(--mac-gold-20);
    color: #5B3900;
}

.skill-node-card.is-match {
    box-shadow: 0 0 0 3px rgba(253, 191, 87, 0.35);
}

.skill-node-card.is-match .skill-match-pill {
    display: inline-flex;
}

.skill-expand {
    flex: 0 0 auto;
    min-width: 42px;
    min-height: 38px;
    border: 1px solid #DCE2E8;
    border-radius: 9px;
    background: white;
    color: var(--mac-maroon);
    font-weight: 900;
    cursor: pointer;
}

.skill-expand[aria-expanded="true"] {
    background: var(--mac-maroon);
    border-color: var(--mac-maroon);
    color: white;
}

.skill-doc-link {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    border-radius: 8px;
    border: 1px solid var(--mac-maroon);
    background: var(--mac-maroon);
    color: white;
    padding: 0.48rem 0.7rem;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 800;
}

.skill-doc-link:hover {
    background: var(--mac-maroon-80);
    color: white;
}

.skill-related-list {
    display: grid;
    gap: 0.35rem;
    margin-top: 0.35rem;
    color: var(--mac-grey);
    font-size: 0.84rem;
}

.skill-related-list a {
    color: var(--mac-maroon);
    font-weight: 800;
}

.skill-preview-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 1.8rem;
}

.skill-preview-root-system::before {
    content: "";
    position: absolute;
    top: calc(100px + 0.35rem);
    left: 50%;
    width: 3px;
    height: 2.4rem;
    transform: translateX(-50%);
    border-radius: 999px;
    background: linear-gradient(#7A003C, #C49A6C);
}

.skill-preview-grid::before {
    content: "";
    position: absolute;
    top: 0;
    left: 11%;
    right: 11%;
    height: 1.65rem;
    border-top: 3px solid rgba(196, 154, 108, 0.46);
    border-radius: 50% 50% 0 0;
}

.skill-preview-grid::after {
    content: "";
    position: absolute;
    top: -1.8rem;
    left: 50%;
    width: 3px;
    height: 1.9rem;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(196, 154, 108, 0.64);
}

.skill-domain-preview {
    position: relative;
    display: grid;
    gap: 0.7rem;
    border-radius: 24px;
    border: 1px solid rgba(122, 0, 60, 0.14);
    border-bottom: 5px solid var(--mac-maroon);
    background:
        radial-gradient(circle at top left, rgba(253, 191, 87, 0.14), transparent 34%),
        white;
    padding: 1rem;
}

.skill-domain-preview::before {
    content: "";
    position: absolute;
    top: -1.85rem;
    left: 50%;
    width: 3px;
    height: 1.85rem;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(196, 154, 108, 0.54);
}

.skill-domain-preview:nth-child(2n) {
    border-bottom-color: var(--mac-gold);
}

.skill-domain-preview:nth-child(3n) {
    border-bottom-color: var(--success);
}

.skill-branch-svg {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.skill-branch-path {
    fill: none;
    stroke: rgba(122, 0, 60, 0.56);
    stroke-width: 3.5;
    stroke-linecap: round;
    filter: drop-shadow(0 6px 8px rgba(122, 0, 60, 0.08));
}

.skill-branch-path.depth-1 {
    stroke: rgba(196, 154, 108, 0.72);
    stroke-width: 2.4;
    stroke-dasharray: 1 9;
}

.skill-root-system {
    display: grid;
    grid-template-columns: minmax(270px, 330px) minmax(0, 1fr);
    gap: clamp(2rem, 4vw, 4rem);
    align-items: start;
    min-height: 30rem;
}

.skill-root-system > .course-root-card,
.skill-root-system > .skill-tree,
.skill-preview-root-system > .course-root-card,
.skill-preview-root-system > .skill-preview-grid {
    z-index: 1;
}

.skill-root-system > .course-root-card {
    align-self: start;
    margin-top: 2.6rem;
}

.skill-root-system > .skill-tree {
    grid-template-columns: minmax(0, 760px);
    gap: 1rem;
    justify-content: start;
    margin-top: 0;
    padding-top: 0;
}

.skill-preview-grid {
    z-index: 1;
}

.skill-root-system::before,
.skill-preview-root-system::before,
.skill-tree::before,
.skill-tree::after,
.skill-tree > .skill-node::before,
.skill-tree ul::before,
.skill-tree ul .skill-node-card::before,
.skill-preview-grid::before,
.skill-preview-grid::after,
.skill-domain-preview::before {
    display: none;
}

.skill-root-system .course-root-card {
    border-radius: 30px 999px 999px 30px;
}

.skill-root-system .skill-tree > .skill-node > .skill-node-card,
.skill-domain-preview {
    box-shadow: 0 16px 36px rgba(73, 89, 101, 0.08);
}

.skill-root-system .skill-tree ul {
    padding-left: 0.85rem;
}

.skill-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.38rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.skill-preview-more[hidden] {
    display: none;
}

.skill-preview-more {
    display: grid;
    gap: 0.35rem;
    margin: 0.2rem 0 0;
    padding-left: 1.1rem;
    color: var(--mac-grey);
}

.documentation-progression {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.progression-step {
    border-radius: 12px;
    border: 1px solid rgba(73, 89, 101, 0.12);
    background: white;
    padding: 0.9rem;
}

.progression-step strong {
    display: block;
    color: var(--mac-maroon);
    margin-bottom: 0.35rem;
}

@media (max-width: 980px) {
    .skill-root-system {
        grid-template-columns: 1fr;
        gap: 2.4rem;
        min-height: 0;
    }

    .skill-root-system > .course-root-card {
        margin-top: 0;
        border-radius: 999px;
    }

    .skill-root-system > .skill-tree {
        grid-template-columns: 1fr;
    }

    .skill-preview-grid,
    .skill-tree,
    .skill-tree ul,
    .documentation-progression {
        grid-template-columns: 1fr;
    }

    .skill-root-system::before,
    .skill-preview-root-system::before {
        height: 2rem;
    }

    .skill-tree,
    .skill-preview-grid {
        margin-top: 2.5rem;
        padding-top: 0;
        padding-left: 1.1rem;
    }

    .skill-tree::before,
    .skill-preview-grid::before {
        left: 0.25rem;
        right: auto;
        top: 0;
        bottom: 0;
        width: 3px;
        height: auto;
        border: 0;
        border-radius: 999px;
        background: rgba(196, 154, 108, 0.58);
    }

    .skill-tree::after,
    .skill-preview-grid::after {
        display: none;
    }

    .skill-tree > .skill-node::before,
    .skill-domain-preview::before {
        top: 1.35rem;
        left: -0.85rem;
        width: 0.9rem;
        height: 3px;
        transform: none;
    }

    .skill-tree > .skill-node {
        padding: 0.8rem;
    }
}

@media (max-width: 640px) {
    .skill-map-search-grid {
        grid-template-columns: 1fr;
    }

    .drag-order-card {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .skill-node-header {
        align-items: stretch;
        flex-direction: column;
    }

    .skill-expand,
    .skill-doc-link,
    .skill-map-control,
    .skill-view-tab {
        width: 100%;
    }

    .skill-tree ul {
        padding-left: 0.75rem;
    }
}


.autograder-page {
    --mac-maroon: #7A003C;
    --mac-gold: #FDBF57;
    --mac-gold-20: #FFF2DD;
    --mac-grey: #495965;
    --lab-text: #2D3338;
    margin: 0;
    background: #F7F8FA;
    color: var(--lab-text);
    font-family: 'Poppins', system-ui, sans-serif;
    line-height: 1.55;
}

.autograder-shell {
    width: min(calc(100% - 1.25rem), 1580px);
    margin: 0 auto;
}

.autograder-header {
    padding: 1.75rem 0 1.2rem;
}

.autograder-back-link {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    color: var(--mac-maroon);
    font-size: 0.88rem;
    font-weight: 800;
    text-decoration: none;
}

.autograder-back-link:hover,
.autograder-back-link:focus-visible {
    text-decoration: underline;
}

.autograder-header-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.5rem;
    align-items: start;
    border-bottom: 1px solid rgba(73, 89, 101, 0.18);
    padding: 0.8rem 0 1.5rem;
}

.autograder-page h1,
.autograder-page h2,
.autograder-page h3,
.autograder-page p {
    margin-top: 0;
}

.autograder-page h1 {
    max-width: 20ch;
    margin-bottom: 0.45rem;
    color: var(--lab-text);
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.05;
    letter-spacing: 0;
}

.autograder-page h2 {
    margin-bottom: 0.35rem;
    font-size: 1.35rem;
    letter-spacing: 0;
}

.autograder-page h3 {
    margin-bottom: 0.5rem;
    font-size: 1.02rem;
    letter-spacing: 0;
}

.autograder-logo {
    width: auto;
    height: 4.35rem;
    object-fit: contain;
}

.autograder-eyebrow,
.autograder-report-eyebrow {
    margin-bottom: 0.35rem;
    color: var(--mac-maroon);
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.autograder-intro {
    max-width: 72ch;
    margin-bottom: 0;
    color: var(--mac-grey);
    font-size: 1.05rem;
}

.autograder-notice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin: 1.25rem 0;
}

.autograder-notice {
    border-left: 4px solid var(--mac-gold);
    background: #FFFFFF;
    padding: 1rem;
}

.autograder-notice:nth-child(2) {
    border-left-color: var(--mac-maroon);
}

.autograder-notice p {
    margin-bottom: 0;
    color: var(--mac-grey);
    font-size: 0.9rem;
}

.autograder-upload-card {
    display: grid;
    grid-template-columns: minmax(250px, 0.85fr) minmax(320px, 1.15fr);
    gap: 1.4rem;
    align-items: center;
    border: 1px solid rgba(73, 89, 101, 0.16);
    border-top: 5px solid var(--mac-maroon);
    border-radius: 8px;
    background: #FFFFFF;
    padding: clamp(1rem, 2vw, 1.5rem);
    box-shadow: 0 10px 24px rgba(73, 89, 101, 0.07);
}

.autograder-upload-card p:not(.autograder-eyebrow),
.autograder-results-heading p {
    color: var(--mac-grey);
}

.autograder-dropzone {
    display: grid;
    min-height: 12rem;
    place-content: center;
    justify-items: center;
    gap: 0.55rem;
    border: 2px dashed rgba(122, 0, 60, 0.32);
    border-radius: 8px;
    background: #FBF7F9;
    padding: 1.25rem;
    color: var(--lab-text);
    text-align: center;
    cursor: pointer;
}

.autograder-dropzone:hover,
.autograder-dropzone:focus-within,
.autograder-dropzone.is-dragging {
    border-color: var(--mac-maroon);
    background: #F6EDF1;
}

.autograder-dropzone-title {
    font-size: 1.06rem;
    font-weight: 850;
}

.autograder-dropzone-copy {
    color: var(--mac-grey);
    font-size: 0.86rem;
}

.autograder-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.autograder-page .utility-button {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(122, 0, 60, 0.24);
    border-radius: 7px;
    background: #FFFFFF;
    color: var(--mac-maroon);
    padding: 0.55rem 0.85rem;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 850;
    letter-spacing: 0;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.autograder-page .utility-button:hover:not(:disabled) {
    border-color: var(--mac-maroon);
    background: #FBF7F9;
}

.autograder-page .utility-button:focus-visible,
.autograder-page input:focus-visible,
.autograder-page textarea:focus-visible,
.autograder-page summary:focus-visible {
    outline: 3px solid rgba(253, 191, 87, 0.78);
    outline-offset: 2px;
}

.autograder-upload-message {
    grid-column: 1 / -1;
    margin: 0;
    border-top: 1px solid rgba(73, 89, 101, 0.12);
    padding-top: 0.8rem;
    color: var(--mac-grey);
    font-size: 0.9rem;
    font-weight: 700;
}

.autograder-upload-message.is-success {
    color: #1F623E;
}

.autograder-upload-message.is-warning {
    color: #765000;
}

.autograder-batch-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin: 1.15rem 0 1.6rem;
}

.autograder-results-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid rgba(73, 89, 101, 0.16);
    padding-bottom: 0.8rem;
}

.autograder-results-heading h2 {
    margin-bottom: 0;
}

.autograder-empty-state,
.autograder-empty-detail {
    margin: 1rem 0;
    border: 1px dashed rgba(73, 89, 101, 0.28);
    border-radius: 8px;
    background: #FFFFFF;
    color: var(--mac-grey);
    padding: 1rem;
}

.autograder-report-card {
    margin: 1rem 0;
    border: 1px solid rgba(73, 89, 101, 0.16);
    border-radius: 8px;
    background: #FFFFFF;
    padding: clamp(1rem, 2vw, 1.45rem);
    box-shadow: 0 8px 18px rgba(73, 89, 101, 0.055);
}

.autograder-report-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.autograder-report-title {
    margin-bottom: 0.2rem !important;
    overflow-wrap: anywhere;
}

.autograder-report-meta {
    margin-bottom: 0;
    color: var(--mac-grey);
    font-family: 'Roboto Mono', ui-monospace, monospace;
    font-size: 0.76rem;
    overflow-wrap: anywhere;
}

.autograder-badge {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    padding: 0.22rem 0.55rem;
    font-size: 0.76rem;
    font-weight: 850;
    text-align: center;
}

.autograder-badge.is-ready {
    background: #F1F8F3;
    color: #1F623E;
}

.autograder-badge.is-high {
    background: #FBF0F0;
    color: #9A2633;
}

.autograder-badge.is-incomplete {
    background: var(--mac-gold-20);
    color: #765000;
}

.autograder-badge.is-review {
    background: #FBF7F9;
    color: var(--mac-maroon);
}

.autograder-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.7rem;
    margin: 1rem 0;
}

.autograder-stat {
    min-width: 0;
    border-left: 3px solid var(--mac-gold);
    background: #F7F8FA;
    padding: 0.68rem 0.75rem;
}

.autograder-stat:nth-child(3n + 2) {
    border-left-color: var(--mac-maroon);
}

.autograder-stat:nth-child(3n) {
    border-left-color: #1F623E;
}

.autograder-stat span,
.autograder-stat strong {
    display: block;
    overflow-wrap: anywhere;
}

.autograder-stat span {
    color: var(--mac-grey);
    font-size: 0.73rem;
    font-weight: 700;
}

.autograder-stat strong {
    margin-top: 0.18rem;
    color: var(--lab-text);
    font-size: 0.9rem;
}

.autograder-rule-note,
.autograder-alert {
    margin: 0.8rem 0;
    border-left: 4px solid var(--mac-gold);
    background: var(--mac-gold-20);
    color: #5B3900;
    padding: 0.72rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 700;
}

.autograder-alert.is-high {
    border-left-color: #9A2633;
    background: #FBF0F0;
    color: #7B2029;
}

.autograder-overrides {
    margin: 1rem 0;
    border-top: 1px solid rgba(73, 89, 101, 0.14);
    padding-top: 1rem;
}

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

.autograder-override-field {
    display: grid;
    gap: 0.35rem;
    color: var(--lab-text);
    font-size: 0.85rem;
    font-weight: 800;
}

.autograder-override-field:last-child {
    grid-column: 1 / -1;
}

.autograder-override-field input,
.autograder-override-field textarea {
    box-sizing: border-box;
    width: 100%;
    min-height: 2.55rem;
    border: 1px solid rgba(73, 89, 101, 0.28);
    border-radius: 6px;
    background: #FFFFFF;
    color: var(--lab-text);
    padding: 0.55rem 0.62rem;
    font: inherit;
}

.autograder-override-field textarea {
    min-height: 5.5rem;
    resize: vertical;
}

.autograder-details {
    margin-top: 0.8rem;
    border-top: 1px solid rgba(73, 89, 101, 0.14);
    padding-top: 0.8rem;
}

.autograder-details summary {
    min-height: 2.55rem;
    color: var(--mac-maroon);
    font-size: 0.92rem;
    font-weight: 850;
    cursor: pointer;
}

.autograder-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.autograder-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    margin-top: 0.55rem;
    font-size: 0.82rem;
}

.autograder-table th,
.autograder-table td {
    border: 1px solid rgba(73, 89, 101, 0.15);
    padding: 0.55rem 0.6rem;
    text-align: left;
    vertical-align: top;
    overflow-wrap: break-word;
    word-break: normal;
}

.autograder-table th {
    background: #F1F3F5;
    color: var(--lab-text);
    font-weight: 850;
    white-space: nowrap;
}

.autograder-table .numeric {
    font-family: 'Roboto Mono', ui-monospace, monospace;
    white-space: nowrap;
}

.autograder-package-meta {
    margin: 0.15rem 0 0.55rem;
    color: var(--mac-grey);
    font-size: 0.82rem;
    font-weight: 700;
}

.autograder-package-table {
    min-width: 1080px;
}

.autograder-package-name {
    font-family: 'Roboto Mono', ui-monospace, monospace;
    font-size: 0.78rem;
}

.autograder-category-table th:nth-child(1),
.autograder-category-table td:nth-child(1) {
    width: 20%;
    min-width: 190px;
}

.autograder-category-table th:nth-child(2),
.autograder-category-table td:nth-child(2) {
    width: 9rem;
    min-width: 9rem;
}

.autograder-checkpoint-table th:nth-child(1),
.autograder-checkpoint-table td:nth-child(1),
.autograder-response-table th:nth-child(1),
.autograder-response-table td:nth-child(1),
.autograder-review-table th:nth-child(2),
.autograder-review-table td:nth-child(2) {
    width: 24%;
    min-width: 230px;
}

.autograder-checkpoint-table th:not(:first-child),
.autograder-checkpoint-table td:not(:first-child) {
    min-width: 120px;
}

.autograder-response-table {
    min-width: 1220px;
}

.autograder-written-review-note {
    margin: 0.15rem 0 0.65rem;
    border-left: 4px solid var(--mac-gold);
    background: var(--mac-gold-20);
    color: #5B3900;
    padding: 0.7rem 0.85rem;
    font-size: 0.86rem;
    font-weight: 700;
}

.autograder-written-response-table {
    min-width: 1080px;
}

.autograder-written-response-table th:nth-child(1),
.autograder-written-response-table td:nth-child(1) {
    width: 22%;
    min-width: 230px;
}

.autograder-written-response-table th:nth-child(2),
.autograder-written-response-table td:nth-child(2) {
    width: 32%;
    min-width: 330px;
}

.autograder-written-response-table th:nth-child(3),
.autograder-written-response-table td:nth-child(3) {
    min-width: 430px;
    white-space: pre-wrap;
}

.autograder-response-table th:nth-child(2),
.autograder-response-table td:nth-child(2) {
    min-width: 220px;
}

.autograder-response-table th:nth-child(3),
.autograder-response-table td:nth-child(3) {
    min-width: 260px;
}

.autograder-response-table th:nth-child(6),
.autograder-response-table td:nth-child(6),
.autograder-review-table th:nth-child(4),
.autograder-review-table td:nth-child(4) {
    min-width: 320px;
}

.autograder-package-table th:nth-child(1),
.autograder-package-table td:nth-child(1) {
    min-width: 160px;
}

.autograder-package-table th:nth-child(2),
.autograder-package-table td:nth-child(2) {
    min-width: 320px;
}

.autograder-package-table th:nth-child(3),
.autograder-package-table td:nth-child(3) {
    min-width: 130px;
}

.autograder-package-table th:nth-child(4),
.autograder-package-table td:nth-child(4) {
    min-width: 100px;
}

.autograder-package-table th:nth-child(5),
.autograder-package-table td:nth-child(5) {
    min-width: 260px;
}

.autograder-image-preview summary {
    width: max-content;
    color: var(--mac-maroon);
    font-weight: 850;
    text-decoration: underline;
    cursor: pointer;
}

.autograder-image-preview img {
    display: block;
    width: auto;
    max-width: 440px;
    max-height: 300px;
    margin: 0.7rem 0 0.45rem;
    border: 1px solid rgba(73, 89, 101, 0.2);
    border-radius: 5px;
    background: #FFFFFF;
    object-fit: contain;
}

.autograder-preview-link {
    color: var(--mac-maroon);
    font-weight: 800;
    text-decoration: underline;
}

@media (min-width: 1200px) {
    .autograder-report-card {
        padding: 1.65rem 1.8rem;
    }
}

@media (max-width: 760px) {
    .autograder-header-grid,
    .autograder-notice-grid,
    .autograder-upload-card,
    .autograder-stat-grid,
    .autograder-override-grid {
        grid-template-columns: 1fr;
    }

    .autograder-header-grid {
        gap: 0.9rem;
    }

    .autograder-logo {
        height: 3.45rem;
    }

    .autograder-upload-message,
    .autograder-override-field:last-child {
        grid-column: auto;
    }

    .autograder-report-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .autograder-badge {
        align-self: flex-start;
    }

    .autograder-batch-actions .utility-button,
    .autograder-report-card > .utility-button {
        width: 100%;
    }

    .autograder-image-preview img {
        max-width: 300px;
        max-height: 230px;
    }
}

@media print {
    .autograder-page {
        background: #FFFFFF;
    }

    .autograder-back-link,
    .autograder-notice-grid,
    .autograder-upload-card,
    .autograder-batch-actions,
    .autograder-overrides,
    .autograder-report-card > .utility-button {
        display: none !important;
    }

    .autograder-report-card {
        box-shadow: none;
        break-inside: avoid;
    }

    .autograder-details {
        display: block;
    }
}

@media (prefers-reduced-motion: reduce) {
    .skill-node-card,
    .skill-map-control,
    .skill-view-tab,
    .drag-order-card {
        transition: none !important;
    }
}

.completion-export-card {
    margin: 1.5rem 0 1rem;
    border: 1px solid rgba(122, 0, 60, 0.2);
    border-top: 5px solid var(--mac-maroon);
    border-radius: 12px;
    background: #FFFFFF;
    padding: clamp(1.1rem, 2vw, 1.65rem);
    box-shadow: 0 12px 28px rgba(73, 89, 101, 0.07);
}

.completion-export-eyebrow {
    margin: 0 0 0.35rem;
    color: var(--mac-maroon);
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.completion-export-title,
.completion-details-title {
    margin: 0;
    color: var(--lab-text);
    font-size: 1.35rem;
    font-weight: 850;
}

.completion-export-copy,
.completion-details-copy,
.completion-export-note {
    max-width: 76ch;
    color: var(--mac-grey);
}

.completion-details {
    margin-top: 1.15rem;
    border-top: 1px solid rgba(73, 89, 101, 0.14);
    padding-top: 1rem;
}

.completion-details-copy {
    margin: 0.35rem 0 0;
    font-size: 0.92rem;
}

.completion-details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin-top: 0.9rem;
}

.completion-detail-field {
    display: grid;
    gap: 0.35rem;
    color: var(--lab-text);
    font-size: 0.9rem;
    font-weight: 750;
}

.completion-detail-field input {
    width: 100%;
    min-height: 2.65rem;
    border: 1px solid rgba(73, 89, 101, 0.28);
    border-radius: 8px;
    background: #FFFFFF;
    color: var(--lab-text);
    padding: 0.55rem 0.65rem;
    font: inherit;
}

.completion-detail-field input:focus {
    outline: 3px solid rgba(253, 191, 87, 0.72);
    outline-offset: 2px;
}

.completion-detail-field.is-invalid input,
.completion-detail-field input[aria-invalid="true"] {
    border-color: #BE123C;
    box-shadow: 0 0 0 1px rgba(190, 18, 60, 0.1);
}

.completion-detail-error {
    color: #9F1239;
    font-size: 0.78rem;
    font-weight: 750;
}

.completion-detail-help {
    color: var(--mac-grey);
    font-size: 0.76rem;
    font-weight: 500;
}

.completion-export-status {
    margin: 1.15rem 0 0;
    border: 1px solid rgba(73, 89, 101, 0.14);
    border-radius: 8px;
    background: #F5F7F8;
    color: var(--lab-text);
    padding: 0.75rem 0.85rem;
    font-weight: 750;
}

.completion-export-status.is-locked {
    border-color: rgba(122, 0, 60, 0.2);
    background: #FBF7F9;
    color: var(--mac-maroon);
}

.completion-export-status.is-details-needed {
    border-color: rgba(196, 154, 108, 0.42);
    background: var(--mac-gold-20);
    color: #5B3900;
}

.completion-export-status.is-ready {
    border-color: rgba(40, 122, 75, 0.28);
    background: #F1F8F3;
    color: #1F623E;
}

.completion-export-remaining {
    margin: 0.65rem 0 0;
    padding-left: 1.25rem;
    color: var(--mac-grey);
    font-size: 0.9rem;
}

.completion-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.completion-export-button:not(:disabled) {
    box-shadow: 0 8px 18px rgba(122, 0, 60, 0.2);
}

.completion-export-note {
    margin: 0.85rem 0 0;
    font-size: 0.82rem;
}

@media (max-width: 640px) {
    .completion-details-grid {
        grid-template-columns: 1fr;
    }

    .completion-export-actions,
    .completion-export-button {
        width: 100%;
    }
}

/* 3CC3 student-page spacing contract.
   Knowledge/Skill Tree and instructor pages are intentionally excluded. */
:where(.portal-shell, body[class*="stage-"]) {
    --student-content-gap: 1rem;
}

/* Use one container-owned gap between adjacent top-level blocks. This replaces
   per-card all-side margins, which doubled vertical gaps and narrowed tables. */
:where(.portal-shell, body[class*="stage-"] .stage-panel) > * + * {
    margin-block-start: var(--student-content-gap) !important;
}

body[class*="stage-"] .stage-panel > :is(.card, .section-card),
body[class*="stage-"] :is(.grid-layout, .learning-outcome-grid, .order-grid, .diagram-grid) > :is(.card, .section-card, .mini-card, .diagram-card),
.portal-shell > :is(.card, section),
.portal-shell :is(.section-grid, .lab-grid, .three-grid) > :is(.card, .lab-card) {
    margin-block: 0 !important;
    margin-inline: 0 !important;
}

/* Apply spacing after the margin reset above. Repeating the container class
   gives these rules enough specificity to win over legacy !important margins. */
.portal-shell.portal-shell > * + *,
body[class*="stage-"] .stage-panel.stage-panel > * + * {
    margin-block-start: var(--student-content-gap) !important;
}

/* Sequential section cards also need the same gap when nested in a
   lab-specific wrapper. Grid containers own their gap, avoiding double space. */
.portal-shell.portal-shell .section-card + .section-card,
body[class*="stage-"] .stage-panel.stage-panel .section-card + .section-card {
    margin-block-start: var(--student-content-gap) !important;
}

.portal-shell.portal-shell :is(
    .section-grid,
    .lab-grid,
    .three-grid,
    .grid-layout,
    .learning-outcome-grid,
    .order-grid,
    .diagram-grid,
    .response-grid,
    .grid,
    .two-grid
) > .section-card + .section-card,
body[class*="stage-"] .stage-panel.stage-panel :is(
    .section-grid,
    .lab-grid,
    .three-grid,
    .grid-layout,
    .learning-outcome-grid,
    .order-grid,
    .diagram-grid,
    .response-grid,
    .grid,
    .two-grid
) > .section-card + .section-card {
    margin-block-start: 0 !important;
}

/* Reusable layout containers own spacing between their children. */
:where(.portal-shell, body[class*="stage-"]) :is(
    .section-grid,
    .lab-grid,
    .three-grid,
    .grid-layout,
    .learning-outcome-grid,
    .order-grid,
    .diagram-grid,
    .signal-chain,
    .chip-row,
    .button-row,
    .button-group,
    .control-row,
    .control-group,
    .completion-export-actions,
    .completion-details-grid
) {
    gap: var(--student-content-gap) !important;
}

.portal-shell .architecture-map,
body[class*="stage-"] .code-header {
    gap: var(--student-content-gap) !important;
}

body[class*="stage-"] .code-header {
    padding: var(--student-content-gap) !important;
}

/* Cards retain their established visual treatment while their internal content
   follows a consistent 1rem vertical rhythm. */
:where(.portal-shell, body[class*="stage-"]) :is(
    .card,
    .lab-card,
    .section-card,
    .mini-card,
    .briefing-card,
    .warning-card,
    .danger-card,
    .success-card,
    .callout,
    .callout-danger,
    .callout-success,
    .diagram-card,
    .figure-frame,
    .formula-card,
    .quiz-card,
    .learning-outcome-card,
    .completion-card,
    .completion-export-card,
    .code-reference,
    .instructor-placeholder,
    .screenshot-placeholder,
    .tab-shell
) {
    box-sizing: border-box;
    min-width: 0;
}

:where(.portal-shell, body[class*="stage-"]) :is(
    .card,
    .lab-card,
    .section-card,
    .mini-card,
    .briefing-card,
    .warning-card,
    .danger-card,
    .success-card,
    .callout,
    .callout-danger,
    .callout-success,
    .diagram-card,
    .figure-frame,
    .formula-card,
    .quiz-card,
    .learning-outcome-card,
    .completion-card,
    .completion-export-card,
    .code-reference,
    .instructor-placeholder,
    .screenshot-placeholder,
    .tab-shell
) > * + * {
    margin-block-start: var(--student-content-gap) !important;
}

/* Smaller shared cards previously used 0.85–0.9rem padding. Raise only those
   known undersized components; larger section-card padding remains untouched. */
:where(.portal-shell, body[class*="stage-"]) :is(
    .learning-outcome-card,
    .evidence-upload,
    .formula-card,
    .quiz-card,
    .instructor-placeholder,
    .screenshot-placeholder__box
) {
    box-sizing: border-box;
    padding: 1rem !important;
}

/* Lab 1 has two intentionally edge-to-edge legacy wrappers. The spacing
   contract now gives their image/code content the same border clearance. */
body[class*="stage-"] :is(.card.overflow-hidden, .figure-frame) {
    padding: 1rem !important;
}

body[class*="stage-"] .figure-frame > img {
    border-radius: 8px;
}

/* Measure field spacing from the visible label text. */
:where(.portal-shell, body[class*="stage-"]) :is(
    .response-field,
    .evidence-field,
    .evidence-upload,
    .completion-detail-field
) {
    display: grid;
    min-width: 0;
    gap: var(--student-content-gap) !important;
    margin-block: 0 !important;
    margin-inline: 0 !important;
}

:where(.portal-shell, body[class*="stage-"]) :is(
    .response-field,
    .evidence-field,
    .evidence-upload,
    .completion-detail-field
) + :is(
    .response-field,
    .evidence-field,
    .evidence-upload,
    .completion-detail-field
) {
    margin-block-start: var(--student-content-gap) !important;
}

:where(.portal-shell, body[class*="stage-"] main) :is(input, select, textarea, button) {
    max-width: 100%;
    box-sizing: border-box;
}

/* Figures, captions, code, lists, and embedded tools remain distinct blocks. */
:where(.portal-shell, body[class*="stage-"]) figure {
    max-width: 100%;
    margin-block: var(--student-content-gap);
    margin-inline: 0;
}

:where(.portal-shell, body[class*="stage-"]) figure > figcaption {
    margin-block-start: var(--student-content-gap) !important;
}

:where(.portal-shell, body[class*="stage-"]) :is(pre, blockquote, ul, ol) {
    margin-block: var(--student-content-gap);
}

:where(.portal-shell, body[class*="stage-"]) pre {
    max-width: 100%;
    overflow-x: auto;
}

:where(.portal-shell, body[class*="stage-"]) :is(img, svg, video, canvas, iframe) {
    max-width: 100%;
}

:where(.portal-shell, body[class*="stage-"]) iframe {
    display: block;
    width: 100%;
    margin-block: var(--student-content-gap);
    border: 0;
}

/* Tables keep their wide instructional layout and scroll only inside the local
   wrapper. Side clearance comes from the parent card's padding. */
:where(.portal-shell, body[class*="stage-"]) .table-wrap {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin-block: var(--student-content-gap) !important;
    margin-inline: 0 !important;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

body[class*="stage-"] [class~="overflow-x-auto"]:has(> table) {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin-block: var(--student-content-gap) !important;
    margin-inline: 0 !important;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

:where(.portal-shell, body[class*="stage-"]) .table-wrap > table {
    margin: 0;
}

/* Preserve visible keyboard focus outside card and field boundaries. */
:where(.portal-shell, body[class*="stage-"]) :is(a, button, input, select, textarea, summary):focus-visible {
    outline-offset: 3px;
}

@media (max-width: 420px) {
    :where(.portal-shell, body[class*="stage-"]) :is(.card, .section-card, .tab-shell) {
        min-width: 0;
    }

    :where(.portal-shell, body[class*="stage-"]) .table-wrap {
        max-width: calc(100vw - 3rem);
    }
}
