/* 智造方舟 LONXANG.AUTH · 共享设计系统 · FREDERIC.LTD 2026 */
:root {
  --brand-primary: #0078D4;
  --brand-accent: #7C3AED;
  --brand-gradient: linear-gradient(135deg, #0078D4 0%, #7C3AED 100%);
  --brand-gradient-soft: linear-gradient(135deg, rgba(0,120,212,0.15) 0%, rgba(124,58,237,0.15) 100%);
  --bg-deep: #050814;
  --bg-base: #0A0E1A;
  --bg-surface: #0F1729;
  --bg-elevated: #1A2035;
  --bg-highlight: #242B45;
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-bg-strong: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-strong: rgba(255, 255, 255, 0.2);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --text-primary: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-tertiary: #94A3B8;
  --text-disabled: #64748B;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --e1-color: #6366F1; --e2-color: #10B981; --e3-color: #F59E0B;
  --e4-color: #EC4899; --e5-color: #06B6D4; --e6-color: #8B5CF6;
  --e7-color: #F43F5E; --e8-color: #84CC16; --e9-color: #3B82F6;
  --e10-color: #14B8A6; --e11-color: #EAB308; --e12-color: #A855F7; --e13-color: #EF4444;
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 16px; --radius-xl: 24px; --radius-full: 9999px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 32px rgba(124, 58, 237, 0.4);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms; --duration-base: 300ms; --duration-slow: 500ms;
  --font-sans: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', -apple-system, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
  --sidebar-width: 280px;
  --sidebar-collapsed: 72px;
  --titlebar-height: 48px;
  --touch-target: 48px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%; font-family: var(--font-sans); font-size: 14px;
  line-height: 1.6; color: var(--text-primary); background: var(--bg-base);
  overflow: hidden; -webkit-font-smoothing: antialiased; user-select: none;
}
body {
  background:
    radial-gradient(ellipse at top left, rgba(0, 120, 212, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
    var(--bg-base);
}
body::before {
  content: ''; position: fixed; inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,0.3), transparent),
    radial-gradient(2px 2px at 80% 10%, rgba(124,58,237,0.4), transparent),
    radial-gradient(1px 1px at 40% 90%, rgba(0,120,212,0.4), transparent),
    radial-gradient(2px 2px at 90% 50%, rgba(255,255,255,0.3), transparent);
  pointer-events: none; z-index: 0; opacity: 0.6;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; border: none; background: none; color: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--glass-border-strong); }

/* === 通用组件类 === */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
}
.glass-strong {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-lg);
}
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--duration-base) var(--ease-out);
}
.card:hover {
  background: var(--glass-bg-strong);
  border-color: var(--glass-border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--touch-target); padding: 0 20px;
  border-radius: var(--radius-md); font-weight: 500; font-size: 14px;
  transition: all var(--duration-fast) var(--ease-out);
  background: var(--glass-bg-strong); border: 1px solid var(--glass-border);
  color: var(--text-primary);
}
.btn:hover { background: var(--glass-border); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--brand-gradient); border: none; box-shadow: var(--shadow-md); }
.btn-primary:hover { box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.btn-ghost { background: transparent; border-color: var(--glass-border); }
.btn-icon { min-width: var(--touch-target); min-height: var(--touch-target); padding: 0; border-radius: var(--radius-md); }
.btn-round { border-radius: var(--radius-full); }

/* 输入框 */
.input {
  width: 100%; min-height: var(--touch-target); padding: 0 16px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius-md); color: var(--text-primary);
  font-family: inherit; font-size: 14px;
  transition: all var(--duration-fast) var(--ease-out);
}
.input:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(0,120,212,0.2); }
.input::placeholder { color: var(--text-disabled); }

/* 标签 */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 500;
  background: var(--glass-bg-strong); border: 1px solid var(--glass-border);
}
.tag.primary { background: rgba(0,120,212,0.15); color: var(--brand-primary); border-color: rgba(0,120,212,0.3); }
.tag.success { background: rgba(16,185,129,0.15); color: var(--success); border-color: rgba(16,185,129,0.3); }
.tag.warning { background: rgba(245,158,11,0.15); color: var(--warning); border-color: rgba(245,158,11,0.3); }
.tag.danger { background: rgba(239,68,68,0.15); color: var(--danger); border-color: rgba(239,68,68,0.3); }

