/* ==========================================================================
   x3fw v4 - liquid glass
   Loaded after style.css and settings.css. Neutral graphite field, white
   accent. Two materials:

     clear glass   every surface. Thin blur, a lens that bends the backdrop
                   along the bezel with a chromatic fringe (liquid.js, Chromium),
                   and a painted chromatic rim that works everywhere.
     liquid white  everything that is "on": the build button, the selected
                   option, the slider thumb at rest. Glossy, lit from above.

   Removing the <link> brings the previous look back unchanged.
   ========================================================================== */

@property --rim-angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: -75deg;
}

@property --sheen-angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: -45deg;
}

/* --- Tokens ------------------------------------------------------------- */

:root {
    --bg:           #0b0b0d;
    --surface:      #19191c;
    --surface-sunk: #111113;

    --fg:        #f5f5f7;
    --fg-muted:  #a1a1a6;
    --fg-subtle: #6e6e73;

    --accent:       #f5f5f7;
    --accent-hover: #ffffff;
    --accent-press: #dedee3;
    --accent-fg:    #0b0b0d;
    --accent-tint:  rgba(255, 255, 255, 0.08);
    --accent-line:  rgba(255, 255, 255, 0.28);

    --hairline: rgba(255, 255, 255, 0.08);

    /* Radius. Four steps and nothing in between, so the same kind of
       element always has the same curve:
         pill  every control: buttons, chips, tabs, segments, badges, bars
         lg    surfaces: panels, sidebar, cards, dialogs, banners, tiles
         md    anything sitting inside a surface: fields, notices, items
         sm    small marks: check boxes, swatches, colour chips */
    --r-sm: 8px;
    --r-xs: var(--r-sm);
    --r-md: 16px;
    --r-lg: 24px;
    --r-pill: 999px;

    --ease: cubic-bezier(0.25, 1, 0.5, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --t-fast: 160ms;
    --t-base: 320ms;

    /* Clear glass. The blur stays low on purpose: a lens can only bend what
       is still sharp, and the chromatic fringe needs edges to split. */
    --lg-blur: 5px;
    --lg-sat: 180%;
    --lg-tint: rgba(16, 16, 19, 0.42);

    /* Flat fills shared by every clear-glass control, and the recessed well
       shared by every track and field. */
    --lg-control: rgba(255, 255, 255, 0.05);
    --lg-control-hover: rgba(255, 255, 255, 0.09);
    --lg-well: rgba(0, 0, 0, 0.28);
    --lg-well-edge: inset 0 1px 3px rgba(0, 0, 0, 0.45), inset 0 -1px 0 rgba(255, 255, 255, 0.06);

    /* Painted rim: white where the light hits, split into cyan, magenta and
       amber either side of each highlight, the way a real bevel disperses. */
    --lg-rim: conic-gradient(from var(--rim-angle) at 50% 50%,
        rgba(255, 255, 255, 0.85),
        rgba(140, 220, 255, 0.45) 4%,
        rgba(255, 255, 255, 0.05) 13% 37%,
        rgba(255, 140, 220, 0.40) 45%,
        rgba(255, 255, 255, 0.60) 50%,
        rgba(150, 255, 210, 0.35) 55%,
        rgba(255, 255, 255, 0.05) 63% 87%,
        rgba(255, 200, 130, 0.40) 95%,
        rgba(255, 255, 255, 0.85));

    /* Inner edge: a cyan fringe on the lit side, magenta on the far side,
       plus the soft internal bounce that gives the material thickness. */
    --lg-edge:
        inset 1.5px 1.5px 1px -0.5px rgba(150, 215, 255, 0.28),
        inset -1.5px -1.5px 1px -0.5px rgba(255, 140, 210, 0.22),
        inset 0 1px 1px rgba(255, 255, 255, 0.22),
        inset 0 -6px 14px -8px rgba(255, 255, 255, 0.10),
        inset 0 0 22px rgba(255, 255, 255, 0.03);

    --lg-drop: 0 16px 36px -16px rgba(0, 0, 0, 0.85), 0 2px 6px -2px rgba(0, 0, 0, 0.5);

    /* Liquid white */
    --lw-fill: linear-gradient(180deg, #f8f8fa 0%, #e9e9ed 48%, #d6d6db 100%);
    --lw-shadow:
        inset 0 1px 0 #fff,
        inset 0 -2px 3px rgba(0, 0, 0, 0.10),
        inset 1px 0 1px rgba(150, 210, 255, 0.35),
        inset -1px 0 1px rgba(255, 160, 210, 0.30),
        0 8px 24px -10px rgba(255, 255, 255, 0.38),
        0 3px 8px -3px rgba(0, 0, 0, 0.55);

    --page-max: 1440px;
    --header-h: 68px;
}

@media (min-width: 960px) {
    :root { --header-h: 76px; }
}

html { background: var(--bg); }
body { background: transparent; }

::selection { background: rgba(255, 255, 255, 0.22); }

/* --- Ambient field ------------------------------------------------------ */
/* Glass needs detail behind it to bend: soft light pools, fixed to the
   viewport so every surface slides over them. */

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(42% 32% at 10% 6%,  rgba(255, 255, 255, 0.13), transparent 70%),
        radial-gradient(36% 30% at 94% 28%, rgba(210, 210, 222, 0.08), transparent 72%),
        radial-gradient(50% 36% at 64% 96%, rgba(255, 255, 255, 0.07), transparent 72%),
        radial-gradient(28% 22% at 32% 58%, rgba(255, 255, 255, 0.035), transparent 70%),
        var(--bg);
}

/* --- Clear glass -------------------------------------------------------- */

.glass,
.glass-sunk,
.glass-deep,
.glass-bar,
.settings-sidebar,
.trigger-dialog,
.header-inner,
.build-actions {
    background: var(--lg-tint);
    -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-sat));
    backdrop-filter: blur(var(--lg-blur)) var(--glass-lens, ) saturate(var(--lg-sat)) brightness(1.06);
    border: 0;
    box-shadow: var(--lg-edge), var(--lg-drop);
}

