/* ============================================================
   NOLBIR · 液态玻璃（Liquid Glass）CSS 复刻层
   对应 docs/UI视觉与动效规范.md §4 液态玻璃
   —— 说明 ——
   1) 这里是「能用在自己 UI 上的玻璃」，纯 CSS，无 WebGL 依赖。
   2) 真正带折射/色散位移的组件在 glass.html，走 GooseHyperGlass WebGL。
   3) 层的顺序：theme.css → app.css → glass.css（本文件最后加载，负责覆盖）
   ============================================================ */

/* ------------------------------------------------------------
   0. 通用：玻璃表面与高光描边
   ------------------------------------------------------------ */

/* 玻璃底：半透明白 + 背景模糊 + 顶部高光 + 底部暗边 */
.lg-surface {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(255, 255, 255, 0.52) 100%);
  -webkit-backdrop-filter: blur(16px) saturate(180%) brightness(1.04);
  backdrop-filter: blur(16px) saturate(180%) brightness(1.04);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 1px rgba(255, 255, 255, 0.35),
    0 1px 2px rgba(16, 24, 40, 0.04),
    0 8px 24px -14px rgba(10, 132, 255, 0.35);
}

/* 1px 高光描边（用 mask 挖出环形，比 border 更能表现玻璃厚度） */
.lg-ring::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(255, 255, 255, 0.42) 38%,
    rgba(29, 29, 31, 0.10) 100%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}

/* 色散环：拖拽时出现，模拟玻璃边缘的红绿蓝分离 */
.lg-disperse::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1.5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms var(--ease-out);
  background: conic-gradient(
    from 200deg,
    var(--disp-r),
    rgba(255, 214, 92, 0.7),
    var(--disp-g),
    rgba(92, 214, 255, 0.75),
    var(--disp-b),
    rgba(198, 92, 255, 0.7),
    var(--disp-r)
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  filter: blur(0.4px) saturate(140%);
}
.lg-disperse.is-dragging::before,
.lg-disperse:active::before { opacity: 1; }

/* ------------------------------------------------------------
   1. 分段控件 .seg —— 玻璃底 + 滑动透镜
   ------------------------------------------------------------ */
.seg {
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.66) 0%, rgba(255, 255, 255, 0.34) 100%);
  -webkit-backdrop-filter: blur(14px) saturate(175%);
  backdrop-filter: blur(14px) saturate(175%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 1px rgba(255, 255, 255, 0.4),
    inset 0 0 0 1px rgba(29, 29, 31, 0.05),
    0 1px 2px rgba(16, 24, 40, 0.04);
}

/* 透镜：跟随选中项滑动 */
.seg-lens {
  position: absolute;
  top: 3px;
  left: 0;
  height: calc(100% - 6px);
  border-radius: var(--radius-full);
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(120% 140% at 50% -30%, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.72) 60%, rgba(255, 255, 255, 0.86));
  box-shadow:
    0 1px 1px rgba(16, 24, 40, 0.06),
    0 6px 16px -8px rgba(10, 132, 255, 0.45),
    0 2px 6px -2px rgba(16, 24, 40, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 1px rgba(255, 255, 255, 0.5);
  transition:
    transform 460ms cubic-bezier(0.32, 1.34, 0.46, 1),
    width 320ms cubic-bezier(0.32, 1.34, 0.46, 1);
  will-change: transform, width;
}

/* 透镜边缘的极淡色散，静态也有玻璃味 */
.seg-lens::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.9),
    rgba(120, 180, 255, 0.35) 35%,
    rgba(255, 255, 255, 0.2) 55%,
    rgba(94, 92, 230, 0.28) 85%,
    rgba(255, 255, 255, 0.85)
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0.9;
}

.seg button {
  position: relative;
  z-index: 1;
  background: transparent;
  box-shadow: none;
  transition: color 260ms var(--ease-out);
}
.seg button.is-active {
  background: transparent;
  box-shadow: none;
  color: var(--text-primary);
}

/* ------------------------------------------------------------
   2. 玻璃按钮
   ------------------------------------------------------------ */
.lg-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  background:
    radial-gradient(120% 160% at 50% -40%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.55) 70%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 1px rgba(255, 255, 255, 0.4),
    0 1px 2px rgba(16, 24, 40, 0.05),
    0 8px 22px -12px rgba(10, 132, 255, 0.4);
  transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out);
  cursor: pointer;
}
.lg-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 1px rgba(255, 255, 255, 0.4),
    0 2px 4px rgba(16, 24, 40, 0.06),
    0 14px 30px -14px rgba(10, 132, 255, 0.5);
}
.lg-btn:active { transform: scale(0.975); }

