/* ============================================================
   liquid-glass.css — iOS 26 "Liquid Glass" 设计系统
   Sumairu 通用站点 · 2026
   ------------------------------------------------------------
   组成：
     1) 设计令牌 (Design Tokens)
     2) 背景层 (Aurora / 流动光斑)
     3) 玻璃基元 (.glass / .glass-strong / .glass-thin)
     4) 液态高光、折射边缘、按压形变
     5) 控件：按钮 / 输入框 / 分段控件 / 胶囊
     6) 布局：容器 / 卡片网格 / 列表
     7) 模态窗 / Toast
     8) 响应式 + 无障碍 + 减弱动效
   ============================================================ */

/* ---------- 1. 设计令牌 ---------- */
:root {
  color-scheme: light dark;

  /* 玻璃折射参数 */
  --lg-blur: 34px;
  --lg-blur-strong: 52px;
  --lg-blur-thin: 18px;
  --lg-saturate: 190%;
  --lg-radius-xs: 12px;
  --lg-radius-sm: 18px;
  --lg-radius: 26px;
  --lg-radius-lg: 34px;
  --lg-radius-xl: 44px;
  --lg-pill: 999px;

  /* 高光 / 描边 */
  --lg-stroke: rgba(255, 255, 255, 0.55);
  --lg-stroke-soft: rgba(255, 255, 255, 0.28);
  --lg-inner-glow: rgba(255, 255, 255, 0.9);
  --lg-shadow:
    0 1px 1px rgba(16, 24, 40, 0.04),
    0 12px 28px -12px rgba(16, 24, 40, 0.28),
    0 40px 80px -40px rgba(16, 24, 40, 0.4);

  /* 文本 */
  --lg-text: #0c1220;
  --lg-text-soft: #3d4a61;
  --lg-text-mute: #6b7793;
  --lg-accent: #0a84ff;
  --lg-accent-2: #7b5cff;
  --lg-accent-3: #35c7d8;
  --lg-danger: #ff453a;
  --lg-ok: #30d158;

  /* 排版 */
  --lg-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Segoe UI Variable",
    system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --lg-mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  /* 动效 */
  --lg-ease: cubic-bezier(0.32, 0.72, 0.28, 1);
  --lg-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --lg-fast: 0.18s;
  --lg-base: 0.34s;
  --lg-slow: 0.6s;

  /* 指针（由 glass.js 更新，用于全局光折射） */
  --lg-pointer-x: 50%;
  --lg-pointer-y: 12%;
  --lg-tilt-x: 0deg;
  --lg-tilt-y: 0deg;
}

/* 深色令牌：由 <html data-theme="dark"> 统一驱动。
   注意不要在 @media (prefers-color-scheme: dark) 里重复定义 —— 那样
   在浅色系统上手动切到深色时，只有文字变白、背景仍是亮的，对比度会崩掉。
   系统偏好由 head.php / glass.js 同步成 data-theme 属性。 */
:root[data-theme="dark"] {
  --lg-stroke: rgba(255, 255, 255, 0.22);
  --lg-stroke-soft: rgba(255, 255, 255, 0.1);
  --lg-inner-glow: rgba(255, 255, 255, 0.35);
  --lg-shadow:
    0 1px 1px rgba(0, 0, 0, 0.3),
    0 16px 34px -14px rgba(0, 0, 0, 0.6),
    0 50px 90px -50px rgba(0, 0, 0, 0.8);
  --lg-text: #f2f5fb;
  --lg-text-soft: #c2cadb;
  --lg-text-mute: #8e98ad;
}

:root[data-theme="light"] {
  --lg-stroke: rgba(255, 255, 255, 0.55);
  --lg-stroke-soft: rgba(255, 255, 255, 0.28);
  --lg-inner-glow: rgba(255, 255, 255, 0.9);
  --lg-shadow:
    0 1px 1px rgba(16, 24, 40, 0.04),
    0 12px 28px -12px rgba(16, 24, 40, 0.28),
    0 40px 80px -40px rgba(16, 24, 40, 0.4);
  --lg-text: #0c1220;
  --lg-text-soft: #3d4a61;
  --lg-text-mute: #6b7793;
}

