/* Brachistochrone race (/brachistochrone): what is its own - the canvas stage and what is drawn over it. The buttons and the accent
   come from the app kit (css/app-kit, docs/app-kit.md); the sliders and checkboxes are the shared app controls.
   Loaded only on this app's page (StylePaths). The stage is the canvas's own box, not the kit's padded
   .ak-stage column; the phone layout is the shared one for canvas apps in landing/seo-pages.css. */

.filter-landing-stage.brach-landing-stage {
    position: relative;
    display: block;
    width: 100%;
    min-height: 280px;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    box-shadow: none;
    cursor: crosshair;
    touch-action: none;
    background-color: #12161f;
    background-image: none;
}

.brach-landing-stage.is-over-finish {
    cursor: grab;
}

.brach-landing-stage.is-dragging {
    cursor: grabbing;
}

.brach-landing-canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
}

/* Top right: the tracks start at A in the top left. */
.brach-hud {
    position: absolute;
    z-index: 2;
    right: 12px;
    top: 12px;
    width: max-content;
    min-width: 170px;
    max-width: min(300px, calc(100% - 24px));
    box-sizing: border-box;
    margin: 0;
    padding: 9px 13px 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(8, 12, 24, 0.72);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #e2e8f0;
    font-size: 0.78rem;
    line-height: 1.55;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

.brach-hud:empty,
.brach-hud[hidden],
.brach-hud [hidden] {
    display: none;
}

.brach-hud-row {
    margin: 0;
}

.brach-hud-head {
    margin-bottom: 3px;
}

.brach-hud-label,
.brach-hud-caption {
    opacity: 0.66;
}

.brach-hud-caption {
    margin-top: 2px;
    font-size: 0.92em;
}

.brach-hud-value {
    color: #f8fafc;
    font-weight: 600;
}

.brach-hud-lane {
    display: flex;
    align-items: center;
    gap: 6px;
}

.brach-hud-swatch {
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.brach-hud-rank {
    flex: none;
    min-width: 1.3em;
    opacity: 0.66;
}

.brach-hud-name {
    flex: 1 1 auto;
    opacity: 0.85;
}

/* Times keep one width from "…" to "0.806 s", so the panel does not grow mid-race. */
.brach-hud-time {
    flex: none;
    min-width: 4.4em;
    margin-inline-start: 10px;
    text-align: end;
}

.brach-hud-lane.is-winner .brach-hud-name,
.brach-hud-lane.is-winner .brach-hud-rank {
    color: #fbbf24;
    opacity: 1;
    font-weight: 600;
}

.brach-hud-foot {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0.8;
    white-space: normal;
}

.brach-hud-paused {
    display: inline-block;
    width: 8px;
    height: 10px;
    margin-inline-end: 7px;
    box-sizing: border-box;
    border-left: 3px solid #fbbf24;
    border-right: 3px solid #fbbf24;
    vertical-align: -1px;
}

.brach-landing-stage--compact .brach-hud {
    right: 8px;
    top: 8px;
    min-width: 0;
    max-width: calc(100% - 16px);
    padding: 6px 9px 7px;
    border-radius: 10px;
    font-size: 0.66rem;
    line-height: 1.45;
}

/* The track checkboxes carry their track's colour. */
.brach-tracks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 8px;
}

.brach-track > span::before {
    content: "";
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-inline-end: 6px;
    border-radius: 50%;
    background: var(--brach-track-color, #94a3b8);
    vertical-align: 0;
}

.brach-track--cycloid { --brach-track-color: #38bdf8; }

.brach-track--parabola { --brach-track-color: #a78bfa; }

.brach-track--circle { --brach-track-color: #fbbf24; }

.brach-track--drop { --brach-track-color: #34d399; }

.brach-track--straight { --brach-track-color: #f87171; }

.brach-track--custom { --brach-track-color: #f472b6; }

.brach-track:has(input:disabled),
.brach-landing-controls .app-slider-row:has(input:disabled) {
    opacity: 0.45;
}

body.filter-app-mode .brach-landing-app .brach-landing-canvas {
    max-width: none;
}

body.filter-app-mode .brach-landing-stage {
    box-shadow: none;
}

.brach-landing-stage.brach-stage--transparent {
    background: var(--component-checkerboard);
}
