/* ==========================================================================
   Liquid Glass —— 苹果液态玻璃设计系统
   ========================================================================== */

:root {
  color-scheme: light;

  /* 基色 */
  --bg: #eef2f9;
  --bg-2: #e3eaf6;
  --ink: #0b1020;
  --ink-2: #3b4457;
  --ink-3: #6b7488;
  --ink-4: #9aa3b5;

  /* 玻璃 */
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.74);
  --glass-soft: rgba(255, 255, 255, 0.34);
  --glass-border: rgba(255, 255, 255, 0.72);
  --glass-border-soft: rgba(255, 255, 255, 0.42);
  --glass-shadow: 0 8px 32px rgba(23, 37, 84, 0.1), 0 1px 2px rgba(23, 37, 84, 0.06);
  --glass-shadow-lg: 0 24px 64px rgba(23, 37, 84, 0.16), 0 2px 8px rgba(23, 37, 84, 0.06);
  --glass-inner: inset 0 1px 0 rgba(255, 255, 255, 0.85), inset 0 -1px 0 rgba(255, 255, 255, 0.25);
  --blur: 30px;
  --blur-lg: 44px;

  /* 强调色 */
  --accent: #0a84ff;
  --accent-2: #5e5ce6;
  --accent-3: #30d158;
  --accent-4: #ff9f0a;
  --accent-5: #ff375f;
  --accent-6: #64d2ff;
  --accent-soft: rgba(10, 132, 255, 0.12);
  --accent-grad: linear-gradient(135deg, #0a84ff 0%, #5e5ce6 100%);
  --success: #30d158;
  --warn: #ff9f0a;
  --danger: #ff375f;

  /* 圆角 */
  --r-xs: 10px;
  --r-sm: 14px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-xl: 32px;
  --r-pill: 999px;

  /* 间距 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;

  --font: -apple-system, BlinkMacSystemFont, 'SF Pro SC', 'SF Pro Text', 'PingFang SC',
    'Helvetica Neue', 'Microsoft YaHei UI', 'Microsoft YaHei', system-ui, sans-serif;
  --font-num: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.32s;

  --sidebar-w: 248px;
  --header-h: 64px;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0b1220;
  --bg-2: #121a2b;
  --ink: #f2f5fa;
  --ink-2: #c3cbd9;
  --ink-3: #8d97ab;
  --ink-4: #667086;

  --glass: rgba(30, 41, 61, 0.55);
  --glass-strong: rgba(34, 46, 68, 0.78);
  --glass-soft: rgba(30, 41, 61, 0.32);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-border-soft: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.38), 0 1px 2px rgba(0, 0, 0, 0.24);
  --glass-shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  --glass-inner: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  --accent-soft: rgba(10, 132, 255, 0.18);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0b1220;
    --bg-2: #121a2b;
    --ink: #f2f5fa;
    --ink-2: #c3cbd9;
    --ink-3: #8d97ab;
    --ink-4: #667086;
    --glass: rgba(30, 41, 61, 0.55);
    --glass-strong: rgba(34, 46, 68, 0.78);
    --glass-soft: rgba(30, 41, 61, 0.32);
    --glass-border: rgba(255, 255, 255, 0.14);
    --glass-border-soft: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.38), 0 1px 2px rgba(0, 0, 0, 0.24);
    --glass-shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
    --glass-inner: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
    --accent-soft: rgba(10, 132, 255, 0.18);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  touch-action: manipulation;
}

/* ---------- 极光背景 ---------- */

.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, var(--bg-2) 0%, var(--bg) 55%, var(--bg) 100%);
}

.aurora .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.62;
  will-change: transform;
  animation: float 26s var(--ease) infinite;
}

