    .ce-scan-review-stage {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: flex-start;
        gap: 10px 24px;
    }

    .ce-scan-review-stage .ce-scan-preview { margin-top: 44px; }

    .ce-scan-stage-main {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        min-width: 0;
    }

    .ce-scan-canvas-wrap {
        position: relative;
        width: min(480px, 100%);
        aspect-ratio: 1 / 1;
        margin: 44px auto 10px;
        touch-action: none;
    }

    .ce-scan-canvas-wrap canvas {
        width: 100%;
        height: 100%;
        display: block;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 8px;
    }

    .ce-scan-quad {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        overflow: visible;
    }

    .ce-scan-quad-shade { fill: rgba(3, 7, 18, 0.45); pointer-events: none; }

    .ce-scan-quad-body {
        fill: rgba(212, 168, 83, 0.08);
        stroke: #f4cf80;
        stroke-width: 2;
        stroke-linejoin: round;
        cursor: move;
        touch-action: none;
    }

    .ce-scan-quad.is-invalid .ce-scan-quad-body { stroke: #f87171; fill: rgba(248, 113, 113, 0.08); }

    /* The clickable/tappable area (44px, matching mobile touch-target guidance) is deliberately
       larger than the visible dot (14px, drawn via ::after) -- keeps the compact desktop look
       while giving fingers a real target to land on. Placed by its centre (negative margins). */
    .ce-scan-quad-handle {
        position: absolute;
        width: 44px;
        height: 44px;
        margin: -22px 0 0 -22px;
        display: flex;
        align-items: center;
        justify-content: center;
        touch-action: none;
        cursor: crosshair;
        pointer-events: auto;
    }

    .ce-scan-quad-handle::after {
        content: "";
        width: 14px;
        height: 14px;
        border-radius: 50%;
        background: #f4cf80;
        border: 2px solid rgba(3, 7, 18, 0.7);
        pointer-events: none;
    }
    .ce-scan-quad-handle:focus-visible { outline: 2px solid #f4cf80; outline-offset: -4px; border-radius: 50%; }

    .ce-scan-detect-status { height: 2.6em; overflow: auto; line-height: 1.3; font-size: 12px; color: #9ca3af; text-align: center; }
    .ce-scan-detect-status.is-found { color: #86efac; }
    .ce-scan-detect-status.is-warn { color: #fcd34d; }

    .ce-scan-preview {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        width: 220px;
    }

    .ce-scan-preview-label {
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: #d4a853;
    }

    .ce-scan-preview-frame {
        position: relative;
        width: 100%;
        height: 344px;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 6px;
        border: 1px dashed rgba(212, 168, 83, 0.35);
        border-radius: 10px;
        padding: 8px;
        background: rgba(255, 255, 255, 0.03);
    }

    .ce-scan-preview-frame img {
        display: block;
        max-width: 100%;
        max-height: 280px;
        object-fit: contain;
        border-radius: 6px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
        transition: opacity 0.15s;
    }

    .ce-scan-preview-frame img.is-stale { opacity: 0.55; }

    .ce-scan-preview-status { height: 2.6em; flex-shrink: 0; overflow: auto; line-height: 1.3; font-size: 12px; color: #9ca3af; text-align: center; padding: 0 6px; }
    .ce-scan-preview-status:empty { visibility: hidden; }
    .ce-scan-preview-status.is-error { color: #fca5a5; }

    .ce-scan-rotate-spoke {
        position: absolute;
        inset: 0;
        pointer-events: none;
    }

    .ce-scan-rotate-line {
        position: absolute;
        left: 50%;
        top: -24px;
        width: 1px;
        height: 24px;
        background: rgba(255, 255, 255, 0.3);
    }

    /* Same larger-hit-area-than-visible-dot approach as .ce-scan-crop-handle. */
    .ce-scan-rotate-handle {
        position: absolute;
        left: 50%;
        top: -46px;
        transform: translateX(-50%);
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        cursor: grab;
        pointer-events: auto;
        touch-action: none;
    }

    .ce-scan-rotate-handle::after {
        content: "";
        width: 22px;
        height: 22px;
        border-radius: 50%;
        background: rgba(212, 168, 83, 0.9);
        border: 2px solid #f4cf80;
        pointer-events: none;
    }

    .ce-scan-rotate-handle:active { cursor: grabbing; }

    .ce-scan-review-angle {
        font-size: 0.68rem;
        color: rgba(255, 255, 255, 0.5);
    }

    .ce-scan-crop-clip {
        position: absolute;
        inset: 0;
        overflow: hidden;
        border-radius: 8px;
        pointer-events: none;
    }

    .ce-scan-crop-clip .ce-scan-quad-body { pointer-events: fill; }

    .ce-scan-canvas-wrap.is-zoomed canvas { cursor: grab; }

    /* Scrollbars for the zoomed view. Overlaid inside the canvas edge (not beside it) so they
       fit on a phone, where the canvas is full width. Once zoomed in the crop box covers most
       of the view, leaving little bare photo to drag -- these always can. */
    .ce-scan-scrollbar {
        position: absolute;
        z-index: 3;
        display: none;
        border-radius: 999px;
        background: rgba(8, 18, 38, 0.65);
        touch-action: none;
    }
    .ce-scan-canvas-wrap.is-zoomed .ce-scan-scrollbar { display: block; }
    .ce-scan-scrollbar.is-x { left: 6px; right: 20px; bottom: 4px; height: 10px; }
    .ce-scan-scrollbar.is-y { top: 6px; bottom: 20px; right: 4px; width: 10px; }
    .ce-scan-scrollbar-thumb {
        position: absolute;
        border-radius: 999px;
        background: rgba(244, 207, 128, 0.75);
        cursor: grab;
    }
    .ce-scan-scrollbar-thumb:hover, .ce-scan-scrollbar.is-dragging .ce-scan-scrollbar-thumb { background: #f4cf80; }
    .ce-scan-scrollbar.is-dragging .ce-scan-scrollbar-thumb { cursor: grabbing; }
    .ce-scan-scrollbar.is-x .ce-scan-scrollbar-thumb { top: 0; bottom: 0; }
    .ce-scan-scrollbar.is-y .ce-scan-scrollbar-thumb { left: 0; right: 0; }
    .ce-scan-canvas-wrap.is-panning canvas { cursor: grabbing; }

    .ce-scan-tools {
        display: flex;
        flex-wrap: wrap;
        gap: 8px 14px;
        justify-content: center;
        margin-top: 8px;
    }

    .ce-scan-tool-group {
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }

    .ce-scan-tool-group button {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.06);
        color: rgba(255, 255, 255, 0.8);
        padding: 6px 10px;
        min-height: 34px;
        font-size: 0.74rem;
        cursor: pointer;
        white-space: nowrap;
    }

    .ce-scan-tool-group button:hover:not(:disabled) { color: #f4cf80; border-color: rgba(212, 168, 83, 0.4); }
    .ce-scan-tool-group button:disabled { opacity: 0.4; cursor: default; }

    .ce-scan-tool-group button.is-active {
        color: #f4cf80;
        border-color: rgba(212, 168, 83, 0.6);
        background: rgba(212, 168, 83, 0.1);
    }

    .ce-scan-tool-group button[data-zoom="in"],
    .ce-scan-tool-group button[data-zoom="out"] {
        justify-content: center;
        min-width: 34px;
        padding: 6px 0;
        font-size: 1rem;
        line-height: 1;
    }

    .ce-scan-shape-icon {
        display: inline-block;
        border: 1.5px solid currentColor;
        border-radius: 2px;
    }

    .ce-scan-shape-icon.is-portrait { width: 9px; height: 13px; }
    .ce-scan-shape-icon.is-landscape { width: 13px; height: 9px; }

    .ce-scan-zoom-readout {
        min-width: 44px;
        text-align: center;
        font-size: 0.72rem;
        color: rgba(255, 255, 255, 0.6);
        font-variant-numeric: tabular-nums;
    }

    .ce-scan-tool-short { display: none; }

    .ce-scan-tools-hint {
        margin-top: 6px;
        text-align: center;
        font-size: 0.66rem;
        color: rgba(255, 255, 255, 0.4);
    }


@media (max-width: 480px) {
        .ce-scan-stage-main {
            flex: 1 1 auto;
            min-width: 0;
        }

        .ce-scan-canvas-wrap {
            width: 100%;
            margin: 44px auto 4px;
        }

        /* Compact tool rows on a phone: icon-first labels, tighter gaps, and the long hint goes
           (pinch/drag are what a phone user tries first anyway). */
        /* Two rows on a phone: rotate (icon-only) + zoom (short labels) share the first, card
           shape gets the second -- three rows pushed the footer off a normal phone screen. */
        .ce-scan-tools { gap: 6px 10px; }
        .ce-scan-tool-group button { padding: 5px 7px; min-height: 32px; font-size: 0.68rem; }
        .ce-scan-tool-group.is-rotate button { min-width: 32px; justify-content: center; font-size: 0.95rem; }
        .ce-scan-tool-group.is-rotate .ce-scan-tool-text,
        .ce-scan-tool-group.is-zoom .ce-scan-tool-text { display: none; }
        .ce-scan-tool-group.is-zoom .ce-scan-tool-short { display: inline; }
        .ce-scan-tool-group.is-zoom { order: 1; }
        .ce-scan-tool-group.is-shape { order: 2; }
        .ce-scan-zoom-readout { min-width: 38px; }
        .ce-scan-tools-hint { display: none; }
}