/* ---------- 基础重置 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 玻璃卡片是 inset 定位的，任何意外溢出都不该让页面横向滚动 */
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--lg-font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--lg-text);
  letter-spacing: 0.01em;
  background-color: #dbe4f2;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

::selection {
  background: color-mix(in srgb, var(--lg-accent) 32%, transparent);
}

/* 滚动条也做成玻璃质感 */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 135, 165, 0.5) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgba(120, 135, 165, 0.45);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--lg-pill);
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(120, 135, 165, 0.7);
  background-clip: content-box;
}

/* ---------- 2. 背景层 ---------- */
.lg-backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(120% 100% at 8% 0%, #eef3ff 0%, transparent 60%),
    radial-gradient(110% 95% at 100% 8%, #ffe9f4 0%, transparent 58%),
    radial-gradient(120% 120% at 50% 118%, #dcf6f2 0%, transparent 62%),
    linear-gradient(168deg, #e9eefb 0%, #e4ecf9 40%, #e7e6f4 74%, #dde9f4 100%);
}

.lg-backdrop__wallpaper {
  position: absolute;
  inset: -4%;
  background-size: cover;
  background-position: center;
  filter: saturate(118%) contrast(104%);
  transform: scale(1.04);
}

.lg-backdrop__wallpaper::after {
  /* 让用户壁纸也带上玻璃雾气，保证前景可读 */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.18) 0%,
    rgba(255, 255, 255, 0.34) 55%,
    rgba(240, 245, 255, 0.42) 100%
  );
}

:root[data-theme="dark"] .lg-backdrop__wallpaper::after {
  background: linear-gradient(
    180deg,
    rgba(6, 10, 22, 0.42) 0%,
    rgba(6, 10, 22, 0.56) 60%,
    rgba(6, 10, 22, 0.68) 100%
  );
}

.lg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.72;
  mix-blend-mode: normal;
  will-change: transform;
}