.aurora .b1 {
  width: 52vw;
  height: 52vw;
  left: -12vw;
  top: -16vw;
  background: radial-gradient(circle, #7db2ff, #b6ccff 60%, transparent 70%);
  animation-delay: -2s;
}
.aurora .b2 {
  width: 46vw;
  height: 46vw;
  right: -10vw;
  top: -8vw;
  background: radial-gradient(circle, #c9b6ff, #e3d3ff 60%, transparent 70%);
  animation-delay: -9s;
}
.aurora .b3 {
  width: 44vw;
  height: 44vw;
  left: 18vw;
  bottom: -22vw;
  background: radial-gradient(circle, #9ff0d8, #c7f5e8 60%, transparent 70%);
  animation-delay: -15s;
}
.aurora .b4 {
  width: 36vw;
  height: 36vw;
  right: 4vw;
  bottom: -14vw;
  background: radial-gradient(circle, #ffd6a5, #ffe8cc 60%, transparent 70%);
  animation-delay: -21s;
}

.aurora .grain {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  mix-blend-mode: overlay;
}

:root[data-theme='dark'] .aurora .blob {
  opacity: 0.32;
  filter: blur(100px);
}

@keyframes float {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  33% {
    transform: translate3d(4vw, 3vh, 0) scale(1.08);
  }
  66% {
    transform: translate3d(-3vw, -2vh, 0) scale(0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  .aurora .blob {
    animation: none;
  }
  * {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}

/* ---------- 玻璃容器 ---------- */

.glass {
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner);
  border-radius: var(--r-lg);
}

.glass-strong {
  background: var(--glass-strong);
  backdrop-filter: blur(var(--blur-lg)) saturate(190%);
  -webkit-backdrop-filter: blur(var(--blur-lg)) saturate(190%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow-lg), var(--glass-inner);
  border-radius: var(--r-lg);
}

.glass-soft {
  background: var(--glass-soft);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--r-md);
}

/* 玻璃高光扫过 */
.glass-sheen {
  position: relative;
  overflow: hidden;
}
.glass-sheen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 30%,
    rgba(255, 255, 255, 0.5) 45%,
    rgba(255, 255, 255, 0.08) 55%,
    transparent 70%
  );
  transform: translateX(-120%);
  transition: transform 0.9s var(--ease-out);
  pointer-events: none;
}
.glass-sheen:hover::after {
  transform: translateX(120%);
}

/* ---------- 滚动条 ---------- */

.scroll-y {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 130, 155, 0.35) transparent;
}
.scroll-y::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.scroll-y::-webkit-scrollbar-track {
  background: transparent;
}
.scroll-y::-webkit-scrollbar-thumb {
  background: rgba(120, 130, 155, 0.28);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 999px;
}
.scroll-y::-webkit-scrollbar-thumb:hover {
  background: rgba(120, 130, 155, 0.5);
  background-clip: content-box;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 18px;
  border-radius: var(--r-pill);
  border: 1px solid var(--glass-border);
  background: var(--glass-strong);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 590;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  box-shadow: 0 1px 2px rgba(23, 37, 84, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: transform 0.16s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease),
    opacity 0.2s;
}
:root[data-theme='dark'] .btn {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn:hover {
  background: rgba(255, 255, 255, 0.9);
}
:root[data-theme='dark'] .btn:hover {
  background: rgba(46, 60, 86, 0.9);
}
.btn:active {
  transform: scale(0.965);
}
.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}
.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(10, 132, 255, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.btn-primary:hover {
  background: var(--accent-grad);
  filter: brightness(1.08);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--ink-2);
}
.btn-ghost:hover {
  background: rgba(120, 130, 155, 0.14);
}
.btn-danger {
  color: var(--danger);
  border-color: rgba(255, 55, 95, 0.28);
  background: rgba(255, 55, 95, 0.08);
}
.btn-danger:hover {
  background: rgba(255, 55, 95, 0.16);
}
.btn-sm {
  height: 30px;
  padding: 0 13px;
  font-size: 13px;
}
.btn-lg {
  height: 46px;
  padding: 0 26px;
  font-size: 15px;
}
.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-strong);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: var(--ink-2);
  cursor: pointer;
  transition: transform 0.16s var(--ease), background 0.2s;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}
.icon-btn:active {
  transform: scale(0.92);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* ---------- 输入 ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.field > label,
.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.01em;
  padding-left: 2px;
}

