@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/Montserrat-Variable.woff2') format('woff2');
}

/* ===========================================================================
   Shared guide-page framework
   A guide is a scrollable set of step sections. The step timeline on the left
   (or above and below on phones) moves between sections.

   Inside every step, each `.guide-section` is a tab panel. That step's own bar
   sits at the top of its content: previous on the left, next on the right, and
   one light strip per subsection in between.
   =========================================================================== */

.guide-page {
    max-width: 1180px;
    font-family: 'Montserrat', var(--site-font);
}

.guide-page .btn,
.guide-page button,
.guide-page input,
.guide-page select,
.guide-page textarea {
    font-family: 'Montserrat', var(--site-font);
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.guide-header {
    margin-bottom: 1.4rem;
}

.guide-header h1 {
    margin-bottom: 0.4rem;
    font-size: clamp(1.8rem, 3vw, 2.65rem);
    font-weight: 750;
    letter-spacing: -0.025em;
}

.guide-header__deck {
    max-width: 72ch;
    margin: 0;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
}

/* Inline copy that changes with the layout (for example "on the right" vs
   "below" when a media panel stacks on phones). */
.guide-only-mobile {
    display: none;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.guide-page {
    /* Subsection strips: left of current, current, right of current. */
    --guide-tab-done: #166534;
    --guide-tab-current: #4ade80;
    --guide-tab-upcoming: #ef4444;
}

.guide-layout {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: clamp(1.1rem, 2.8vw, 2.2rem);
    align-items: start;
}

.guide-stage {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

/* ── Subsection tabs ─────────────────────────────────────────────────────── */
/* Each step renders its own bar at the top of the step's content. Previous is
   on the left, next on the right, and one strip per subsection sits in between. */
.guide-subtabs {
    flex: 0 0 auto;
    margin: 0 0 1.1rem;
    padding: 0.55rem 0.65rem 0.45rem;
    border: 1px solid var(--border-light, var(--border-color));
    border-radius: 10px;
    background: rgba(var(--accent-color-rgb), 0.04);
}

.guide-step__body > .guide-section {
    margin-top: 0;
}

.guide-subtabs__row {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 1.4vw, 0.9rem);
}

.guide-subtabs__nav {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-width: 2.2rem;
    min-height: 2.2rem;
    padding: 0.2rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-color);
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    transition: color 0.15s ease, opacity 0.15s ease;
}

.guide-subtabs__nav i {
    font-size: 0.8rem;
}

.guide-subtabs__nav:hover:not(:disabled) {
    color: var(--accent-color);
}

.guide-subtabs__nav:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.guide-subtabs__nav:disabled {
    opacity: 0.45;
    cursor: default;
}

.guide-subtabs__tabs {
    display: flex;
    flex: 1 1 auto;
    gap: 5px;
    min-width: 0;
}

.guide-subtab {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.45rem 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
}

.guide-subtab__bar {
    display: block;
    width: 100%;
    height: 7px;
    border-radius: 999px;
    background: var(--guide-tab-upcoming);
    transition: background-color 160ms ease, box-shadow 160ms ease, filter 120ms ease;
}

.guide-subtab.is-done .guide-subtab__bar {
    background: var(--guide-tab-done);
}

.guide-subtab.is-active .guide-subtab__bar {
    background: var(--guide-tab-current);
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.28);
}

.guide-subtab:hover .guide-subtab__bar {
    filter: brightness(1.08);
}

.guide-subtab:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 1px;
}

.guide-subtabs__status {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.45rem;
    min-width: 0;
    margin-top: 0.32rem;
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    line-height: 1.25;
}

.guide-subtabs__progress {
    flex: 0 0 auto;
    white-space: nowrap;
}

.guide-subtabs__current {
    overflow: hidden;
    color: var(--text-color);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.guide-subtabs__current::before {
    content: "·";
    margin-right: 0.45rem;
    color: var(--text-muted);
}

.guide-subtabs__current[hidden] {
    display: none !important;
}

/* ── Timeline shells ─────────────────────────────────────────────────────── */
.guide-timeline-shell {
    border: 1px solid var(--card-item-border, var(--border-color));
    border-radius: 12px;
    background: var(--card-item-bg, var(--card-bg));
}

.guide-timeline-shell--side {
    position: sticky;
    top: calc(var(--header-height, 70px) + 0.5rem);
    z-index: 20;
    max-height: calc(100vh - var(--header-height, 70px) - 2rem);
    padding: 0.3rem;
    overflow-y: auto;
}

.guide-timeline-shell--mobile {
    display: none;
    margin: 0 0 1rem;
    padding: 0.3rem;
}

.guide-timeline-shell--bottom {
    margin: 1rem 0 0;
}

.guide-timeline__progress {
    padding: 0.25rem 0 0.35rem;
    color: var(--text-muted);
    font-size: 0.62rem;
    font-weight: 650;
    text-align: center;
    white-space: nowrap;
}

/* ── Timeline items ──────────────────────────────────────────────────────── */
.guide-timeline {
    display: flex;
    min-width: 0;
}

.guide-timeline--side {
    flex-direction: column;
    gap: 0.15rem;
}

.guide-timeline--mobile {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 1px;
}

.guide-timeline__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
    padding: 0.3rem 0.2rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.63rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: color 120ms ease, background-color 120ms ease;
}

.guide-timeline__item:hover {
    color: var(--text-color);
    background: var(--hover-bg);
}

.guide-timeline__item:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 1px;
}

.guide-timeline__item.is-active {
    color: var(--text-color);
    background: rgba(var(--accent-color-rgb), 0.12);
}

/* The next step keeps a softer highlight, so it still looks like the obvious
   thing to click without competing with the step being read. */
.guide-timeline__item.is-next {
    color: var(--text-color);
    background: rgba(var(--accent-color-rgb), 0.05);
}

.guide-timeline__item.is-next .guide-timeline__index {
    border-color: rgba(var(--accent-color-rgb), 0.4);
}

.guide-timeline__item.is-next .guide-timeline__thumb {
    border-color: rgba(var(--accent-color-rgb), 0.32);
}

.guide-timeline__index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    margin-bottom: 0.18rem;
    border: 1.5px solid var(--border-color);
    border-radius: 999px;
    background: var(--card-item-bg, var(--card-bg));
    color: var(--text-muted);
    font-size: 0.6rem;
    font-weight: 750;
    line-height: 1;
}

.guide-timeline__item.is-active .guide-timeline__index {
    border-color: var(--accent-color);
    background: var(--accent-color);
    color: #fff;
}

.guide-timeline__thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    overflow: hidden;
    border: 1.5px solid var(--border-color);
    border-radius: 7px;
    background: var(--bg-secondary);
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.guide-timeline__thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 1px;
}

/* Generated cube pictures and inlined SVG icons fill the thumbnail; the text
   icon (e.g. "R") uses the item's own colour so it follows the active state. */
.guide-timeline__thumb svg {
    display: block;
    width: 100%;
    height: 100%;
}

.guide-timeline__thumb-text {
    color: inherit;
    font-size: 1.1rem;
    font-weight: 750;
    line-height: 1;
}

.guide-timeline__thumb .fa-solid {
    color: var(--text-muted);
    font-size: 1rem;
}

.guide-timeline__item.is-active .guide-timeline__thumb {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(var(--accent-color-rgb), 0.16);
}