.lg-blob--a {
  width: 46vmax;
  height: 46vmax;
  left: -12vmax;
  top: -14vmax;
  background: radial-gradient(circle at 35% 35%, #6ea8ff 0%, rgba(110, 168, 255, 0) 70%);
  animation: lg-float-a 26s var(--lg-ease) infinite alternate;
}

.lg-blob--b {
  width: 40vmax;
  height: 40vmax;
  right: -10vmax;
  top: -6vmax;
  background: radial-gradient(circle at 60% 40%, #ff8fd0 0%, rgba(255, 143, 208, 0) 70%);
  animation: lg-float-b 31s var(--lg-ease) infinite alternate;
}

.lg-blob--c {
  width: 52vmax;
  height: 52vmax;
  left: 18vmax;
  bottom: -26vmax;
  background: radial-gradient(circle at 50% 50%, #4fe0d0 0%, rgba(79, 224, 208, 0) 70%);
  animation: lg-float-c 37s var(--lg-ease) infinite alternate;
}

.lg-blob--d {
  width: 34vmax;
  height: 34vmax;
  right: 6vmax;
  bottom: -12vmax;
  background: radial-gradient(circle at 50% 50%, #b08cff 0%, rgba(176, 140, 255, 0) 70%);
  animation: lg-float-d 24s var(--lg-ease) infinite alternate;
}

@keyframes lg-float-a {
  to {
    transform: translate3d(9vmax, 7vmax, 0) scale(1.14);
  }
}
@keyframes lg-float-b {
  to {
    transform: translate3d(-8vmax, 9vmax, 0) scale(1.1);
  }
}
@keyframes lg-float-c {
  to {
    transform: translate3d(-11vmax, -6vmax, 0) scale(1.08);
  }
}
@keyframes lg-float-d {
  to {
    transform: translate3d(7vmax, -9vmax, 0) scale(1.16);
  }
}

/* 颗粒：让玻璃有真实的"材质感"，而不是塑料 */
.lg-backdrop__grain {
  position: absolute;
  inset: 0;
  opacity: 0.4;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='160' height='160' filter='url(%23n)' opacity='0.5'/></svg>");
  background-size: 160px 160px;
}

/* 跟随指针的全局光斑：光线穿过玻璃的感觉 */
.lg-backdrop__glow {
  position: absolute;
  inset: -20%;
  background: radial-gradient(
    46vmax 46vmax at var(--lg-pointer-x) var(--lg-pointer-y),
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0.16) 38%,
    rgba(255, 255, 255, 0) 68%
  );
  transition: background 0.5s linear;
  pointer-events: none;
}

:root[data-theme="dark"] .lg-backdrop__glow {
  background: radial-gradient(
    46vmax 46vmax at var(--lg-pointer-x) var(--lg-pointer-y),
    rgba(140, 180, 255, 0.28) 0%,
    rgba(140, 180, 255, 0.08) 40%,
    rgba(140, 180, 255, 0) 70%
  );
}

/* 深色背景：只认 data-theme，保证手动切换也生效 */
:root[data-theme="dark"] .lg-backdrop {
  background:
    radial-gradient(120% 100% at 8% 0%, #16203a 0%, transparent 60%),
    radial-gradient(110% 95% at 100% 8%, #2a1630 0%, transparent 58%),
    radial-gradient(120% 120% at 50% 118%, #0d2b30 0%, transparent 62%),
    linear-gradient(168deg, #0a1020 0%, #0c1426 45%, #101227 78%, #0a1620 100%);
}

:root[data-theme="dark"] body {
  background-color: #0a1020;
}

:root[data-theme="dark"] .lg-blob {
  opacity: 0.5;
  filter: blur(80px);
}

/* ---------- 3. 玻璃基元 ---------- */
.glass {
  position: relative;
  isolation: isolate;
  border-radius: var(--lg-radius);
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.62) 0%,
    rgba(255, 255, 255, 0.34) 46%,
    rgba(255, 255, 255, 0.48) 100%
  );
  -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate));
  backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate));
  box-shadow: var(--lg-shadow);
  border: 0;
  color: var(--lg-text);
}

/* 折射描边：上亮下暗，模拟玻璃厚度（跟随主题令牌，深色下不会变成白块） */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    160deg,
    var(--lg-inner-glow) 0%,
    var(--lg-stroke-soft) 32%,
    rgba(255, 255, 255, 0.04) 56%,
    var(--lg-stroke) 100%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
}

/* 内部顶部高光 + 底部反光 */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0) 22%),
    linear-gradient(0deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 16%);
  opacity: 0.85;
  pointer-events: none;
  z-index: 1;
}

:root[data-theme="dark"] .glass,
:root:not([data-theme="light"]) .glass {
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.14) 0%,
    rgba(255, 255, 255, 0.05) 46%,
    rgba(255, 255, 255, 0.1) 100%
  );
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .glass {
    background: linear-gradient(
      155deg,
      rgba(255, 255, 255, 0.62) 0%,
      rgba(255, 255, 255, 0.34) 46%,
      rgba(255, 255, 255, 0.48) 100%
    );
  }
}

.glass--thin {
  -webkit-backdrop-filter: blur(var(--lg-blur-thin)) saturate(160%);
  backdrop-filter: blur(var(--lg-blur-thin)) saturate(160%);
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.4) 0%,
    rgba(255, 255, 255, 0.2) 100%
  );
}

.glass--strong {
  -webkit-backdrop-filter: blur(var(--lg-blur-strong)) saturate(200%);
  backdrop-filter: blur(var(--lg-blur-strong)) saturate(200%);
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.78) 0%,
    rgba(255, 255, 255, 0.56) 55%,
    rgba(255, 255, 255, 0.66) 100%
  );
}

:root[data-theme="dark"] .glass--thin {
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.04) 100%);
}
:root[data-theme="dark"] .glass--strong {
  background: linear-gradient(
    155deg,
    rgba(30, 40, 62, 0.78) 0%,
    rgba(24, 32, 52, 0.62) 55%,
    rgba(30, 40, 62, 0.7) 100%
  );
}