/* === 布局 === */
.app {
  position: relative; z-index: 1; display: flex; flex-direction: column;
  height: 100vh; width: 100vw;
}
.titlebar {
  height: var(--titlebar-height); display: flex; align-items: center;
  padding: 0 16px; border-bottom: 1px solid var(--glass-border);
  background: var(--glass-bg); backdrop-filter: blur(20px); -webkit-app-region: drag;
  flex-shrink: 0;
}
.titlebar .title { flex: 1; font-size: 13px; color: var(--text-tertiary); display: flex; align-items: center; gap: 12px; }
.titlebar .window-controls { display: flex; gap: 4px; -webkit-app-region: no-drag; }
.titlebar .window-controls button {
  width: 36px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); transition: background var(--duration-fast);
}
.titlebar .window-controls button:hover { background: var(--glass-bg-strong); }
.titlebar .window-controls .close:hover { background: var(--danger); }

.body-wrap { display: flex; flex: 1; overflow: hidden; }

.sidebar {
  width: var(--sidebar-width); flex-shrink: 0;
  background: var(--glass-bg); backdrop-filter: blur(30px);
  border-right: 1px solid var(--glass-border);
  display: flex; flex-direction: column;
  transition: width var(--duration-base) var(--ease-out);
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar-header {
  height: 80px; display: flex; align-items: center; gap: 12px;
  padding: 0 20px; border-bottom: 1px solid var(--glass-border);
}
.sidebar-logo {
  width: 40px; height: 40px; border-radius: var(--radius-md);
  background: var(--brand-gradient); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}
.sidebar-brand {
  flex: 1; overflow: hidden; white-space: nowrap;
}
.sidebar-brand .brand-name { font-size: 15px; font-weight: 600; }
.sidebar-brand .brand-sub { font-size: 11px; color: var(--text-tertiary); }
.sidebar.collapsed .sidebar-brand { display: none; }

.nav-list { flex: 1; padding: 12px 10px; overflow-y: auto; overflow-x: hidden; }
.nav-section-title {
  padding: 12px 14px 6px; font-size: 11px; font-weight: 600; letter-spacing: 1px;
  color: var(--text-tertiary); text-transform: uppercase;
}
.sidebar.collapsed .nav-section-title { text-align: center; padding: 8px 0; font-size: 9px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; margin: 2px 0;
  border-radius: var(--radius-md); cursor: pointer;
  transition: background var(--duration-fast); white-space: nowrap;
  min-height: 44px; color: var(--text-secondary);
}
.nav-item:hover { background: var(--glass-bg-strong); color: var(--text-primary); }
.nav-item.active {
  background: var(--brand-gradient-soft);
  color: var(--text-primary); font-weight: 600;
  border: 1px solid rgba(124,58,237,0.3);
}
.nav-item .icon {
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 18px;
}
.nav-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-item .badge {
  background: var(--danger); color: #fff; font-size: 11px;
  padding: 2px 6px; border-radius: var(--radius-full); font-weight: 600;
}
.sidebar.collapsed .nav-item .label,
.sidebar.collapsed .nav-item .badge { display: none; }

.main-content {
  flex: 1; overflow-y: auto; padding: 24px 32px;
  position: relative;
}
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-header h1 { font-size: 24px; font-weight: 600; }
.page-header .subtitle { color: var(--text-tertiary); font-size: 13px; margin-top: 4px; }

/* === 动画 === */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInScale { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 20px rgba(124,58,237,0.4); } 50% { box-shadow: 0 0 40px rgba(124,58,237,0.8); } }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.fade-in { animation: fadeIn var(--duration-slow) var(--ease-out) both; }
.fade-in-scale { animation: fadeInScale var(--duration-base) var(--ease-spring) both; }
.pulse { animation: pulse 2s ease-in-out infinite; }
.glow { animation: glow 3s ease-in-out infinite; }
.float { animation: float 3s ease-in-out infinite; }

/* === 网格 === */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* === Flex === */
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.between { justify-content: space-between; }