.glass::before { display: none; }

.glass::after,
.settings-sidebar::after,
.header-inner::after,
.build-actions::after {
    content: "";
    display: block;
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: inherit;
    background: var(--lg-rim);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.75;
    pointer-events: none;
    transition: --rim-angle 700ms var(--ease), opacity var(--t-base) var(--ease);
}

@media (hover: hover) { .glass-interactive:hover::after { --rim-angle: -130deg; opacity: 1; } }

/* Tracks that hold a selection are recessed: darker, lit from below. */
.glass-sunk {
    background: var(--lg-well);
    box-shadow: var(--lg-well-edge);
}
.glass-sunk::after { opacity: 0.4; }

.glass-deep {
    --lg-blur: 24px;
    --lg-tint: rgba(22, 22, 26, 0.72);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .glass, .glass-bar, .settings-sidebar, .trigger-dialog, .header-inner, .build-actions { background: var(--surface); }
    .glass-sunk { background: var(--surface-sunk); }
}

/* --- Liquid white ------------------------------------------------------- */

.btn--primary,
.lg-ind,
.model[aria-pressed="true"],
.settings-nav-item[aria-current="page"],
.lg-thumb {
    background: var(--lw-fill);
    color: var(--accent-fg);
    box-shadow: var(--lw-shadow);
}

/* --- Sliding indicator (liquid.js) -------------------------------------- */

.lg-has-ind { position: relative; }

.lg-ind {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    border-radius: var(--r-pill);
    pointer-events: none;
    transform-origin: center;
    scale: 1 var(--squash, 1);
    will-change: transform, width;
}

.lg-has-ind > button {
    position: relative;
    z-index: 1;
    transition: color 220ms var(--ease), transform var(--t-base) var(--spring);
}

/* With an indicator present the buttons themselves stay clear. */
.lg-has-ind > button[aria-pressed="true"],
.lg-has-ind > button[aria-selected="true"] {
    color: var(--accent-fg);
    background: transparent !important;
    box-shadow: none !important;
}

.lg-has-ind > button:active:not(:disabled) { transform: scale(0.94); }

/* --- Loading screen ----------------------------------------------------- */