.guide-timeline__label {
    display: -webkit-box;
    width: 100%;
    margin-top: 0.22rem;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.guide-timeline__item.is-locked {
    opacity: 0.38;
    filter: grayscale(1);
}

.guide-timeline__item.is-locked:hover {
    opacity: 0.65;
}

.guide-timeline__reset {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.38rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    cursor: pointer;
    transition: color 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.guide-timeline__reset:hover {
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger-color, #ef4444);
}

.guide-timeline__reset:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.guide-timeline__reset[hidden] {
    display: none !important;
}

/* ── Steps ───────────────────────────────────────────────────────────────── */
.guide-step {
    position: relative;
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: calc(100vh - var(--header-height, 70px) - 2rem);
    max-height: calc(100dvh - var(--header-height, 70px) - 2rem);
    --guide-carousel-offset: 50px;
    padding: clamp(1rem, 2.2vw, 1.6rem);
    border: 0;
    border-radius: 16px;
    background-color: var(--card-surface, rgba(var(--accent-color-rgb), 0.08));
    box-shadow: 0 2px 12px var(--shadow-sm);
    overflow: hidden;
    scroll-margin-top: calc(var(--header-height, 70px) + 1rem);
}

.guide-step.is-locked > :not(.guide-step__lock-overlay) {
    filter: blur(4px) grayscale(1);
    opacity: 0.45;
    pointer-events: none;
    user-select: none;
}

.guide-step__lock-overlay {
    position: absolute;
    inset: 0;
    z-index: calc(var(--global-renderer-z-index, 1026) + 1);
    transform: translateZ(0);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    border: 0;
    border-radius: inherit;
    background: rgba(128, 128, 128, 0.08);
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: background-color 140ms ease;
}

.guide-step__lock-overlay[hidden] {
    display: none !important;
}

.guide-step__lock-overlay:hover {
    background: rgba(128, 128, 128, 0.14);
}

.guide-step__lock-overlay:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: -2px;
}

.guide-step__lock-card {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    max-width: 34ch;
    padding: 0.85rem 1.15rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--card-item-bg, var(--card-bg));
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 650;
    line-height: 1.45;
    text-align: left;
}

.guide-step__lock-card i {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 1rem;
}

.guide-step__body {
    flex: 1 1 auto;
    min-height: 0;
    height: var(--guide-step-body-height, auto);
    overflow: hidden;
    scrollbar-gutter: stable;
}

/* The panel fills the body; inside a text/image panel only the copy scrolls,
   so the player on the right stays where it is. */
.guide-step__body > .guide-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    margin-top: 0;
}

/* Sections with a carousel bar start their content 50px lower. Give the
   ordinary text/image sections the same top inset so the cube and copy do not
   jump when moving between subsections, examples, and quizzes. */
.guide-step:has(.guide-subcarousel) .guide-step__body > .guide-section:not(:has(> .guide-subcarousel)) > .guide-media-panel,
.guide-step:has(.guide-subcarousel) .guide-step__body > .guide-section:not(:has(> .guide-subcarousel)) > .guide-quiz,
.guide-step:has(.guide-subcarousel) .guide-step__body > .guide-section:not(:has(> .guide-subcarousel)) > .guide-example,
.guide-step:has(.guide-subcarousel) .guide-step__body > .guide-section:not(:has(> .guide-subcarousel)) > .guide-prose {
    margin-top: var(--guide-carousel-offset);
}

.guide-step__body > .guide-section > .guide-media-panel {
    flex: 1 1 auto;
    min-height: 0;
}

