/*!
 * liquid-glass.css — a Liquid Glass theme for any website. No build step, no framework.
 *
 *   <link rel="stylesheet" href="liquid-glass.css">
 *   <script src="liquid-glass.js" defer></script>     (optional: real edge refraction + moving highlights)
 *
 * THE RULES (from Apple's guidance — the look falls apart when these are ignored)
 *   1. Glass is for the layer that floats ABOVE content: toolbars, tab bars, sidebars,
 *      menus, sheets, floating buttons. Content itself (cards, lists, page background)
 *      uses the plain surfaces below (.lg-card, .lg-list), never glass.
 *   2. Never put glass on glass. Inside a glass bar, buttons are .lg-plain.
 *   3. Use it sparingly: a few important floating elements per screen.
 *   4. .lg-glass (regular) everywhere; .lg-clear only over photos/video, with .lg-dim
 *      (35% dark layer) behind it when the media is bright.
 *   5. Nested corners are concentric: inner radius = outer radius - padding (.lg-nest).
 *   6. Tint only what matters most (one .lg-prominent action per view).
 *
 * THEMING
 *   Glass follows the page's color-scheme. Put one of these on <html> or any subtree:
 *     .lg-auto   follow the OS        .lg-light / .lg-dark   force one
 *   Override any --lg-* token on :root or on a single element, e.g.
 *     :root { --lg-accent: #00806a; }      <nav class="lg-glass" style="--lg-radius: 28px">
 *
 * Works in current Chrome, Edge, Firefox and Safari. Edge refraction is Chromium-only
 * (which is what almost everybody on Windows uses); other browsers get the same glass
 * without the lensing.
 */

/* ============================== Tokens ============================== */
@property --lg-light-angle { syntax: "<angle>"; inherits: true; initial-value: 135deg; }
@property --lg-hx { syntax: "<length>"; inherits: true; initial-value: 1.5px; }
@property --lg-hy { syntax: "<length>"; inherits: true; initial-value: 1.5px; }
:root {
  --lg-font: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

  /* Text and color */
  --lg-fg: light-dark(#121215, #f5f5f7);
  --lg-fg-2: light-dark(rgba(18, 18, 21, 0.68), rgba(245, 245, 247, 0.72));
  --lg-fg-3: light-dark(rgba(18, 18, 21, 0.52), rgba(245, 245, 247, 0.55));
  --lg-accent: light-dark(#0068d6, #2f8fff);
  --lg-on-accent: #fff;
  --lg-danger: light-dark(#d12c2c, #ff6b63);

  /* Content layer (not glass) */
  --lg-page: light-dark(#f2f2f6, #0b0b0e);
  --lg-surface: light-dark(#ffffff, #1b1b1f);
  --lg-sep: light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.12));
  --lg-well: light-dark(rgba(0, 0, 0, 0.06), rgba(255, 255, 255, 0.1));
  --lg-well-hover: light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.16));

  /* Glass material */
  --lg-fill: light-dark(rgba(255, 255, 255, 0.46), rgba(38, 38, 44, 0.46));
  --lg-fill-clear: light-dark(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  --lg-fill-solid: light-dark(#f4f4f7, #232328);        /* reduced transparency / no backdrop-filter */
  --lg-rim: light-dark(rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.5));   /* lit edge */
  --lg-rim-dim: light-dark(rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.07));
  --lg-edge: light-dark(rgba(0, 0, 0, 0.09), rgba(0, 0, 0, 0.55));             /* outer hairline */
  --lg-bloom: light-dark(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.1)); /* inner edge glow */
  --lg-sheen: light-dark(rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.16)); /* pointer highlight */
  --lg-shade: light-dark(rgba(20, 25, 50, 0.2), rgba(0, 0, 0, 0.6));
  --lg-shadow: 0 1px 2px -1px var(--lg-shade), 0 10px 28px -10px var(--lg-shade);
  --lg-shadow-lift: 0 2px 4px -1px var(--lg-shade), 0 22px 50px -14px var(--lg-shade);
  --lg-blur: 12px;
  --lg-saturate: 180%;
  --lg-light-angle: 135deg;       /* where the light comes from (liquid-glass.js turns it toward the pointer) */
  --lg-hx: 1.5px; --lg-hy: 1.5px; /* which inner edge catches the light */
  --lg-drop: var(--lg-shadow);

  /* Lens (read by liquid-glass.js) */
  --lg-bezel: 22;                 /* px of curved edge that bends light */
  --lg-refraction: 9;             /* px the rim pulls the background inward (capped at 40% of the bezel) */
  --lg-dispersion: 0.12;          /* how far red and blue split apart at the edge (0 = none) */

  /* Shape */
  --lg-radius: 24px;
  --lg-pad: 6px;
  --lg-control: 44px;             /* control height */

  /* Motion */
  --lg-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --lg-spring: linear(0, 0.006, 0.025, 0.058, 0.104, 0.163, 0.232, 0.31, 0.394, 0.481, 0.568, 0.653, 0.733, 0.806, 0.87, 0.925, 0.968, 1, 1.022, 1.035, 1.04, 1.039, 1.033, 1.024, 1.014, 1.006, 1);
  --lg-bounce: linear(0, 0.074, 0.268, 0.531, 0.811, 1.066, 1.263, 1.385, 1.429, 1.403, 1.323, 1.212, 1.092, 0.981, 0.894, 0.838, 0.816, 0.825, 0.857, 0.904, 0.956, 1.004, 1.043, 1.068, 1.079, 1.076, 1.063, 1.043, 1.021, 1, 0.983, 0.972, 0.966, 0.967, 0.972, 0.981, 0.99, 0.999, 1.007, 1.012, 1.014, 1.014, 1.012, 1.009, 1);   /* looser spring: rings two or three times, for knobs and thumbs */
}
.lg-auto { color-scheme: light dark; }
.lg-light { color-scheme: light; }
.lg-dark { color-scheme: dark; }