.input,
.textarea,
.select {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--glass-strong);
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-shadow: inset 0 1px 2px rgba(23, 37, 84, 0.04);
}
.input::placeholder,
.textarea::placeholder {
  color: var(--ink-4);
}
.input:focus,
.textarea:focus,
.select:focus {
  border-color: rgba(10, 132, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.14);
}
.textarea {
  resize: vertical;
  min-height: 84px;
  line-height: 1.55;
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7488' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

/* ---------- 卡片 ---------- */

.card {
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--glass-shadow), var(--glass-inner);
  padding: var(--sp-5);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--glass-shadow-lg), var(--glass-inner);
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin: 0 0 var(--sp-4);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* ---------- 徽章 ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 620;
  letter-spacing: 0.01em;
  background: rgba(120, 130, 155, 0.14);
  color: var(--ink-2);
  white-space: nowrap;
}
.badge-blue {
  background: rgba(10, 132, 255, 0.14);
  color: #0571e0;
}
.badge-green {
  background: rgba(48, 209, 88, 0.16);
  color: #1a9c43;
}
.badge-orange {
  background: rgba(255, 159, 10, 0.18);
  color: #c47500;
}
.badge-red {
  background: rgba(255, 55, 95, 0.14);
  color: #d42a4e;
}
.badge-purple {
  background: rgba(94, 92, 230, 0.15);
  color: #4a48c4;
}
:root[data-theme='dark'] .badge-blue {
  color: #6ab4ff;
}
:root[data-theme='dark'] .badge-green {
  color: #59e07f;
}
:root[data-theme='dark'] .badge-orange {
  color: #ffbd54;
}
:root[data-theme='dark'] .badge-red {
  color: #ff7a96;
}
:root[data-theme='dark'] .badge-purple {
  color: #9d9bff;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* ---------- 骨架屏 ---------- */

.skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(120, 130, 155, 0.12);
  border-radius: var(--r-sm);
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
}
:root[data-theme='dark'] .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent);
}
@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

/* ---------- 模态 ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  background: rgba(12, 18, 32, 0.32);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  animation: fade-in 0.22s var(--ease-out);
}
.modal {
  width: min(560px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--glass-strong);
  backdrop-filter: blur(var(--blur-lg)) saturate(190%);
  -webkit-backdrop-filter: blur(var(--blur-lg)) saturate(190%);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl);
  box-shadow: var(--glass-shadow-lg), var(--glass-inner);
  animation: modal-in 0.32s var(--ease-out);
  overflow: hidden;
}
.modal-lg {
  width: min(760px, 100%);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-6) var(--sp-3);
}
.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 680;
  letter-spacing: -0.02em;
}
.modal-body {
  padding: var(--sp-3) var(--sp-6) var(--sp-5);
  overflow-y: auto;
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6) var(--sp-5);
  border-top: 1px solid var(--glass-border-soft);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(12px);
  }
}

/* ---------- Toast ---------- */

.toast-stack {
  position: fixed;
  z-index: 1200;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
  width: min(420px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 18px;
  border-radius: var(--r-md);
  background: var(--glass-strong);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow-lg), var(--glass-inner);
  font-size: 14px;
  font-weight: 560;
  color: var(--ink);
  animation: toast-in 0.34s var(--ease-out);
  pointer-events: auto;
}
.toast.out {
  animation: toast-out 0.26s var(--ease) forwards;
}
.toast-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: none;
}
.toast-icon svg {
  width: 13px;
  height: 13px;
  color: #fff;
}
.toast-success .toast-icon {
  background: var(--success);
}
.toast-error .toast-icon {
  background: var(--danger);
}
.toast-info .toast-icon {
  background: var(--accent);
}

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

/* ---------- 工具类 ---------- */

.row {
  display: flex;
  align-items: center;
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.gap-1 {
  gap: var(--sp-1);
}
.gap-2 {
  gap: var(--sp-2);
}
.gap-3 {
  gap: var(--sp-3);
}
.gap-4 {
  gap: var(--sp-4);
}
.col {
  display: flex;
  flex-direction: column;
}
.grow {
  flex: 1;
  min-width: 0;
}
.muted {
  color: var(--ink-3);
}
.tiny {
  font-size: 12px;
}
.small {
  font-size: 13px;
}
.nowrap {
  white-space: nowrap;
}
.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hidden {
  display: none !important;
}
.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.spin {
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
