.bb-transition {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
    overflow: hidden;
    /* Matches the onboarding interstitial (creating_bragbox.html) rather
       than a flat brand-yellow field. */
    background: #2a2a2a url('/static/images/bragbox-background-large.png') center / cover no-repeat;
    color: #111;
    /* Some pages this panel is embedded in (payment_connecting.html,
       logout_processing.html) never load a webfont at all, so without an
       explicit stack this fell back to the browser's default serif. */
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    opacity: 1;
    transition: opacity 220ms ease;
}

.bb-transition[hidden] {
    display: none !important;
}

.bb-transition--entry.is-leaving {
    opacity: 0;
    pointer-events: none;
}

.bb-transition__panel {
    /* Without border-box, the padding+border below add on top of the
       100% width instead of being included in it, overflowing the panel
       ~10px past each side of the viewport on mobile -- this file never
       sets box-sizing anywhere, so it was inheriting the browser default
       (content-box). */
    box-sizing: border-box;
    /* min(100%, 36rem) depends on .bb-transition's own fixed-position box
       being sized correctly to the viewport by the browser. calc(100vw -
       2rem) computes the panel's max width directly from the true
       viewport instead (matching .bb-transition's own 1rem side padding),
       so the panel keeps its margins even if an ancestor's box is ever
       mis-sized under a browser-specific fixed-position quirk. */
    width: min(calc(100vw - 2rem), 22rem);
    padding: clamp(1.25rem, 4vw, 1.75rem);
    border: 2px solid #000;
    border-radius: 0.875rem;
    background: #fff;
    box-shadow: 5px 5px 0 #000;
    text-align: center;
    outline: none;
    overflow: hidden; /* keeps the floating icons (below) from ever rendering past the card edge */
}

.bb-transition__status {
    max-width: 24ch;
    margin: 0 auto;
    font-family: 'Sora', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: clamp(1.15rem, 4vw, 1.35rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.01em;
    text-wrap: balance;
    text-transform: lowercase;
}

.bb-transition[data-transition-state="beat"] .bb-transition__status,
.bb-transition[data-transition-state="succeeded"] .bb-transition__status {
    animation: bb-transition-copy-in 500ms 100ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Cube motion/outcome slot - visible for working/beat (turning) and every
   outcome state (settled + recoloured, #41). Not just working/beat - the
   cube itself carries the outcome now, there's no separate badge element
   with its own visibility rule anymore. */
.bb-transition__motion {
    display: none;
    margin: 0 auto 1rem;
    justify-content: center;
}
.bb-transition[data-transition-state="working"] .bb-transition__motion,
.bb-transition[data-transition-state="beat"] .bb-transition__motion,
.bb-transition[data-transition-state="succeeded"] .bb-transition__motion,
.bb-transition[data-transition-state="failed"] .bb-transition__motion,
.bb-transition[data-transition-state="timed-out"] .bb-transition__motion,
.bb-transition[data-transition-state="suspended"] .bb-transition__motion,
.bb-transition[data-transition-state="locked"] .bb-transition__motion,
.bb-transition[data-transition-state="closed"] .bb-transition__motion {
    display: flex;
}
.bb-transition__detail {
    max-width: 26rem;
    margin: 0.4rem auto 0;
    color: #374151;
    font-weight: 600;
    font-size: clamp(0.85rem, 2.6vw, 0.95rem);
    line-height: 1.4;
    text-wrap: balance;
}

.bb-transition__progress {
    width: min(100%, 18rem);
    height: 0.35rem;
    margin: 2rem auto 0;
    overflow: hidden;
    border-radius: 999px;
    background: #e5e7eb;
}

.bb-transition__progress span {
    display: block;
    width: 38%;
    height: 100%;
    border-radius: inherit;
    background: #ffea30;
    animation: bb-transition-progress 1.05s linear infinite;
}

.bb-transition__actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 2rem;
}

.bb-transition__button {
    min-height: 2.75rem;
    padding: 0.65rem 1.1rem;
    border: 2px solid #111;
    border-radius: 0.5rem;
    background: #ffea30;
    color: #111;
    font: inherit;
    font-weight: 800;
    text-transform: lowercase;
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease;
}

.bb-transition__button:hover:not(:disabled) {
    background: #111;
    color: #fff;
}

.bb-transition__button--secondary {
    background: #fff;
    color: #111;
}

.bb-transition__button--secondary:hover:not(:disabled) {
    background: #111;
    color: #fff;
}

.bb-transition__button:disabled {
    cursor: wait;
    opacity: 0.45;
}

.bb-transition__button:focus-visible {
    outline: 3px solid #111;
    outline-offset: 4px;
    box-shadow: 0 0 0 7px #fff;
}

@keyframes bb-transition-progress {
    from {
        transform: translateX(-110%);
    }

    to {
        transform: translateX(275%);
    }
}

@keyframes bb-transition-copy-in {
    from {
        opacity: 0;
        transform: translateY(0.65rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .bb-transition,
    .bb-transition *,
    .bb-transition *::before,
    .bb-transition *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .bb-transition__progress span {
        width: 100%;
        transform: none;
    }
}


/* Contained Dashboard <-> My Brags layered-page route-wipe test. */
html.bb-route-wipe-pending body {
    visibility: hidden !important;
}

/* Defensive fallback for iOS Safari's translucent bottom toolbar: even
   with the overlay correctly sized and painted, a sliver of whatever's
   behind it can still show through the toolbar's own glass effect.
   Matching html/body's own background to the wipe's dominant colour
   (shared by both route-wipe systems -- see transition.js/route-wipe-
   bold.js) means that sliver, if it appears at all, is the wipe's own
   colour rather than raw page content. */
html.bb-route-wipe-active,
html.bb-route-wipe-active body {
    background: #0a0a0a;
}
