/* ============================================================
   星辞开源云 · 液态玻璃风格（浅色主题）
   复刻「星辞液态玻璃」WebGL 材质：毛玻璃、折射、高光、弹簧动画
   ============================================================ */

:root {
  --bg-1: #eef2f7;
  --bg-2: #f5f7fb;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-border-soft: rgba(255, 255, 255, 0.35);
  --text: #1c1c1e;
  --text-2: #6e6e73;
  --text-3: #aeaeb2;
  --line: rgba(60, 60, 67, 0.12);
  --fill: #f2f2f7;
  --blue: #007aff;
  --blue-press: #0066d6;
  --blue-soft: rgba(0, 122, 255, 0.12);
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --purple: #af52de;
  --radius: 20px;
  --radius-lg: 28px;
  --ease-ios: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.17, 0.9, 0.24, 1.18);
  --shadow-card: 0 12px 40px -12px rgba(31, 38, 135, 0.18),
                 0 4px 12px -6px rgba(31, 38, 135, 0.08);
  --shadow-glow: 0 8px 32px -8px rgba(0, 122, 255, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
               "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg-1);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* 动态背景光斑（模拟 WebGL 版的动态光斑） */
body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
  animation: blobFloat 18s ease-in-out infinite;
}
body::before {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #a5c8ff, transparent 70%);
  top: -120px; left: -100px;
}
body::after {
  width: 460px; height: 460px;
  background: radial-gradient(circle, #ffd6e0, transparent 70%);
  bottom: -120px; right: -100px;
  animation-delay: -9s;
}
@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -30px) scale(1.08); }
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input { font: inherit; }
a { color: var(--blue); text-decoration: none; }

/* ---------- 玻璃卡片 ---------- */
.glass {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.glass-strong {
  background: var(--glass-strong);
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

/* ---------- 顶部导航 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border-soft);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar .brand .logo {
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, #007aff, #5856d6);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 6px 16px -4px rgba(0,122,255,0.5);
}
.topbar .brand h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.topbar .brand h1 span { color: var(--blue); }
.topbar .user-area { display: flex; align-items: center; gap: 12px; }
.topbar .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #34c759, #30b0c7);
  color: #fff; display: grid; place-items: center;
  font-size: 14px; font-weight: 600;
}
.topbar .user-name { font-size: 14px; font-weight: 500; }
.topbar .btn-logout {
  font-size: 13px; color: var(--text-2); padding: 6px 12px;
  border-radius: 10px; transition: all 0.2s;
}
.topbar .btn-logout:hover { background: var(--fill); color: var(--red); }

/* ---------- 主容器 ---------- */
.container {
  position: relative; z-index: 1;
  max-width: 720px; margin: 0 auto;
  padding: 20px 16px 120px;
}

/* ---------- 玻璃按钮 ---------- */
.btn-glass {
  position: relative;
  height: 48px; padding: 0 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(0,122,255,0.95), rgba(88,86,214,0.92));
  color: #fff; font-size: 16px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  overflow: hidden;
  transition: transform 0.25s var(--ease-ios), box-shadow 0.25s var(--ease-ios);
  box-shadow: 0 10px 26px -10px rgba(0,122,255,0.7),
              inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn-glass::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.25), transparent);
  border-radius: 999px 999px 0 0;
}
.btn-glass:hover { transform: translateY(-2px); box-shadow: 0 14px 32px -10px rgba(0,122,255,0.8), inset 0 1px 0 rgba(255,255,255,0.3); }
.btn-glass:active { transform: scale(0.97); }
.btn-glass:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  height: 44px; padding: 0 20px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  color: var(--text); font-size: 15px; font-weight: 500;
  transition: all 0.25s var(--ease-ios);
}
.btn-ghost:hover { background: var(--glass-strong); transform: translateY(-1px); }
.btn-ghost:active { transform: scale(0.97); }

/* ---------- 玻璃开关（复刻 WebGL toggle） ---------- */
.switch {
  position: relative;
  width: 56px; height: 32px;
  border-radius: 999px;
  background: rgba(120,120,128,0.32);
  transition: background 0.3s var(--ease-ios);
  cursor: pointer;
  flex-shrink: 0;
}
.switch::after {
  content: ""; position: absolute;
  top: 3px; left: 3px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,0.15), 0 1px 2px rgba(0,0,0,0.1);
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s;
}
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(24px); }
.switch:active::after { transform: scale(0.92); }
.switch.on:active::after { transform: translateX(24px) scale(0.92); }

/* ---------- 输入框 ---------- */
.field {
  position: relative;
  height: 52px;
  display: flex; align-items: center;
  background: var(--fill);
  border: 1.5px solid transparent;
  border-radius: 14px;
  padding: 0 14px;
  transition: all 0.25s var(--ease-ios);
}
.field:focus-within {
  background: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}
.field input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: none;
  font-size: 16px; color: var(--text);
}
.field input::placeholder { color: var(--text-3); }