/* 液态扭曲：玻璃底部缓慢流动的彩色折射条纹 */
.glass--liquid > .lg-liquid {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

.glass--liquid > .lg-liquid::before {
  content: "";
  position: absolute;
  left: -30%;
  right: -30%;
  bottom: -60%;
  height: 130%;
  background: conic-gradient(
    from 0deg,
    rgba(110, 168, 255, 0.55),
    rgba(176, 140, 255, 0.45),
    rgba(255, 143, 208, 0.42),
    rgba(79, 224, 208, 0.45),
    rgba(110, 168, 255, 0.55)
  );
  filter: blur(28px);
  animation: lg-liquid-spin 18s linear infinite;
}

@keyframes lg-liquid-spin {
  to {
    transform: rotate(1turn);
  }
}

/* 指针高光（每张玻璃卡片跟随鼠标的那束光） */
.glass--spot {
  overflow: hidden;
}

.glass--spot::after {
  background:
    radial-gradient(
      240px 240px at var(--lg-spot-x, 50%) var(--lg-spot-y, 50%),
      rgba(255, 255, 255, 0.6) 0%,
      rgba(255, 255, 255, 0.1) 42%,
      rgba(255, 255, 255, 0) 70%
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0) 22%),
    linear-gradient(0deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 16%);
  opacity: 0;
  transition: opacity var(--lg-base) var(--lg-ease);
}

.glass--spot:hover::after,
.glass--spot:focus-within::after {
  opacity: 1;
}

/* ---------- 4. 通用工具 ---------- */
.lg-stack {
  position: relative;
  z-index: 3;
}

.lg-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lg-row--between {
  justify-content: space-between;
}

.lg-row--wrap {
  flex-wrap: wrap;
}

.lg-grow {
  flex: 1 1 auto;
  min-width: 0;
}

.lg-mute {
  color: var(--lg-text-mute);
}

.lg-soft {
  color: var(--lg-text-soft);
}

.lg-mono {
  font-family: var(--lg-mono);
  font-variant-numeric: tabular-nums;
}

.lg-sep {
  color: var(--lg-text-mute);
  opacity: 0.5;
  margin: 0 6px;
}

.lg-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lg-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 5. 控件 ---------- */
.lg-btn {
  --lg-btn-bg: rgba(255, 255, 255, 0.55);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  min-height: 42px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--lg-text);
  text-decoration: none;
  border: 0;
  border-radius: var(--lg-pill);
  cursor: pointer;
  background: var(--lg-btn-bg);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -1px 0 rgba(255, 255, 255, 0.25),
    0 8px 18px -10px rgba(16, 24, 40, 0.5);
  transition:
    transform var(--lg-fast) var(--lg-ease),
    box-shadow var(--lg-base) var(--lg-ease),
    background var(--lg-base) var(--lg-ease),
    filter var(--lg-fast) linear;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  isolation: isolate;
}

.lg-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.95),
    rgba(255, 255, 255, 0.2) 45%,
    rgba(255, 255, 255, 0.5)
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.lg-btn:hover {
  transform: translateY(-1px) scale(1.015);
  filter: brightness(1.05);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 14px 26px -12px rgba(16, 24, 40, 0.55);
}

.lg-btn:active {
  transform: translateY(0) scale(0.965);
  transition-duration: 0.08s;
}

.lg-btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--lg-accent) 55%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.lg-btn--primary {
  --lg-btn-bg: linear-gradient(150deg, #3d9bff 0%, #0a6bf0 55%, #0a5ad0 100%);
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 30, 80, 0.35);
}

