/* v2 liquid glass (r6 → r8) — active only when lg.js has a working WebGL context (html.v2-lg). Everything is scoped, so without it the r5 CSS
   glass (incl. cards) stays exactly as before. r8: every surface is glass. The shader draws the big surfaces on three layers of one GL context;
   their own CSS fills are dropped here so the glass shows through. Small controls get the CSS "lite" version of the same look (bottom). */

/* ---------- layers ---------- */
canvas.v2-lgc { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100lvh; pointer-events: none; display: block; }
html.v2-lg .v2-world { z-index: -3; }
html.v2-lg .v2-sec > .v2-wrap::before { z-index: -2; }            /* section fog stays behind the glass */
canvas.v2-lg-back { z-index: -1; }                                 /* the GL canvas: under all page content */
canvas.v2-lg-front { z-index: 31; }                                /* above content and the action bar's glass, below the top bar (40) */
canvas.v2-lg-hero { position: absolute; inset: auto; left: 0; top: 0; width: 0; height: 0; z-index: 0; }
html.v2-lg .v2-hero-txt > :not(canvas) { position: relative; z-index: 1; }
html.v2-lg .v2-actbar { z-index: 32; }
html.v2-lg .v2-hero-txt { position: relative; }
html.v2-lg .v2-steps::before { display: none; }              /* the connector line used to hide under opaque chips; on clear glass it crossed the labels */

/* top bar: the canvas paints a band of the night scene with the capsules floating on it */
html.v2-lg .v2-top { background: none; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; box-shadow: none; }
html.v2-lg .v2-top::before { display: none; }
html.v2-lg .v2-top::after { opacity: .9; }
html.v2-lg :is(.v2-nav, .v2-nav a, .v2-lang, .v2-lang button) { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }

