/**
 * First-run orientation tour.
 *
 * The spotlight is a single element with a very large box-shadow spread: that darkens the whole
 * viewport except its own box, with no positioning library, no extra DOM and nothing that forces
 * layout. Deliberately NOT filter: blur() on the question area -- blurring promotes the entire
 * question subtree to its own compositor layer, and every question is in the DOM at once, so on a
 * long paper that is real GPU cost for decoration.
 */

.rmqb-tour-overlay {
    position: fixed;
    inset: 0;
    /*
     * Above the accessibility FAB (999998), which is fixed to the bottom-right of every quiz
     * page. Below that value the FAB floated over the dimming -- so the one step that points AT
     * the FAB could never single it out -- and on a phone it sat on top of the card's buttons.
     */
    z-index: 999999;
    pointer-events: auto;
}

/* The hole. Moved by setting top/left/width/height from JS. */
.rmqb-tour-spotlight {
    position: fixed;
    border-radius: 10px;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.62);
    outline: 3px solid #2563eb;
    outline-offset: 3px;
    pointer-events: none;
    transition: top 0.22s ease, left 0.22s ease, width 0.22s ease, height 0.22s ease;
}

/* No target to point at (the intro and outro steps): dim everything, ring nothing. */
.rmqb-tour-spotlight.rmqb-tour-no-target {
    outline: none;
    width: 0;
    height: 0;
    top: 50%;
    left: 50%;
}

.rmqb-tour-card {
    position: fixed;
    z-index: 1000000;
    box-sizing: border-box;
    width: min(340px, calc(100vw - 32px));
    background: #fff;
    color: #1f2937;
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.3);
    padding: 18px 18px 14px;
    font-size: 15px;
    line-height: 1.5;
    transition: top 0.22s ease, left 0.22s ease;
}

.rmqb-tour-card h3 {
    margin: 0 0 6px;
    font-size: 17px;
    line-height: 1.3;
    color: #111827;
}

.rmqb-tour-card p {
    margin: 0 0 14px;
}

.rmqb-tour-foot {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rmqb-tour-count {
    font-size: 13px;
    color: #6b7280;
    margin-right: auto;
}

.rmqb-tour-card button {
    font: inherit;
    cursor: pointer;
    border-radius: 7px;
    padding: 8px 15px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
}

.rmqb-tour-card button.rmqb-tour-next {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
    font-weight: 600;
}

.rmqb-tour-card button:focus-visible {
    outline: 3px solid #1d4ed8;
    outline-offset: 2px;
}

.rmqb-tour-skip {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 2px 8px !important;
    border: 0 !important;
    background: none !important;
    color: #6b7280 !important;
    font-size: 20px !important;
    line-height: 1;
}

/* "How this works" on the welcome screen, so the tour can be replayed. */
.rmqb-tour-replay {
    display: inline-block;
    margin-top: 12px;
    background: none;
    border: 0;
    padding: 4px 2px;
    font: inherit;
    font-size: 14px;
    color: #2563eb;
    text-decoration: underline;
    cursor: pointer;
}

/*
 * Keep the paper unreadable while the clock is stopped.
 *
 * visibility (not display) so every element keeps its box: the spotlight is positioned from live
 * getBoundingClientRect() values, and collapsing the layout underneath it would move every target
 * the moment the tour opened.
 *
 * visibility: visible on a descendant overrides a hidden ancestor, which is how the step currently
 * being explained is revealed even when it sits inside the hidden question body.
 */
.rmqb-tour-running .rmqb-question-title,
.rmqb-tour-running .rmqb-question-body,
.rmqb-tour-running .rmqb-case-header {
    visibility: hidden;
}

.rmqb-tour-running .rmqb-tour-reveal,
.rmqb-tour-running .rmqb-tour-reveal * {
    visibility: visible;
}

/*
 * Calm Mode exists to still motion, and prefers-reduced-motion is the same request from the OS.
 * A tour that glides anyway is worse than no tour for the people those settings are for.
 */
.rmqb-wrapper[data-calm="1"] .rmqb-tour-spotlight,
.rmqb-wrapper[data-calm="1"] .rmqb-tour-card {
    transition: none;
}

@media (prefers-reduced-motion: reduce) {
    .rmqb-tour-spotlight,
    .rmqb-tour-card {
        transition: none;
    }
}

/* Phone: a full-width card pinned to the bottom beats trying to dodge the target at 375px. */
@media (max-width: 520px) {
    .rmqb-tour-card {
        width: calc(100vw - 32px);
        left: 16px !important;
        right: 16px;
        top: auto !important;
        bottom: 16px;
    }

    /*
     * Target low on the screen (the submit button, the accessibility FAB): move the card out of
     * its way rather than trying to dodge it. At 375px there is not room to do both.
     */
    .rmqb-tour-card.rmqb-tour-card--top {
        top: 16px !important;
        bottom: auto;
    }
}
