/* Mountain ball run (/gifts/ball-run/). The bench-and-panel layout of the
   other gift makers, with a stage for the 3D roll, a height and speed strip
   under it and the run's numbers at the top of the panel. */

.br {
    --bench: #182024;
    --bench-deep: #11171a;
    --panel: #141716;
    --field: #1c201e;
    --field-2: #232826;
    --ink: #eceee9;
    --muted: #9aa49e;
    --rule: rgba(236, 238, 233, 0.09);
    --accent: var(--tpa-accent, #ff8f1f);
    --track: #ff8a1f;
    --real: #2e3a8c;
    --bad: #ff4d4d;
    --good: #8fd6a8;
    font-family: 'Schibsted Grotesk', system-ui, sans-serif;
    color: var(--ink);
    max-width: 1560px;
    margin: 0 auto;
    padding: 14px 24px 56px;
}
.br *, .br *::before, .br *::after { box-sizing: border-box; }
.br h1, .br h2, .br h3 { font-family: inherit; color: var(--ink); }
.br-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.br-intro { padding: 18px 0 16px; border-bottom: 1px solid var(--rule); }
.br-intro h1 { font-size: 2.15rem; font-weight: 800; letter-spacing: -0.035em; line-height: 1; margin: 0 0 10px; }
.br-intro p { color: var(--muted); font-size: 0.93rem; line-height: 1.5; margin: 0; }

.br-app { display: grid; grid-template-columns: minmax(0, 1fr) 410px; gap: 20px; align-items: start; }

/* ---------- the bench ---------- */
.br-bench {
    position: sticky; top: 68px;
    display: flex; flex-direction: column;
    height: calc(100vh - 84px); min-height: 600px;
    background: var(--bench-deep); border-radius: 14px; overflow: hidden;
}
.br-benchbar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; flex-wrap: wrap; }
.br-stage {
    position: relative; flex: 1; min-height: 0; margin: 0 10px; border-radius: 10px; overflow: hidden;
    background: radial-gradient(120% 90% at 50% 25%, #26333a 0%, var(--bench) 62%, #12181b 100%);
}
.br-3d { position: absolute; inset: 0; }
.br-3d canvas { width: 100% !important; height: 100% !important; display: block; cursor: grab; touch-action: none; }
.br-progress { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: rgba(255, 255, 255, 0.06); z-index: 4; }
.br-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.br-empty {
    position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); margin: 0; z-index: 3;
    background: rgba(17, 23, 26, 0.9); color: var(--ink); padding: 12px 18px; border-radius: 10px; font-size: 0.92rem; text-align: center; max-width: min(90%, 420px); line-height: 1.45;
}