/* Panels without a text/image layout scroll as a whole. */
.guide-step__body > .guide-section > :not(.guide-media-panel) {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.guide-step__body > .guide-section > .guide-subsection-title {
    flex: 0 0 auto;
    overflow: visible;
}

/* Sub-carousel sections are layout wrappers, not another scroll layer: give
   the active item the available height so the prose's own scroll area handles
   overflow and the next/reset row stays fixed below it. */
.guide-step__body > .guide-section > .guide-subcarousel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.guide-step__body > .guide-section > .guide-subcarousel > [data-guide-subcarousel-item]:not([hidden]) {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.guide-step__body > .guide-section > .guide-subcarousel > [data-guide-subcarousel-item]:not([hidden]) > .guide-media-panel {
    flex: 1 1 auto;
    min-height: 0;
    /* One row that fills the panel, so the copy cell can scroll instead of
       stretching the row past the panel. */
    grid-template-rows: minmax(0, 1fr);
}

/* Panels with another layout (e.g. the quiz grid) scroll inside the item
   instead of clipping. */
.guide-step__body > .guide-section > .guide-subcarousel > [data-guide-subcarousel-item]:not([hidden]) > :not(.guide-media-panel) {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.guide-step__body > .guide-section > .guide-subcarousel .guide-example__media {
    align-self: stretch;
    min-height: 0;
}

.guide-step__body > .guide-section > .guide-subcarousel .guide-example__media .guide-cube {
    height: 100%;
    min-height: 0;
    max-height: 375px;
}

/* The quiz panels inside a carousel follow the same pattern: the copy column
   scrolls and the player stays put. */
@media (min-width: 768px) {
    .guide-step__body > .guide-section > .guide-subcarousel > [data-guide-subcarousel-item]:not([hidden]) > .guide-quiz {
        flex: 1 1 auto;
        min-height: 0;
        grid-template-rows: minmax(0, 1fr);
    }

    .guide-step__body > .guide-section > .guide-subcarousel > [data-guide-subcarousel-item]:not([hidden]) > .guide-quiz > .guide-quiz__copy {
        align-self: stretch;
        min-height: 0;
        overflow-y: auto;
        padding-left: 0.55rem;
    }

    .guide-step__body > .guide-section > .guide-subcarousel .guide-quiz__player {
        align-self: stretch;
        min-height: 0;
    }

    .guide-step__body > .guide-section > .guide-subcarousel .guide-quiz__player .guide-cube {
        height: 375px;
        min-height: 375px;
        max-height: 375px;
    }
}

.guide-media-panel[data-guide-media-panel="text"] > .guide-prose {
    align-self: stretch;
    min-height: 0;
    overflow-y: auto;
    padding-left: 0.55rem;
}

/* ── Scrollbars on the left ─────────────────────────────────────────────── */
/* A guide's copy column scrolls inside the page, so a scrollbar on its right
   edge floats in the middle of the screen. Flipping the writing direction puts
   the bar on the left, and the copy itself flips straight back. */
.guide-step__body .guide-prose,
.guide-step__body .guide-quiz__copy {
    direction: rtl;
}

.guide-step__body .guide-prose > *,
.guide-step__body .guide-quiz__copy > * {
    direction: ltr;
}

/* Action-chain prose gets its own scroll area so the progress strip and the
   next/reset buttons sit below the scrollbar instead of scrolling with it. */
.guide-media-panel[data-guide-media-panel="text"] > .guide-prose.guide-prose--has-scroll {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-right: 0;
}

.guide-prose--has-scroll > .guide-prose__scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-left: 0.55rem;
    scrollbar-gutter: stable;
}

.guide-step__heading {
    flex: 0 0 auto;
    margin-bottom: 1rem;
}

/* A step with its own picture puts it left of the step number and title, in the
   same frame the timeline uses for that step. Steps without a picture keep the
   plain stacked heading. */
.guide-step__heading:has(> .guide-step__heading-image) {
    display: flex;
    align-items: center;
    gap: clamp(0.7rem, 1.6vw, 1rem);
}

.guide-step__heading-image {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    padding: 4px;
    border: 1.5px solid var(--border-color);
    border-radius: 9px;
    background: var(--bg-secondary);
}

.guide-step__heading-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Generated/inlined step icons fill the heading frame; the text variant follows
   the heading's own colour. */
.guide-step__heading-image svg {
    display: block;
    width: 100%;
    height: 100%;
}

.guide-step__heading-image-text {
    color: inherit;
    font-size: 1.55rem;
    font-weight: 750;
    line-height: 1;
}

.guide-step__heading-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.guide-step__eyebrow {
    margin-bottom: 0.2rem;
    color: var(--accent-color);
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.guide-step__heading h2 {
    margin: 0;
    font-size: clamp(1.35rem, 2.1vw, 1.7rem);
    font-weight: 720;
    letter-spacing: -0.015em;
}

.guide-step__summary {
    max-width: 70ch;
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 0.93rem;
    line-height: 1.55;
}

.guide-section {
    margin-top: 1.35rem;
    scroll-margin-top: calc(var(--header-height, 70px) + 1rem);
}

/* Optional visible label for a named subsection, fixed to the section's
   top-left corner. Its size is 1.5x the guide prose text. */
.guide-subsection-title {
    margin: 0 0 0.65rem;
    color: var(--accent-color);
    font-size: calc(0.94rem * 1.5);
    font-weight: 750;
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.guide-section[hidden] {
    display: none !important;
}

.guide-section + .guide-section {
    padding-top: 1.35rem;
    border-top: 1px solid var(--border-light, var(--border-color));
}

/* Only one panel is visible, so a divider above it would just be a stray line. */
.guide-section[hidden] + .guide-section {
    padding-top: 0;
    border-top: 0;
}

.guide-section__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 0.7rem;
}

.guide-section__head h3 {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    color: var(--text-color);
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.guide-section__head h3::before {
    content: "";
    width: 2px;
    height: 0.95rem;
    border-radius: 999px;
    background: var(--accent-color);
}

/* ── Text / video switch ─────────────────────────────────────────────────── */
.guide-media-toggle {
    display: flex;
    gap: 1px;
    width: 148px;
}

.guide-media-toggle__btn {
    flex: 1;
    padding: 0.25rem 0.55rem;
    border: 1.5px solid var(--accent-color);
    border-radius: 0;
    background: transparent;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.74rem;
    font-weight: 550;
    line-height: 1.35;
    cursor: pointer;
    transition: 120ms ease;
}

.guide-media-toggle__btn:first-child {
    border-radius: 5px 0 0 5px;
}

.guide-media-toggle__btn:last-child {
    border-radius: 0 5px 5px 0;
}

.guide-media-toggle__btn + .guide-media-toggle__btn {
    margin-left: -1px;
}

.guide-media-toggle__btn:hover:not(.active) {
    background: var(--hover-bg);
}

.guide-media-toggle__btn.active {
    background: var(--accent-color);
    color: #fff;
}

.guide-media-toggle__btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.guide-media-panel[hidden] {
    display: none !important;
}

/* Text sits left and its supporting image sits right. */
.guide-media-panel[data-guide-media-panel="text"] {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(220px, 0.92fr);
    grid-template-rows: auto auto;
    gap: clamp(1rem, 2.4vw, 2rem);
    align-items: start;
}

/* When a tracing quiz's next button is moved out of the scrolling prose, keep
   it under the copy and let the cube span both rows. */
.guide-media-panel[data-guide-media-panel="text"] > .guide-prose {
    grid-column: 1;
    grid-row: 1;
}

.guide-media-panel[data-guide-media-panel="text"] > .guide-example__media {
    grid-column: 2;
    grid-row: 1 / span 2;
}

.guide-media-panel[data-guide-media-panel="text"] > .guide-quiz-next-row {
    grid-column: 1;
    grid-row: 2;
    align-self: start;
}

/* When the player or image is taller than the copy, the copy still fills the
   panel height and scrolls on its own once it outgrows it. Copy that fits is
   centred against the taller media column instead of hugging the top of an
   otherwise empty column; `safe` drops it back to the top as soon as the copy
   has to scroll, so the first line is never clipped. */
.guide-media-panel[data-guide-media-panel="text"] > .guide-prose {
    display: flex;
    flex-direction: column;
    justify-content: safe center;
    align-self: stretch;
}

/* The copy uses the media column's rows too: in a panel of fixed height the
   second row would otherwise stay empty under the copy, and the copy's own
   scroll area would be that much shorter. A next-row keeps the copy above it. */
.guide-media-panel[data-guide-media-panel="text"]:not(:has(> .guide-quiz-next-row)) > .guide-prose {
    grid-row: 1 / -1;
}

/* Action chains scroll inside their own copy area, so the chain itself is the
   thing to centre there while it fits. */
.guide-prose--has-scroll > .guide-prose__scroll {
    display: flex;
    flex-direction: column;
    justify-content: safe center;
}

.guide-media-panel[data-guide-media-panel="text"] > .guide-example__media {
    align-self: stretch;
}

.guide-media-panel[data-guide-media-panel="video"] {
    width: 100%;
    max-width: 860px;
}

.guide-prose {
    max-width: 70ch;
    color: var(--text-color);
    font-size: 0.94rem;
    line-height: 1.65;
}

.guide-prose > :last-child {
    margin-bottom: 0;
}

/* Small aside inside the copy, e.g. a pro tip. */
.guide-note {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.guide-prose ul,
.guide-prose ol {
    margin-bottom: 0.6rem;
    padding-left: 1.2rem;
}

.guide-prose li + li {
    margin-top: 0.25rem;
}

.guide-prose code {
    color: var(--algorithm-text);
}

/* Sub-steps keep their own "1a)" labels, so they carry no list marker. */
.guide-step-list--plain {
    padding-left: 0;
    list-style: none;
}

/* A case heading labels one of the two ways to bring a cross piece down; the
   demo plays both on its own. */
.guide-cross-case__title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.5rem 0 0.3rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-color);
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: color 140ms ease;
}

.guide-cross-case__title:hover {
    color: var(--accent-color);
}

.guide-cross-case__title:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.guide-cross-case__title.is-active {
    color: var(--accent-color);
}

.guide-cross-case__title--static {
    cursor: default;
}

.guide-cross-case__title--static:hover {
    color: var(--text-color);
}

.guide-cross-case + .guide-cross-case {
    margin-top: 1rem;
}

/* ── Top-cross and top-side cases ────────────────────────────────────────── */
/* The four last-layer patterns in one line. The demo lights the one on the
   cube; the pictures are rendered from the player's sticker sets by
   topCrossDemo.js and topSideDemo.js. */
.guide-top-cross-cases,
.guide-top-side-cases {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.55rem;
    max-width: 24rem;
    margin: 0.55rem 0 0.65rem;
}

.guide-top-cross-case,
.guide-top-side-case {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.45rem 0.35rem 0.4rem;
    border: 1px solid rgba(var(--accent-color-rgb), 0.22);
    border-radius: 10px;
    background: rgba(var(--accent-color-rgb), 0.04);
    transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.guide-top-cross-case__image,
.guide-top-side-case__image {
    display: block;
    width: 100%;
    max-width: 4.2rem;
    height: auto;
    margin: 0 auto;
}

/* The "2 corners" card keeps one picture per shape and shows the matching one. */
.guide-top-side-case__image[hidden] {
    display: none;
}

.guide-top-cross-case__label,
.guide-top-side-case__label {
    color: var(--text-muted);
    font-size: 0.6rem;
    font-weight: 750;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: color 160ms ease;
}

.guide-top-cross-case.is-active,
.guide-top-side-case.is-active {
    border-color: var(--accent-color);
    background: rgba(var(--accent-color-rgb), 0.14);
    box-shadow: 0 0 0 2px rgba(var(--accent-color-rgb), 0.22);
}

.guide-top-cross-case.is-active .guide-top-cross-case__label,
.guide-top-side-case.is-active .guide-top-side-case__label {
    color: var(--accent-color);
}

/* The three trigger cards sit in one row. */
.guide-trigger-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.45rem 0 0.65rem;
}

/* The top-side corner pictures carry their orientation on the side bands too,
   so they get a little more room than the top-cross ones. */
.guide-top-side-cases {
    max-width: 30rem;
}

.guide-top-side-case__image {
    max-width: 6.2rem;
}

/* ── Cross quizzes ───────────────────────────────────────────────────────── */
/* Three short exercises under the cross step. Each step dims until it is the
   one being worked on, and the counts sit in the step line. */
.guide-cross-quiz {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.guide-cross-quiz__step {
    margin: 0.4rem 0 0;
    font-weight: 600;
    line-height: 1.5;
    opacity: 0.45;
    transition: opacity 0.2s ease;
}

.guide-cross-quiz__step.is-current {
    opacity: 1;
}

.guide-cross-quiz__step.is-done {
    opacity: 0.75;
}

.guide-cross-quiz__count {
    color: var(--accent-color);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.guide-cross-quiz__prompt {
    margin: 0.6rem 0 0;
    color: var(--text-muted);
    font-size: 0.86rem;
    line-height: 1.55;
}

.guide-cross-quiz .guide-pill {
    align-self: flex-start;
    margin-top: 0.6rem;
}

/* Reset and the "done" next button share one row: reset at the start, the next
   button pushed to the far end once the quiz is finished. */
.guide-cross-quiz__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.guide-cross-quiz__actions .guide-pill {
    align-self: center;
    margin-top: 0;
}

.guide-cross-quiz__actions .guide-quiz-next-row {
    width: auto;
    margin: 0 0 0 auto;
}

/* An algorithm card with a control of its own in the corner (the Sexy demo's
   fast-mode toggle). The card stays the big click target; the toggle is a
   sibling, not a nested button. */
.guide-sexy-card {
    position: relative;
    display: flex;
    margin: 0.4rem 0;
}

.guide-sexy-card .guide-alg-card {
    flex: 1;
    margin: 0;
}

.guide-callout {
    margin: 1rem 0;
    padding: 0.65rem 0.75rem;
    border-left: 3px solid var(--accent-color);
    border-radius: 0 6px 6px 0;
    background: rgba(var(--accent-color-rgb), 0.07);
    color: var(--text-color);
    font-size: 0.86rem;
    line-height: 1.5;
}

.guide-callout strong {
    color: var(--accent-color);
}

/* Numbered instructions that a running demo lights up step by step. */
.guide-step-list {
    margin: 0.2rem 0 1rem;
    padding-left: 1.4rem;
}

.guide-step-list li {
    margin: 0.35rem 0;
    color: var(--text-muted);
    /* Every step is bold, playing or not, so lighting one up only changes its
       colour and never reflows the line. */
    font-weight: 650;
    transition: color 160ms ease;
}

.guide-step-list li.is-active {
    color: var(--accent-color);
}

.guide-callout[hidden] {
    display: none !important;
}

/* The copy is a flex column, so its margins no longer collapse: a callout's own
   top margin would add to the previous paragraph's bottom margin and double the
   gap above it. Let the paragraph's spacing set the gap. */
.guide-media-panel[data-guide-media-panel="text"] > .guide-prose > .guide-callout,
.guide-prose--has-scroll > .guide-prose__scroll > .guide-callout {
    margin-top: 0;
}

.guide-inline-action {
    display: inline;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent-color);
    font: inherit;
    font-weight: 650;
    line-height: inherit;
    text-align: left;
    text-decoration: underline;
    text-decoration-color: rgba(var(--accent-color-rgb), 0.35);
    text-underline-offset: 2px;
    cursor: pointer;
    /* The current step hands the accent colour over to the next one. */
    transition: color 0.22s ease, opacity 0.22s ease, text-decoration-color 0.22s ease;
}

.guide-inline-action:hover {
    color: var(--accent-color);
    text-decoration-color: currentColor;
}

.guide-inline-action.is-active {
    color: var(--accent-color);
    text-decoration-color: currentColor;
    text-decoration-thickness: 2px;
}

.guide-inline-action:disabled {
    color: var(--text-muted);
    cursor: default;
    /* Transparent rather than none, so the underline fades with the text. */
    text-decoration-color: transparent;
    opacity: 0.7;
}

/* Chain steps: the step that was just played keeps the strong highlight, and
   the step to press next is faint until it becomes the current one. */
.guide-inline-action.is-current,
.guide-inline-action.is-current:disabled {
    color: var(--accent-color);
    text-decoration-color: currentColor;
    text-decoration-thickness: 2px;
    opacity: 0.95;
}

.guide-inline-action.is-next {
    color: var(--accent-color);
    text-decoration-color: rgba(var(--accent-color-rgb), 0.3);
    opacity: 0.62;
}

.guide-inline-action.is-next:hover,
.guide-inline-action.is-next:focus-visible {
    opacity: 1;
    text-decoration-color: currentColor;
}

/* ── Algorithm cards ─────────────────────────────────────────────────────── */
/* A sequence the reader is meant to execute is shown as a card: a small label
   above the algorithm itself, whose moves light up as they play. Scrambles and
   incidental twists stay plain text. */
.guide-alg-card {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.16rem;
    margin: 0.4rem 0;
    padding: 0.5rem 0.8rem 0.55rem;
    border: 1px solid rgba(var(--accent-color-rgb), 0.32);
    border-radius: 9px;
    background: rgba(var(--accent-color-rgb), 0.07);
    color: var(--text-color);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, opacity 0.2s ease;
}

.guide-alg-card:hover:not(:disabled) {
    border-color: rgba(var(--accent-color-rgb), 0.6);
    background: rgba(var(--accent-color-rgb), 0.12);
}

.guide-alg-card--static {
    cursor: default;
}

.guide-alg-card--static:hover {
    border-color: rgba(var(--accent-color-rgb), 0.32);
    background: rgba(var(--accent-color-rgb), 0.07);
}

.guide-alg-card:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.guide-alg-card:disabled {
    cursor: default;
    opacity: 0.62;
}

/* While its own sequence plays the card stays lit, so the run is readable. */
.guide-alg-card[aria-busy] {
    opacity: 1;
    border-color: rgba(var(--accent-color-rgb), 0.6);
    background: rgba(var(--accent-color-rgb), 0.12);
}

.guide-alg-card__label {
    color: var(--text-muted);
    font-size: 0.62rem;
    font-weight: 750;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.guide-alg-card__moves {
    /* The app-wide move type (see styles.css), the same one the algorithm
       trainers, the reconstructor and a profile's saved solutions use. */
    font-family: var(--moves-font-mono);
    font-size: 1.14rem;
    font-weight: var(--moves-font-weight);
    letter-spacing: var(--moves-letter-spacing);
    line-height: 1.25;
    white-space: nowrap;
}

/* The played move is the one the cube is turning; the tint itself is the
   app-wide `is-current-move` mark (see played-move.css), which leaves only the
   card's own vertical breathing room here. */
.guide-alg-card__move {
    padding: 0.06em 0;
}

/* A card whose algorithm is broken into triggers: each trigger keeps its moves
   together in brackets, with the trigger's name underneath. Stretches that are
   no trigger stay plain, so Righty reads `F' (R U R' U') (R' F R)`. */
.guide-alg-card__moves--breakdown {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.1rem 0.55em;
    white-space: normal;
}

.guide-alg-card__part {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.06rem;
}

.guide-alg-card__part-moves {
    white-space: nowrap;
}

.guide-alg-card__part-name {
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.58rem;
    font-weight: 750;
    letter-spacing: 0.07em;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

/* The brace lying under a trigger's moves, pointing down into its name. It
   stretches to the moves' width (`align-self: stretch`) instead of asking for a
   width of its own, so a two-move trigger keeps a narrow brace. */
.guide-alg-card__brace {
    display: block;
    align-self: stretch;
    width: auto;
    height: 0.5rem;
    margin-top: 0.02rem;
    color: var(--text-muted);
    opacity: 0.85;
    overflow: visible;
}

.guide-alg-card__brace path {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Centred reset control below a guide's interactive text. */
/* Ordered guide actions need a little breathing room below their final row so
   the round controls are never clipped by the step body's scroll edge. */
[data-guide-action-chain] {
    padding-bottom: 0.5rem;
}

/* ── Action-chain playback progress ─────────────────────────────────────── */
.guide-chain-progress {
    display: flex;
    flex: 0 0 auto;
    gap: 4px;
    margin-top: 0.65rem;
}

.guide-chain-progress[hidden] {
    display: none !important;
}

.guide-chain-progress__segment {
    flex: 1 1 0;
    min-width: 4px;
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(var(--accent-color-rgb), 0.12);
}

.guide-chain-progress__segment.is-next {
    background: rgba(var(--accent-color-rgb), 0.24);
}

.guide-chain-progress__fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent-color);
    transition: background-color 160ms ease;
}

.guide-chain-progress__segment.is-done .guide-chain-progress__fill {
    width: 100%;
    background: #9ca3af;
}

.guide-reset-row {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 2.2rem;
    margin-top: 0.85rem;
}

.guide-reset-row__steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Right-hand end of the row: move on to the next example/quiz, subsection or
   step. It stays available at every point of the chain. */
.guide-next-subsection {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    min-width: 2.2rem;
    height: 2.2rem;
    min-height: 2.2rem;
    padding: 0;
    border: 1px solid rgba(var(--accent-color-rgb), 0.45);
    border-radius: 999px;
    background: rgba(var(--accent-color-rgb), 0.07);
    color: var(--accent-color);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 650;
    line-height: 1;
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease, filter 120ms ease;
}

.guide-next-subsection:hover {
    border-color: var(--accent-color);
    background: rgba(var(--accent-color-rgb), 0.15);
}

.guide-next-subsection:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.guide-next-subsection[hidden] {
    display: none !important;
}

.guide-next-subsection.is-final {
    border-color: var(--accent-color);
    background: var(--accent-color);
    color: #fff;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.28);
    animation: guide-next-subsection-pulse 1.8s ease-in-out infinite;
}

@keyframes guide-next-subsection-pulse {
    0%,
    100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.18);
    }
}

.guide-quiz-next-row {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    margin-top: 0.55rem;
}

.guide-quiz-next-row[hidden] {
    display: none;
}

.guide-quiz-next.is-final {
    border-color: var(--accent-color);
    background: var(--accent-color);
    color: #fff;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.28);
    animation: guide-next-subsection-pulse 1.8s ease-in-out infinite;
}

.guide-reset-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    padding: 0;
    border: 1px solid rgba(var(--accent-color-rgb), 0.45);
    border-radius: 999px;
    background: rgba(var(--accent-color-rgb), 0.07);
    color: var(--accent-color);
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 120ms ease, border-color 120ms ease, background-color 120ms ease, opacity 120ms ease;
}

.guide-reset-icon:hover:not(:disabled) {
    border-color: var(--accent-color);
    background: rgba(var(--accent-color-rgb), 0.14);
    color: var(--accent-color);
}

.guide-reset-icon:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.guide-reset-icon:disabled {
    opacity: 0.45;
    cursor: default;
}

.guide-inline-action:focus-visible,
.guide-point-action:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* ── Clickable action list ──────────────────────────────────────────────── */
/* A list whose points are actions rather than plain prose. Every point is
   rendered as a full-width button card so the list reads as clickable.

   Markup:
       <ul class="guide-action-list">
           <li><button type="button" class="guide-point-action">…</button></li>
       </ul>
*/
.guide-action-list,
.guide-prose ul.guide-action-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin: 0.85rem 0 0.9rem;
    padding: 0;
    list-style: none;
}

.guide-action-list > li,
.guide-prose .guide-action-list > li {
    margin: 0;
}

.guide-point-action {
    position: relative;
    display: block;
    width: 100%;
    padding: 0.5rem 1.9rem 0.5rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: transparent;
    color: var(--text-color);
    font: inherit;
    font-size: 0.88rem;
    line-height: 1.45;
    text-align: left;
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease;
}

/* Chevron marker: the point looks like a button, not a sentence. */
.guide-point-action::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0.8rem;
    width: 0.34rem;
    height: 0.34rem;
    margin-top: -0.27rem;
    border-right: 1.5px solid var(--text-muted);
    border-bottom: 1.5px solid var(--text-muted);
    opacity: 0.65;
    transform: rotate(-45deg);
    transition: border-color 120ms ease, opacity 120ms ease;
}