:root[data-theme="dark"] .lg-btn--primary {
  --lg-btn-bg: linear-gradient(150deg, #4aa3ff 0%, #0a6bf0 60%, #0a55c2 100%);
}

.lg-btn--ghost {
  --lg-btn-bg: rgba(255, 255, 255, 0.28);
}

.lg-btn--danger {
  --lg-btn-bg: linear-gradient(150deg, #ff6a5e 0%, #e0332a 100%);
  color: #fff;
}

.lg-btn--sm {
  min-height: 34px;
  padding: 6px 14px;
  font-size: 13.5px;
}

.lg-btn--lg {
  min-height: 52px;
  padding: 14px 26px;
  font-size: 17px;
}

.lg-btn--block {
  width: 100%;
}

.lg-btn[disabled],
.lg-btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

/* 图标按钮 */
.lg-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: var(--lg-text);
  background: rgba(255, 255, 255, 0.4);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 6px 14px -8px rgba(16, 24, 40, 0.5);
  transition: transform var(--lg-fast) var(--lg-ease), background var(--lg-base) var(--lg-ease);
}

.lg-icon-btn:hover {
  transform: translateY(-1px) scale(1.06);
  background: rgba(255, 255, 255, 0.6);
}

.lg-icon-btn:active {
  transform: scale(0.92);
}

/* 输入框 */
.lg-field {
  display: block;
  margin-bottom: 16px;
}

.lg-field > label,
.lg-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--lg-text-soft);
  margin-bottom: 6px;
}

.lg-input,
.lg-textarea,
.lg-select {
  width: 100%;
  padding: 12px 16px;
  font: inherit;
  font-size: 15px;
  color: var(--lg-text);
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--lg-radius-sm);
  box-shadow:
    inset 0 1px 2px rgba(16, 24, 40, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 1px 0 rgba(255, 255, 255, 0.4);
  outline: none;
  transition: border-color var(--lg-base) var(--lg-ease), box-shadow var(--lg-base) var(--lg-ease);
  appearance: none;
}

.lg-textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.6;
}

.lg-select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'><path d='M1 1l6 6 6-6' fill='none' stroke='%236b7793' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 42px;
}

.lg-input::placeholder,
.lg-textarea::placeholder {
  color: var(--lg-text-mute);
}

.lg-input:focus,
.lg-textarea:focus,
.lg-select:focus {
  border-color: color-mix(in srgb, var(--lg-accent) 62%, white);
  box-shadow:
    0 0 0 3.5px color-mix(in srgb, var(--lg-accent) 26%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

:root[data-theme="dark"] .lg-input,
:root[data-theme="dark"] .lg-textarea,
:root[data-theme="dark"] .lg-select,
:root[data-theme="dark"] .lg-icon-btn {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

/* 分段控件（iOS 风格） */
.lg-segment {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--lg-pill);
  background: rgba(120, 135, 165, 0.18);
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.1);
}

.lg-segment__item {
  padding: 7px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--lg-text-soft);
  text-decoration: none;
  border-radius: var(--lg-pill);
  transition: all var(--lg-base) var(--lg-ease);
}

.lg-segment__item[aria-current="true"],
.lg-segment__item.is-active {
  color: var(--lg-text);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 8px -3px rgba(16, 24, 40, 0.4);
}

/* 徽标 / 胶囊 */
.lg-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--lg-text-soft);
  background: rgba(255, 255, 255, 0.44);
  border-radius: var(--lg-pill);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}