/* 深底上的玻璃按钮（展示区用） */
.ink .lg-btn {
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 1px rgba(255, 255, 255, 0.12),
    0 10px 26px -14px rgba(0, 0, 0, 0.8);
}

/* 播放按钮：做成玻璃圆钮 */
.play-btn {
  background:
    radial-gradient(120% 160% at 50% -40%, #4DA3FF, var(--accent) 70%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 2px 4px rgba(10, 132, 255, 0.25),
    0 10px 24px -10px rgba(10, 132, 255, 0.7);
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.play-btn:hover { transform: scale(1.04); }
.play-btn:active { transform: scale(0.96); }

/* ------------------------------------------------------------
   3. 滑杆 .lg-range
   ------------------------------------------------------------ */
.lg-range {
  position: relative;
  display: flex;
  align-items: center;
  height: 28px;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.lg-range-track {
  position: relative;
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(29, 29, 31, 0.12);
  box-shadow: inset 0 1px 1px rgba(16, 24, 40, 0.10);
}
.lg-range-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 2px;
  background: linear-gradient(90deg, #4DA3FF, var(--accent));
  box-shadow: 0 0 8px rgba(10, 132, 255, 0.45);
}
.lg-range-knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  background:
    radial-gradient(120% 140% at 40% 25%, #ffffff 0%, #ffffff 55%, #EDF2F8 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 1px 2px rgba(16, 24, 40, 0.18),
    0 4px 10px -3px rgba(16, 24, 40, 0.22);
  transition: transform 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}
/* 拖动时：旋钮微胀 + 色散彩边 */
.lg-range.is-dragging .lg-range-knob {
  transform: scale(1.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 0 0 1.5px rgba(255, 92, 92, 0.5),
    0 0 0 3px rgba(92, 156, 255, 0.28),
    0 6px 14px -4px rgba(16, 24, 40, 0.3);
}
.lg-range.is-dragging .lg-range-fill {
  box-shadow: 0 0 14px rgba(10, 132, 255, 0.65);
}

/* ------------------------------------------------------------
   4. 开关 .lg-switch
   ------------------------------------------------------------ */
.lg-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.lg-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.lg-switch-rail {
  position: relative;
  display: block;
  width: 51px;
  height: 31px;
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.16);
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.16);
  transition: background 300ms var(--ease-out), box-shadow 300ms var(--ease-out);
}
.lg-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 999px;
  background: #fff;
  box-shadow:
    0 1px 2px rgba(16, 24, 40, 0.18),
    0 3px 8px -2px rgba(16, 24, 40, 0.22),
    inset 0 0.5px 0 rgba(255, 255, 255, 1);
  transition:
    transform 380ms cubic-bezier(0.32, 1.34, 0.46, 1),
    width 260ms var(--ease-out),
    box-shadow 260ms var(--ease-out);
}
/* 开：绿色轨 + 右移 */
.lg-switch input:checked + .lg-switch-rail {
  background: linear-gradient(180deg, #3AD35C, #2FBF51);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.10),
    0 0 14px -2px rgba(52, 199, 89, 0.55);
}
.lg-switch input:checked + .lg-switch-rail .lg-switch-knob {
  transform: translateX(20px);
}
/* 按住时旋钮被拉长（液态被拉扯的感觉） */
.lg-switch input:active + .lg-switch-rail .lg-switch-knob {
  width: 34px;
}
.lg-switch input:checked:active + .lg-switch-rail .lg-switch-knob {
  transform: translateX(13px);
}
/* 拖动/按下时的色散彩边 */
.lg-switch input:active + .lg-switch-rail .lg-switch-knob {
  box-shadow:
    0 0 0 1.5px rgba(255, 92, 92, 0.55),
    0 0 0 3.5px rgba(92, 156, 255, 0.30),
    0 3px 8px -2px rgba(16, 24, 40, 0.22);
}
.lg-switch input:focus-visible + .lg-switch-rail {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ------------------------------------------------------------
   5. 深色展示区（首页玻璃带 / glass.html）
   ------------------------------------------------------------ */
.ink {
  position: relative;
  background: var(--ink-900);
  color: #fff;
  overflow: hidden;
}
.ink::before {
  content: "";
  position: absolute;
  inset: -20% -10%;
  pointer-events: none;
  background:
    radial-gradient(40% 45% at 18% 20%, rgba(10, 132, 255, 0.42), transparent 70%),
    radial-gradient(36% 40% at 82% 12%, rgba(94, 92, 230, 0.36), transparent 70%),
    radial-gradient(50% 55% at 62% 92%, rgba(64, 210, 255, 0.22), transparent 72%),
    radial-gradient(30% 34% at 8% 88%, rgba(255, 92, 150, 0.16), transparent 70%);
  filter: blur(24px);
  opacity: 0.95;
}
.ink > * { position: relative; z-index: 1; }

/* 深底上的分段控件 */
.ink .seg {
  background: rgba(255, 255, 255, 0.09);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 1px rgba(255, 255, 255, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.ink .seg button { color: rgba(255, 255, 255, 0.66); }
.ink .seg button.is-active { color: #fff; }
.ink .seg-lens {
  background: rgba(255, 255, 255, 0.20);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 1px rgba(255, 255, 255, 0.14),
    0 6px 18px -8px rgba(0, 0, 0, 0.9);
}

/* 深底上的滑杆 */
.ink .lg-range-track { background: rgba(255, 255, 255, 0.18); }
.ink .lg-range-fill { background: linear-gradient(90deg, #6FB8FF, #0A84FF); }

/* 深底上的玻璃卡片 */
.lg-card {
  position: relative;
  border-radius: 24px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.055);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 1px rgba(255, 255, 255, 0.06),
    0 20px 50px -24px rgba(0, 0, 0, 0.9);
}

/* ------------------------------------------------------------
   5b. 首页液态玻璃带
   ------------------------------------------------------------ */
.gp-band { padding: 84px 0; }
.gp-band-inner {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 64px; align-items: center;
}
.gp-band-copy h2 {
  font-size: 38px; line-height: 1.2; letter-spacing: -0.02em;
  color: #fff; margin: 14px 0 16px; font-weight: 500;
}
.gp-band-copy p {
  font-size: 15px; line-height: 1.8; color: rgba(255, 255, 255, 0.55);
  max-width: 420px; margin-bottom: 26px;
}
.gp-band-eyebrow {
  color: rgba(255, 255, 255, 0.45) !important;
  display: inline-flex; align-items: center; gap: 9px;
}
.gp-band-eyebrow::before {
  content: ""; width: 18px; height: 1px; background: var(--accent);
}
.gp-band-cta { text-decoration: none; }
.gp-band-cta i { display: inline-flex; margin-left: 2px; }

.gp-band-stage {
  padding: 28px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.055);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 40px 80px -50px rgba(0, 0, 0, 1);
  display: flex; flex-direction: column; gap: 24px;
}
.gp-band-stage .seg { width: 100%; }
.gp-band-stage .seg button { flex: 1; }
.gp-band-row { display: flex; align-items: center; gap: 18px; }
.gp-band-label {
  font-size: 13px; color: rgba(255, 255, 255, 0.55);
  width: 64px; flex: none;
}

@media (max-width: 900px) {
  .gp-band { padding: 64px 0; }
  .gp-band-inner { grid-template-columns: 1fr; gap: 36px; }
  .gp-band-copy h2 { font-size: 30px; }
}

/* ------------------------------------------------------------
   6. WebGL 组件容器（glass.html 用）
   ------------------------------------------------------------ */
.lg-stage {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  background: transparent;
}
.lg-stage liquid-glass { display: block; width: 100%; height: 100%; }
/* 组件还没渲染出来时先占位，避免布局跳动 */
.lg-stage[data-pending]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.04);
}

/* ------------------------------------------------------------
   7. 降级：不支持 backdrop-filter 时退回实色
   ------------------------------------------------------------ */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .lg-surface,
  .lg-btn,
  .seg,
  .lg-card {
    background: rgba(255, 255, 255, 0.94);
  }
  .ink .lg-btn,
  .ink .lg-card,
  .ink .seg {
    background: rgba(255, 255, 255, 0.16);
  }
  .seg-lens { background: #fff; }
}

/* 减少动效：透镜直接跳位，不做弹性 */
@media (prefers-reduced-motion: reduce) {
  .seg-lens,
  .lg-switch-knob,
  .lg-range-knob {
    transition-duration: 1ms !important;
  }
}