/* Optional page defaults: <body class="lg-page"> */
.lg-page { margin: 0; background: var(--lg-page); color: var(--lg-fg); font-family: var(--lg-font); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }

/* ============================== The material ============================== */
.lg-glass, .lg-clear {
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  border: 0;
  border-radius: var(--lg-radius);
  color: var(--lg-fg);
  font-family: var(--lg-font);
  background: var(--lg-fill);
  /* --lg-lens is set by liquid-glass.js to an SVG refraction filter; empty otherwise */
  -webkit-backdrop-filter: var(--lg-lens,) blur(var(--lg-blur)) saturate(var(--lg-saturate));
  backdrop-filter: var(--lg-lens,) blur(var(--lg-blur)) saturate(var(--lg-saturate));
  box-shadow:
    inset var(--lg-hx) var(--lg-hy) 5px -3px var(--lg-rim),                               /* reflection on the lit edge */
    inset calc(var(--lg-hx) * -1) calc(var(--lg-hy) * -1) 6px -3px var(--lg-rim-dim),     /* light leaving the far edge */
    inset 0 0 14px -4px var(--lg-bloom),
    0 0 0 0.5px var(--lg-edge),
    var(--lg-drop);
  transition: --lg-light-angle 0.5s var(--lg-ease), --lg-hx 0.5s var(--lg-ease), --lg-hy 0.5s var(--lg-ease);
}
.lg-clear { --lg-blur: 2px; --lg-saturate: 140%; background: var(--lg-fill-clear); }
.lg-thick { --lg-blur: 28px; background: color-mix(in srgb, var(--lg-fill-solid) 72%, transparent); }   /* text-heavy: alerts, sheets */
.lg-lift { --lg-drop: var(--lg-shadow-lift); }