.boot {
    background:
        radial-gradient(50% 38% at 50% 40%, rgba(255, 255, 255, 0.09), transparent 70%),
        var(--bg);
    transition: opacity 460ms var(--ease), transform 460ms var(--ease);
}

.boot[data-done="1"] { transform: scale(1.05); }

.boot-inner { position: relative; gap: 22px; }

.boot-orb {
    position: relative;
    display: grid;
    place-items: center;
    width: 100px;
    height: 100px;
    border-radius: var(--r-lg);
    background: rgba(16, 16, 19, 0.35);
    -webkit-backdrop-filter: blur(3px) saturate(180%);
    backdrop-filter: blur(3px) saturate(180%);
    box-shadow: var(--lg-edge), var(--lg-drop), 0 0 70px -10px rgba(255, 255, 255, 0.16);
    animation: boot-float 2.4s var(--ease) infinite alternate;
}

/* A light runs round the rim, dispersing as it goes. */
.boot-orb::after {
    content: "";
    position: absolute;
    inset: 0;
    padding: 1.5px;
    border-radius: inherit;
    background: conic-gradient(from var(--rim-angle),
        rgba(255, 255, 255, 0.95),
        rgba(140, 220, 255, 0.6) 5%,
        rgba(255, 255, 255, 0.04) 16% 46%,
        rgba(255, 140, 220, 0.55) 54%,
        rgba(255, 255, 255, 0.6) 60%,
        rgba(255, 210, 140, 0.45) 66%,
        rgba(255, 255, 255, 0.04) 78%,
        rgba(255, 255, 255, 0.95));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: boot-rim 1.8s linear infinite;
}

.boot-mark {
    width: 48px;
    height: 48px;
    opacity: 1;
    animation: none;
    filter: grayscale(1) brightness(1.6) drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.boot-word {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 19px;
    font-weight: 650;
    letter-spacing: -0.03em;
    color: var(--fg);
}

.boot-track {
    width: 120px;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.boot-track > i {
    width: 45%;
    background: var(--lw-fill);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.45);
    animation: boot-slide 1.2s var(--ease) infinite;
}

@keyframes boot-rim { to { --rim-angle: 285deg; } }

@keyframes boot-float {
    from { transform: translateY(0); }
    to   { transform: translateY(-6px); }
}

/* --- Version badge ------------------------------------------------------ */

.ver {
    display: inline-flex;
    align-items: center;
    height: 17px;
    padding: 0 6px;
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.02em;
    color: var(--fg-muted);
    background: rgba(255, 255, 255, 0.07);
    border-radius: var(--r-pill);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 1px 0 0 rgba(150, 215, 255, 0.2),
        inset -1px 0 0 rgba(255, 140, 210, 0.2);
    transform: translateY(-1px);
}

/* --- Header: a floating capsule ------------------------------------------ */

.header {
    height: auto;
    padding: calc(8px + env(safe-area-inset-top, 0px)) var(--gutter) 8px;
    background: transparent;
    border: 0;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    pointer-events: none;
}

.header::after { display: none; }

.header-inner {
    --lg-blur: 10px;
    --lg-tint: rgba(18, 18, 21, 0.5);
    position: relative;
    height: 52px;
    padding: 0 7px 0 14px;
    border-radius: var(--r-pill);
    pointer-events: auto;
}

@media (min-width: 960px) {
    .header { padding-top: calc(10px + env(safe-area-inset-top, 0px)); padding-bottom: 10px; }
    .header-inner { height: 56px; padding: 0 9px 0 18px; }
}

.brand { gap: 8px; font-size: inherit; }
.brand-mark { width: 24px; height: 24px; filter: grayscale(1) brightness(1.5); }

.lang { padding: 3px; border-radius: var(--r-pill); }

.lang-btn {
    min-width: 42px;
    height: 36px;
    border-radius: var(--r-pill);
}

/* --- Tabs --------------------------------------------------------------- */

.tabs {
    position: relative;
    display: inline-flex;
    gap: 2px;
    padding: 4px;
    margin-bottom: 18px;
    border: 0;
    border-radius: var(--r-pill);
    background: var(--lg-well);
    box-shadow: var(--lg-well-edge);
}

.tab {
    height: 38px;
    padding: 0 20px;
    border-radius: var(--r-pill);
}

.tab::after { display: none; }

/* --- Scooter picker ----------------------------------------------------- */

.model {
    border-radius: var(--r-lg);
    transition: background var(--t-base) var(--ease),
                box-shadow var(--t-base) var(--ease),
                transform var(--t-base) var(--spring);
}

.model:active:not(:disabled) { transform: scale(0.95); }

.model[aria-pressed="true"]::after { display: none; }
.model[aria-pressed="true"] .model-name { color: var(--accent-fg); font-weight: 650; }
.model[aria-pressed="true"] .model-figure img { transform: scale(1.06); filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.25)); }

