/* ==========================================================================
   Liquid Glass — design system v1.2  (Saif's projects)
   --------------------------------------------------------------------------
   An iOS 26/27-style "Liquid Glass" look for any website or web app.
   Read README.md first. Pair with liquid-glass.js for springs, gestures,
   refraction, sheets, tab bars and toasts.

   Material values come from Apple's own CoreMaterial recipes on macOS 27
   (read-only): dockLight = blur 30 / saturation 1.8 / brightness +0.08,
   platformContentUltraThinLight = blur 22.5 / 1.1 / +0.12,
   platformChromeDark = blur 22.5 / 2.0 / -0.10.

   Usage: put class "lg" on the root of your app (usually <body>).
   Light/dark follows the system; force with data-mode="light|dark".
   Everything is prefixed lg- so it never collides with your own CSS.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
.lg {
  /* type */
  --lg-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, "Segoe UI", Roboto, sans-serif;
  --lg-font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", system-ui, "Segoe UI", Roboto, sans-serif;
  --lg-font-rounded: ui-rounded, -apple-system, BlinkMacSystemFont, "SF Pro Rounded", system-ui, sans-serif;
  --lg-font-mono: ui-monospace, "SF Mono", Menlo, monospace;

  /* colour (light) */
  --lg-bg: #E9EEF8;            /* behind everything; usually covered by a wallpaper */
  --lg-label: #0B0B10;          /* primary text */
  --lg-label-2: rgba(38,40,62,.66);
  --lg-label-3: rgba(38,40,62,.36);
  --lg-separator: rgba(40,44,90,.13);
  --lg-fill: rgba(40,44,90,.07);     /* pressed rows, subtle wells */
  --lg-accent: #00917A;
  --lg-on-accent: #FFFFFF;
  --lg-accent-soft: color-mix(in srgb, var(--lg-accent) 15%, transparent);
  /* accent for TEXT and small icons: a deeper shade in light mode (~6:1 on white instead of ~3.5:1).
     Fills (buttons, bars, rings) keep --lg-accent. Learned in Ledger: orange text on light glass was too faint. */
  --lg-accent-ink: color-mix(in oklab, var(--lg-accent) 72%, #000);
  --lg-green: #34C759; --lg-red: #FF3B30; --lg-orange: #FF9500; --lg-yellow: #FFCC00;
  --lg-blue: #0A84FF; --lg-indigo: #5856D6; --lg-pink: #FF2D55; --lg-teal: #00A28A; --lg-gray: #8E8E93; --lg-brown: #A2845E;
  --lg-track: rgba(30,30,60,.14);

  /* glass material */
  --lg-glass: rgba(255,255,255,.26);
  --lg-glass-strong: rgba(255,255,255,.62);   /* selected thumbs, indicators */
  --lg-glass-clear: rgba(255,255,255,.12);
  --lg-glass-sheet: rgba(246,248,253,.78);
  --lg-rim: rgba(255,255,255,.95);
  --lg-rim-soft: rgba(255,255,255,.4);
  --lg-edge: rgba(255,255,255,.3);
  --lg-shadow: 0 16px 34px -16px rgba(28,36,90,.38), 0 2px 6px -2px rgba(28,36,90,.12);
  --lg-blur-content: blur(18px) saturate(1.1) brightness(1.12);
  --lg-blur-chrome: blur(24px) saturate(1.8) brightness(1.08);
  --lg-blur-sheet: blur(30px) saturate(1.8) brightness(1.04);
  --lg-scroll-fade: rgba(233,238,248,.55);
  --lg-spec: 140deg;            /* rim-light angle; liquid-glass.js moves it with the pointer */
  --lg-refract-tone: saturate(1.8) brightness(1.08);  /* applied after edge refraction */

  /* shape */
  --lg-r-card: 28px; --lg-r-list: 26px; --lg-r-tile: 22px; --lg-r-control: 999px; --lg-r-sheet: 38px; --lg-r-small: 12px;
  --lg-gutter: 16px;

  /* motion — Apple-style springs as CSS linear() curves (generated by springs.mjs) */
  /* springs:start */
  --lg-ease-smooth: linear(0, 0.0191, 0.0667, 0.1313, 0.2048, 0.2816, 0.3577, 0.4308, 0.4991, 0.562, 0.6189, 0.67, 0.7154, 0.7554, 0.7905, 0.821, 0.8475, 0.8704, 0.89, 0.9069, 0.9213, 0.9336, 0.9441, 0.9529, 0.9605, 0.9668, 0.9722, 0.9767, 0.9805, 0.9837, 0.9864, 0.9887, 0.9905, 0.9921, 0.9934, 0.9945, 0.9955, 0.9962, 0.9969, 0.9974, 0.9978, 0.9982, 1);
  --lg-dur-smooth: 700ms;
  --lg-ease-snappy: linear(0, 0.0291, 0.0999, 0.1933, 0.2959, 0.3989, 0.4965, 0.5854, 0.6641, 0.732, 0.7894, 0.8371, 0.8761, 0.9074, 0.9322, 0.9516, 0.9665, 0.9777, 0.986, 0.992, 0.9962, 0.9991, 1.001, 1.0021, 1.0027, 1.0029, 1.0029, 1.0028, 1.0025, 1.0022, 1.0019, 1.0016, 1);
  --lg-dur-snappy: 530ms;
  --lg-ease-bouncy: linear(0, 0.0197, 0.0713, 0.1447, 0.2316, 0.3255, 0.4209, 0.5139, 0.6016, 0.6821, 0.7542, 0.8172, 0.8712, 0.9163, 0.9532, 0.9824, 1.005, 1.0216, 1.0332, 1.0406, 1.0447, 1.046, 1.0452, 1.043, 1.0397, 1.0357, 1.0314, 1.027, 1.0227, 1.0187, 1.015, 1.0116, 1.0087, 1.0061, 1.004, 1.0023, 1.0009, 0.9999, 0.9991, 0.9985, 0.9982, 0.998, 0.9979, 0.9979, 0.998, 0.9982, 0.9983, 1);
  --lg-dur-bouncy: 780ms;
  --lg-ease-gentle: linear(0, 0.0101, 0.0365, 0.0747, 0.1207, 0.1718, 0.2255, 0.2803, 0.3347, 0.3879, 0.4391, 0.4879, 0.5339, 0.577, 0.6171, 0.6542, 0.6884, 0.7197, 0.7484, 0.7744, 0.7981, 0.8196, 0.839, 0.8564, 0.8722, 0.8863, 0.8989, 0.9103, 0.9204, 0.9295, 0.9375, 0.9447, 0.9511, 0.9568, 0.9618, 0.9663, 0.9703, 0.9738, 0.9769, 0.9797, 0.9821, 0.9842, 0.9861, 0.9878, 0.9893, 0.9906, 0.9917, 0.9928, 0.9936, 0.9944, 0.9951, 0.9957, 0.9962, 0.9967, 0.9971, 0.9975, 0.9978, 0.9981, 0.9983, 1);
  --lg-dur-gentle: 980ms;
  --lg-ease-quick: linear(0, 0.0491, 0.1571, 0.2847, 0.4107, 0.5249, 0.6232, 0.705, 0.7714, 0.8244, 0.8661, 0.8985, 0.9234, 0.9425, 0.957, 0.968, 0.9762, 0.9824, 0.987, 0.9904, 0.9929, 0.9948, 0.9962, 0.9972, 0.998, 1);
  --lg-dur-quick: 420ms;
  /* springs:end */
  --lg-press-scale: .97;

  font-family: var(--lg-font);
  color: var(--lg-label);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
.lg[data-mode="dark"] {
  --lg-bg: #070A18; --lg-label: #FFFFFF; --lg-label-2: rgba(235,235,245,.66); --lg-label-3: rgba(235,235,245,.32);
  --lg-separator: rgba(255,255,255,.12); --lg-fill: rgba(255,255,255,.08);
  --lg-accent: #45E2BC; --lg-accent-ink: var(--lg-accent); --lg-on-accent: #03231B; --lg-track: rgba(255,255,255,.16);
  --lg-green: #30D158; --lg-red: #FF453A; --lg-orange: #FF9F0A; --lg-blue: #0A84FF; --lg-indigo: #5E5CE6; --lg-pink: #FF375F;
  --lg-glass: rgba(36,38,60,.3); --lg-glass-strong: rgba(255,255,255,.18); --lg-glass-clear: rgba(30,32,52,.14); --lg-glass-sheet: rgba(24,26,44,.78);
  --lg-rim: rgba(255,255,255,.5); --lg-rim-soft: rgba(255,255,255,.14); --lg-edge: rgba(255,255,255,.12);
  --lg-shadow: 0 18px 38px -16px rgba(0,0,0,.7), 0 2px 6px -2px rgba(0,0,0,.4);
  --lg-blur-content: blur(18px) saturate(2) brightness(.9);
  --lg-blur-chrome: blur(24px) saturate(2) brightness(.9);
  --lg-blur-sheet: blur(30px) saturate(1.8) brightness(.9);
  --lg-scroll-fade: rgba(7,10,24,.5); --lg-refract-tone: saturate(2) brightness(.9);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  .lg:not([data-mode="light"]) {
    --lg-bg: #070A18; --lg-label: #FFFFFF; --lg-label-2: rgba(235,235,245,.66); --lg-label-3: rgba(235,235,245,.32);
    --lg-separator: rgba(255,255,255,.12); --lg-fill: rgba(255,255,255,.08);
    --lg-accent: #45E2BC; --lg-accent-ink: var(--lg-accent); --lg-on-accent: #03231B; --lg-track: rgba(255,255,255,.16);
    --lg-green: #30D158; --lg-red: #FF453A; --lg-orange: #FF9F0A; --lg-blue: #0A84FF; --lg-indigo: #5E5CE6; --lg-pink: #FF375F;
    --lg-glass: rgba(36,38,60,.3); --lg-glass-strong: rgba(255,255,255,.18); --lg-glass-clear: rgba(30,32,52,.14); --lg-glass-sheet: rgba(24,26,44,.78);
    --lg-rim: rgba(255,255,255,.5); --lg-rim-soft: rgba(255,255,255,.14); --lg-edge: rgba(255,255,255,.12);
    --lg-shadow: 0 18px 38px -16px rgba(0,0,0,.7), 0 2px 6px -2px rgba(0,0,0,.4);
    --lg-blur-content: blur(18px) saturate(2) brightness(.9);
    --lg-blur-chrome: blur(24px) saturate(2) brightness(.9);
    --lg-blur-sheet: blur(30px) saturate(1.8) brightness(.9);
    --lg-scroll-fade: rgba(7,10,24,.5); --lg-refract-tone: saturate(2) brightness(.9);
    color-scheme: dark;
  }
}
/* Fallback curves for browsers without linear() (Safari < 17.2) */
@supports not (transition-timing-function: linear(0, 1)) {
  .lg {
    --lg-ease-smooth: cubic-bezier(.32,.72,0,1); --lg-ease-snappy: cubic-bezier(.25,.9,.3,1.04);
    --lg-ease-bouncy: cubic-bezier(.3,1.35,.5,1); --lg-ease-gentle: cubic-bezier(.3,.8,.3,1); --lg-ease-quick: cubic-bezier(.2,.8,.3,1);
  }
}
.lg *, .lg *::before, .lg *::after { box-sizing: border-box; }
.lg [hidden] { display: none !important; }  /* component display rules must never beat the hidden attribute */
.lg :where(button) { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.lg ::selection { background: var(--lg-accent-soft); }

/* ---------- 2. Glass material ----------
   .lg-glass          regular glass (cards, lists, controls)
   .lg-glass--clear   clearer glass over busy content (hero cards, lenses)
   .lg-glass--chrome  bars that float over scrolling content (tab bar, players)
   .lg-glass--tint    glass tinted with the accent colour
   Add data-lg-refract="<preset>" to bend light at the edges (Chromium only). */
.lg-glass {
  position: relative;
  background: var(--lg-glass);
  -webkit-backdrop-filter: var(--lg-blur-content); backdrop-filter: var(--lg-blur-content);
  box-shadow: inset 0 0 0 .5px var(--lg-edge), inset 0 1px 1.5px var(--lg-rim-soft), var(--lg-shadow);
}
.lg-glass::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.2px; pointer-events: none;
  background: linear-gradient(var(--lg-spec), var(--lg-rim), rgba(255,255,255,0) 30%, rgba(255,255,255,0) 70%, var(--lg-rim-soft));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
.lg-glass--clear { background: var(--lg-glass-clear); }
.lg-glass--chrome { -webkit-backdrop-filter: var(--lg-blur-chrome); backdrop-filter: var(--lg-blur-chrome); }
.lg-glass--tint { background: color-mix(in srgb, var(--lg-accent) 28%, var(--lg-glass)); }
@media (prefers-reduced-transparency: reduce) {
  .lg-glass, .lg-sheet, .lg-toast { background: color-mix(in srgb, var(--lg-bg) 94%, var(--lg-label)) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}
@media (prefers-contrast: more) {
  .lg-glass { box-shadow: inset 0 0 0 1px var(--lg-label-3), var(--lg-shadow); }
}

/* ---------- 3. Type ---------- */
.lg-large-title { font: 700 34px/1.12 var(--lg-font-display); letter-spacing: -.022em; margin: 0 4px; text-wrap: balance; }
.lg-title  { font: 700 28px/1.15 var(--lg-font-display); letter-spacing: -.02em; margin: 0; }
.lg-title2 { font: 700 22px/1.2 var(--lg-font-display); letter-spacing: -.015em; margin: 0; }
.lg-headline { font: 600 17px/1.3 var(--lg-font); margin: 0; }
.lg-body { font: 400 16px/1.5 var(--lg-font); margin: 0; }
.lg-callout { font: 400 15px/1.45 var(--lg-font); margin: 0; }
.lg-subhead { font: 400 14.5px/1.4 var(--lg-font); color: var(--lg-label-2); margin: 0; }
.lg-footnote { font: 400 13px/1.35 var(--lg-font); color: var(--lg-label-2); margin: 0; }
.lg-caption { font: 400 12px/1.3 var(--lg-font); color: var(--lg-label-2); margin: 0; }
.lg-eyebrow { font: 600 12px/1 var(--lg-font); letter-spacing: .07em; text-transform: uppercase; color: var(--lg-label-2); }
.lg-num { font-family: var(--lg-font-rounded); font-variant-numeric: tabular-nums; }
.lg-section-title { font: 600 13px/1.2 var(--lg-font); letter-spacing: .06em; text-transform: uppercase; color: var(--lg-label-2); margin: 10px 6px -2px; }

/* ---------- 4. Page structure ----------
   .lg-stack > .lg-page > (.lg-edge, .lg-nav, .lg-scroll)
   Pages are full-screen layers; liquid-glass.js NavStack slides them. */
.lg-stack { position: relative; overflow: hidden; }
.lg-page { position: absolute; inset: 0; background: var(--lg-page-bg, var(--lg-bg)); touch-action: pan-y; contain: layout paint; }
.lg-page[hidden] { display: none !important; }
.lg-page__dim { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 30; }
.lg-scroll { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  padding: var(--lg-top, 104px) var(--lg-gutter) var(--lg-bottom, 128px); display: flex; flex-direction: column; gap: 14px; -webkit-overflow-scrolling: touch; }
.lg-scroll::-webkit-scrollbar { display: none; }
/* always scrollable by 1px, so iOS gives every page its native bounce instead of the whole screen rubber-banding */
.lg-scroll::before { content: ""; position: absolute; top: 0; left: 0; width: 1px; height: calc(100% + 1px); pointer-events: none; }
.lg-scroll > * { flex-shrink: 0; }
/* plain wrapper divs (a section that re-renders) keep the page's spacing between their cards */
.lg-scroll > div:not([class]) { display: flex; flex-direction: column; gap: 14px; }
.lg-scroll > div:not([class]) > * { flex-shrink: 0; }
.lg-edge { position: absolute; top: 0; left: 0; right: 0; height: var(--lg-edge-h, 116px); z-index: 4; pointer-events: none;
  background: linear-gradient(var(--lg-scroll-fade), rgba(0,0,0,0)); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  -webkit-mask: linear-gradient(#000 40%, transparent); mask: linear-gradient(#000 40%, transparent);
  opacity: calc(var(--lg-collapse, 0) * 1.6); }
.lg-nav { position: absolute; top: var(--lg-nav-top, 52px); left: 0; right: 0; height: 44px; display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; padding: 0 14px; z-index: 6; pointer-events: none; }
.lg-nav > * { pointer-events: auto; }
.lg-nav__lead { justify-self: start; display: flex; gap: 8px; }
.lg-nav__trail { justify-self: end; display: flex; gap: 8px; }
.lg-nav__title { font: 600 16.5px/1 var(--lg-font); max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
  opacity: clamp(0, calc((var(--lg-collapse, 0) - .55) * 3), 1); transform: translateY(calc((1 - clamp(0, calc((var(--lg-collapse, 0) - .55) * 3), 1)) * 6px)); }
.lg-page .lg-large-title { transform-origin: left center; opacity: calc(1 - var(--lg-collapse, 0) * 1.25);
  transform: translateY(calc(var(--lg-collapse, 0) * -8px)) scale(calc(1 - var(--lg-collapse, 0) * .05)); }

/* ---------- 5. Buttons ---------- */
.lg-pressable, .lg-btn, .lg-icon-btn, .lg-pill, .lg-row:is(button, a), .lg-card:is(button, a), .lg-tile {
  transition: transform var(--lg-dur-bouncy) var(--lg-ease-bouncy), background-color .25s, box-shadow .25s, opacity .25s; }
.is-pressed:is(.lg-pressable, .lg-btn, .lg-pill, .lg-card, .lg-tile) { transform: scale(var(--lg-press-scale)); transition: transform 140ms cubic-bezier(.2,.8,.3,1); }
.is-pressed.lg-icon-btn { transform: scale(1.1); transition: transform 160ms cubic-bezier(.2,.8,.3,1); }
.is-pressed.lg-icon-btn.lg-glass { --lg-glass: var(--lg-glass-strong); }
.is-pressed.lg-row { background: var(--lg-fill); transition: background-color 0s; }
.lg-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 52px; padding: 0 22px;
  border: 0; border-radius: var(--lg-r-control); font: 600 17px/1 var(--lg-font); cursor: pointer; text-decoration: none; color: var(--lg-label); background: var(--lg-fill); }
.lg-btn--primary { background: var(--lg-accent); color: var(--lg-on-accent); box-shadow: inset 0 1px 1px rgba(255,255,255,.45), 0 10px 22px -10px var(--lg-accent); }
.lg-btn--destructive { color: var(--lg-red); }
.lg-btn--block { width: 100%; }
.lg-btn--small { height: 38px; padding: 0 16px; font-size: 15px; }
.lg-btn svg { width: 19px; height: 19px; }
.lg-btn:disabled { opacity: .4; pointer-events: none; }
.lg-icon-btn { position: relative; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 0; padding: 0; cursor: pointer; flex: none; background: transparent; }
.lg-icon-btn svg { width: 21px; height: 21px; }
.lg-pill { position: relative; height: 38px; border-radius: 19px; border: 0; padding: 0 16px; display: inline-flex; gap: 7px; align-items: center; justify-content: center;
  font: 600 14.5px/1 var(--lg-font); cursor: pointer; white-space: nowrap; flex: none; background: var(--lg-fill); }
.lg-pill--primary { background: var(--lg-accent); color: var(--lg-on-accent); }
.lg-pill[aria-pressed="true"] { background: var(--lg-label); color: var(--lg-bg); }
.lg-pill svg { width: 16px; height: 16px; }
.lg-chip { position: relative; height: 44px; border-radius: 22px; border: 0; padding: 0 15px 0 12px; display: inline-flex; gap: 6px; align-items: center;
  font: 600 14.5px/1 var(--lg-font); cursor: pointer; white-space: nowrap; }
.lg-chip svg { width: 17px; height: 17px; color: var(--lg-accent-ink); }
.lg-pills { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--lg-gutter) * -1); padding: 2px var(--lg-gutter) 6px; }
.lg-pills::-webkit-scrollbar { display: none; }

/* ---------- 6. Cards, tiles, lists ---------- */
.lg-card { position: relative; display: grid; gap: 6px; padding: 16px 18px; border-radius: var(--lg-r-card); border: 0; width: 100%; text-align: left; color: inherit; text-decoration: none; }
.lg-card:is(button, a) { cursor: pointer; }
.lg-tiles { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 10px; }
.lg-tile { position: relative; border: 0; border-radius: var(--lg-r-tile); padding: 13px 12px 12px; display: grid; gap: 10px; align-content: space-between;
  min-height: 100px; text-align: left; cursor: pointer; color: inherit; text-decoration: none; }
.lg-tile__title { font: 600 14px/1.2 var(--lg-font); display: block; }
.lg-tile__sub { font: 400 11.5px/1.25 var(--lg-font); color: var(--lg-label-2); display: block; margin-top: 2px; }
.lg-symbol { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; color: #fff; background: var(--c, var(--lg-gray)); }
.lg-symbol svg { width: 18px; height: 18px; stroke-width: 2; }
.lg-symbol--lg { width: 38px; height: 38px; border-radius: 11px; }
.lg-symbol--lg svg { width: 21px; height: 21px; }
.lg-list { position: relative; border-radius: var(--lg-r-list); overflow: hidden; }
.lg-row { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 11px 16px; border: 0;
  background: none; text-align: left; color: inherit; text-decoration: none; font: inherit; }
.lg-row:is(button, a) { cursor: pointer; }
.lg-row + .lg-row::before { content: ""; position: absolute; left: var(--lg-sep-inset, 16px); right: 0; top: 0; height: .5px; background: var(--lg-separator); }
.lg-list--icons { --lg-sep-inset: 58px; }
.lg-row__text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.lg-row__title { font: 600 16px/1.28 var(--lg-font); }
.lg-row__sub { font: 400 13px/1.32 var(--lg-font); color: var(--lg-label-2); }
.lg-row__value { color: var(--lg-label-2); font-size: 15.5px; white-space: nowrap; }
.lg-row__chev { width: 15px; height: 15px; color: var(--lg-label-3); flex: none; stroke-width: 2.5; }
.lg-row--grid { display: grid; gap: 10px; align-items: stretch; }

/* ---------- 7. Inputs ---------- */
.lg-search { position: relative; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: var(--lg-r-control); }
.lg-search svg { width: 18px; height: 18px; color: var(--lg-label-2); flex: none; }
.lg-search input { flex: 1; min-width: 0; border: 0; background: transparent; font: 400 16px var(--lg-font); color: var(--lg-label); outline: none; }
.lg-search input::placeholder { color: var(--lg-label-2); }
.lg-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.lg-field { width: 100%; height: 48px; padding: 0 16px; border-radius: 16px; border: 0; background: var(--lg-fill); font: 400 16px var(--lg-font); color: var(--lg-label); outline: none; }
.lg-field:focus { box-shadow: 0 0 0 2px var(--lg-accent); }
textarea.lg-field { height: auto; min-height: 96px; padding: 12px 16px; resize: vertical; line-height: 1.45; }
.lg-seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; gap: 2px; border-radius: var(--lg-r-control); }
.lg-seg__thumb { position: absolute; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: var(--lg-r-control); background: var(--lg-glass-strong);
  box-shadow: inset 0 0 0 .5px var(--lg-edge), inset 0 1px 1px var(--lg-rim-soft), 0 3px 10px -4px rgba(0,0,0,.25); pointer-events: none; }
.lg-seg button { position: relative; z-index: 1; height: 36px; border: 0; background: none; border-radius: var(--lg-r-control); font: 600 14.5px var(--lg-font);
  color: var(--lg-label-2); cursor: pointer; transition: color .25s; padding: 0 8px; white-space: nowrap; }
.lg-seg button[aria-pressed="true"] { color: var(--lg-label); }
.lg-toggle { position: relative; width: 51px; height: 31px; border-radius: 16px; border: 0; padding: 0; flex: none; cursor: pointer; background: var(--lg-track); transition: background-color .3s; }
.lg-toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 14px; background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: transform var(--lg-dur-bouncy) var(--lg-ease-bouncy), width .2s; }
.lg-toggle:active::after { width: 33px; }
.lg-toggle[aria-checked="true"] { background: var(--lg-green); }
.lg-toggle[aria-checked="true"]::after { transform: translateX(20px); }
.lg-toggle[aria-checked="true"]:active::after { transform: translateX(14px); }
.lg-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 3px; outline: none;
  background: linear-gradient(var(--lg-accent), var(--lg-accent)) 0 / var(--p, 50%) 100% no-repeat, var(--lg-track); }