/* Specular rim: a 1px ring lit at two opposite corners */
.lg-glass::before, .lg-clear::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; padding: 1.25px; pointer-events: none;
  background: linear-gradient(var(--lg-light-angle), var(--lg-rim) 0%, var(--lg-rim-dim) 30%, transparent 52%, var(--lg-rim-dim) 80%, color-mix(in srgb, var(--lg-rim) 70%, transparent) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
/* Highlight that follows the pointer (liquid-glass.js sets --lg-mx / --lg-my) */
.lg-glass::after, .lg-clear::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: radial-gradient(160px 110px at var(--lg-mx, 50%) var(--lg-my, 0%), var(--lg-sheen), transparent 70%);
  opacity: 0; transition: opacity 0.35s var(--lg-ease);
}
.lg-glass:hover::after, .lg-clear:hover::after { opacity: 0.7; }

/* Tint: colored glass for the one action that matters */
.lg-tinted, .lg-prominent {
  --lg-fg: var(--lg-on-accent);
  background: color-mix(in oklab, var(--lg-tint, var(--lg-accent)) 82%, transparent);
  --lg-bloom: rgba(255, 255, 255, 0.35);
  --lg-edge: color-mix(in srgb, var(--lg-tint, var(--lg-accent)) 60%, #000);
}

/* Shapes */
.lg-capsule { --lg-radius: 999px; }
.lg-r-sm { --lg-radius: 14px; }
.lg-r-lg { --lg-radius: 32px; }
.lg-r-xl { --lg-radius: 40px; }
.lg-nest { border-radius: max(4px, calc(var(--lg-radius) - var(--lg-pad))); }   /* child concentric with its glass parent */
@supports (corner-shape: squircle) {
  .lg-glass:not(.lg-capsule, .lg-btn, .lg-toolbar, .lg-tabbar, .lg-field), .lg-clear:not(.lg-capsule, .lg-btn, .lg-field), .lg-card, .lg-list {
    corner-shape: squircle; border-radius: calc(var(--lg-radius) * 1.5);
  }
  /* the rim and sheen layers must take the same corner curve, or they draw a second outline */
  .lg-glass::before, .lg-glass::after, .lg-clear::before, .lg-clear::after, .lg-dim::after { corner-shape: inherit; }
}

/* 35% dimming layer for clear glass over bright media */
.lg-dim { position: relative; }
.lg-dim::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.35); pointer-events: none; border-radius: inherit; }
.lg-dim > * { position: relative; z-index: 1; }

/* ============================== Buttons ============================== */
.lg-btn {
  --lg-radius: 999px;
  position: relative; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--lg-control); padding: 0 18px; margin: 0; border: 0; border-radius: var(--lg-radius);
  font: 600 15px/1 var(--lg-font); letter-spacing: -0.01em; color: var(--lg-fg); text-decoration: none; white-space: nowrap;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: scale 0.8s var(--lg-bounce), background-color 0.2s var(--lg-ease), opacity 0.2s, --lg-light-angle 0.5s var(--lg-ease), --lg-hx 0.5s var(--lg-ease), --lg-hy 0.5s var(--lg-ease);
}
/* While liquid-glass.js is driving an element's wobble, CSS must not ease its transform */
.lg-live { transition-property: background-color, opacity, --lg-light-angle, --lg-hx, --lg-hy !important; will-change: scale, translate; }
[data-lg-interactive] { cursor: grab; touch-action: none; user-select: none; }
.lg-btn:where(:not(.lg-glass, .lg-clear, .lg-plain)) { background: var(--lg-well); }
.lg-btn:where(:not(.lg-glass, .lg-clear, .lg-plain)):hover { background: var(--lg-well-hover); }
.lg-btn.lg-plain { background: transparent; }
.lg-btn.lg-plain:hover { background: var(--lg-well); }
.lg-btn.lg-prominent:where(:not(.lg-glass, .lg-clear)) { background: var(--lg-tint, var(--lg-accent)); color: var(--lg-on-accent); }
.lg-btn:active { scale: 0.96; transition-duration: 0.12s, 0.2s, 0.2s; }
.lg-btn.lg-glass:active::after, .lg-btn.lg-clear:active::after { opacity: 1; }
.lg-btn:disabled, .lg-btn[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }
.lg-btn[aria-pressed="true"] { color: var(--lg-accent); background: color-mix(in srgb, var(--lg-accent) 16%, transparent); }
.lg-btn svg { width: 20px; height: 20px; flex: none; }
.lg-btn.lg-icon { padding: 0; width: var(--lg-control); }
.lg-btn.lg-danger { color: var(--lg-danger); }
.lg-sm { --lg-control: 34px; padding: 0 13px; font-size: 13px; }
.lg-lg { --lg-control: 54px; padding: 0 26px; font-size: 17px; }