.guide-point-action:hover {
    border-color: rgba(var(--accent-color-rgb), 0.45);
    background: rgba(var(--accent-color-rgb), 0.06);
}

.guide-point-action:hover::after {
    border-color: var(--accent-color);
    opacity: 1;
}

/* Pressed/toggled state, e.g. a point that twists the cube. */
.guide-point-action.is-active {
    border-color: rgba(var(--accent-color-rgb), 0.7);
    background: rgba(var(--accent-color-rgb), 0.09);
}

.guide-point-action.is-active::after {
    border-color: var(--accent-color);
    opacity: 1;
}

.guide-image-stack {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    justify-items: center;
    gap: clamp(0.3rem, 1vw, 0.8rem);
    margin-top: 1.25rem;
}

.guide-nxn-image {
    display: block;
    width: 100%;
    max-width: 260px;
    min-width: 0;
    height: auto;
}

.guide-figure {
    margin: 0;
    text-align: center;
}

.guide-figure img {
    width: 100%;
    max-width: 280px;
    max-height: 230px;
    object-fit: contain;
}

.guide-figure figcaption {
    margin-top: 0.4rem;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.guide-video {
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--card-item-border, var(--border-color));
    border-radius: 10px;
    background: var(--bg-secondary);
    aspect-ratio: 16 / 9;
}