.lg-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.25), inset 0 0 0 .5px rgba(0,0,0,.08); transition: transform .2s; }
.lg-slider:active::-webkit-slider-thumb { transform: scale(1.15); }
.lg-slider::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 2px 8px rgba(0,0,0,.25); }

/* ---------- 8. Progress & status ---------- */
.lg-progress { height: 6px; border-radius: 3px; background: var(--lg-track); overflow: hidden; }
.lg-progress > i { display: block; height: 100%; width: var(--p, 0%); background: var(--lg-label); border-radius: inherit; transition: width .8s var(--lg-ease-smooth); }
.lg-ring { --p: 0; --s: 48px; width: var(--s); height: var(--s); border-radius: 50%; display: grid; place-items: center; flex: none; position: relative;
  background: conic-gradient(var(--lg-accent) calc(var(--p) * 1%), var(--lg-track) 0); font: 700 12px/1 var(--lg-font-rounded); }
.lg-ring::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--lg-ring-hole, var(--lg-bg)); }
.lg-ring > * { position: relative; }
.lg-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--lg-red); color: #fff; font: 600 12px/1 var(--lg-font); }
.lg-spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.4px solid currentColor; border-right-color: transparent; animation: lg-spin .7s linear infinite; }
@keyframes lg-spin { to { transform: rotate(360deg); } }
.lg-skeleton { border-radius: 12px; background: linear-gradient(90deg, var(--lg-fill) 0%, color-mix(in srgb, var(--lg-fill) 40%, transparent) 50%, var(--lg-fill) 100%) 0 0 / 200% 100%; animation: lg-shimmer 1.4s linear infinite; }
@keyframes lg-shimmer { to { background-position: -200% 0; } }
.lg-empty { display: grid; gap: 10px; justify-items: center; text-align: center; padding: 24px 20px; }
.lg-empty svg { width: 34px; height: 34px; color: var(--lg-label-3); }

