/*!
 * liquid-glass-tabbar - an iOS 26 "Liquid Glass" floating tab bar for the web.
 * Read README.md first: the markup, the script and the host page must fit together as it describes.
 * Part 1 of 3: design tokens. Override any --lgtb-* token on :root (or on the bar) after this file.
 */
:root {
  --lgtb-height: 62px;        /* bar height; the lens and every map are sized from the measured bar */
  --lgtb-slot: 76px;          /* width of one tab at the natural size; the bar is 2 * pad + tabs * slot wide */
  --lgtb-pad: 8px;            /* inner padding at both ends (the script reads it: keep it in px) */
  --lgtb-gutter: 12px;        /* minimum gap to the screen edges on narrow screens */
  --lgtb-bottom: 14px;        /* distance from the bottom edge (the safe-area inset is added) */
  --lgtb-bg: #000;            /* THE PAGE BACKGROUND COLOUR: the glass copy of the page is drawn over it (Safari/Firefox) */
  --lgtb-fg: #f7f7f7;         /* tab label and icon colour */
  --lgtb-fg-held: #fefefe;    /* the same while the lens is held (iOS brightens the other items) */
  --lgtb-tab-on: rgb(247, 247, 247);        /* the selected tab inside the resting pill (JS reads it: use rgb()) */
  --lgtb-tab-on-lift: rgb(254, 254, 254);   /* ... inside the lifted lens */
  --lgtb-accent: rgb(244, 118, 72);         /* keyboard focus ring */
  --lgtb-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  --lgtb-tone: .73;           /* contrast() and brightness() of the glass, fitted to the iOS Music bar over scrolling content */
  --lgtb-bright: .96;
  --lgtb-sat: 1.55;
  --lgtb-blur: .4px;          /* the sharp layer keeps content faintly readable */
  --lgtb-glow: 14px;          /* the wide glow carries colour into gaps */
  --lgtb-sharp: .25;          /* share of the sharp, edge-bent layer; the glow makes up the rest (Safari/Firefox) */
  --lgtb-lens-pad: 12px;      /* room for the lens rim to look outside itself (the script reads it: keep it in px) */
}
.lgtb:not(.lgtb-ready) { visibility: hidden; }   /* until the script has built the layers */
.lgtb, .lgtb *, .lgtb *::before, .lgtb *::after { box-sizing: border-box; }
.lgtb-tab { appearance: none; -webkit-appearance: none; background: none; border: 0; margin: 0; padding: 0; font: inherit; text-align: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* Optional page switching (the "pages" option): the page that appears gets this class for one entry animation. */
.lgtb-page-enter { animation: lgtb-page-in .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes lgtb-page-in { from { opacity: .001; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { .lgtb-page-enter { animation: none; } }

/*
 * Part 2 of 3: the bar. Layer order inside <nav class="lgtb"> (built by the script):
 *   .lgtb-sw   shadow, frost (the glass), glow          } three groups scaled by the press "swell"
 *   .lgtb-glass  page copy for the glass (Safari/Firefox)
 *   .lgtb-sw   rim, items (the real buttons), lens
 *   .lgtb-wkm, .lgtb-wk*  lifted-lens layers for WebKit
 *   .lgtb-sw   tint copy, ink canvas (WebGL), shine
 */
/* ---------- the bar ---------- */
.lgtb {
  position: fixed; z-index: 50;
  left: 0; right: 0; margin-inline: auto;
  bottom: calc(var(--lgtb-bottom) + env(safe-area-inset-bottom, 0px));
  width: min(calc(var(--lgtb-pad) * 2 + var(--lgtb-slot) * var(--lgtb-n, 5)), calc(100% - 2 * var(--lgtb-gutter) - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  height: var(--lgtb-height);
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.lgtb-sw { position: absolute; inset: 0; transform: scale(1); pointer-events: none; }
.lgtb-shadow, .lgtb-frost, .lgtb-glow, .lgtb-glass, .lgtb-rim { position: absolute; inset: 0; border-radius: 999px; pointer-events: none; }
.lgtb-shadow { box-shadow: 0 12px 34px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .35); }
/* Bar glass, measured from iOS: a nearly sharp copy of the backdrop with compressed contrast (black reads #212121),
   mixed 40/60 with a wide glow. Chromium runs the whole chain, plus edge refraction, inside #lg-bar. */
.lgtb-frost {
  background:
    radial-gradient(130px 96px at var(--lgtb-gx, 50%) 50%, rgba(255, 255, 255, var(--lgtb-ga, 0)), rgba(255, 255, 255, 0) 70%),
    linear-gradient(to bottom, rgba(255, 255, 255, .07), rgba(255, 255, 255, .03) 6%, rgba(255, 255, 255, .01) 15%, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0) 88%, rgba(255, 255, 255, .03) 96%, rgba(255, 255, 255, .065)),
    rgba(255, 255, 255, var(--lgtb-lift, 0));
  -webkit-backdrop-filter: contrast(var(--lgtb-tone)) brightness(var(--lgtb-bright)) saturate(var(--lgtb-sat)) blur(var(--lgtb-blur));
  backdrop-filter: contrast(var(--lgtb-tone)) brightness(var(--lgtb-bright)) saturate(var(--lgtb-sat)) blur(var(--lgtb-blur));
}
.lgtb-glow { opacity: .75; -webkit-backdrop-filter: blur(var(--lgtb-glow)); backdrop-filter: blur(var(--lgtb-glow)); }
.lgtb--svg .lgtb-frost { backdrop-filter: url(#lg-bar); }
.lgtb--svg .lgtb-glow, .lgtb-glass { display: none; }
/* Other engines ignore SVG filters in backdrop-filter but run them on ordinary elements, so the sharp layer bends
   a live copy of the page instead: the frost is the glow alone, and the copy lies over it at --lgtb-sharp.
   WebKit measures the filter from the nearest transformed box, so .lgtb-fx owns a transform; it must stay
   uncomposited, and nothing inside the copy may get a layer of its own, or it would draw unfiltered. */
.lgtb--mirror .lgtb-frost {
  -webkit-backdrop-filter: contrast(var(--lgtb-tone)) brightness(var(--lgtb-bright)) saturate(var(--lgtb-sat)) blur(var(--lgtb-glow));
  backdrop-filter: contrast(var(--lgtb-tone)) brightness(var(--lgtb-bright)) saturate(var(--lgtb-sat)) blur(var(--lgtb-glow));
}
.lgtb--mirror .lgtb-glow { display: none; }
/* The glass box reaches GLASS_PAD px past the bar so it can hold the swollen bar; its clip is the bar's outline. */
.lgtb--mirror .lgtb-glass { display: block; inset: calc(-1px * var(--lgtb-glass-pad, 16)); border-radius: 0; overflow: hidden; opacity: var(--lgtb-sharp); will-change: transform; }
.lgtb-fx { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform: translate(0, 0); filter: url(#lg-mirror); }
.lgtb-win { position: absolute; inset: calc(-1px * var(--lgtb-mirror-m, 32)); overflow: hidden; background: var(--lgtb-bg); }
.lgtb-mirror { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; }
.lgtb-mirror > * { margin: 0; max-width: none; width: auto; min-width: 0; }
.lgtb-mirror * { will-change: auto !important; animation: none !important; transition: none !important; }
/* Lifted lens in engines without SVG backdrop filters. The lens backdrop (.lgtb-lens, native) is the bar glass as
   it lies under each point; its rim must show what lies further out instead. Per colour channel c, with q the
   point the rim looks at (bent outward, further for blue) and m(q) the bar's coverage there:
     lens = m(q_c) * native + (1 - m(q_c)) * tone(page(q_c))
   .lgtb-wkm (WebGL; .lgtb-wk-mul, an SVG filter on an empty box, without WebGL) multiplies the native layer by
   m(q_c); .lgtb-wk-add adds the second term, from a copy of the page bent by the same lens map. Both are clipped to
   the lens. The composited box clips its overflow: with the filter's overflow in its bounds WebKit misplaces it. */
.lgtb-wk { position: absolute; left: 0; top: 0; display: none; overflow: hidden; pointer-events: none; clip-path: inset(var(--lgtb-lens-pad) round 999px); will-change: transform; }
.lgtb-lens-wk .lgtb-wk { display: block; }
.lgtb-wk-mul, .lgtb-wkm { mix-blend-mode: multiply; }
.lgtb-wkm { position: absolute; display: none; pointer-events: none; }
.lgtb-lens-wk .lgtb-wkm { display: block; }
.lgtb.lgtb-has-wkm .lgtb-wk-mul, .lgtb:not(.lgtb-has-wkm) .lgtb-wkm { display: none; }   /* WebGL draws the mask when it can */
.lgtb-wk-add { mix-blend-mode: plus-lighter; }
.lgtb-wkfx { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform: translate(0, 0); }
.lgtb-wk-mul .lgtb-wkfx { background: #000; filter: url(#lg-wk-mul); }
.lgtb-wk-add .lgtb-wkfx { filter: url(#lg-wk-add); }
.lgtb-wkwin { position: absolute; overflow: hidden; background: var(--lgtb-bg); }
.lgtb-wkshadow { position: absolute; border-radius: 999px; }
/* with the WebGL mask the shadow is baked into the copy's outside image (see buildOutside); the multiply filter of
   the fallback needs the plain image, so the copy draws the shadow itself there */
.lgtb:not(.lgtb-has-wkm) .lgtb-wkshadow { box-shadow: 0 12px 34px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .35); }
/* The rim catches light along the straight top (and half as much along the bottom) and fades out around the
   round ends. Stops are measured at the pressed brightness; at rest the rim shows at 74%. */
.lgtb-rim {
  padding: 1px;
  opacity: calc(.74 + .26 * var(--lgtb-pv, 0));
  background: linear-gradient(to bottom, rgba(255, 255, 255, .54) 0, rgba(255, 255, 255, .35) .8%, rgba(255, 255, 255, .23) 1.5%, rgba(255, 255, 255, .16) 3.8%, rgba(255, 255, 255, .125) 7.4%, rgba(255, 255, 255, .09) 12.3%, rgba(255, 255, 255, .06) 18.4%, rgba(255, 255, 255, .035) 25.4%, rgba(255, 255, 255, .02) 33.2%, rgba(255, 255, 255, 0) 42%, rgba(255, 255, 255, 0) 58%, rgba(255, 255, 255, .015) 66.8%, rgba(255, 255, 255, .03) 74.6%, rgba(255, 255, 255, .05) 81.6%, rgba(255, 255, 255, .068) 87.7%, rgba(255, 255, 255, .092) 92.6%, rgba(255, 255, 255, .115) 96.2%, rgba(255, 255, 255, .135) 98.5%, rgba(255, 255, 255, .18) 99.2%, rgba(255, 255, 255, .3) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
/* On iOS the held lens hardly shows the bar's rim stroke it bends inward (about 0.4 of it): where the rim runs under
   the lens (from --lgtb-lx + --lgtb-le to --lgtb-lx + --lgtb-lw - --lgtb-le, fully dimmed --lgtb-lr in), it keeps --lgtb-rk of its light. */
.lgtb.lgtb--svg.lgtb-held .lgtb-rim {
  -webkit-mask: linear-gradient(to right, #000 calc(var(--lgtb-lx) + var(--lgtb-le)), rgba(0, 0, 0, var(--lgtb-rk)) calc(var(--lgtb-lx) + var(--lgtb-lr)), rgba(0, 0, 0, var(--lgtb-rk)) calc(var(--lgtb-lx) + var(--lgtb-lw) - var(--lgtb-lr)), #000 calc(var(--lgtb-lx) + var(--lgtb-lw) - var(--lgtb-le))), linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: source-in, xor;
  mask-composite: intersect, exclude;
}
.lgtb-items, .lgtb-tint-items {
  position: absolute; left: 0; top: 0;
  display: grid; grid-template-columns: repeat(var(--lgtb-n, 5), minmax(0, 1fr));
  padding-inline: var(--lgtb-pad);
}
.lgtb-items { right: 0; bottom: 0; pointer-events: auto; }
.lgtb-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 0; height: 100%;
  color: var(--lgtb-fg, #f7f7f7);
  border-radius: 999px;
}
.lgtb-held .lgtb-items .lgtb-tab { color: var(--lgtb-fg-held, #fefefe); }   /* iOS brightens the other items while the lens is held */
.lgtb-tab svg { flex: none; width: 30px; height: 30px; fill: currentColor; }
.lgtb-tab span { font: 600 10.5px/1.15 var(--lgtb-font); letter-spacing: -.01em; white-space: nowrap; }
.lgtb-items .lgtb-tab:focus-visible { outline: none; }
/* The lens sits on top of the bar glass. Its box is padded so the rim can pull in what lies just outside it;
   the clip keeps the visible shape a capsule. At rest it is the selected pill: softer and darker glass. */
.lgtb-lens {
  position: absolute; left: 0; top: 0;
  pointer-events: none;
  clip-path: inset(var(--lgtb-lens-pad) round 999px);
}
.lgtb-shine {
  position: absolute; left: 0; top: 0;
  border-radius: 999px;
  pointer-events: none;
}
.lgtb:has(.lgtb-tab:focus-visible) .lgtb-shine { outline: 2px solid var(--lgtb-accent); outline-offset: 2px; }
/* Fallback when WebGL is missing: a tinted copy of the items, clipped to the lens, each item scaled on its own centre. */
.lgtb-tint { position: absolute; inset: 0; pointer-events: none; }
.lgtb-tint-items .lgtb-tab { color: var(--lgtb-tab-on-lift); }
.lgtb-ink { position: absolute; pointer-events: none; }
.lgtb-has-ink .lgtb-tint { display: none; }
.lgtb-shine::before, .lgtb-shine::after { content: ""; position: absolute; inset: 0; border-radius: inherit; opacity: var(--lgtb-pv, 0); }
.lgtb-shine::before { box-shadow: inset 0 0 0 .7px rgba(90, 90, 90, .6), inset 0 0 0 1.4px rgba(255, 255, 255, .18); }
.lgtb-has-ink .lgtb-shine::before, .lgtb-has-ink .lgtb-shine::after { display: none; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .lgtb-frost { background: rgba(33, 33, 33, .96); }
}
