/* ============================================
   LexiBlocks — 响应式 Web 全局样式
   浅色毛玻璃主题 · 手机+桌面自适应
   ============================================ */

:root {
  --primary: #10B981;
  --primary-light: rgba(16, 185, 129, 0.1);
  --primary-glow: rgba(16, 185, 129, 0.25);
  --prefix: #14B8A6;
  --root: #3B82F6;
  --suffix: #F59E0B;
  --bg: #F0F7F4;
  --bg-card: rgba(255, 255, 255, 0.72);
  --bg-elevated: rgba(255, 255, 255, 0.85);
  --card-bg: rgba(255, 255, 255, 0.65);
  --border: rgba(0, 0, 0, 0.06);
  --text: #1a2e1a;
  --text-sec: rgba(20, 50, 30, 0.5);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.06);
  --shadow-glow: 0 0 40px rgba(16, 185, 129, 0.06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --sidebar-w: 240px;
  --content-max: 1200px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; outline: none; }
html, body { margin: 0; padding: 0; -webkit-overflow-scrolling: touch; overscroll-behavior: none; }
button, a, [role="button"] { touch-action: manipulation; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Helvetica Neue", sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  background-image:
    radial-gradient(ellipse at 10% 0%, rgba(16, 185, 129, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 100%, rgba(20, 184, 166, 0.06) 0%, transparent 50%);
  background-attachment: fixed;
}

.perf-lite, .perf-lite * { animation: none !important; transition: none !important; box-shadow: none !important; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ===== 布局 ===== */
.app-shell { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-w);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  transition: transform var(--transition);
}
.sidebar-brand {
  padding: 22px 18px 16px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #6EE7B7);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 900; color: #fff;
  box-shadow: 0 3px 12px rgba(16, 185, 129, 0.25);
}
.sidebar-brand .brand-text {
  font-size: 17px; font-weight: 900; color: var(--text);
}
.sidebar-nav {
  flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-md);
  color: var(--text-sec); text-decoration: none;
  font-size: 14px; font-weight: 600;
  transition: all var(--transition);
}
.sidebar-nav a:hover { background: rgba(16, 185, 129, 0.06); color: var(--text); }
.sidebar-nav a.active {
  background: var(--primary-light);
  color: var(--primary); font-weight: 700;
}
.sidebar-nav a .nav-icon {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; background: rgba(0,0,0,0.03);
}
.sidebar-nav a.active .nav-icon { background: rgba(16, 185, 129, 0.12); }
.sidebar-footer { padding: 14px; border-top: 1px solid var(--border); }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-md);
}
.sidebar-user .avatar-sm {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #6EE7B7);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 900; color: #fff;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-tier { font-size: 11px; color: var(--text-sec); }

/* 主内容 */
.main-content {
  flex: 1; margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column;
}
.page-wrapper {
  flex: 1; width: 100%; max-width: var(--content-max);
  margin: 0 auto; padding: 28px 36px 40px;
}

/* Tabbar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(56px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: none; justify-content: space-around; align-items: center;
  padding-bottom: var(--safe-bottom); z-index: 1000;
}
.tab-item {
  display: flex; flex-direction: column; align-items: center;
  color: var(--text-sec); text-decoration: none;
  font-size: 10px; font-weight: 600; flex: 1; padding: 5px 0;
  transition: color var(--transition);
}
.tab-item.active { color: var(--primary); font-weight: 700; }
.tab-icon {
  width: 26px; height: 26px; border-radius: 50%;
  font-size: 17px; margin-bottom: 2px;
  display: inline-flex; align-items: center; justify-content: center;
}
.tab-item.hidden { display: none !important; }

/* ===== 通用组件 ===== */
.btn {
  background: var(--primary); color: white; border: none;
  height: 46px; border-radius: var(--radius-md);
  font-weight: 700; font-size: 15px; padding: 0 22px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25); }
.btn:active { transform: scale(0.98); filter: brightness(0.96); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); box-shadow: none; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: rgba(16,185,129,0.04); box-shadow: none; }
.btn-full { width: 100%; }
.btn-sm { height: 36px; font-size: 13px; padding: 0 14px; border-radius: var(--radius-sm); }

.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
}
.card:hover { box-shadow: 0 4px 24px rgba(0,0,0,0.08); }

.block {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px; border-radius: 12px;
  font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; font-size: 14px;
  box-shadow: 0 3px 0 rgba(0,0,0,0.1);
  transition: transform 0.1s;
}
.block:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.1); }
.block-prefix { background: var(--prefix); color: #fff; }
.block-root { background: var(--root); color: #fff; }
.block-suffix { background: var(--suffix); color: #fff; }

.nav-bar {
  height: 52px; padding: 0 20px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: var(--text);
  position: sticky; top: 0; z-index: 100;
  background: rgba(240, 247, 244, 0.8);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.status-bar { height: 0; }

.toast {
  position: fixed; left: 50%; top: 60px; transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  color: var(--text); padding: 10px 24px; border-radius: var(--radius-md);
  font-weight: 700; font-size: 13px;
  display: none; z-index: 9000;
  max-width: calc(100vw - 40px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}
.toast.success { background: rgba(0, 184, 148, 0.92); color: #fff; }
.toast.error { background: rgba(225, 112, 85, 0.92); color: #fff; }

.hidden { display: none !important; }

/* ===== 响应式 ===== */
@media (min-width: 1024px) {
  .sidebar { display: flex; }
  .tabbar { display: none !important; }
  .main-content { margin-left: var(--sidebar-w); }
  .page-wrapper { padding: 32px 48px 60px; max-width: 100%; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .sidebar { display: none; }
  .tabbar { display: flex; }
  .main-content { margin-left: 0; }
  .page-wrapper { padding: 20px 24px calc(76px + var(--safe-bottom)); }
}
@media (max-width: 767px) {
  .sidebar { display: none; }
  .tabbar { display: flex; }
  .main-content { margin-left: 0; }
  .page-wrapper { padding: 14px 14px calc(76px + var(--safe-bottom)); }
  .nav-bar { height: 48px; font-size: 15px; padding: 0 16px; }
  .btn { height: 42px; font-size: 14px; border-radius: 12px; }
  .card { border-radius: 16px; padding: 14px; }
  .status-bar { height: 0; }
}

.page-container { min-height: 100vh; padding-bottom: 0; }
@media (max-width: 1023px) {
  .page-container { padding-bottom: calc(66px + var(--safe-bottom)); }
}