/* nav capsule — the label under the droplet is "lit" (lg.js follows the droplet, so it works mid-slide and while scroll-tracking) */
html.v2-lg .v2-nav { position: relative; padding: .3125rem; gap: .125rem; border-radius: 999px; justify-self: center; touch-action: none; -webkit-user-select: none; user-select: none; }
html.v2-lg .v2-nav a { position: relative; z-index: 1; background: none !important; box-shadow: none !important; clip-path: none; border-radius: 999px; padding: .5rem 1.125rem; color: var(--v2-ink); transition: color .18s; -webkit-user-drag: none; }
html.v2-lg .v2-nav a::after { display: none; }
html.v2-lg .v2-nav a.is-lit { color: #fff; }
html.v2-lg .v2-nav a:not(.is-lit):hover { color: var(--v2-accent-ink); }
html.v2-lg .v2-nav a:focus-visible { outline-offset: -3px; border-radius: 999px; }

/* language capsule */
html.v2-lg .v2-lang { background: none; clip-path: none; border-radius: 999px; padding: .25rem; gap: .125rem; box-shadow: none; touch-action: none; -webkit-user-select: none; user-select: none; }
html.v2-lg .v2-lang::before, html.v2-lg .v2-lang::after { display: none; }
html.v2-lg .v2-lang button { background: none !important; clip-path: none; border-radius: 999px; box-shadow: none !important; padding: .375rem .875rem; color: var(--v2-ink); }
html.v2-lg .v2-lang button.is-lit { color: var(--v2-inv-ink); }
html.v2-lg .v2-lang button:focus-visible { outline-offset: -3px; border-radius: 999px; }

/* ---------- shader-drawn surfaces: drop their CSS fill / rim / blur ---------- */
html.v2-lg :is(.v2-card, .v2-cal, .v2-ticket, .v2-stamp, .v2-fold, .v2-steps > li, .v2-cal-d.is-ev, .v2-foot, .v2-btn, .v2-actbar, .v2-notice, .v2-hero-data, .v2-cd-i) {
  background-color: transparent !important; background-image: none !important; box-shadow: none !important; border-color: transparent !important;
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
html.v2-lg :is(.v2-card, .v2-cal, .v2-hero-data, .v2-actbar, .v2-foot)::before, html.v2-lg .v2-stamp::after, html.v2-lg .v2-btn::before, html.v2-lg .v2-btn::after { display: none !important; }
html.v2-lg .v2-card, html.v2-lg .v2-cal { overflow: visible; }
html.v2-lg .v2-btn { clip-path: none; border-radius: 999px; transform: none !important; }
html.v2-lg .v2-btn:focus-visible { outline-offset: -4px; border-radius: 999px; }
html.v2-lg .v2-btn-primary { color: #fff; text-shadow: 0 1px 1px rgba(60, 10, 6, .35); }
html.v2-lg .v2-btn-ghost { color: var(--v2-ink); }
html.v2-lg .v2-cta-row { gap: 1.125rem; }
html.v2-lg .v2-cd-i { clip-path: none; border-radius: 999px; border-left: 0 !important; padding: .5rem 1rem; }
html.v2-lg .v2-cd { gap: var(--v2-sp-2) var(--v2-sp-3); }
/* state tints the shader reads (r g b a) */
html.v2-lg .v2-btn-primary { --lg-tint: 172 40 28 .9; }
html[data-v2-night].v2-lg .v2-btn-primary { --lg-tint: 196 50 34 .76; }
html.v2-lg :is(.v2-steps > li.is-cur, .v2-cal-d.is-sel, .v2-stamp.is-cur) { --lg-tint: 47 63 168 .88; color: var(--v2-on-dark); }
html[data-v2-night].v2-lg :is(.v2-steps > li.is-cur, .v2-cal-d.is-sel, .v2-stamp.is-cur) { --lg-tint: 44 60 190 .93; }
html.v2-lg .v2-cal-d.lv-full { background-image: repeating-linear-gradient(-45deg, var(--v2-hatch) 0 2px, transparent 2px 7px) !important; }
html.v2-lg .v2-cal-d.lv-full.is-sel { --lg-tint: 120 128 140 .7; }
/* r10: on the long page the booking block sits lower over the brighter part of the night scene; a light dark-glass tint keeps its small text AA */
html[data-v2-night].v2-lg .v2-book :is(.v2-cal, .v2-daycard, .v2-cal-d.is-ev:not(.is-sel)) { --lg-tint: 8 12 30 .34; }
html.v2-lg .v2-stamp.is-cur .v2-stamp-no { color: #fff; }
html.v2-lg .v2-ticket { --v2-cut: .875rem; }

/* ---------- lite glass: same look, CSS only (tags, labels, inputs, chips, switches, segmented, quantity) ---------- */
html.v2-lg { --lg-lite: rgba(var(--v2-glass-rgb), .46); --lg-lite-hi: rgba(255, 255, 255, .16); --lg-lite-rim: rgba(255, 255, 255, .34); --lg-lite-edge: rgba(255, 255, 255, .1); }
html[data-v2-night].v2-lg { --lg-lite: rgba(10, 14, 34, .5); --lg-lite-hi: rgba(255, 255, 255, .12); --lg-lite-rim: rgba(255, 255, 255, .3); --lg-lite-edge: rgba(255, 255, 255, .08); }
html.v2-lg :is(.v2-tag, .v2-friend-name em, .v2-friend-o em, .v2-cur-ops em, .v2-stn-no, .v2-switch, .v2-field input, .v2-field select, .v2-field textarea, .v2-check input,
  .v2-chips a, .v2-seg button, .v2-qty div, .v2-route-leg span, .v2-route-stn b, .v2-route-end span) {
  background: linear-gradient(180deg, var(--lg-lite-hi), transparent 58%), var(--lg-lite) !important;
  box-shadow: inset 0 1px 0 var(--lg-lite-rim), inset 0 0 0 1px var(--lg-lite-edge), inset 0 -1px 0 rgba(0, 0, 0, .22), 0 .25rem .75rem rgba(0, 0, 0, .14) !important;
  border-color: transparent !important; -webkit-backdrop-filter: saturate(1.5) !important; backdrop-filter: saturate(1.5) !important; }
html.v2-lg :is(.v2-tag, .v2-friend-name em, .v2-friend-o em, .v2-cur-ops em, .v2-chips a, .v2-seg button, .v2-switch) { border-radius: 999px; clip-path: none; }
/* tinted lite variants keep their meaning: station labels red, lead role red, cast / support ultramarine, selected ultramarine, sample gold */
/* r9.2: tints sit inside the glass (translucent body + bright rim) instead of reading as solid paint */
html.v2-lg :is(.v2-stn-no, .v2-route-stn b, .v2-friend-name em) { background: radial-gradient(130% 95% at 32% -8%, rgba(255, 255, 255, .28), rgba(255, 255, 255, .05) 55%, transparent 72%), rgba(164, 38, 26, .64) !important; color: #fff !important;
  box-shadow: inset 0 1px 0 rgba(255, 220, 210, .62), inset 0 0 0 1px rgba(255, 176, 160, .3), inset 0 -1px 0 rgba(0, 0, 0, .2), 0 .25rem .75rem rgba(0, 0, 0, .16) !important; text-shadow: 0 1px 1px rgba(60, 10, 6, .4); }
html.v2-lg :is(.v2-friend-o em, .v2-route-end span, .v2-switch[aria-pressed="true"], .v2-seg button[aria-pressed="true"], .v2-seg button.is-on, .v2-chips a.is-on) {
  background: radial-gradient(130% 95% at 32% -8%, rgba(255, 255, 255, .26), rgba(255, 255, 255, .05) 55%, transparent 72%), rgba(42, 58, 170, .66) !important; color: #fff !important;
  box-shadow: inset 0 1px 0 rgba(220, 228, 255, .6), inset 0 0 0 1px rgba(170, 186, 255, .3), inset 0 -1px 0 rgba(0, 0, 0, .2), 0 .25rem .75rem rgba(0, 0, 0, .16) !important; text-shadow: 0 1px 1px rgba(8, 12, 50, .4); }
html.v2-lg .v2-tag-sample { background: linear-gradient(180deg, rgba(255, 255, 255, .1), transparent 60%), rgba(20, 16, 6, .55) !important; box-shadow: inset 0 0 0 1px var(--v2-gold), inset 0 1px 0 rgba(255, 255, 255, .25) !important; }
html.v2-lg .v2-check input:checked { background: linear-gradient(180deg, rgba(255, 255, 255, .24), transparent 60%), var(--v2-primary) !important; }
html.v2-lg .v2-check input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--v2-warn-ink) !important; }
html.v2-lg .v2-switch i { background: rgba(0, 0, 0, .28); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); }
html.v2-lg .v2-switch i::after { background: radial-gradient(circle at 35% 30%, #fff, rgba(255, 255, 255, .7) 45%, rgba(220, 228, 240, .55)); box-shadow: 0 1px 3px rgba(0, 0, 0, .35), inset 0 -1px 1px rgba(0, 0, 0, .15); }
html.v2-lg :is(.v2-field input, .v2-field select, .v2-field textarea):focus-visible { box-shadow: inset 0 1px 0 var(--lg-lite-rim), inset 0 0 0 2px var(--v2-accent-ink) !important; }
html.v2-lg .v2-qr { background: var(--v2-plate) !important; }       /* QR codes stay on light plates (old rule) */
html.v2-lg .v2-qr .v2-tag { background: linear-gradient(180deg, rgba(255, 255, 255, .22), transparent 60%), var(--v2-primary) !important; color: #fff !important; }

/* the route wipe leaves the top bar (and the phone tab bar) uncovered so the droplet slide stays visible */
html.v2-lg .v2-xf { top: var(--v2-top-h); }

/* phones: nav becomes a floating bottom tab capsule; the top bar is a single row */
@media (max-width: 760px) {
  html.v2-lg { --v2-top-h: 3.5rem; --v2-tab-h: 3.375rem; }
  html.v2-lg .v2-top-in { grid-template-rows: 3.5rem; }
  html.v2-lg .v2-nav { position: fixed; left: .75rem; right: .75rem; justify-self: stretch; width: auto; bottom: calc(.75rem + env(safe-area-inset-bottom, 0px)); height: var(--v2-tab-h); padding: .3125rem; display: flex; justify-content: space-between; grid-row: auto; }
  html.v2-lg .v2-nav a { flex: 1; justify-content: center; align-items: center; padding: 0 .25rem; font-size: .8125rem; }
  html.v2-lg body { padding-bottom: calc(var(--v2-tab-h) + 1.5rem); }
  html.v2-lg .v2-actbar { bottom: 0; padding-bottom: calc(var(--v2-tab-h) + 1.25rem + env(safe-area-inset-bottom, 0px)); }
  html.v2-lg .v2-nav a::before { display: none; }
  html.v2-lg .has-bar { padding-bottom: calc(var(--v2-bar-h) + var(--v2-tab-h) + 3.5rem); }
  html.v2-lg .v2-xf { bottom: calc(var(--v2-tab-h) + 1.5rem); }
  html.v2-lg .v2-lang button { padding: .3125rem .75rem; }
}

/* fallback (no WebGL / ?lg=0 / ?glass=solid / reduced transparency): r5 CSS glass, but the top bar gets a denser veil so its labels hold AA over any scrolled content */
html:not(.v2-lg) .v2-top { --g-tint: max(var(--g-a), .93); }

/* ================= r10: tinted liquid glass for every small coloured widget ================= */
/* One recipe for tags, role labels, station numbers, route legs / end, switches, chips, segmented, checkbox, badges — with or without WebGL.
   Body: the hue as a thin tint (never a solid block) · specular cap top-left · caustic: light gathered at the lower edge in the tint ·
   rim: bright top line + hue edge · dispersion: warm fringe on the left edge, cool on the right · refraction: backdrop blur + saturation + lift.
   Opaque fallbacks (?glass=solid, reduced transparency) keep their old fills. */
html:not([data-v2-glass="solid"]) body :is(.v2-tag:not(:where(.v2-qr .v2-tag)), .v2-friend-name em, .v2-friend-o em, .v2-cur-ops em, .v2-stn-no, .v2-route-stn b, .v2-route-leg span, .v2-route-end span,
  .v2-switch, .v2-seg button, .v2-chips a, .v2-check input:checked, .v2-qty div) {
  --gx: 255 255 255; --gxa: .07; --gxe: .3;
  background:
    radial-gradient(120% 85% at 28% -12%, rgba(255, 255, 255, .36), rgba(255, 255, 255, .07) 46%, transparent 64%),
    radial-gradient(110% 70% at 50% 125%, rgb(var(--gx) / calc(var(--gxa) + .22)), transparent 68%) !important;
  background-color: rgb(var(--gx) / var(--gxa)) !important;   /* the tint itself is a real colour layer (what text contrast is measured against) */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .62), inset 0 -1px 0 rgba(255, 255, 255, .14),
    inset 1.5px 0 0 -.5px rgba(255, 128, 150, .34), inset -1.5px 0 0 -.5px rgba(120, 196, 255, .38),
    inset 0 0 0 1px rgb(var(--gx) / var(--gxe)), 0 .25rem .75rem rgba(0, 0, 0, .18), 0 0 .875rem rgb(var(--gx) / calc(var(--gxa) * .4)) !important;
  border-color: transparent !important; clip-path: none !important;
  -webkit-backdrop-filter: blur(4px) saturate(1.9) brightness(1.1) !important; backdrop-filter: blur(4px) saturate(1.9) brightness(1.1) !important; }
html:not([data-v2-glass="solid"]) body :is(.v2-tag:not(:where(.v2-qr .v2-tag)), .v2-friend-name em, .v2-friend-o em, .v2-cur-ops em, .v2-route-leg span, .v2-route-end span, .v2-switch, .v2-seg button, .v2-chips a) { border-radius: 999px !important; }
html:not([data-v2-glass="solid"]) body :is(.v2-stn-no, .v2-route-stn b) { border-radius: .5rem !important; }
/* hues (original palette): cinnabar = lead role, station numbers, checked box · ultramarine = support role, faction, finish, "on" states · gold = sample badge */
html:not([data-v2-glass="solid"]) body :is(.v2-stn-no, .v2-route-stn b, .v2-friend-name em, em.is-lead, .v2-check input:checked) { --gx: 214 58 40; --gxa: .36; --gxe: .55; color: #fff !important; text-shadow: 0 1px 1px rgba(70, 8, 4, .45); }
html:not([data-v2-glass="solid"]) body :is(em.is-sup, .v2-route-end span, .v2-switch[aria-pressed="true"], .v2-seg button[aria-pressed="true"], .v2-seg button.is-on, .v2-chips a.is-on) { --gx: 70 92 228; --gxa: .36; --gxe: .58; color: #fff !important; text-shadow: 0 1px 1px rgba(8, 12, 60, .45); }
html:not([data-v2-glass="solid"]) body .v2-qty div { --gx: 10 14 34; --gxa: .42; --gxe: .3; }   /* quantity tiles hold small muted labels: dark glass body */
html:not([data-v2-glass="solid"]) body .v2-tag-faction { --gx: 90 150 235; --gxa: .26; --gxe: .45; color: #fff !important; text-shadow: 0 1px 1px rgba(6, 18, 50, .45); }
html:not([data-v2-glass="solid"]) body .v2-tag-sample { --gx: 120 92 30; --gxa: .34; --gxe: .62; color: #f8e2a8 !important; text-shadow: 0 1px 1px rgba(40, 28, 4, .5); }   /* QR-plate tags keep their solid label (light-plate rule) */
/* the 老朋友 / 新相逢 switch: glass track with a liquid bead (it was a square knob) */
html:not([data-v2-glass="solid"]) body .v2-switch i { border-radius: 999px !important; background: linear-gradient(180deg, rgba(0, 0, 0, .34), rgba(0, 0, 0, .16)) !important; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .4), inset 0 -1px 0 rgba(255, 255, 255, .16) !important; }
html:not([data-v2-glass="solid"]) body .v2-switch[aria-pressed="true"] i { background: linear-gradient(180deg, rgba(150, 30, 20, .55), rgba(214, 58, 40, .4)) !important; }
html:not([data-v2-glass="solid"]) body .v2-switch i::after { border-radius: 50% !important; background: radial-gradient(circle at 34% 28%, #fff 0 18%, rgba(255, 255, 255, .78) 32%, rgba(214, 226, 246, .5) 62%, rgba(190, 210, 240, .7)) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4), inset 0 -1px 1.5px rgba(80, 110, 170, .45), inset 1px 0 0 rgba(255, 140, 160, .35), inset -1px 0 0 rgba(120, 200, 255, .4) !important; }
html:not([data-v2-glass="solid"]) body .v2-check input:checked::after { background: #fff; }
/* the stamp-card progress fill and the phone poster dot read as tinted glass too */
html:not([data-v2-glass="solid"]) body .v2-prog-bar i { background: linear-gradient(180deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, .06) 55%, transparent), linear-gradient(90deg, rgba(214, 58, 40, .72), rgba(214, 170, 80, .72)) !important; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); }
html:not([data-v2-glass="solid"]) body .v2-posters-nav i.is-on { background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .7), rgba(214, 170, 80, .6) 55%, rgba(214, 170, 80, .8)); box-shadow: inset 0 0 0 1px rgba(255, 236, 190, .5); }
/* no WebGL: the chips the shader would tint get the same CSS glass */
html:not(.v2-lg):not([data-v2-glass="solid"]) body :is(.v2-cal-d.is-sel, .v2-steps > li.is-cur, .v2-stamp.is-cur) {
  background: radial-gradient(120% 85% at 28% -12%, rgba(255, 255, 255, .3), rgba(255, 255, 255, .06) 46%, transparent 64%), linear-gradient(180deg, rgba(70, 92, 228, .62), rgba(52, 70, 190, .56)) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), inset 1.5px 0 0 -.5px rgba(255, 128, 150, .34), inset -1.5px 0 0 -.5px rgba(120, 196, 255, .38), inset 0 0 0 1px rgba(150, 170, 255, .55), 0 .25rem .75rem rgba(0, 0, 0, .2) !important; color: #fff !important; }
@media (prefers-reduced-transparency: reduce) { html body :is(.v2-tag, .v2-friend-name em, .v2-friend-o em, .v2-cur-ops em, .v2-stn-no, .v2-route-stn b, .v2-route-leg span, .v2-route-end span, .v2-switch, .v2-seg button, .v2-chips a, .v2-check input:checked, .v2-qty div) { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; --gxa: .9; } }