/* ============================== Bars ============================== */
/* .lg-bar is an invisible sticky row that holds one or more glass groups and
   fades the content scrolling beneath it (the scroll edge effect). */
.lg-bar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 10px;
  padding: 10px max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
  pointer-events: none; font-family: var(--lg-font);
}
.lg-bar > * { pointer-events: auto; }
.lg-bar::before {
  content: ""; position: absolute; inset: 0 0 -28px; z-index: -1; pointer-events: none;
  background: linear-gradient(color-mix(in srgb, var(--lg-page) 78%, transparent), transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  -webkit-mask-image: linear-gradient(#000 35%, transparent); mask-image: linear-gradient(#000 35%, transparent);
}
.lg-bar.lg-bottom { position: fixed; top: auto; bottom: 0; left: 0; right: 0; justify-content: center; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.lg-bar.lg-bottom::before { inset: -28px 0 0; background: linear-gradient(transparent, color-mix(in srgb, var(--lg-page) 78%, transparent)); -webkit-mask-image: linear-gradient(transparent, #000 65%); mask-image: linear-gradient(transparent, #000 65%); }
.lg-bar.lg-no-edge::before { display: none; }
.lg-spacer { flex: 1; }

/* A glass group of controls. Buttons inside are plain: no glass on glass. */
.lg-toolbar {
  --lg-radius: 999px; --lg-pad: 4px;
  display: inline-flex; align-items: center; gap: 2px; padding: var(--lg-pad); min-height: calc(var(--lg-control) + var(--lg-pad) * 2);
}
.lg-toolbar .lg-btn { background: transparent; padding: 0 14px; }
.lg-toolbar .lg-btn:hover { background: var(--lg-well); }
.lg-toolbar .lg-btn.lg-icon { padding: 0; }
.lg-toolbar .lg-btn.lg-prominent { background: var(--lg-tint, var(--lg-accent)); color: var(--lg-on-accent); }
.lg-title { padding: 0 14px; font-weight: 650; font-size: 17px; letter-spacing: -0.02em; }

/* Tab bar */
.lg-tabbar {
  --lg-radius: 999px; --lg-pad: 4px;
  display: inline-flex; align-items: stretch; gap: 2px; padding: var(--lg-pad);
}
.lg-tab {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 72px; min-height: 52px; padding: 4px 14px; border: 0; border-radius: 999px; background: none; cursor: pointer;
  font: 600 11px/1 var(--lg-font); color: var(--lg-fg-2); text-decoration: none; -webkit-tap-highlight-color: transparent;
  transition: background-color 0.25s var(--lg-ease), color 0.2s, scale 0.45s var(--lg-spring);
}
.lg-tab svg { width: 24px; height: 24px; }
.lg-tab:hover { color: var(--lg-fg); }
.lg-tab { transition: scale 0.7s var(--lg-bounce), color 0.2s; }
.lg-tab:active { scale: 0.92; transition-duration: 0.12s, 0.2s; }
.lg-tab[aria-current], .lg-tab[aria-selected="true"] { color: var(--lg-accent); background: var(--lg-well); box-shadow: inset 0 0 0 0.5px var(--lg-rim-dim); }

/* Segmented control (content layer or inside glass) */
.lg-segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--lg-well); font-family: var(--lg-font); }
.lg-segmented > * {
  min-height: 34px; padding: 0 16px; border: 0; border-radius: 999px; background: none; cursor: pointer;
  font: 600 14px/1 var(--lg-font); color: var(--lg-fg-2); transition: background-color 0.25s var(--lg-ease), color 0.2s;
}
.lg-segmented > :hover { color: var(--lg-fg); }
.lg-segmented > [aria-pressed="true"], .lg-segmented > [aria-checked="true"], .lg-segmented > [aria-selected="true"] {
  color: var(--lg-fg); background: light-dark(#fff, rgba(255, 255, 255, 0.18));
  box-shadow: inset 0 1px 0 var(--lg-rim-dim), 0 0 0 0.5px var(--lg-edge), 0 2px 6px -2px var(--lg-shade);
}

/* The selection pill liquid-glass.js adds: under the chosen label at rest, clear glass above the labels while held */
.lg-segmented { position: relative; isolation: isolate; touch-action: pan-y; }
.lg-segmented.lg-has-pill > :not(.lg-seg-pill) { position: relative; z-index: 1; }
.lg-segmented.lg-has-pill > :is([aria-pressed="true"], [aria-checked="true"], [aria-selected="true"]) { background: none; box-shadow: none; }
.lg-segmented > .lg-seg-pill {
  position: absolute; z-index: 0; min-height: 0; padding: 0; pointer-events: none;
  --lg-bezel: 14; --lg-refraction: 11; --lg-dispersion: 0.1; --lg-blur: 0.3px; --lg-saturate: 120%;
  background: light-dark(#fff, rgba(255, 255, 255, 0.18));
  --lg-drop: 0 0 0 0.5px var(--lg-edge), 0 2px 6px -2px var(--lg-shade);
  transition: background-color 0.2s var(--lg-ease), box-shadow 0.3s var(--lg-ease);
}
.lg-segmented > .lg-seg-pill.lg-held {
  z-index: 2; background: color-mix(in srgb, #fff 10%, transparent);
  --lg-drop: 0 8px 20px -6px rgba(0, 0, 0, 0.35);
}
.lg-seg-pill[hidden] { display: none; }
/* Same pill for the tab bar: a soft well under the current tab, a glass bubble while pressed or dragged */
.lg-tabbar { touch-action: pan-y; }
.lg-tab, .lg-segmented > * { -webkit-user-drag: none; user-select: none; }
.lg-tabbar.lg-has-pill > .lg-tab { position: relative; z-index: 1; }
.lg-tabbar.lg-has-pill > .lg-tab:is([aria-current], [aria-selected="true"]) { background: none; box-shadow: none; }
.lg-tab-pill {
  position: absolute; z-index: 1; pointer-events: none;
  --lg-bezel: 18; --lg-refraction: 14; --lg-dispersion: 0.1; --lg-blur: 0px; --lg-saturate: 100%;
  background: var(--lg-well); --lg-drop: 0 0 0 0 transparent;
  transition: background-color 0.2s var(--lg-ease), box-shadow 0.3s var(--lg-ease);
}
.lg-tab-pill.lg-held { background: color-mix(in srgb, #fff 8%, transparent); --lg-drop: 0 8px 20px -6px rgba(0, 0, 0, 0.35); }

/* ============================== Sidebar ============================== */
.lg-sidebar { --lg-radius: 28px; --lg-pad: 8px; display: flex; flex-direction: column; gap: 2px; padding: var(--lg-pad); width: 260px; box-sizing: border-box; }
.lg-side-item {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border: 0; background: none; cursor: pointer; text-align: start;
  border-radius: max(4px, calc(var(--lg-radius) - var(--lg-pad))); font: 500 15px/1.2 var(--lg-font); color: var(--lg-fg); text-decoration: none;
  transition: background-color 0.2s var(--lg-ease);
}
.lg-side-item svg { width: 20px; height: 20px; color: var(--lg-accent); flex: none; }
.lg-side-item:hover { background: var(--lg-well); }
.lg-side-item[aria-current] { background: var(--lg-well-hover); font-weight: 600; }
.lg-side-heading { padding: 14px 12px 6px; font: 600 13px/1 var(--lg-font); color: var(--lg-fg-3); }

/* ============================== Menus, sheets, alerts ============================== */
.lg-menu { --lg-radius: 22px; --lg-pad: 6px; margin: 0; padding: var(--lg-pad); min-width: 220px; list-style: none; box-sizing: border-box; }
.lg-menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 0 12px; box-sizing: border-box; border: 0; background: none; cursor: pointer; text-align: start;
  border-radius: max(4px, calc(var(--lg-radius) - var(--lg-pad))); font: 500 15px/1.2 var(--lg-font); color: var(--lg-fg); text-decoration: none;
}
.lg-menu-item svg { width: 18px; height: 18px; flex: none; }
.lg-menu-item:hover, .lg-menu-item:focus-visible { background: var(--lg-well-hover); }
.lg-menu-item.lg-danger { color: var(--lg-danger); }
.lg-menu-sep { height: 1px; margin: 6px 12px; background: var(--lg-sep); border: 0; }

/* <div popover class="lg-glass lg-menu"> grows out of the button that opened it */
[popover]:is(.lg-glass, .lg-clear) {
  position: fixed; inset: auto; overflow: visible;
  position-area: bottom span-right; position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline; margin: 8px 0;
  opacity: 0; scale: 0.8; transform-origin: top left;
  transition: opacity 0.2s var(--lg-ease), scale 0.4s var(--lg-spring), display 0.4s allow-discrete, overlay 0.4s allow-discrete;
}
[popover]:is(.lg-glass, .lg-clear):popover-open { opacity: 1; scale: 1; }
@starting-style { [popover]:is(.lg-glass, .lg-clear):popover-open { opacity: 0; scale: 0.8; } }

/* <dialog class="lg-glass lg-sheet"> — floats inset from the screen edges */
dialog:is(.lg-glass, .lg-clear) {
  --lg-radius: 34px;
  position: fixed; width: min(520px, calc(100vw - 16px)); max-height: min(86dvh, 800px); padding: 24px; overflow: auto;
  opacity: 0; translate: 0 24px; scale: 0.96;
  transition: opacity 0.25s var(--lg-ease), translate 0.5s var(--lg-spring), scale 0.5s var(--lg-spring), display 0.5s allow-discrete, overlay 0.5s allow-discrete;
}
dialog:is(.lg-glass, .lg-clear)[open] { opacity: 1; translate: 0 0; scale: 1; }
@starting-style { dialog:is(.lg-glass, .lg-clear)[open] { opacity: 0; translate: 0 24px; scale: 0.96; } }
dialog:is(.lg-glass, .lg-clear)::backdrop { background: rgba(0, 0, 0, 0.28); transition: opacity 0.3s; }
dialog.lg-alert { width: min(320px, calc(100vw - 32px)); text-align: center; }
@media (max-width: 600px) { dialog.lg-sheet { margin-bottom: 8px; } }
.lg-sheet h2, .lg-alert h2 { margin: 0 0 6px; font: 650 20px/1.2 var(--lg-font); letter-spacing: -0.02em; }
.lg-sheet p, .lg-alert p { margin: 0 0 18px; color: var(--lg-fg-2); font-size: 15px; }
.lg-actions { display: flex; gap: 10px; }
.lg-actions > * { flex: 1; }

/* ============================== Inputs ============================== */
.lg-field {
  --lg-radius: 999px;
  box-sizing: border-box; display: inline-flex; align-items: center; gap: 8px; min-height: var(--lg-control); padding: 0 16px; border-radius: var(--lg-radius);
  font-family: var(--lg-font); color: var(--lg-fg);
}
.lg-field:where(:not(.lg-glass, .lg-clear)) { background: var(--lg-well); }
.lg-field input { flex: 1; min-width: 0; border: 0; padding: 0; background: none; outline: none; color: inherit; font: 500 16px/1 var(--lg-font); }
.lg-field input::placeholder { color: var(--lg-fg-3); }
.lg-field svg { width: 18px; height: 18px; flex: none; color: var(--lg-fg-2); }
.lg-field:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--lg-accent) 45%, transparent); }

/* <input type="checkbox" role="switch" class="lg-switch"> — the knob turns to glass while held */
.lg-switch {
  -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 56px; height: 30px; margin: 0; border-radius: 999px; cursor: pointer;
  background: var(--lg-well-hover); transition: background-color 0.3s var(--lg-ease); -webkit-tap-highlight-color: transparent;
}
.lg-switch::before {
  content: ""; position: absolute; top: 2px; left: 2px; width: 34px; height: 26px; border-radius: 999px; background: #fff;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.22);
  transition: translate 0.8s var(--lg-bounce), scale 0.8s var(--lg-bounce), background-color 0.2s, box-shadow 0.2s;
}
.lg-switch:checked { background: var(--lg-accent); }
.lg-switch:checked::before { translate: 18px 0; }
.lg-switch:active::before {
  scale: 1.25 1.3; background: rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: blur(2px) saturate(160%); backdrop-filter: blur(2px) saturate(160%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75), inset 0 0 8px rgba(255, 255, 255, 0.5), 0 3px 10px rgba(0, 0, 0, 0.25);
}
.lg-switch:disabled { opacity: 0.4; pointer-events: none; }

/* <input type="range" class="lg-slider"> — liquid-glass.js keeps the fill in sync */
.lg-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; margin: 0; background: none; cursor: pointer; --lg-pct: 50%; }
.lg-slider::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--lg-accent) var(--lg-pct), var(--lg-well-hover) var(--lg-pct)); }
.lg-slider::-moz-range-track { height: 6px; border-radius: 99px; background: var(--lg-well-hover); }
.lg-slider::-moz-range-progress { height: 6px; border-radius: 99px; background: var(--lg-accent); }
.lg-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 36px; height: 24px; margin-top: -9px; border-radius: 999px; background: #fff;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.25);
  /* liquid-glass.js drives --lg-tsx / --lg-tsy from a spring (swell, smear along the drag, jelly wobble) */
  scale: var(--lg-tsx, 1) var(--lg-tsy, 1);
  transition: scale 0.8s var(--lg-bounce), background-color 0.2s, box-shadow 0.2s;
}
.lg-slider.lg-sliding::-webkit-slider-thumb, .lg-slider.lg-sliding::-moz-range-thumb { transition-property: background-color, box-shadow; }
.lg-slider::-moz-range-thumb { scale: var(--lg-tsx, 1) var(--lg-tsy, 1); transition: scale 0.8s var(--lg-bounce); width: 36px; height: 24px; border: 0; border-radius: 999px; background: #fff; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.25); }
.lg-slider:active::-moz-range-thumb { scale: var(--lg-tsx, 1.3) var(--lg-tsy, 1.3); }
.lg-slider:active::-webkit-slider-thumb {
  scale: var(--lg-tsx, 1.3) var(--lg-tsy, 1.3); background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8), inset 0 0 8px rgba(255, 255, 255, 0.5), 0 3px 10px rgba(0, 0, 0, 0.25);
}