:root[data-theme="dark"] .lg-chip {
  background: rgba(255, 255, 255, 0.16);
  color: var(--lg-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.lg-chip--accent {
  color: #fff;
  background: linear-gradient(150deg, #4aa3ff, #0a6bf0);
}

.lg-chip--warn {
  color: #6a3b00;
  background: linear-gradient(150deg, #ffd88a, #ffb733);
}

.lg-chip--lock {
  color: #fff;
  background: linear-gradient(150deg, #8f7bff, #6b4ef0);
}

/* ---------- 6. 布局 ---------- */
.lg-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 44px) clamp(14px, 3vw, 32px) 120px;
}

.lg-shell--wide {
  max-width: 1180px;
}

.lg-shell--narrow {
  max-width: 480px;
}

.lg-hero {
  padding: clamp(24px, 4vw, 40px);
  margin-bottom: 22px;
}

.lg-hero__title {
  margin: 0;
  font-size: clamp(26px, 5vw, 40px);
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.14;
}

.lg-hero__sub {
  margin: 10px 0 0;
  font-size: clamp(14px, 2.2vw, 17px);
  color: var(--lg-text-soft);
}

.lg-section {
  padding: clamp(18px, 3vw, 26px);
  margin-bottom: 20px;
}

.lg-section__title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lg-grid {
  display: grid;
  gap: 14px;
}

.lg-grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.lg-grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.lg-grid--4 {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

/* 行列表（文件、条目） */
.lg-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lg-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-radius: var(--lg-radius-sm);
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition:
    transform var(--lg-fast) var(--lg-ease),
    background var(--lg-base) var(--lg-ease),
    box-shadow var(--lg-base) var(--lg-ease);
}

.lg-item:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.52);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 16px 30px -18px rgba(16, 24, 40, 0.55);
}

.lg-item:active {
  transform: scale(0.99);
}

:root[data-theme="dark"] .lg-item {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
}

:root[data-theme="dark"] .lg-item:hover {
  background: rgba(255, 255, 255, 0.13);
}

.lg-item__icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  font-size: 20px;
  border-radius: 14px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.3));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 6px 14px -10px rgba(16, 24, 40, 0.6);
}

:root[data-theme="dark"] .lg-item__icon {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 6px 14px -10px rgba(0, 0, 0, 0.8);
}

.lg-item__body {
  flex: 1 1 auto;
  min-width: 0;
}

.lg-item__title {
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lg-item__meta {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--lg-text-mute);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 8px;
}

.lg-item__trail {
  flex: 0 0 auto;
  color: var(--lg-text-mute);
  font-size: 15px;
}

/* 统计条 */
.lg-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 14px 18px;
  font-size: 13px;
  color: var(--lg-text-soft);
}

/* 空状态 */
.lg-empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--lg-text-mute);
}

.lg-empty__icon {
  font-size: 42px;
  opacity: 0.7;
  margin-bottom: 10px;
}

/* 页脚 */
.lg-footer {
  margin-top: 26px;
  text-align: center;
  font-size: 12.5px;
  color: var(--lg-text-mute);
  line-height: 1.9;
}

.lg-footer a {
  color: var(--lg-text-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.lg-footer a:hover {
  border-bottom-color: currentColor;
}

/* 顶栏 */
.lg-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 18px;
  border-radius: var(--lg-pill);
}

.lg-topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.lg-topbar__dot {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: linear-gradient(150deg, #6ea8ff, #b08cff 55%, #4fe0d0);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 6px 14px -8px rgba(60, 90, 200, 0.9);
  flex: 0 0 auto;
}

.lg-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.lg-nav a {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--lg-text-soft);
  border-radius: var(--lg-pill);
  transition: all var(--lg-base) var(--lg-ease);
  white-space: nowrap;
}

.lg-nav a:hover {
  color: var(--lg-text);
  background: rgba(255, 255, 255, 0.45);
}

.lg-nav a[aria-current="page"] {
  color: var(--lg-text);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 4px 10px -6px rgba(16, 24, 40, 0.5);
}

:root[data-theme="dark"] .lg-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
}
:root[data-theme="dark"] .lg-nav a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.18);
}

/* 面包屑 */
.lg-crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 13.5px;
  margin-bottom: 14px;
}

.lg-crumbs a {
  padding: 5px 12px;
  border-radius: var(--lg-pill);
  text-decoration: none;
  color: var(--lg-text-soft);
  background: rgba(255, 255, 255, 0.36);
  transition: all var(--lg-base) var(--lg-ease);
}

.lg-crumbs a:hover {
  color: var(--lg-text);
  background: rgba(255, 255, 255, 0.62);
}

.lg-crumbs__current {
  padding: 5px 12px;
  border-radius: var(--lg-pill);
  color: var(--lg-text);
  font-weight: 650;
  background: rgba(255, 255, 255, 0.52);
}