.model-check { background: var(--accent-fg); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }
.model-check svg { stroke: #fff; }

/* A badge, like the version tag. */
.model-soon { border-radius: var(--r-pill); }

/* --- Segmented controls ------------------------------------------------- */

.segments,
#components {
    border-radius: var(--r-pill);
    padding: 4px;
}

.segment {
    border-radius: var(--r-pill);
    font-weight: 600;
}

@media (hover: hover) { .segment:hover:not(:disabled):not([aria-pressed="true"]) {
    color: var(--fg);
    background: var(--lg-control-hover);
} }

/* Without liquid.js the selected segment carries the material itself. */
.segment[aria-pressed="true"] {
    color: var(--accent-fg);
    background: var(--lw-fill);
    box-shadow: var(--lw-shadow);
}

/* --- Settings sidebar --------------------------------------------------- */

.settings-sidebar {
    position: sticky;
    top: calc(var(--header-h) + 4px);
    border-radius: var(--r-lg);
}

/* A pill on every screen size, like the segments and tabs that carry the
   same liquid-white selection. */
.settings-nav-item {
    position: relative;
    padding-inline: 16px;
    border-radius: var(--r-pill);
    transition: background-color var(--t-base) var(--ease),
                color var(--t-fast) var(--ease),
                transform var(--t-base) var(--spring);
}

.settings-nav-item:active { transform: scale(0.96); }
.settings-nav-item::after { color: var(--fg-subtle); }
@media (hover: hover) { .settings-nav-item:hover:not([aria-current="page"]) { background: var(--lg-control-hover); color: var(--fg); } }
.settings-nav-item[aria-current="page"] { font-weight: 600; }
.settings-nav-item[aria-current="page"]::after { color: var(--accent-fg); }

/* --- Panels ------------------------------------------------------------- */

.panel { border-radius: var(--r-lg); }

.settings-ready .panel-head {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
    border-bottom: 1px solid var(--hairline);
}

.panel-scope {
    color: var(--fg);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.panel-content .group-label:not(:first-child) { margin-top: var(--s-5); }

/* --- Row labels --------------------------------------------------------- */
/* Every settings row names itself the same way, whether the markup wraps
   the text in .field-label or not. */

.slider-head > label,
.toggle-text {
    font-size: var(--fs-base);
    color: var(--fg-muted);
}

/* The end labels of a slider sit under its track, not under its name. */
@media (min-width: 600px) {
    .slider > .range-labels { grid-column: 2; }
}

/* --- Sliders (liquid.js) ------------------------------------------------- */

.lg-range {
    --thumb-w: 36px;
    --thumb-h: 24px;
    position: relative;
    display: block;
    width: 100%;
    height: 32px;
    touch-action: pan-y;
}

.slider > .lg-range { grid-column: 2; grid-row: 1; }

/* The native input stays on top for pointer, keyboard and screen readers;
   its thumb is sized like the drawn one so values map to the same spot. */
.lg-range > input[type="range"] {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    opacity: 0;
}

.lg-range > input[type="range"]::-webkit-slider-runnable-track { height: 100%; background: none; box-shadow: none; }
.lg-range > input[type="range"]::-webkit-slider-thumb { width: var(--thumb-w); height: 100%; margin-top: 0; }
.lg-range > input[type="range"]::-moz-range-track { background: none; }
.lg-range > input[type="range"]::-moz-range-thumb { width: var(--thumb-w); height: 100%; border-radius: 0; }

.lg-track {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 7px;
    margin-top: -3.5px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, 0.09);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.55), inset 0 -1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.lg-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: calc(var(--thumb-w) / 2 + (100% - var(--thumb-w)) * var(--v, 0));
    border-radius: inherit;
    background: linear-gradient(180deg, #ffffff, #cfcfd5);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
}