/* The glass knob liquid-glass.js lays over the thumb: a white pill at rest, clear glass while dragged */
.lg-slider.lg-has-knob::-webkit-slider-thumb { opacity: 0; }
.lg-slider.lg-has-knob::-moz-range-thumb { opacity: 0; }
.lg-knob {
  position: absolute; z-index: 1; pointer-events: none; width: 58px; height: 40px; margin: -20px 0 0 -29px;
  left: calc(anchor(left) + 18px + (anchor-size(width) - 36px) * var(--lg-frac, 0.5)); top: anchor(center);
  --lg-bezel: 18; --lg-refraction: 15; --lg-dispersion: 0.1; --lg-blur: 0.4px; --lg-saturate: 120%;
  scale: 0.62; background: #fff; transition: background-color 0.3s var(--lg-ease), box-shadow 0.3s var(--lg-ease);
  --lg-drop: 0 0 0 0.5px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.25);
}
.lg-knob.lg-held {
  background: color-mix(in srgb, #fff 14%, transparent);
  --lg-drop: 0 6px 18px -4px color-mix(in srgb, var(--lg-accent) 45%, transparent), 0 3px 12px rgba(0, 0, 0, 0.18);   /* the track's colour spills into the shadow */
}

/* ============================== Content layer (not glass) ============================== */
.lg-card { box-sizing: border-box; padding: 20px; border-radius: var(--lg-radius); background: var(--lg-surface); color: var(--lg-fg); font-family: var(--lg-font); box-shadow: 0 0 0 0.5px var(--lg-sep); }
.lg-list { margin: 0; padding: 0; list-style: none; border-radius: var(--lg-radius); background: var(--lg-surface); color: var(--lg-fg); font-family: var(--lg-font); overflow: hidden; box-shadow: 0 0 0 0.5px var(--lg-sep); }
.lg-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px; padding: 8px 20px; box-sizing: border-box; font-size: 16px; }
.lg-row + .lg-row { box-shadow: inset 0 0.5px 0 var(--lg-sep); }
.lg-section-title { margin: 28px 20px 8px; font: 600 15px/1.2 var(--lg-font); color: var(--lg-fg-2); }
.lg-badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; background: var(--lg-well); font: 600 12px/1 var(--lg-font); color: var(--lg-fg-2); }