/* ---------- 9. Floating chrome: tab bar, accessory, toast, banner ---------- */
.lg-tabbar { position: absolute; left: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); width: calc(100% - 28px); height: 68px; z-index: 40;
  display: flex; padding: 6px; border-radius: 34px; transition: width var(--lg-dur-bouncy) var(--lg-ease-bouncy); view-transition-name: lg-tabbar; touch-action: none; }
.lg-tabbar__item { position: relative; z-index: 1; flex: 1 1 0; min-width: 0; padding: 0; border: 0; background: none; cursor: pointer; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 28px; color: var(--lg-label);
  font: 600 10.5px/1 var(--lg-font); transition: color .2s, flex-grow var(--lg-dur-bouncy) var(--lg-ease-bouncy), opacity .25s; }
.lg-tabbar__item svg { width: 24px; height: 24px; transition: transform var(--lg-dur-bouncy) var(--lg-ease-bouncy); }
.lg-tabbar__item[aria-selected="true"] { color: var(--lg-accent-ink); }
.lg-tabbar__item.is-hover svg { transform: scale(1.12); }
.lg-tabbar__indicator { position: absolute; top: 6px; bottom: 6px; left: 0; width: 0; z-index: 0; border-radius: 28px; background: var(--lg-glass-strong);
  box-shadow: inset 0 0 0 .5px var(--lg-edge), inset 0 1px 1px var(--lg-rim-soft); transition: opacity .2s, transform var(--lg-dur-bouncy) var(--lg-ease-bouncy), background-color .2s, box-shadow .2s; }