.lg-thumb {
    position: absolute;
    top: 50%;
    left: 0;
    z-index: 1;
    width: var(--thumb-w);
    height: var(--thumb-h);
    margin-top: calc(var(--thumb-h) / -2);
    border-radius: var(--r-pill);
    pointer-events: none;
    translate: calc((100cqw - var(--thumb-w)) * var(--v, 0)) 0;
    transform: scale(var(--sx, 1), var(--sy, 1));
    transition: background 200ms var(--ease), box-shadow 200ms var(--ease), scale 260ms var(--spring);
    -webkit-backdrop-filter: blur(0.5px);
    backdrop-filter: var(--glass-lens, ) saturate(160%);
}

.lg-range { container-type: inline-size; }

/* Pressed, the thumb grows and turns to clear glass: the fill underneath
   shows through it, bent and split at the rim. */
.lg-range[data-pressed] .lg-thumb {
    scale: 1.32 1.38;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
    box-shadow:
        inset 1.5px 1.5px 1px -0.5px rgba(150, 215, 255, 0.7),
        inset -1.5px -1.5px 1px -0.5px rgba(255, 140, 210, 0.6),
        inset 0 1px 1px rgba(255, 255, 255, 0.85),
        inset 0 0 0 1px rgba(255, 255, 255, 0.35),
        0 10px 22px -8px rgba(0, 0, 0, 0.7);
}

.lg-range:has(input:focus-visible) .lg-thumb { outline: 2px solid rgba(255, 255, 255, 0.7); outline-offset: 3px; }
.lg-range:has(input:disabled) .lg-thumb { background: #6e6e73; box-shadow: none; }
.lg-range:has(input:disabled) .lg-fill { background: rgba(255, 255, 255, 0.3); box-shadow: none; }

/* --- Switches ----------------------------------------------------------- */

.switch { width: 58px; margin-right: -6px; }

.switch-track {
    width: 50px;
    height: 30px;
    background: rgba(255, 255, 255, 0.10);
    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.55),
        inset 0 -1px 0 rgba(255, 255, 255, 0.06);
    transition: background var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}

.switch-track::after {
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: var(--lw-fill);
    box-shadow:
        inset 0 1px 0 #fff,
        inset 0 -1px 2px rgba(0, 0, 0, 0.12),
        0 3px 8px rgba(0, 0, 0, 0.5);
    transition:
        transform 420ms var(--spring),
        width 260ms var(--ease),
        height 260ms var(--ease),
        top 260ms var(--ease),
        left 260ms var(--ease),
        background 200ms var(--ease),
        box-shadow 200ms var(--ease);
}

.switch input:checked + .switch-track {
    background: var(--lw-fill);
    box-shadow: inset 0 1px 0 #fff, inset 0 -1px 3px rgba(0, 0, 0, 0.18), 0 0 18px -4px rgba(255, 255, 255, 0.35);
}

.switch input:checked + .switch-track::after {
    transform: translateX(20px);
    background: linear-gradient(180deg, #2c2c30, #121214);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 2px 6px rgba(0, 0, 0, 0.45);
}

/* Pressed, the knob swells into a clear lens, like iOS. */
.switch:active .switch-track::after {
    top: -2px;
    left: -3px;
    width: 36px;
    height: 34px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.05));
    -webkit-backdrop-filter: blur(1px) brightness(1.25);
    backdrop-filter: blur(1px) brightness(1.25);
    box-shadow:
        inset 1.5px 1.5px 1px -0.5px rgba(150, 215, 255, 0.75),
        inset -1.5px -1.5px 1px -0.5px rgba(255, 140, 210, 0.65),
        inset 0 1px 1px rgba(255, 255, 255, 0.9),
        inset 0 0 0 1px rgba(255, 255, 255, 0.35),
        0 8px 18px -6px rgba(0, 0, 0, 0.6);
}

.switch:active input:checked + .switch-track::after { transform: translateX(17px); }