/* ============================== Focus ============================== */
:is(.lg-btn, .lg-tab, .lg-side-item, .lg-menu-item, .lg-switch, .lg-slider, .lg-segmented > *):focus-visible {
  outline: 2px solid var(--lg-accent); outline-offset: 2px;
}

/* ============================== Accessibility + fallbacks ============================== */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .lg-glass, .lg-clear { background: var(--lg-fill-solid); }
}
@media (prefers-reduced-transparency: reduce) {
  .lg-glass, .lg-clear, .lg-thick { background: var(--lg-fill-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .lg-tinted, .lg-prominent { background: var(--lg-tint, var(--lg-accent)); }
  .lg-bar::before { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--lg-page); }
}
@media (prefers-contrast: more) {
  :root {
    --lg-fill: light-dark(rgba(255, 255, 255, 0.9), rgba(24, 24, 28, 0.92));
    --lg-fill-clear: light-dark(rgba(255, 255, 255, 0.8), rgba(24, 24, 28, 0.85));
    --lg-edge: light-dark(rgba(0, 0, 0, 0.6), rgba(255, 255, 255, 0.7));
    --lg-fg-2: var(--lg-fg); --lg-fg-3: var(--lg-fg);
    --lg-sep: light-dark(rgba(0, 0, 0, 0.4), rgba(255, 255, 255, 0.45));
  }
  .lg-glass, .lg-clear { box-shadow: 0 0 0 1px var(--lg-edge), var(--lg-shadow); }
}
@media (forced-colors: active) {
  .lg-glass, .lg-clear, .lg-card, .lg-list, .lg-btn, .lg-switch { border: 1px solid CanvasText; background: Canvas; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .lg-glass::before, .lg-glass::after, .lg-clear::before, .lg-clear::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lg-glass, .lg-clear, .lg-glass::after, .lg-clear::after, .lg-btn, .lg-tab, .lg-switch, .lg-switch::before, .lg-slider::-webkit-slider-thumb,
  [popover]:is(.lg-glass, .lg-clear), dialog:is(.lg-glass, .lg-clear) { transition-duration: 0.01s !important; scale: 1 !important; translate: none; }
  .lg-switch:checked::before { translate: 18px 0; }
}