.lg-tabbar.is-dragging .lg-tabbar__indicator { transform: scale(1.14, 1.2); background: color-mix(in srgb, var(--lg-glass-strong) 55%, transparent);
  box-shadow: inset 0 0 0 1px var(--lg-rim), 0 8px 24px -8px rgba(0,0,0,.35); }
.lg-tabbar--mini { width: 68px; }
.lg-tabbar--mini .lg-tabbar__item:not([aria-selected="true"]) { flex-grow: 0; opacity: 0; pointer-events: none; }
.lg-tabbar--mini .lg-tabbar__item span { display: none; }
.lg-tabbar--mini .lg-tabbar__indicator { opacity: 0; }
.lg-accessory { position: absolute; left: 14px; right: 14px; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); height: 56px; border-radius: 28px; z-index: 39;
  display: flex; align-items: center; gap: 10px; padding: 0 8px; cursor: pointer;
  transition: left var(--lg-dur-bouncy) var(--lg-ease-bouncy), bottom var(--lg-dur-bouncy) var(--lg-ease-bouncy), transform var(--lg-dur-snappy) var(--lg-ease-snappy), opacity .3s; }
.lg-accessory[hidden] { display: flex !important; transform: translateY(24px) scale(.96); opacity: 0; pointer-events: none; }
.lg-tabbar--mini ~ .lg-accessory, .lg-accessory.is-inline { left: 92px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
.lg-toast { position: absolute; left: 50%; bottom: var(--lg-toast-bottom, 100px); z-index: 88; height: 42px; border-radius: 21px; padding: 0 16px;
  display: flex; align-items: center; gap: 8px; font: 600 14.5px/1 var(--lg-font); white-space: nowrap; pointer-events: none; max-width: calc(100% - 32px); }
.lg-toast svg { width: 17px; height: 17px; color: var(--lg-accent-ink); flex: none; }
.lg-toast span { overflow: hidden; text-overflow: ellipsis; }
.lg-banner { position: absolute; left: 10px; right: 10px; top: calc(56px + env(safe-area-inset-top, 0px)); z-index: 80; border-radius: 28px; padding: 12px 14px;
  display: flex; gap: 12px; align-items: center; cursor: pointer; }

/* ---------- 10. Sheets ---------- */
.lg-scrim { position: absolute; inset: 0; z-index: 60; background: rgba(0,0,0,.25); opacity: 0; }
.lg-sheet { position: absolute; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); z-index: 61; max-height: calc(100% - 64px);
  display: flex; flex-direction: column; border-radius: var(--lg-r-sheet); background: var(--lg-glass-sheet);
  -webkit-backdrop-filter: var(--lg-blur-sheet); backdrop-filter: var(--lg-blur-sheet); touch-action: none; will-change: transform; }