.guide-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}

/* ── Examples ────────────────────────────────────────────────────────────── */
.guide-examples {
    display: flex;
    flex-direction: column;
}

.guide-example {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.92fr);
    gap: clamp(1rem, 2.4vw, 2rem);
    align-items: center;
    padding: 1rem 0;
    border-top: 1px solid var(--border-light, var(--border-color));
}

.guide-example:first-child {
    padding-top: 0;
    border-top: 0;
}

.guide-example:last-child {
    padding-bottom: 0;
}

.guide-example__body {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.guide-example__body h4 {
    margin: 0;
    font-size: 0.96rem;
    font-weight: 700;
}

.guide-example__body p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.86rem;
    line-height: 1.55;
}

.guide-example__moves {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted);
    font-size: 0.76rem;
}

.guide-example__moves code {
    padding: 0.14rem 0.38rem;
    border-radius: 4px;
    background: var(--bg-tertiary, var(--bg-secondary));
    color: var(--algorithm-text);
    font-size: 0.78rem;
}

.guide-example__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.1rem;
}

.guide-example__media {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.guide-example__image {
    width: 100%;
    max-height: 260px;
    object-fit: contain;
}

.guide-cube {
    position: relative;
    width: 420px;
    max-width: 100%;
    height: 375px;
    min-height: 375px;
    border-radius: 7px;
    touch-action: none;
    /* Dragging to turn the cube must never start a text selection, which used
       to leave the nearby Reset button looking highlighted. */
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.guide-cube canvas {
    border-radius: 7px;
}

.guide-cube__modes {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: calc(var(--global-renderer-z-index, 1026) + 2);
    transform: translateZ(0);
    display: flex;
    align-items: center;
    gap: 4px;
    pointer-events: none;
}

.guide-cube__mode {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px solid rgba(var(--accent-color-rgb), 0.35);
    border-radius: 7px;
    background: var(--card-item-bg, var(--card-bg));
    color: var(--accent-color);
    font-size: 11px;
    line-height: 1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
    pointer-events: auto;
    cursor: default;
}

.guide-cube-tooltip {
    position: fixed;
    z-index: calc(var(--global-renderer-z-index, 1026) + 10);
    transform: translateZ(0);
    padding: 0.32rem 0.55rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-item-bg, var(--card-bg, #1c1c1c));
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
    color: var(--text-color);
    font-family: 'Montserrat', var(--site-font);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    pointer-events: none;
}

.guide-cube-tooltip[hidden] {
    display: none !important;
}

.guide-cube__mode[data-guide-cube-mode="view"] {
    border-color: var(--border-color);
    color: var(--text-muted);
}

.guide-cube__mode[hidden] {
    display: none !important;
}

.guide-swap-diagram {
    display: flex;
    justify-content: center;
    margin: 0.75rem 0 0;
    transition: filter 220ms ease, opacity 220ms ease;
}

.guide-swap-diagram.is-grayed {
    filter: grayscale(1);
    opacity: 0.35;
}

.guide-swap-diagram svg,
.guide-swap-diagram canvas {
    display: block;
    width: 150px;
    max-width: 100%;
    height: auto;
}

/* ── Quizzes ─────────────────────────────────────────────────────────────── */
.guide-quiz {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(220px, 0.92fr);
    grid-template-rows: auto auto;
    gap: clamp(1rem, 2.4vw, 2rem);
    align-items: stretch;
}

.guide-quiz + .guide-quiz {
    margin-top: 1.35rem;
}

.guide-quiz__copy {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    align-self: stretch;
    overflow-y: auto;
    /* Quiz copy is centred against the player the same way a text panel's copy
       is; `safe` keeps a long quiz scrolling from its first line. */
    display: flex;
    flex-direction: column;
    justify-content: safe center;
}

/* Without a next-row below it, the copy owns the player's full height and can
   centre itself in it. */
.guide-quiz:not(:has(> .guide-quiz-next-row)) > .guide-quiz__copy {
    grid-row: 1 / -1;
}

.guide-quiz > .guide-quiz-next-row {
    grid-column: 1;
    grid-row: 2;
    align-self: start;
    justify-self: end;
}

.guide-quiz h4 {
    margin: 0 0 0.35rem;
    font-size: 0.98rem;
    font-weight: 700;
}

.guide-quiz__prompt {
    margin: 0 0 0.6rem;
    color: var(--text-muted);
    font-size: 0.86rem;
    line-height: 1.55;
}

.guide-quiz__options {
    display: grid;
    gap: 0.4rem;
    grid-template-columns: 1fr;
}

.guide-quiz__options--two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.guide-quiz__option {
    padding: 0.5rem 0.65rem;
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-item-bg, var(--card-bg));
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 550;
    text-align: left;
    cursor: pointer;
    transition: 120ms ease;
}

.guide-quiz__option:hover {
    border-color: rgba(var(--accent-color-rgb), 0.55);
    background: var(--hover-bg);
}

.guide-quiz__option:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.guide-quiz__option.is-correct {
    border-color: var(--success-color);
    background: var(--success-bg);
}

.guide-quiz__option.is-wrong {
    border-color: var(--danger-color);
    background: var(--danger-bg);
}

.guide-quiz__feedback {
    min-height: 1.2rem;
    margin: 0.55rem 0 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 550;
}

.guide-quiz__feedback.is-correct {
    color: var(--success-color);
}

.guide-quiz__feedback.is-wrong {
    color: var(--danger-color);
}

/* Worked solution, hidden until the quiz is answered wrong. */
.guide-quiz__solution {
    margin-top: 0.7rem;
    padding: 0.6rem 0.75rem;
    border-left: 3px solid var(--accent-color);
    border-radius: 0 6px 6px 0;
    background: rgba(var(--accent-color-rgb), 0.07);
    color: var(--text-color);
    font-size: 0.84rem;
    line-height: 1.5;
}

.guide-quiz__solution[hidden] {
    display: none;
}

.guide-quiz__solution-label {
    margin-bottom: 0.2rem;
    color: var(--accent-color);
    font-size: 0.64rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.guide-quiz__solution p {
    margin: 0;
}

/* The old per-quiz "Next" button is superseded by the shared >> button. */
.guide-quiz__next-row {
    display: none !important;
}

/* ── Numbered sub-subsections (examples, quizzes) ────────────────────────── */
/* A panel can hold a numbered series with plain arrows around its title. */
[data-guide-subcarousel-item][hidden] {
    display: none;
}

.guide-subcarousel__bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    margin: 0 0 0.9rem;
}

.guide-subcarousel__title {
    min-width: 7.5rem;
    color: var(--text-color);
    font-size: 0.92rem;
    font-weight: 700;
    text-align: center;
}

.guide-subcarousel__nav {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-width: 2.2rem;
    min-height: 2.2rem;
    padding: 0.2rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-color);
    font-size: 0.78rem;
    cursor: pointer;
    transition: color 0.15s ease, opacity 0.15s ease;
}

.guide-subcarousel__nav i {
    font-size: 0.8rem;
}

.guide-subcarousel__nav:hover:not(:disabled) {
    color: var(--accent-color);
}

.guide-subcarousel__nav:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.guide-subcarousel__nav:disabled {
    opacity: 0.45;
    cursor: default;
}

/* ── Worked example steps ────────────────────────────────────────────────── */
/* The solution of an example, read as a short sequence of next steps. */
.guide-solution-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.9rem 0 0;
    padding: 0;
    list-style: none;
    counter-reset: guide-solution;
}