/* --- Buttons ------------------------------------------------------------ */

.btn { border-radius: var(--r-pill); }

.btn:active:not(:disabled) { transform: scale(0.96); }

.btn--primary {
    transition: transform var(--t-base) var(--spring), box-shadow var(--t-base) var(--ease), opacity var(--t-fast);
}

@media (hover: hover) { .btn--primary:hover:not(:disabled) {
    box-shadow:
        inset 0 1px 0 #fff,
        inset 0 -2px 3px rgba(0, 0, 0, 0.08),
        inset 1px 0 1px rgba(150, 210, 255, 0.4),
        inset -1px 0 1px rgba(255, 160, 210, 0.35),
        0 14px 34px -10px rgba(255, 255, 255, 0.5),
        0 4px 10px -4px rgba(0, 0, 0, 0.5);
} }

.btn--primary:active:not(:disabled) { background: linear-gradient(180deg, #ececf0, #d6d6db); }

/* Sheen that slides across on hover, same as the reference button. */
.btn--primary::after,
.btn--secondary::after,
.trigger-configure::after {
    content: "";
    display: block;
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(var(--sheen-angle),
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.85) 40% 50%,
        rgba(255, 255, 255, 0) 55%);
    background-size: 220% 220%;
    background-position: 0% 50%;
    background-repeat: no-repeat;
    transition: background-position 650ms var(--ease), --sheen-angle 650ms var(--ease);
}

.btn--secondary::after,
.trigger-configure::after { opacity: 0.22; }

@media (hover: hover) { .btn--primary:hover:not(:disabled)::after, .btn--secondary:hover:not(:disabled)::after, .trigger-configure:hover::after { background-position: 30% 50%; } }

.btn--primary:active:not(:disabled)::after,
.btn--secondary:active:not(:disabled)::after { background-position: 50% 15%; --sheen-angle: -15deg; }

/* Secondary: clear glass pill. */
.btn--secondary,
.trigger-configure,
.preset,
.link-btn,
.mirrors a,
.stock-item,
.dpad-key,
.nwo-chip,
.nwo-icon,
.check {
    position: relative;
    color: var(--fg);
    background: var(--lg-control);
    border: 0;
    box-shadow: var(--lg-edge), 0 6px 16px -8px rgba(0, 0, 0, 0.6);
    transition: background var(--t-base) var(--ease),
                box-shadow var(--t-base) var(--ease),
                transform var(--t-base) var(--spring);
}

@media (hover: hover) { .btn--secondary:hover:not(:disabled), .trigger-configure:hover, .preset:hover, .link-btn:hover, .mirrors a:hover, .stock-item:hover:not(:disabled), .dpad-key:hover:not(:disabled), .nwo-chip:hover, .nwo-icon:hover, .check:hover {
    background: var(--lg-control-hover);
    border-color: transparent;
} }

.preset,
.trigger-configure,
.btn--secondary,
.nwo-chip { border-radius: var(--r-pill); }

.link-btn,
.mirrors a,
.stock-item,
.dpad-key,
.nwo-icon,
.check { border-radius: var(--r-md); }

.preset:active,
.dpad-key:active:not(:disabled),
.link-btn:active,
.stock-item:active:not(:disabled),
.trigger-configure:active { transform: scale(0.95); }

@media (hover: hover) { .preset[data-tone="danger"]:hover { background: var(--danger-tint); } }

.btn--danger { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 10px 26px -12px rgba(229, 100, 107, 0.7); }

@media (hover: hover) { .btn--ghost:hover:not(:disabled) { color: var(--fg); } }

.check:has(input:checked) { background: rgba(255, 255, 255, 0.12); }

.check input:checked + .check-box {
    background: var(--lw-fill);
    border-color: transparent;
    box-shadow: inset 0 1px 0 #fff, 0 2px 6px -2px rgba(0, 0, 0, 0.5);
}

.info {
    border: 0;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.flash-bar > i { background: var(--lw-fill); box-shadow: 0 0 12px rgba(255, 255, 255, 0.5); }

@media (hover: hover) { .stock-item:hover:not(:disabled) .stock-item-mark { color: var(--fg); } }

/* --- Stock revert ------------------------------------------------------- */
/* Lives inside the glass sidebar, so it must not be a second pane. */

#stock-bar {
    background: transparent;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

#stock-bar::after { display: none; }

/* Turnstile runs interaction-only and leaves an invisible container behind
   after the first build. Give it its own zero-gap row above the dock so the
   label and button never split; a real challenge still shows full width. */
.build-actions { row-gap: 0; }
.build-actions .challenge { order: -1; flex: 1 1 100%; margin: 0; }

/* --- Inputs ------------------------------------------------------------- */

.trigger-select,
.curve-number,
.nwo-input,
.category-picker select {
    border-radius: var(--r-md);
    border: 0;
    background: var(--lg-well);
    box-shadow: var(--lg-well-edge);
}

/* --- Dialogs, toast, popovers ------------------------------------------- */

.trigger-dialog {
    --lg-blur: 26px;
    --lg-tint: rgba(24, 24, 28, 0.78);
    border-radius: var(--r-lg);
}

.trigger-dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.trigger-dialog-head {
    background: rgba(30, 30, 34, 0.7);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--hairline);
}

.trigger-done { color: var(--fg); }

.modal {
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    backdrop-filter: blur(10px) saturate(140%);
}

.modal-box { border-radius: var(--r-lg); }
.modal-actions .btn { min-height: 50px; }

.info-pop {
    background: rgba(30, 30, 34, 0.8);
    border: 0;
    border-radius: var(--r-md);
    box-shadow: var(--lg-edge), var(--lg-drop);
}

.toast { border-radius: var(--r-pill); }

.kofi-banner {
    border-radius: var(--r-lg);
    background: linear-gradient(180deg, rgba(40, 40, 44, 0.82), rgba(22, 22, 25, 0.86));
    -webkit-backdrop-filter: blur(24px) saturate(170%);
    backdrop-filter: blur(24px) saturate(170%);
    box-shadow: var(--lg-edge), 0 20px 48px rgba(0, 0, 0, 0.55);
}

.kofi-banner::after { display: none; }
.kofi-banner-avatar { border-radius: var(--r-md); }

/* --- Misc --------------------------------------------------------------- */

.notice,
.dpc-chip,
.unlock-code,
.nwo-logo-shot { border-radius: var(--r-md); }
.card { border-radius: var(--r-lg); }
.footer { border-top: 0; }

.dpc-area { opacity: 0.08; }
.dpc-dot { fill: #fff; }
.dpc-line { filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.35)); }