.lg-crumbs__sep {
  color: var(--lg-text-mute);
  opacity: 0.6;
}

/* 内联链接 */
.inline-link {
  color: var(--lg-accent);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--lg-accent) 35%, transparent);
  transition: border-color var(--lg-base) var(--lg-ease);
  cursor: pointer;
}

.inline-link:hover {
  border-bottom-color: currentColor;
}

:root[data-theme="dark"] .inline-link {
  color: #6fb4ff;
  border-bottom-color: rgba(111, 180, 255, 0.4);
}

/* 卡片网格（首页链接卡） */
.lg-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  text-decoration: none;
  color: inherit;
  border-radius: var(--lg-radius);
}

.lg-card__text {
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.005em;
}

.lg-card__arrow {
  font-size: 18px;
  color: var(--lg-text-mute);
  transition: transform var(--lg-base) var(--lg-ease), color var(--lg-base) var(--lg-ease);
}

.lg-card:hover .lg-card__arrow {
  transform: translate(3px, -3px);
  color: var(--lg-accent);
}

/* 提示条 */
.lg-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  border-radius: var(--lg-radius-sm);
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.lg-alert--error {
  background: color-mix(in srgb, var(--lg-danger) 16%, rgba(255, 255, 255, 0.4));
  border-color: color-mix(in srgb, var(--lg-danger) 38%, transparent);
  color: #7d1610;
}

.lg-alert--ok {
  background: color-mix(in srgb, var(--lg-ok) 16%, rgba(255, 255, 255, 0.4));
  border-color: color-mix(in srgb, var(--lg-ok) 40%, transparent);
  color: #0c5c22;
}

.lg-alert--warn {
  background: color-mix(in srgb, #ffb733 22%, rgba(255, 255, 255, 0.4));
  border-color: color-mix(in srgb, #ffb733 46%, transparent);
  color: #6a4200;
}

:root[data-theme="dark"] .lg-alert--error {
  color: #ffb3ad;
}
:root[data-theme="dark"] .lg-alert--ok {
  color: #a8f0bd;
}
:root[data-theme="dark"] .lg-alert--warn {
  color: #ffdd9e;
}

/* 保险库横幅 */
.lg-vaultbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 18px;
  margin-bottom: 16px;
  border-radius: var(--lg-pill);
  background: linear-gradient(120deg, rgba(143, 123, 255, 0.32), rgba(79, 224, 208, 0.26));
  border: 1px solid rgba(255, 255, 255, 0.45);
  font-size: 13.5px;
}

/* ---------- 7. 模态窗 ---------- */
dialog.lg-modal {
  width: min(520px, 92vw);
  padding: 0;
  border: 0;
  color: var(--lg-text);
  border-radius: var(--lg-radius-lg);
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.82) 0%,
    rgba(255, 255, 255, 0.62) 55%,
    rgba(255, 255, 255, 0.74) 100%
  );
  -webkit-backdrop-filter: blur(44px) saturate(200%);
  backdrop-filter: blur(44px) saturate(200%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 40px 90px -30px rgba(16, 24, 40, 0.6);
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  transition: opacity var(--lg-base) var(--lg-ease), transform var(--lg-base) var(--lg-ease);
}

:root[data-theme="dark"] dialog.lg-modal {
  background: linear-gradient(
    155deg,
    rgba(28, 36, 56, 0.9) 0%,
    rgba(20, 27, 44, 0.82) 55%,
    rgba(28, 36, 56, 0.86) 100%
  );
}

dialog.lg-modal[open] {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* 显式兜底：任何带 hidden 的 dialog 都不显示（避免 display 规则覆盖 hidden 属性） */
dialog.lg-modal[hidden] {
  display: none !important;
}

dialog.lg-modal::backdrop {
  background: rgba(12, 18, 30, 0.32);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
  opacity: 0;
  transition: opacity var(--lg-base) var(--lg-ease);
}

dialog.lg-modal[open]::backdrop {
  opacity: 1;
}

.lg-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px 12px;
}