.guide-solution-steps li {
    position: relative;
    padding-left: 1.9rem;
    color: var(--text-color);
    font-size: 0.88rem;
    line-height: 1.5;
    counter-increment: guide-solution;
}

.guide-solution-steps li::before {
    content: counter(guide-solution);
    position: absolute;
    top: 0.05rem;
    left: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    background: rgba(var(--accent-color-rgb), 0.14);
    color: var(--accent-color);
    font-size: 0.7rem;
    font-weight: 750;
}

/* The step that states the verdict. */
.guide-solution-steps li.is-result {
    font-weight: 650;
}

.guide-solution-steps li.is-result::before {
    background: var(--accent-color);
    color: #fff;
}

/* A clickable step: it replays that step on the example cube. */
.guide-solution-steps__action {
    display: block;
    width: 100%;
    margin: -0.15rem -0.4rem;
    padding: 0.15rem 0.4rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease;
}

.guide-solution-steps__action:hover {
    background: rgba(var(--accent-color-rgb), 0.08);
    color: var(--accent-color);
}

.guide-solution-steps__action:active {
    background: rgba(var(--accent-color-rgb), 0.14);
}

.guide-solution-steps__action:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Hovering a step also lights its number, so the step reads as one control. */
.guide-solution-steps li:not(.is-result):hover::before {
    background: rgba(var(--accent-color-rgb), 0.35);
}

/* ── Multi-item slots ────────────────────────────────────────────────────── */
/* One subsection can hold several examples or quizzes. The footer next button
   swaps the visible item and reloads the cube with that item's scramble. */
[data-guide-carousel-item][hidden] {
    display: none;
}

.guide-carousel__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 1rem;
    margin-top: 1.1rem;
}

.guide-carousel__controls {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
}

.guide-carousel__count {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Filled pill used for the main action of a block (next case, mark pairs). */
.guide-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 0.8rem;
    border: 1px solid var(--accent-color);
    border-radius: 999px;
    background: var(--accent-color);
    color: #fff;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 650;
    cursor: pointer;
    transition: filter 120ms ease;
}

.guide-pill:hover {
    filter: brightness(1.1);
}

.guide-pill:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.guide-pill i {
    font-size: 0.7rem;
    transition: transform 120ms ease;
}

.guide-pill:hover i {
    transform: translateX(2px);
}

/* ── Piece filter (one cube, one piece type at a time) ───────────────────── */
.guide-piece-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.15rem 0 0.9rem;
}

.guide-piece-filter__btn {
    padding: 0.4rem 0.8rem;
    border: 1.5px solid var(--accent-color);
    border-radius: 999px;
    background: transparent;
    color: var(--text-color);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 650;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}

.guide-piece-filter__btn:hover {
    background: rgba(var(--accent-color-rgb), 0.14);
}

.guide-piece-filter__btn.is-active {
    background: var(--accent-color);
    color: #fff;
}

.guide-piece-filter__btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* ── Outer-move grid (notation) ──────────────────────────────────────────── */
/* Six columns, one per face: plain moves, then doubles, then the inverses. */
.guide-move-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.35rem;
    margin: 0.2rem 0 1rem;
}

.guide-move-grid__move {
    padding: 0.45rem 0.15rem;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: rgba(var(--accent-color-rgb), 0.06);
    color: var(--text-color);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 650;
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
}

.guide-move-grid__move:hover {
    border-color: var(--accent-color);
    background: rgba(var(--accent-color-rgb), 0.16);
}