/* === 触摸滑动 & 返回栏 === */
.touch-hint {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 8px 16px; background: var(--glass-bg-strong); border: 1px solid var(--glass-border);
  border-radius: var(--radius-full); font-size: 12px; color: var(--text-tertiary);
  backdrop-filter: blur(20px); z-index: 100;
  display: flex; align-items: center; gap: 8px;
}

/* 原型跳转返回栏 */
.proto-nav {
  position: fixed; top: 12px; right: 12px; z-index: 1000;
  display: flex; gap: 6px;
}
.proto-nav a {
  padding: 6px 12px; background: rgba(0,0,0,0.6); color: #fff;
  border-radius: var(--radius-full); font-size: 11px; backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2); transition: all var(--duration-fast);
}
.proto-nav a:hover { background: var(--brand-primary); }

/* === 响应式 === */
@media (max-width: 1024px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar .sidebar-brand,
  .sidebar .nav-item .label,
  .sidebar .nav-item .badge { display: none; }
  .main-content { padding: 16px 20px; }
}

/* === 工具类 === */
.text-center { text-align: center; }
.text-tertiary { color: var(--text-tertiary); }
.text-secondary { color: var(--text-secondary); }
.text-gradient { background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
@media (max-width: 768px) { .hide-mobile { display: none !important; } }

/* === 数据来源说明卡片（务实透明）=== */
.data-source-card {
  margin: 20px 0 28px;
  background: linear-gradient(135deg, rgba(16,185,129,0.06), rgba(0,120,212,0.05));
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: 14px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.data-source-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #10B981, #0078D4);
}
.data-source-card .ds-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}
.data-source-card .ds-header .ds-icon {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, #10B981, #059669);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.data-source-card .ds-header .ds-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 3px 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  color: var(--text-tertiary);
  letter-spacing: 1px;
  font-weight: 600;
}
.data-source-card .ds-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.data-source-card .ds-item {
  padding: 10px 12px;
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
}
.data-source-card .ds-item .ds-level {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.data-source-card .ds-item.ds-now .ds-level { color: #34D399; }
.data-source-card .ds-item.ds-config .ds-level { color: #FBBF24; }
.data-source-card .ds-item.ds-future .ds-level { color: #A78BFA; }
.data-source-card .ds-item strong {
  display: block;
  color: var(--text-primary);
  font-size: 12px;
  margin-bottom: 3px;
}
.data-source-card .ds-item span {
  color: var(--text-tertiary);
  font-size: 11px;
}
.data-source-card .ds-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255,255,255,0.08);
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.7;
}
.data-source-card .ds-footer strong {
  color: #34D399;
}
@media (max-width: 768px) {
  .data-source-card .ds-grid { grid-template-columns: 1fr; }
}

/* ── AI 输入工具按钮（全局通用） ── */
.ai-input-tools {
  display: flex; gap: 6px; align-items: center;
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
}
.ai-input-tools button {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  background: var(--glass-bg-strong); border: 1px solid var(--glass-border);
  color: var(--text-tertiary); cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all 150ms;
}
.ai-input-tools button:hover {
  background: var(--glass-border); color: var(--text-primary);
  border-color: var(--brand-primary);
}
.ai-input-tools button.ai-send {
  background: var(--engine-grad, var(--brand-gradient));
  border: none; color: #fff; width: auto; padding: 0 16px;
  font-weight: 600; font-size: 12px; font-family: inherit;
}
.ai-input-tools button.ai-send:hover { opacity: 0.9; }

/* ── 演示模式进度条 ── */
.demo-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 99999;
  height: 36px; background: rgba(0,0,0,0.85); backdrop-filter: blur(20px);
  border-top: 1px solid rgba(124,58,237,0.4);
  display: flex; align-items: center; justify-content: center;
}
.demo-progress {
  position: absolute; left: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, #0078D4, #7C3AED, #EC4899);
  transition: width 300ms;
}
.demo-info {
  font-size: 12px; color: rgba(255,255,255,0.8); letter-spacing: 0.5px;
  position: relative; z-index: 1;
}
.demo-info b { color: #A78BFA; }