/* ---------- 页面标题区 ---------- */
.page-header { text-align: center; padding: 8px 0 24px; }
.page-header h2 { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.page-header p { margin-top: 8px; font-size: 14px; color: var(--text-2); line-height: 1.5; }

/* ---------- 文件卡片网格 ---------- */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.file-card {
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 16px;
  transition: transform 0.3s var(--ease-ios), box-shadow 0.3s;
  box-shadow: 0 4px 16px -6px rgba(31,38,135,0.1);
  display: flex; flex-direction: column;
}
.file-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px -8px rgba(31,38,135,0.18);
}
.file-card .icon {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(0,122,255,0.15), rgba(88,86,214,0.1));
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: var(--blue);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.file-card .name {
  font-size: 14px; font-weight: 600; color: var(--text);
  line-height: 1.4; margin-bottom: 6px;
  word-break: break-all;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.file-card .meta {
  font-size: 12px; color: var(--text-2);
  display: flex; justify-content: space-between; align-items: center;
  margin-top: auto; padding-top: 10px;
}
.file-card .actions {
  display: flex; gap: 8px; margin-top: 10px;
}
.file-card .actions button {
  flex: 1; height: 34px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  transition: all 0.2s;
}
.file-card .btn-dl {
  background: var(--blue); color: #fff;
}
.file-card .btn-dl:hover { background: var(--blue-press); }
.file-card .btn-dl:active { transform: scale(0.96); }
.file-card .btn-del {
  background: rgba(255,59,48,0.1); color: var(--red);
}
.file-card .btn-del:hover { background: rgba(255,59,48,0.18); }

/* ---------- 上传区 ---------- */
.upload-area {
  border: 2px dashed rgba(0,122,255,0.3);
  border-radius: 20px;
  padding: 40px 24px;
  text-align: center;
  background: rgba(255,255,255,0.4);
  backdrop-filter: blur(12px);
  transition: all 0.3s var(--ease-ios);
  cursor: pointer;
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--blue);
  background: var(--blue-soft);
  transform: scale(1.01);
}
.upload-area .icon { font-size: 40px; margin-bottom: 10px; }
.upload-area h3 { font-size: 16px; margin-bottom: 6px; }
.upload-area p { font-size: 13px; color: var(--text-2); }

/* ---------- 分页 ---------- */
.pagination {
  display: flex; justify-content: center; align-items: center;
  gap: 8px; margin-top: 24px; flex-wrap: wrap;
}
.pagination button {
  min-width: 38px; height: 38px; padding: 0 12px;
  border-radius: 10px; font-size: 14px; font-weight: 500;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border-soft);
  color: var(--text);
  transition: all 0.2s var(--ease-ios);
}
.pagination button:hover:not(:disabled):not(.active) {
  background: var(--blue-soft); color: var(--blue);
}
.pagination button.active {
  background: var(--blue); color: #fff;
  box-shadow: 0 4px 12px -2px rgba(0,122,255,0.5);
}
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- 底部玻璃标签栏（复刻 WebGL 版底部标签栏） ---------- */
.tabbar {
  position: fixed; bottom: 16px; left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  padding: 6px;
  background: var(--glass-strong);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  box-shadow: 0 16px 48px -12px rgba(31,38,135,0.25),
              inset 0 1px 0 rgba(255,255,255,0.6);
  display: flex;
  max-width: calc(100% - 32px);
}
.tabbar .tab {
  position: relative;
  padding: 10px 22px;
  font-size: 14px; font-weight: 500;
  color: var(--text-2);
  border-radius: 999px;
  transition: color 0.3s var(--ease-ios);
  white-space: nowrap;
  z-index: 1;
}
.tabbar .indicator {
  position: absolute; top: 6px; bottom: 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(0,122,255,0.9), rgba(88,86,214,0.85));
  box-shadow: 0 6px 18px -4px rgba(0,122,255,0.5),
              inset 0 1px 0 rgba(255,255,255,0.3);
  transition: all 0.4s var(--ease-spring);
  z-index: 0;
}
.tabbar .tab.active { color: #fff; }
.tabbar .tab:not(.active):hover { color: var(--text); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 70px; left: 50%;
  transform: translate(-50%, -16px);
  background: rgba(28,28,30,0.88);
  color: #fff; font-size: 14px; font-weight: 500;
  padding: 11px 22px; border-radius: 999px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s var(--ease-ios), transform 0.3s var(--ease-spring);
  z-index: 999; max-width: 90vw; text-align: center;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,0.35);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center; padding: 60px 20px;
  color: var(--text-3);
}
.empty .icon { font-size: 56px; margin-bottom: 16px; opacity: 0.5; }
.empty p { font-size: 14px; }

/* ---------- 搜索框 ---------- */
.search-bar {
  display: flex; gap: 10px; margin-bottom: 18px;
}
.search-bar .field { flex: 1; }

/* ---------- 统计横幅 ---------- */
.stats-banner {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  margin-bottom: 20px;
}
.stat-item {
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px; padding: 16px;
}
.stat-item .num { font-size: 24px; font-weight: 700; color: var(--blue); }
.stat-item .label { font-size: 12px; color: var(--text-2); margin-top: 4px; }

/* ---------- 模态弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s var(--ease-ios);
}
.modal-mask.show { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--glass-strong);
  backdrop-filter: blur(30px) saturate(200%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 28px; width: 100%; max-width: 400px;
  box-shadow: 0 24px 60px -16px rgba(0,0,0,0.3);
  transform: scale(0.94);
  transition: transform 0.35s var(--ease-spring);
}
.modal-mask.show .modal { transform: scale(1); }
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.modal p { font-size: 14px; color: var(--text-2); margin-bottom: 18px; }
.modal .field { margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions button { flex: 1; }

/* ---------- 响应式 ---------- */
@media (max-width: 480px) {
  .container { padding: 16px 12px 110px; }
  .tabbar .tab { padding: 10px 16px; font-size: 13px; }
  .file-grid { grid-template-columns: 1fr; }
  .page-header h2 { font-size: 22px; }
}

/* ---------- 减弱动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