.lg-sheet--full { top: 56px; }
.lg-sheet__grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--lg-label-3); margin: 8px auto 0; flex: none; }
.lg-sheet__head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 6px; padding: 4px 12px 2px; flex: none; }
.lg-sheet__title { text-align: center; font: 600 17px/1.25 var(--lg-font); }
.lg-sheet__body { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding: 10px 18px 22px; display: flex; flex-direction: column; gap: 12px; touch-action: pan-y; }
.lg-sheet__body::-webkit-scrollbar { display: none; }
.lg-sheet__body > * { flex-shrink: 0; }

/* ---------- 11. Number roll (contentTransition: numericText) ---------- */
.lg-roll { display: inline-flex; overflow: hidden; vertical-align: bottom; line-height: 1.1; }
.lg-roll__c { position: relative; display: inline-block; }
.lg-roll__c > span { display: inline-block; }
.lg-roll__c > span.is-new { position: absolute; left: 0; top: 0; }

/* ---------- 12. View transitions (tab switches) ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: var(--lg-dur-quick, 420ms); animation-timing-function: var(--lg-ease-quick, ease); }
::view-transition-old(lg-content) { animation: lg-vt-out 200ms ease both; }
::view-transition-new(lg-content) { animation: lg-vt-in var(--lg-dur-smooth, 600ms) var(--lg-ease-smooth, ease) both; }
@keyframes lg-vt-out { to { opacity: 0; transform: scale(.985); } }
@keyframes lg-vt-in { from { opacity: 0; transform: scale(1.015); } }

/* ---------- 13. Motion safety ---------- */
@media (prefers-reduced-motion: reduce) {
  .lg *, .lg *::before, .lg *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ==========================================================================
   v1.1 additions (2026-10-07) — learned building Ledger's Liquid Glass theme
   ========================================================================== */

/* ---------- Appearance options (set by LG.applyAppearance) ----------
   data-glass="clear" (default) | "tinted" (easier to read) | "off" (solid, no blur)
   data-motion="reduced" turns every animation and transition off. */
.lg[data-glass="tinted"], [data-glass="tinted"] .lg { --lg-glass: rgba(255,255,255,.62); --lg-glass-clear: rgba(255,255,255,.5); --lg-glass-sheet: rgba(250,251,255,.88); }
.lg[data-mode="dark"][data-glass="tinted"], [data-mode="dark"][data-glass="tinted"] .lg { --lg-glass: rgba(28,30,48,.72); --lg-glass-clear: rgba(28,30,48,.6); --lg-glass-sheet: rgba(24,26,42,.9); }
.lg[data-glass="off"], [data-glass="off"] .lg { --lg-glass: #FFFFFF; --lg-glass-clear: #FFFFFF; --lg-glass-sheet: #F4F5FA; --lg-blur-content: none; --lg-blur-chrome: none; --lg-blur-sheet: none; }
.lg[data-mode="dark"][data-glass="off"], [data-mode="dark"][data-glass="off"] .lg { --lg-glass: #1C1E2C; --lg-glass-clear: #1C1E2C; --lg-glass-sheet: #16182A; }
[data-motion="reduced"] .lg *, .lg[data-motion="reduced"] *, [data-motion="reduced"] .lg *::before, [data-motion="reduced"] .lg *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }

/* ---------- Wallpaper layer ----------
   <div class="lg-wall"></div> as the first child of the app (or body). LG.setWallpaper / applyAppearance
   fill --lg-wall; --lg-dim darkens it at night; --lg-px/--lg-py move it (mouse + LG.wallpaperParallax). */
.lg-wall {
  position: fixed; inset: -16px; z-index: 0; pointer-events: none;
  background: linear-gradient(rgba(0,0,0,var(--lg-dim,0)), rgba(0,0,0,var(--lg-dim,0))), var(--lg-wall, none) center / cover no-repeat, var(--lg-bg);
  transform: translate3d(var(--lg-px,0), var(--lg-py,0), 0); transition: transform .6s var(--lg-ease-smooth);
}

/* ---------- Text links in the accent ---------- */
.lg-link { color: var(--lg-accent-ink); font-weight: 650; background: none; border: 0; padding: 0; cursor: pointer; }

/* ---------- Entrance: cards rise in one after another ----------
   Add class lg-rise and style="--i:<index>" to each card in a grid or list. */
.lg-rise { animation: lg-rise var(--lg-dur-smooth) var(--lg-ease-smooth) backwards; animation-delay: calc(min(var(--i, 0), 12) * 35ms); }
@keyframes lg-rise { from { transform: translateY(18px) scale(.94); opacity: 0; } }
/* NOTE: use fill-mode "backwards", never "both": a filled end state blocks the :active press scale. */

/* ---------- Paper: a note / document page on glass ---------- */
.lg-paper {
  position: relative; border-radius: 30px; padding: 22px 20px 30px; min-height: 60vh;
  background: var(--lg-paper-tint, var(--lg-glass));
  -webkit-backdrop-filter: var(--lg-blur-content); backdrop-filter: var(--lg-blur-content);
  box-shadow: inset 0 0 0 .5px var(--lg-edge), inset 0 1px 1.5px var(--lg-rim-soft), var(--lg-shadow);
}
.lg-paper__title { width: 100%; border: 0; outline: 0; background: transparent; font: 750 26px/1.2 var(--lg-font-display); letter-spacing: -.02em; color: inherit; padding: 0 0 6px; }
.lg-paper__meta { font: 400 12.5px/1.3 var(--lg-font); color: var(--lg-label-2); margin-bottom: 14px; }
.lg-paper__body { width: 100%; min-height: 50vh; border: 0; outline: 0; resize: none; background: transparent; font: 400 16.5px/1.55 var(--lg-font); color: inherit; }
/* tint a paper or card with a colour: style="--lg-paper-tint: color-mix(in srgb, #FFD84D 42%, var(--lg-glass))" */

/* ---------- Floating toolbar (bottom of an editor) ---------- */
.lg-toolbar {
  position: sticky; bottom: calc(env(safe-area-inset-bottom) + 10px); z-index: 4; display: flex; align-items: center; gap: 2px;
  margin-top: 14px; padding: 6px; border-radius: 999px;
  background: var(--lg-glass); -webkit-backdrop-filter: var(--lg-blur-chrome); backdrop-filter: var(--lg-blur-chrome);
  box-shadow: inset 0 0 0 .5px var(--lg-edge), inset 0 1px 1.5px var(--lg-rim-soft), var(--lg-shadow);
}
.lg-toolbar > button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: none; display: grid; place-items: center; transition: transform var(--lg-dur-snappy) var(--lg-ease-bouncy), background .2s; }
.lg-toolbar > button:active { background: var(--lg-fill); transform: scale(.9); }
.lg-toolbar > .lg-toolbar__done { width: auto; margin-left: auto; padding: 0 22px; border-radius: 999px; background: var(--lg-accent); color: var(--lg-on-accent); font-weight: 650; }

/* ---------- Horizontal card row (savings pots, wallpapers) ---------- */
.lg-carousel { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 calc(-1 * var(--lg-gutter)); padding: 4px var(--lg-gutter) 12px; scrollbar-width: none; }
.lg-carousel::-webkit-scrollbar { display: none; }
.lg-carousel > * { flex: 0 0 auto; scroll-snap-align: start; }

/* ---------- Never let a page scroll sideways ----------
   A child with negative side margins wider than the page gutter (e.g. margin: 0 -18px inside a 16px
   gutter) makes the whole page slide left/right under the finger. Pages clip x as a safety net. */
.lg-scroll { overflow-x: hidden; overscroll-behavior-x: none; }


/* ==========================================================================
   v1.2 (2026-10-12) — Lite mode, learned from Arsa lagging on a Realme 8
   <html data-perf="lite"> (LG.setPerf('lite')). Same colours, shapes and layout;
   live blur becomes frosted, more opaque glass; shadows get smaller; every spring
   becomes a short ease-out with no overshoot. Pair with data-motion="reduced" for no animation.
   ========================================================================== */
[data-perf="lite"] .lg {
  --lg-blur-content: none; --lg-blur-chrome: none; --lg-blur-sheet: none;
  --lg-glass: rgba(255,255,255,.56); --lg-glass-clear: rgba(255,255,255,.42); --lg-glass-strong: rgba(255,255,255,.82);
  --lg-glass-sheet: rgba(246,248,253,.97); --lg-glass-bar: rgba(248,249,253,.95);
  --lg-scroll-fade: rgba(233,238,248,.92);
  --lg-shadow: 0 8px 18px -12px rgba(28,36,90,.32), 0 1px 3px -1px rgba(28,36,90,.1);
  --lg-ease-smooth: cubic-bezier(.25,.8,.25,1); --lg-ease-snappy: cubic-bezier(.25,.8,.25,1); --lg-ease-bouncy: cubic-bezier(.25,.8,.25,1);
  --lg-ease-gentle: cubic-bezier(.25,.8,.25,1); --lg-ease-quick: cubic-bezier(.25,.8,.25,1);
  --lg-dur-smooth: 240ms; --lg-dur-snappy: 200ms; --lg-dur-bouncy: 220ms; --lg-dur-gentle: 260ms; --lg-dur-quick: 160ms;
}
[data-perf="lite"] .lg[data-mode="dark"] {
  --lg-glass: rgba(30,32,52,.66); --lg-glass-clear: rgba(30,32,52,.5); --lg-glass-strong: rgba(255,255,255,.2);
  --lg-glass-sheet: rgba(22,24,40,.97); --lg-glass-bar: rgba(24,26,42,.95); --lg-scroll-fade: rgba(7,10,24,.88);
  --lg-shadow: 0 10px 20px -12px rgba(0,0,0,.6), 0 1px 3px -1px rgba(0,0,0,.35);
}
@media (prefers-color-scheme: dark) {
  [data-perf="lite"] .lg:not([data-mode="light"]) {
    --lg-glass: rgba(30,32,52,.66); --lg-glass-clear: rgba(30,32,52,.5); --lg-glass-strong: rgba(255,255,255,.2);
    --lg-glass-sheet: rgba(22,24,40,.97); --lg-glass-bar: rgba(24,26,42,.95); --lg-scroll-fade: rgba(7,10,24,.88);
    --lg-shadow: 0 10px 20px -12px rgba(0,0,0,.6), 0 1px 3px -1px rgba(0,0,0,.35);
  }
}
/* bars floating over scrolling content need more body once the blur is gone */
[data-perf="lite"] .lg-glass--chrome, [data-perf="lite"] .lg-toast, [data-perf="lite"] .lg-banner { background: var(--lg-glass-bar); }
/* the top fade: a plain gradient instead of blur + mask */
[data-perf="lite"] .lg-edge { -webkit-backdrop-filter: none; backdrop-filter: none; -webkit-mask: none; mask: none;
  background: linear-gradient(var(--lg-scroll-fade) 50%, rgba(0,0,0,0)); }
[data-perf="lite"] .lg-sheet { will-change: auto; }
[data-perf="lite"] .lg-skeleton { animation-duration: 2.4s; }