.guide-move-grid__move:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Hint blocks that a click can reveal (see data-guide-reveal). */
[data-guide-hint][hidden] {
    display: none;
}

/* One entry of the "types of swaps" list: copy + its own cube. */
.guide-swap {
    margin-top: 1.15rem;
}

.guide-swap + .guide-swap {
    padding-top: 1.15rem;
    border-top: 1px solid var(--border-light, var(--border-color));
}

.guide-swap h4 {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 700;
}

.guide-swap .guide-pill {
    margin-top: 0.1rem;
}

.guide-quiz__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.65rem;
}

.guide-quiz__player {
    display: flex;
    grid-column: 2;
    grid-row: 1 / span 2;
    align-items: center;
    justify-content: center;
    min-width: 0;
    align-self: stretch;
}

.guide-quiz__player .guide-cube {
    width: 420px;
    max-width: 100%;
    height: 375px;
    min-height: 375px;
}

/* Tracing quizzes use the example media column, so give their cube the same
   footprint as the multiple-choice quiz cube. */
.guide-section[data-guide-title="Quiz"] .guide-subcarousel .guide-example__media .guide-cube {
    width: 420px;
    height: 375px;
    min-height: 375px;
}

.guide-quiz--click .guide-cube {
    cursor: crosshair;
}

/* ── Tracing quizzes ─────────────────────────────────────────────────────── */
/* A two-step exercise on the cube. The steps dim while the intro scramble is
   still waiting. */