/* ==========================================================================
   Desktop
   ========================================================================== */

@media (min-width: 960px) {
    .page { padding-top: 10px; }

    .models { gap: 10px; }
    .model { min-height: 76px; padding: 10px 14px; }
    @media (hover: hover) { .model:hover:not(:disabled):not([aria-pressed="true"]) {
        background: linear-gradient(var(--lg-control-hover), var(--lg-control-hover)), var(--lg-tint);
    } }

    #components { min-height: 76px; padding: 6px; }
    .segment { min-height: 44px; }

    .settings-sidebar { padding: 12px; }
    .settings-nav-item { min-height: 44px; }

    .build-actions {
        --lg-blur: 10px;
        position: sticky;
        bottom: 16px;
        z-index: 30;
        margin-top: 16px;
        padding: 10px 10px 10px 22px;
        border-radius: var(--r-pill);
    }

    #build-btn { min-height: 48px; min-width: 240px; }
}

/* ==========================================================================
   Phone and tablet
   ========================================================================== */

@media (max-width: 959px) {
    .page { padding-top: 6px; }

    .tabs { display: flex; width: 100%; }
    .tab { flex: 1; height: 40px; }

    /* Scooters: four small cards with the artwork, so the choice is
       recognisable at a glance rather than a row of similar words. */
    .models { gap: 8px; }
    .model {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        min-height: 98px;
        padding: 10px 4px 9px;
    }
    .model-figure {
        display: grid;
        flex: none;
        width: 100%;
        height: 54px;
        aspect-ratio: auto;
        border-radius: var(--r-md);
        /* A soft pool of light so the dark scooter artwork reads on glass. */
        background: radial-gradient(60% 70% at 50% 62%, rgba(255, 255, 255, 0.16), transparent 72%);
    }
    .model-figure img {
        position: absolute;
        inset: 3px 0;
        width: 100%;
        height: calc(100% - 6px);
        object-fit: contain;
    }
    .model[aria-pressed="true"] .model-figure { background: none; }
    .model-name {
        max-width: 100%;
        font-size: 12px;
        font-weight: 600;
        text-align: center;
        letter-spacing: -0.01em;
    }
    .model-check {
        display: grid;
        position: absolute;
        top: 7px;
        right: 7px;
        width: 16px;
        height: 16px;
        margin: 0;
    }
    .model-check svg { width: 9px; height: 9px; }

    #components { min-height: 52px; padding: 4px; }
    .segment { min-height: 44px; font-size: 13px; }

    /* Sticky strip under the header: only the profile picker. */
    .settings-sidebar {
        --lg-blur: 12px;
        --lg-tint: rgba(18, 18, 21, 0.62);
        top: var(--header-h);
        z-index: 20;
        margin: 0 calc(-1 * var(--gutter) + 6px) 12px;
        padding: 6px;
    }

    .profile-bar { margin: 0; }
    #profiles { min-height: 46px; }
    #profiles .segment { min-height: 38px; font-size: 13px; }

    .settings-ready .panel-content { padding: 6px 16px 14px; }
    .slider { padding: 10px 0; }
    .toggle-row { min-height: 54px; }

    /* Build dock: floats above the content, one thumb from the bottom. */
    .build-actions {
        --lg-blur: 12px;
        --lg-tint: rgba(18, 18, 21, 0.62);
        bottom: calc(10px + var(--safe-b));
        margin: 14px calc(-1 * var(--gutter) + 6px) 0;
        padding: 8px 8px 8px 18px;
        border-radius: var(--r-pill);
    }

    .build-context { flex: 0 1 auto; font-size: 12px; font-weight: 550; color: var(--fg-muted); }
    #build-btn { min-height: 50px; font-size: 15px; }

    .page { padding-bottom: calc(18px + var(--safe-b)); }
    .toast { bottom: calc(94px + var(--safe-b)); }

    .trigger-row { min-height: 64px; }
    .trigger-configure { min-height: 40px; }
}

