/* Guide card, step bubble and red frames (replay-help.js). The layer never blocks the page;
 * only the card and bubble take clicks. */
.replay-help-layer {
    position: fixed;
    inset: 0;
    z-index: 1300;
    pointer-events: none;
}

.replay-help-layer[hidden] {
    display: none;
}

.replay-help-frame {
    position: fixed;
    box-sizing: border-box;
    border: 3px solid #e3262d;
    border-radius: 12px;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.75), 0 0 18px rgba(227, 38, 45, 0.45);
    animation: replay-help-pulse 1.6s ease-in-out infinite;
}

.replay-help-frame[hidden] {
    display: none;
}

@keyframes replay-help-pulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.75), 0 0 10px rgba(227, 38, 45, 0.35); }
    50% { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.75), 0 0 22px rgba(227, 38, 45, 0.6); }
}

@media (prefers-reduced-motion: reduce) {
    .replay-help-frame { animation: none; }
}

.replay-help-card,
.replay-help-bubble {
    position: fixed;
    box-sizing: border-box;
    display: grid;
    gap: 8px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #ffffff;
    color: #1c2226;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.35);
    font: inherit;
    font-size: 14px;
    line-height: 1.55;
    pointer-events: auto;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.replay-help-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.replay-help-count {
    color: #b21217;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
}

.replay-help-title {
    margin: 0;
    font-size: 16px;
    line-height: 1.35;
    font-weight: 700;
    text-wrap: balance;
}

.replay-help-body,
.replay-help-note {
    margin: 0;
}

.replay-help-note {
    color: #5a666e;
    font-size: 12px;
}

.replay-help-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 2px;
}

.replay-help-card .replay-help-actions {
    justify-content: stretch;
}

.replay-help-card .replay-help-actions button {
    flex: 1 1 0;
}

.replay-help-primary,
.replay-help-secondary {
    min-height: 36px;
    padding: 0 14px;
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.replay-help-primary {
    border: 1px solid #b21217;
    background: #b21217;
    color: #ffffff;
}

.replay-help-primary:hover {
    background: #951015;
}

.replay-help-secondary {
    border: 1px solid #cfd5d9;
    background: #ffffff;
    color: #343e45;
}

.replay-help-secondary:hover {
    background: #f0f3f5;
}

.replay-help-close {
    width: 32px;
    height: 32px;
    margin: -6px -8px -6px 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #5a666e;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.replay-help-close:hover {
    background: #f0f3f5;
    color: #1c2226;
}

.replay-help-layer button:focus-visible {
    outline: 3px solid rgba(178, 18, 23, 0.45);
    outline-offset: 2px;
}

/* "?" sits beside ⚙. On a phone's route map the toolbar is full, so it floats at the top right,
 * mirroring the Tracks button at the top left. */
.replay-help-button {
    flex: 0 0 auto;
    width: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 12px;
}

.replay-help-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.route-map-tools .replay-help-button {
    flex: 0 0 42px;
    width: 42px;
    min-height: 42px;
}

.replay-help-float-slot {
    position: absolute;
    top: 9px;
    right: 13px;
    z-index: 27;
    pointer-events: none;
}

.replay-help-button.is-floating {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.92);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
    color: #ffffff;
    pointer-events: auto;
}

.replay-help-button.is-floating svg {
    width: 22px;
    height: 22px;
}

.settings-help-start {
    min-height: 30px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(180deg, var(--theme-brand) 0%, var(--accent) 100%);
    color: var(--theme-paper);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}

/* Section menu and the section name above each step. */
.replay-help-menu .replay-help-head .replay-help-title {
    flex: 1 1 auto;
}

.replay-help-menu-start {
    width: 100%;
}

.replay-help-sections {
    display: grid;
    gap: 6px;
}

.replay-help-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid #dfe3e7;
    border-radius: 10px;
    background: #f7f8fa;
    color: #1c2226;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.replay-help-section:hover {
    border-color: #b21217;
    background: #fff5f5;
}

.replay-help-section-count {
    flex: 0 0 auto;
    min-width: 24px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #e9edf0;
    color: #5a666e;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.replay-help-count {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
}

.replay-help-section-name {
    color: #5a666e;
    font-weight: 600;
    letter-spacing: 0;
}

/* Highlights take the whole screen: the guide disappears the moment they start (also keeps it out of exported video). */
body:has(.viewer-frame.is-cinematic) #replayHelpLayer {
    display: none !important;
}

/* Phone control bar: the same 44 px touch target as ⚙ beside it. */
@media (max-width: 720px), (any-pointer: coarse) and (max-width: 1180px), (pointer: coarse) and (orientation: landscape) and (max-height: 560px) {
    .replay-help-button:not(.is-floating) {
        width: 44px;
        min-height: 44px;
    }
}