/* the big button */
.br-drop {
    position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 3;
    display: inline-flex; align-items: center; gap: 12px;
    border: 0; border-radius: 999px; padding: 10px 22px 10px 10px;
    background: linear-gradient(180deg, #ffa043, #ff8a1f); color: #1d1206;
    font: inherit; font-size: 1.05rem; font-weight: 800; letter-spacing: -0.01em; cursor: pointer;
    box-shadow: 0 12px 30px -10px rgba(255, 138, 31, 0.65), 0 2px 0 rgba(255, 255, 255, 0.35) inset;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s;
}
.br-drop:hover:not(:disabled) { transform: translateX(-50%) translateY(-2px); box-shadow: 0 16px 34px -10px rgba(255, 138, 31, 0.75), 0 2px 0 rgba(255, 255, 255, 0.35) inset; }
.br-drop:disabled { opacity: 0.45; cursor: progress; }
.br-drop:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.br-drop-ball {
    width: 30px; height: 30px; border-radius: 50%; flex: none;
    background: radial-gradient(circle at 34% 30%, #ffffff 0 9%, #dfe5ea 16%, #8b959c 46%, #3b4247 72%, #b9c2c8 100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.br-drop.is-rolling .br-drop-ball { animation: br-spin 0.6s linear infinite; }
@keyframes br-spin { to { transform: rotate(360deg); } }

.br-hud {
    position: absolute; left: 12px; top: 12px; z-index: 3; min-width: 168px;
    background: rgba(12, 16, 18, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 10px; padding: 8px 12px 10px;
    font-variant-numeric: tabular-nums;
}
.br-hud-row { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; }
.br-hud-k { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.br-hud b { font-size: 1.15rem; font-weight: 700; }
.br-hud-meter { height: 4px; background: rgba(255, 255, 255, 0.08); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.br-hud-meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #8fd6a8, #ffcf5a, #ff6a3d); }
.br-finish {
    position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 3;
    background: rgba(12, 16, 18, 0.8); border: 1px solid rgba(143, 214, 168, 0.35); color: var(--ink);
    padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 0.95rem; white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis;
}
.br-finish.is-bad { border-color: rgba(255, 77, 77, 0.5); }

/* height and speed strip */
.br-chart { height: 112px; margin: 8px 10px 0; position: relative; }
.br-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.br-chart .ax { fill: rgba(236, 238, 233, 0.5); font-size: 10px; font-family: inherit; }
.br-chart .tip { fill: var(--ink); font-size: 11px; font-weight: 600; }
.br-status { margin: 0; padding: 6px 14px 10px; font-size: 0.8rem; color: rgba(236, 238, 233, 0.62); min-height: 2.2em; }

/* ---------- controls ---------- */
.br-seg { display: inline-flex; background: rgba(0, 0, 0, 0.28); border-radius: 9px; padding: 3px; gap: 2px; }
.br-seg button {
    border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.85rem; font-weight: 600;
    padding: 6px 11px; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.br-seg button:hover { color: var(--ink); }
.br-seg button[aria-pressed="true"], .br-seg button[aria-selected="true"] { background: var(--ink); color: #141716; }
.br-icon { border: 0; background: rgba(0, 0, 0, 0.28); color: var(--ink); width: 34px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 1rem; }
.br-icon[aria-pressed="true"] { background: var(--ink); }
.br-benchbar .br-icon:first-of-type { margin-left: auto; }
.br-tabs { display: flex; width: 100%; background: var(--field); margin-bottom: 10px; }
.br-tabs button { flex: 1; padding: 6px 4px; font-size: 0.82rem; }

.br-panel { background: var(--panel); border-radius: 14px; padding: 4px 18px 18px; }
.br-sec { padding: 16px 0 18px; border-bottom: 1px solid var(--rule); }
.br-sec h2 { font-size: 1.05rem; font-weight: 700; margin: 0 0 12px; letter-spacing: -0.01em; }
.br-sec h3 { font-size: 0.92rem; font-weight: 700; margin: 0 0 6px; }
.br-hint { font-size: 0.79rem; color: var(--muted); margin: 8px 0 0; line-height: 1.45; }
.br-note { font-size: 0.84rem; margin: 10px 0 0; line-height: 1.45; }
.br-note:empty { display: none; }

/* the run's numbers */
.br-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.br-fact { background: var(--field); border-radius: 9px; padding: 9px 10px 8px; min-width: 0; }
.br-fact b { display: block; font-size: clamp(0.95rem, 1.2vw, 1.2rem); font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.br-fact span { display: block; font-size: 0.72rem; color: var(--muted); line-height: 1.3; }
.br-fact.is-hero { grid-column: span 3; display: flex; align-items: baseline; gap: 10px; background: linear-gradient(120deg, #2a2116, #1c201e 70%); }
.br-fact.is-hero b { font-size: 1.7rem; color: #ffb066; white-space: nowrap; flex: none; }
.br-fact.is-hero > span { flex: 1; min-width: 0; }
.br-fact.is-warn b { color: #ffb36b; }
.br-flags { list-style: none; margin: 8px 0 0; padding: 0; font-size: 0.82rem; }
.br-flags li { padding: 4px 0 4px 18px; position: relative; color: var(--muted); }
.br-flags li::before { content: ''; position: absolute; left: 2px; top: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.br-flags li.is-bad::before { background: var(--bad); }
.br-flags li.is-warn::before { background: #ffb36b; }

.br-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.br .br-preset {
    display: flex; flex-direction: column; gap: 1px; text-align: left; border: 1px solid transparent;
    background: var(--field); color: var(--ink); border-radius: 9px; padding: 8px 10px; cursor: pointer; font: inherit; text-decoration: none;
}
.br .br-preset:hover { background: var(--field-2); }
.br .br-preset[aria-current="true"] { border-color: var(--accent); background: #2a2116; }
.br-preset b { font-size: 0.88rem; font-weight: 700; }
.br-preset span { font-size: 0.72rem; color: var(--muted); }

.br-search { display: flex; gap: 6px; }
.br-search input, .br-field input, .br-field select {
    width: 100%; min-width: 0; background: var(--field); color: var(--ink); border: 1px solid transparent; border-radius: 8px;
    padding: 8px 10px; font: inherit; font-size: 0.9rem;
}
.br-field select { appearance: auto; }
.br-search input:focus, .br-field input:focus, .br-field select:focus { outline: none; border-color: var(--accent); }
.br-results { list-style: none; margin: 6px 0 0; padding: 0; }
.br-results button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--ink); font: inherit; padding: 7px 8px; border-radius: 7px; cursor: pointer; }
.br-results button:hover, .br-results button:focus-visible { background: var(--field); }
.br-results strong { display: block; font-size: 0.9rem; font-weight: 600; }
.br-results span { display: block; font-size: 0.76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br-res-note { font-size: 0.8rem; color: var(--muted); padding: 6px 8px; }
.br-row-btns { display: flex; gap: 12px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.br-file { display: block; background: var(--field); border: 1px dashed rgba(236, 238, 233, 0.25); border-radius: 9px; padding: 14px; text-align: center; cursor: pointer; font-size: 0.88rem; }
.br-file:hover { border-color: var(--accent); }
.br-file input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.br-mapwrap { position: relative; margin-top: 12px; border-radius: 9px; overflow: hidden; background: var(--field); }
.br-map { width: 100%; aspect-ratio: 1 / 1; }
.br-maplegend { position: absolute; left: 8px; bottom: 8px; display: flex; gap: 10px; flex-wrap: wrap; pointer-events: none; background: rgba(20, 23, 22, 0.8); border-radius: 6px; padding: 3px 8px; font-size: 0.72rem; }
.br-maplegend span { display: inline-flex; align-items: center; gap: 5px; }
.br-maplegend i { width: 14px; height: 3px; border-radius: 2px; }
.lg-real { background: #3346c4; }
.lg-track { background: var(--track); height: 5px !important; }
.lg-bad { background: var(--bad); width: 8px !important; height: 8px !important; border-radius: 50% !important; }
.br-mapwrap .maplibregl-ctrl-attrib { font-size: 10px; }

.br-balls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.br-ball {
    display: flex; align-items: center; gap: 8px; border: 1px solid transparent; background: var(--field); color: var(--ink);
    border-radius: 9px; padding: 7px 8px; cursor: pointer; font: inherit; text-align: left;
}
.br-ball:hover { background: var(--field-2); }
.br-ball[aria-checked="true"] { border-color: var(--accent); background: #2a2116; }
.br-ball i { flex: none; border-radius: 50%; background: radial-gradient(circle at 34% 30%, #fff 0 10%, #d8dee3 18%, #87919a 50%, #3a4146 76%, #aab4bb 100%); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.br-ball.is-glass i { background: radial-gradient(circle at 34% 30%, #fff 0 10%, rgba(200, 235, 255, 0.85) 22%, rgba(120, 190, 230, 0.55) 55%, rgba(60, 120, 160, 0.8) 100%); }
.br-ball b { display: block; font-size: 0.85rem; font-weight: 700; }
.br-ball span { display: block; font-size: 0.7rem; color: var(--muted); }

.br-field { display: block; margin: 10px 0 0; }
.br-field > span, .br-range > span { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.br-range output { color: var(--ink); }
.br-range { display: block; margin: 12px 0 4px; }
.br-range input { width: 100%; accent-color: var(--accent); }
.br-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.br-check { display: flex; align-items: center; gap: 9px; font-size: 0.87rem; margin: 9px 0; cursor: pointer; }
.br-check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; flex: none; }
.br-link { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: 0.8rem; text-decoration: underline; cursor: pointer; }
.br-link:hover { color: var(--ink); }

.br-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid rgba(236, 238, 233, 0.2); background: transparent; color: var(--ink); font: inherit; font-size: 0.88rem; font-weight: 600;
    padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.br-btn:hover:not(:disabled) { border-color: var(--ink); }
.br-btn-main { background: var(--accent); border-color: var(--accent); color: #1a1205; }
.br-btn-main:hover:not(:disabled) { background: #ffa246; border-color: #ffa246; }
.br-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.br-btn:focus-visible, .br-seg button:focus-visible, .br-link:focus-visible, .br-preset:focus-visible, .br-ball:focus-visible, .br-icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.br-dl { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.br-test { margin-top: 16px; background: var(--field); border-radius: 10px; padding: 12px; }
.br-test .br-btn { margin-top: 10px; }
.br-license { font-size: 0.76rem; color: var(--muted); margin: 12px 0 0; }
.br-license a { color: var(--muted); }
.br-info { font-size: 0.84rem; line-height: 1.5; }
.br-info p { margin: 0 0 6px; }
.br-info ul { margin: 6px 0 0; padding-left: 1.1rem; color: var(--muted); }
.br-info li { margin-bottom: 3px; }
.br-swatches { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0; }
.br-swatches span { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.br-swatches i { width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.br-safety { margin-top: 14px; font-size: 0.8rem; line-height: 1.45; color: #e9d7c4; background: rgba(255, 143, 31, 0.08); border: 1px solid rgba(255, 143, 31, 0.25); border-radius: 9px; padding: 10px 12px; }

/* ---------- about ---------- */
.br-about { margin-top: 44px; max-width: 1180px; }
.br-about h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 16px; }
.br-about-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 40px; }
.br-about h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.br-about p, .br-about li { color: var(--muted); font-size: 0.92rem; line-height: 1.6; max-width: 62ch; }
.br-about p { margin: 0; }
.br-about ul { margin: 0; padding-left: 1.1rem; }
.br-credit { margin-top: 22px !important; font-size: 0.82rem !important; }

.br-toast {
    position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50;
    width: max-content; max-width: calc(100vw - 32px);
    background: var(--ink); color: #141716; padding: 10px 16px; border-radius: 9px; font-size: 0.9rem; font-weight: 500;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
}

@media (max-width: 1100px) {
    .br-app { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 900px) {
    .br { padding: 12px 14px 44px; }
    .br-app { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .br-bench { position: relative; top: 0; height: auto; min-height: 0; }
    .br-stage { height: 400px; flex: none; }
    .br-about-cols { grid-template-columns: 1fr; gap: 18px; }
    .br-panel { display: contents; }
    .br-intro { order: -1; border: 0; padding: 6px 2px 4px; }
    .br-intro h1 { font-size: 1.8rem; }
    .br-sec { order: 1; background: var(--panel); border-radius: 12px; padding: 14px; border: 0; }
    .br-safety { order: 2; }
}
@media (max-width: 480px) {
    .br-stage { height: 330px; }
    .br-benchbar { gap: 6px; padding: 8px; }
    .br-seg button { padding: 5px 8px; font-size: 0.78rem; }
    .br-icon { width: 30px; height: 30px; }
    .br-tabs button { font-size: 0.74rem; padding: 6px 2px; }
    .br-fact b { font-size: 1.05rem; }
    .br-fact.is-hero b { font-size: 1.4rem; }
    .br-balls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .br-drop { font-size: 0.95rem; padding: 8px 18px 8px 8px; bottom: 12px; }
    .br-drop-ball { width: 26px; height: 26px; }
    .br-hud { min-width: 0; padding: 6px 9px 8px; }
    .br-hud b { font-size: 0.98rem; }
}
@media (prefers-reduced-motion: reduce) {
    .br-drop, .br-progress i { transition: none; }
    .br-drop.is-rolling .br-drop-ball { animation: none; }
}

/* Terrain mode and the track style */
.br-mt0 { margin-top: 0 !important; margin-bottom: 10px !important; }
.br-presets + .br-row-btns { margin-top: 10px; }
.br-style { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.br-label { font-size: 0.86rem; }
.br-style .br-seg { background: var(--field); }
.br-fact.is-hero small { display: block; color: var(--muted); font-size: 0.72rem; }
.br-meter { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 6px; }
.br-meter i { display: block; height: 100%; background: linear-gradient(90deg, #ff8a1f, #ffcf5a); }