.lg-modal__title {
  margin: 0;
  font-size: 19px;
  font-weight: 720;
  letter-spacing: -0.01em;
}

.lg-modal__sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--lg-text-mute);
  font-weight: 400;
}

.lg-modal__body {
  padding: 6px 22px 20px;
  max-height: min(64vh, 560px);
  overflow: auto;
}

.lg-modal__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 22px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.4);
}

.lg-modal__close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: var(--lg-text-soft);
  background: rgba(120, 135, 165, 0.18);
  transition: all var(--lg-base) var(--lg-ease);
}

.lg-modal__close:hover {
  color: #fff;
  background: var(--lg-danger);
}

.lg-modal__links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lg-modal__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  text-decoration: none;
  font-weight: 620;
  color: var(--lg-text);
  border-radius: var(--lg-pill);
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.5);
  transition: all var(--lg-base) var(--lg-ease);
}

.lg-modal__link:hover {
  transform: translateX(4px);
  background: rgba(255, 255, 255, 0.66);
}

.lg-modal__link small {
  font-size: 12px;
  color: var(--lg-text-mute);
  font-weight: 500;
}

/* Toast */
.lg-toast-host {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.lg-toast {
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--lg-pill);
  color: var(--lg-text);
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(26px) saturate(190%);
  backdrop-filter: blur(26px) saturate(190%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 20px 40px -20px rgba(16, 24, 40, 0.6);
  animation: lg-toast-in 0.34s var(--lg-ease-out);
}

.lg-toast.is-out {
  animation: lg-toast-out 0.26s var(--lg-ease) forwards;
}

@keyframes lg-toast-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.94);
  }
}

@keyframes lg-toast-out {
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
}

/* 悬浮主题切换 */
.lg-theme-toggle {
  position: fixed;
  top: max(14px, env(safe-area-inset-top, 0px));
  right: 14px;
  z-index: 60;
}

/* ---------- 8. 响应式 / 无障碍 / 动效收敛 ---------- */
@media (max-width: 720px) {
  body {
    font-size: 15.5px;
  }
  .lg-shell {
    padding-bottom: 90px;
  }
  .lg-topbar {
    border-radius: var(--lg-radius);
  }
  .lg-topbar__brand {
    font-size: 15px;
  }
  .lg-nav {
    gap: 2px;
  }
  .lg-nav a {
    padding: 7px 11px;
    font-size: 13px;
  }
  .lg-item {
    padding: 12px 13px;
    gap: 11px;
  }
  .lg-item__icon {
    width: 38px;
    height: 38px;
    font-size: 17px;
    border-radius: 12px;
  }
}

@media (max-width: 480px) {
  .lg-hero__title {
    font-size: 24px;
  }
  .lg-modal {
    border-radius: var(--lg-radius);
  }
  .lg-modal__body {
    padding-inline: 16px;
  }
  .lg-modal__head,
  .lg-modal__foot {
    padding-inline: 16px;
  }
  .lg-item__trail {
    font-size: 13px;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .glass,
  .glass--thin,
  .glass--strong,
  dialog.lg-modal,
  .lg-btn,
  .lg-input,
  .lg-textarea,
  .lg-select,
  .lg-icon-btn,
  .lg-item {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: #f5f7fb;
  }
  :root[data-theme="dark"] .glass,
  :root[data-theme="dark"] dialog.lg-modal,
  :root[data-theme="dark"] .lg-item {
    background: #161b28;
  }
  .glass--liquid > .lg-liquid,
  .lg-backdrop__glow {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .glass:hover,
  .lg-btn:hover,
  .lg-item:hover {
    transform: none;
  }
}

@media (prefers-contrast: more) {
  .glass,
  .lg-item,
  .lg-input {
    border: 1px solid rgba(0, 0, 0, 0.5);
  }
}

/* 打印：玻璃变白纸 */
@media print {
  .lg-backdrop,
  .lg-theme-toggle,
  .lg-topbar,
  .lg-toast-host {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
  .glass {
    box-shadow: none;
    border: 1px solid #ccc;
    background: #fff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