.guide-tracing-quiz {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.guide-tracing-quiz__step {
    margin: 0.4rem 0 0;
    font-weight: 600;
    line-height: 1.5;
    opacity: 0.45;
    transition: opacity 0.2s ease;
}

.guide-tracing-quiz__step.is-current {
    opacity: 1;
}

.guide-tracing-quiz__hint {
    color: var(--text-muted);
    font-weight: 400;
}

.guide-tracing-quiz__solution {
    margin: 0.25rem 0 0;
    color: var(--accent-color);
    font-family: var(--moves-font-mono);
    font-size: 1rem;
    letter-spacing: var(--moves-letter-spacing);
}

.guide-tracing-quiz__solution[hidden] {
    display: none;
}

.guide-tracing-quiz__explanation {
    margin: 0.5rem 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

.guide-tracing-quiz__explanation[hidden] {
    display: none;
}

.guide-tracing-quiz.is-locked [data-guide-quiz-step] {
    opacity: 0.5;
}

.guide-tracing-quiz .guide-pill {
    align-self: flex-start;
    margin-top: 0.5rem;
}

.guide-tracing-quiz__freeplay {
    margin: 0.5rem 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ── Optional preliminary / what's next sections ────────────────────────── */
.guide-related {
    padding: clamp(1rem, 2.2vw, 1.6rem);
    border-radius: 16px;
    background-color: var(--card-surface, rgba(var(--accent-color-rgb), 0.08));
    box-shadow: 0 2px 12px var(--shadow-sm);
}

.guide-related__head {
    margin-bottom: 0.7rem;
}

.guide-related__head h2 {
    margin: 0;
    font-size: clamp(1.2rem, 1.9vw, 1.5rem);
    font-weight: 720;
    letter-spacing: -0.015em;
}

.guide-related__head p {
    max-width: 70ch;
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.guide-related__list {
    display: flex;
    flex-direction: column;
}

.guide-related__item {
    display: grid;
    grid-template-columns: 4.3rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-top: 1px solid var(--border-light, var(--border-color));
    color: inherit;
    text-decoration: none;
}

.guide-related__item:first-child {
    padding-top: 0;
    border-top: 0;
}

.guide-related__item:last-child {
    padding-bottom: 0;
}

.guide-related__type {
    color: var(--accent-color);
    font-size: 0.62rem;
    font-weight: 750;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.guide-related__body {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.guide-related__title {
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 650;
    transition: color 120ms ease;
}

.guide-related__desc {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

.guide-related__arrow {
    color: var(--text-muted);
    font-size: 0.72rem;
    transition: color 120ms ease, transform 120ms ease;
}

.guide-related__item:hover .guide-related__title,
.guide-related__item:hover .guide-related__arrow {
    color: var(--accent-color);
}

.guide-related__item:hover .guide-related__arrow {
    transform: translateX(2px);
}

/* ── Mobile floating previous / next ─────────────────────────────────────── */
.guide-mobile-nav {
    display: none;
}

@media (max-width: 767.98px) {
    .guide-only-desktop {
        display: none;
    }

    .guide-only-mobile {
        display: inline;
    }

    .guide-page {
        padding-right: 0.45rem;
        padding-left: 0.45rem;
    }

    .guide-header {
        margin-bottom: 1rem;
    }

    .guide-layout {
        display: block;
    }

    .guide-timeline-shell--side {
        display: none;
    }

    .guide-timeline-shell--mobile {
        display: flex;
        align-items: center;
        gap: 0.25rem;
    }

    .guide-timeline-shell--top {
        margin-bottom: 0.85rem;
    }

    .guide-timeline--mobile {
        flex: 1 1 auto;
        gap: 0;
    }

    .guide-timeline-shell--mobile .guide-timeline__reset {
        flex: 0 0 auto;
        width: 2rem;
        height: 2rem;
        margin-top: 0;
        padding: 0;
    }

    .guide-timeline__item {
        padding: 0.18rem 0.05rem;
        font-size: 0.56rem;
    }

    .guide-timeline__index {
        width: 0.95rem;
        height: 0.95rem;
        margin-bottom: 0.12rem;
        font-size: 0.52rem;
    }

    .guide-timeline__thumb {
        width: clamp(30px, 8.8vw, 44px);
        height: clamp(30px, 8.8vw, 44px);
    }

    .guide-timeline__label {
        margin-top: 0.15rem;
        font-size: 0.54rem;
        -webkit-line-clamp: 1;
    }

    .guide-subtabs {
        padding: 0.45rem 0.45rem 0.35rem;
    }

    .guide-subtabs__row {
        gap: 0.4rem;
    }

    .guide-subtabs__nav {
        min-width: 2rem;
        min-height: 2rem;
        padding: 0.36rem 0.4rem;
    }

    .guide-subtabs__tabs {
        gap: 3px;
    }

    .guide-subtab {
        padding: 0.5rem 0;
    }

    .guide-step {
        height: auto;
        max-height: none;
        padding: 1rem;
        overflow: visible;
        scroll-margin-top: calc(var(--header-height, 70px) + 0.5rem);
    }

    .guide-step__body {
        height: auto;
        overflow: visible;
        scrollbar-gutter: auto;
    }

    .guide-step__body > .guide-section > .guide-subcarousel {
        display: block;
        overflow: visible;
    }

    .guide-step__body > .guide-section > .guide-subcarousel > [data-guide-subcarousel-item]:not([hidden]) {
        display: block;
    }

    .guide-step__body > .guide-section > .guide-subcarousel .guide-example__media .guide-cube {
        height: 375px;
        min-height: 330px;
        max-height: none;
    }

    .guide-media-panel[data-guide-media-panel="text"] > .guide-prose.guide-prose--has-scroll {
        display: block;
        overflow: visible;
        padding-left: 0.55rem;
    }

    .guide-prose--has-scroll > .guide-prose__scroll {
        overflow: visible;
        padding-right: 0;
    }

    .guide-step__summary {
        font-size: 0.88rem;
    }

    .guide-media-panel[data-guide-media-panel="text"],
    .guide-example,
    .guide-quiz {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.85rem;
    }

    .guide-media-panel[data-guide-media-panel="text"] {
        align-items: start;
    }

    .guide-figure img {
        max-height: 220px;
    }

    .guide-related__item {
        grid-template-columns: 3.6rem minmax(0, 1fr) auto;
        gap: 0.55rem;
    }

    .guide-related__type {
        font-size: 0.56rem;
    }

    .guide-example {
        padding: 0.9rem 0;
    }

    .guide-example__media {
        justify-content: center;
    }

    .guide-cube {
        width: 375px;
        height: 330px;
        min-height: 330px;
    }

    .guide-quiz__player {
        justify-content: center;
    }

    .guide-quiz__player .guide-cube {
        width: 375px;
        max-width: 100%;
        height: 345px;
        min-height: 345px;
    }

    .guide-section[data-guide-title="Quiz"] .guide-subcarousel .guide-example__media .guide-cube {
        width: 375px;
        height: 345px;
        min-height: 345px;
    }

    .guide-next-subsection {
        min-width: 2.2rem;
    }

    .guide-mobile-nav {
        display: block;
    }

    .guide-mobile-nav__btn {
        position: fixed;
        right: 0.55rem;
        z-index: 10000;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.2rem;
        height: 2.2rem;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: var(--accent-color);
        color: #fff;
        font-size: 0.9rem;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
        cursor: pointer;
        opacity: 0.94;
    }

    .guide-mobile-nav__btn:hover {
        opacity: 1;
    }

    .guide-mobile-nav__btn:focus-visible {
        outline: 2px solid #fff;
        outline-offset: 2px;
    }

    .guide-mobile-nav__btn--prev {
        top: calc(var(--header-height, 70px) + 0.7rem);
    }

    .guide-mobile-nav__btn--next {
        bottom: 1rem;
    }

    .guide-mobile-nav__btn[hidden] {
        display: none !important;
    }

    /* ── Phone viewport mode ──────────────────────────────────────────────── */
    body.guide-page-body main {
        width: 100%;
        max-width: none;
        margin: 0 !important;
        padding: 0 !important;
    }

    body.guide-mobile-header-hidden {
        padding-top: 0;
        --header-height: 0px;
    }

    body.guide-mobile-header-hidden #main-navbar {
        display: none !important;
    }

    .guide-page {
        width: 100%;
        max-width: none;
        padding: 5px !important;
    }

    .guide-header {
        padding-right: 0.65rem;
        padding-left: 0.65rem;
    }

    .guide-stage {
        gap: 1rem;
    }

    .guide-step {
        height: calc(100dvh - var(--header-height, 64px) - 10px);
        max-height: calc(100dvh - var(--header-height, 64px) - 10px);
        padding: 0.7rem 0.65rem;
        border-radius: 10px;
        overflow: hidden;
        scroll-margin-top: calc(var(--header-height, 64px) + 5px);
    }

    body.guide-mobile-header-hidden .guide-step {
        height: calc(100dvh - 10px);
        max-height: calc(100dvh - 10px);
        scroll-margin-top: 5px;
    }

    .guide-step__heading {
        margin-bottom: 0.5rem;
    }

    .guide-step__heading h2 {
        font-size: 1.35rem;
    }

    .guide-step__body {
        display: flex;
        flex: 1 1 auto;
        height: auto;
        min-height: 0;
        overflow: hidden;
    }

    .guide-step__body > .guide-section {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        width: 100%;
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    .guide-step__body > .guide-section > .guide-prose {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }

    .guide-subtabs {
        margin-bottom: 0.45rem;
        padding: 0.28rem 0.35rem 0.2rem;
    }

    .guide-subtabs__status {
        display: none;
    }

    .guide-subsection-title {
        margin-bottom: 0.2rem;
    }

    /* Copy scrolls; the media column/cube stays put at the bottom. */
    .guide-media-panel[data-guide-media-panel="text"] {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
        height: 100%;
        min-height: 0;
    }

    .guide-media-panel[data-guide-media-panel="text"] > .guide-prose {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        justify-content: safe center;
        min-height: 0;
        overflow-y: auto;
        padding-right: 0.35rem;
    }

    .guide-media-panel[data-guide-media-panel="text"] > .guide-prose.guide-prose--has-scroll {
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding-right: 0;
    }

    .guide-prose--has-scroll > .guide-prose__scroll {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        padding-right: 0.35rem;
    }

    .guide-media-panel[data-guide-media-panel="text"] > .guide-example__media {
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: center;
        min-height: 0;
    }

    .guide-step__body > .guide-section > .guide-subcarousel {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }

    .guide-subcarousel__bar {
        flex: 0 0 auto;
    }

    .guide-step__body > .guide-section > .guide-subcarousel > [data-guide-subcarousel-item]:not([hidden]) {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }

    .guide-step__body > .guide-section > .guide-subcarousel > [data-guide-subcarousel-item]:not([hidden]) > .guide-media-panel {
        flex: 1 1 auto;
        min-height: 0;
    }

    .guide-quiz,
    .guide-example {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }

    .guide-quiz {
        gap: 0.35rem;
    }

    .guide-quiz__copy,
    .guide-example__body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }

    .guide-quiz__player,
    .guide-example__media {
        display: flex;
        flex: 0 0 auto;
        justify-content: center;
    }

    .guide-quiz-next-row {
        flex: 0 0 auto;
        margin-top: 0.3rem;
    }

    .guide-example {
        padding: 0;
    }

    .guide-media-panel[data-guide-media-panel="text"] .guide-example__media .guide-cube,
    .guide-quiz__player .guide-cube,
    .guide-example__media .guide-cube {
        width: min(74vw, 300px);
        height: clamp(200px, 58vw, 270px);
        min-height: 0;
        max-height: 270px;
    }

    .guide-section[data-guide-title="Quiz"] .guide-subcarousel .guide-example__media .guide-cube {
        width: min(74vw, 300px);
        height: clamp(200px, 58vw, 270px);
        min-height: 0;
        max-height: 270px;
    }

    .guide-step__body > .guide-section > .guide-subcarousel .guide-example__media .guide-cube {
        width: min(74vw, 300px);
        height: clamp(200px, 58vw, 270px);
        min-height: 0;
        max-height: 270px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .guide-next-subsection.is-final {
        animation: none;
    }

    .guide-quiz-next.is-final {
        animation: none;
    }

    .guide-timeline__item,
    .guide-subtabs__nav,
    .guide-subtab__bar,
    .guide-media-toggle__btn,
    .guide-quiz__option,
    .guide-point-action,
    .guide-point-action::after,
    .guide-solution-steps__action,
    .guide-pill,
    .guide-pill i {
        transition: none;
    }
}

.ucpt-helper-form .form-label {
    font-weight: 600;
}

.ucpt-helper-form .guide-note {
    font-weight: 400;
}

.ucpt-helper-form .guide-pill {
    margin-top: 0.25rem;
}

.guide-helper-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.6rem;
}

.guide-helper-clear i {
    font-size: 0.8rem;
}

.guide-helper-controls {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-top: 1.1rem;
}

.guide-helper-controls .guide-pill {
    margin-left: auto;
}

.guide-helper-controls a.guide-pill {
    color: #fff !important;
    -webkit-text-fill-color: #fff;
    text-decoration: none;
}

.ucpt-helper-steps {
    display: grid;
    gap: 0.45rem;
    margin: 0.5rem 0 0.2rem;
}

.ucpt-helper-step {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.16));
    border-radius: 0.55rem;
    background: var(--bg-secondary, rgba(255, 255, 255, 0.04));
    color: var(--text-color, #e8edf5);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
}

.ucpt-helper-step:hover {
    border-color: rgba(59, 130, 246, 0.65);
}

.ucpt-helper-step.is-active {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.14);
}

.ucpt-helper-step__num {
    flex: 0 0 auto;
    min-width: 1.25rem;
    color: var(--accent-color);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.ucpt-helper-step__text {
    flex: 1;
    font-size: 0.8rem;
    line-height: 1.45;
}

.guide-helper-controls .guide-reset-icon:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

@media (max-width: 575px) {
    .guide-helper-controls .guide-pill {
        margin-left: 0;
    }
}

/* ── Middle Layer algorithm cards ───────────────────────────────────────── */
/* The two trigger cards sit side by side above the one shared cube player. */
.guide-alg-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.guide-alg-cards .guide-alg-card {
    margin: 0.25rem 0;
}