@media (max-width: 599px) {
    .trigger-dialog {
        border-radius: var(--r-lg) var(--r-lg) 0 0;
        max-height: calc(100dvh - 24px);
    }
    .trigger-dialog-head { border-radius: var(--r-lg) var(--r-lg) 0 0; padding-top: 18px; }

    .trigger-dialog-head::before {
        content: "";
        position: absolute;
        top: 6px;
        left: 50%;
        width: 36px;
        height: 5px;
        margin-left: -18px;
        border-radius: var(--r-pill);
        background: rgba(255, 255, 255, 0.25);
    }

    .modal { place-items: end center; }
}

@media (prefers-reduced-motion: reduce) {
    .boot-orb, .boot-orb::after { animation: none; }
}

/* ==========================================================================
   Touch screens
   ========================================================================== */

/* Taps act at once: no double-tap zoom delay, no grey flash. */
button, a, label, summary, select, .segment, .settings-nav-item, .lg-range {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.lg-range { touch-action: pan-y; }

/* liquid.js takes the pointer on touch screens so a scroll that starts on a
   slider does not change it; the input stays for keyboard and screen readers. */
.lg-range[data-touch] > input[type="range"] { pointer-events: none; }

@media (hover: none), (pointer: coarse) {
    /* A backdrop filter on every thumb is redrawn for each scrolled frame. */
    .lg-thumb { -webkit-backdrop-filter: none; backdrop-filter: none; }
    .glass-interactive::after { transition: none; }
}

@media (max-width: 959px) {
    /* iOS zooms the whole page into any field under 16px and leaves it
       zoomed, which is where most of the sideways wobble came from. */
    input[type="text"], input[type="number"], input:not([type]), select, textarea,
    .nwo-input, .trigger-select, .curve-number input { font-size: 16px; }

    /* Stop the page bouncing sideways when a chip row is flung. */
    html, body { overflow-x: clip; }
}
