/* ===================== 伴成长 · 设计系统 v2 ===================== */
/* 基于 Impeccable 技能指南：独特字体 + 模块化比例 + oklch 色彩 + 间距令牌 */

/* ---- 字体加载 ---- */
@import url('https://fonts.googleapis.com/css2?family=LXGW+WenKai+TC:wght@300;400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap');

:root {
  /* 色板 — 暖色亲子风，用 oklch 偏移中性色 */
  --primary: #ff7043;
  --primary-soft: #fff0e8;
  --primary-deep: #d84315;
  --teal: #26a69a;
  --teal-soft: #e0f2f1;
  --amber: #ffb300;
  --amber-soft: #fff8e1;
  --violet: #7986cb;
  --violet-soft: #ede7f6;
  --pink: #f06292;
  --pink-soft: #fce4ec;
  --green: #66bb6a;
  --green-soft: #e8f5e9;
  /* 红：仅用于「错得多」这类需要立刻抓住注意力的状态，不与 --primary 橙混淆 */
  --red: #ef5350;
  --red-soft: #ffebee;
  --red-deep: #c62828;

  /* 中性色 — 带暖色偏移，不用纯黑纯白 */
  --bg: #faf5ee;
  --bg-card: #ffffff;
  --bg-elevated: #fffcf7;
  --text: #3d342a;
  --text-muted: #8a7f73;
  --text-light: #b8aea2;
  --border: #ebe0d3;
  --border-light: #f5ede3;

  /* 间距令牌 — 4px 基数，有节奏的变化 */
  --space-xs: 6px;
  --space-sm: 10px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
  --space-2xl: 64px;

  /* 圆角 — 有机不刻板 */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  /* 阴影 — 柔和、带暖色调 */
  --shadow: 0 2px 12px oklch(0.7 0.05 50 / 0.06);
  --shadow-md: 0 6px 24px oklch(0.7 0.05 50 / 0.08);
  --shadow-hover: 0 12px 36px oklch(0.7 0.05 50 / 0.12);
  --shadow-inset: inset 0 1px 3px oklch(0.7 0.05 50 / 0.04);

  /* 字体 — 展示字体 + 正文字体，有对比 */
  --font-display: "LXGW WenKai TC", "KaiTi", "STKaiti", serif;
  --font-body: "Noto Sans SC", -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;

  /* Type Scale — 1.25 ratio, rem-based */
  --text-caption: 0.75rem;    /* 12px */
  --text-secondary: 0.8125rem; /* 13px */
  --text-body: 0.9375rem;     /* 15px */
  --text-subheading: 1.0625rem; /* 17px */
  --text-heading: 1.25rem;    /* 20px */
  --text-display: 1.75rem;    /* 28px */

  /* 缓动曲线 — 自然减速，不用 bounce/elastic */
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);

  /* 布局 */
  --sidebar-w: 224px;
  --topbar-h: 64px;
  --bottomnav-h: 62px;
  --content-max: 1080px;

  /* z-index 语义层 */
  --z-dropdown: 100;
  --z-sticky: 15;
  --z-overlay: 40;
  --z-modal: 200;
  --z-toast: 300;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: var(--text-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}
a { color: var(--primary); text-decoration: none; transition: color 0.15s var(--ease-out-quart); }
a:hover { color: var(--primary-deep); }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

/* ---- 隐藏兜底 ----
   浏览器 UA 样式表的 [hidden]{display:none} 是低优先级，
   本文件里 .onboard / .img-editor 这类浮层写了 display:flex 会把它盖掉，
   导致 JS 设置 el.hidden = true 后浮层仍然铺满全屏遮住应用。
   这里统一兜底，保证 hidden 属性在作者样式下依然生效。 */
[hidden] { display: none !important; }

/* ---- 入场动画 ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.view > * {
  animation: fadeInUp 0.4s var(--ease-out-quart) backwards;
}
.view > *:nth-child(2) { animation-delay: 0.06s; }
.view > *:nth-child(3) { animation-delay: 0.12s; }
.view > *:nth-child(4) { animation-delay: 0.18s; }
.view > *:nth-child(5) { animation-delay: 0.24s; }
.view > *:nth-child(6) { animation-delay: 0.30s; }

/* ===================== 应用外壳 ===================== */
.app-shell { min-height: 100vh; }

/* ---- 侧边栏（桌面） ---- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border-light);
  display: flex; flex-direction: column;
  padding: var(--space-lg) var(--space-md);
  z-index: var(--z-sticky);
}
.sidebar-brand { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-xs) var(--space-md) var(--space-lg); }
.brand-logo { font-size: 28px; line-height: 1; }
.brand-name { font-family: var(--font-display); font-size: var(--text-heading); font-weight: 700; letter-spacing: 0.5px; color: var(--text); }
.sidebar-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-xs); }
.nav-item {
  display: flex; align-items: center; gap: var(--space-md);
  padding: 11px var(--space-md); border-radius: var(--radius-sm); border: none; background: transparent;
  color: var(--text-muted); font-size: var(--text-body); text-align: left;
  transition: all 0.2s var(--ease-out-quart);
}
.nav-item .nav-icon { font-size: 20px; transition: transform 0.2s var(--ease-out-quart); }
.nav-item:hover { background: var(--primary-soft); color: var(--primary-deep); }
.nav-item:hover .nav-icon { transform: scale(1.15); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-deep); font-weight: 600; }
.nav-item.active .nav-icon { transform: scale(1.1); }
.sidebar-user { padding: var(--space-md) var(--space-md) var(--space-xs); border-top: 1px solid var(--border-light); font-size: var(--text-secondary); color: var(--text-muted); }

/* ---- 主区域 ---- */
.main-area { margin-left: var(--sidebar-w); min-height: 100vh; padding-bottom: var(--space-2xl); }
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; justify-content: space-between;
  height: var(--topbar-h); padding: 0 var(--space-xl);
  background: oklch(0.98 0.01 50 / 0.85); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
}
.topbar-title { display: flex; align-items: center; gap: var(--space-md); }
.topbar-icon { font-size: 24px; transition: transform 0.2s var(--ease-out-quart); }
.topbar-title h1 { font-family: var(--font-display); font-size: var(--text-heading); font-weight: 700; letter-spacing: 0.3px; }
.topbar-actions { display: flex; align-items: center; gap: var(--space-md); }
.avatar-chip {
  width: 38px; height: 38px; border-radius: 50%; background: var(--primary-soft);
  display: inline-flex; align-items: center; justify-content: center; font-size: 20px;
  transition: transform 0.2s var(--ease-out-quart);
}
.avatar-chip:hover { transform: scale(1.08); }
.view { max-width: var(--content-max); margin: 0 auto; padding: var(--space-xl) var(--space-xl) var(--space-lg); }

/* ---- 底部导航（移动端） ---- */
.bottomnav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sticky);
  background: var(--bg-card); border-top: 1px solid var(--border-light);
  padding: var(--space-xs) var(--space-xs) calc(var(--space-xs) + env(safe-area-inset-bottom));
  justify-content: space-around;
}
.bottomnav .bn-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: none; background: transparent; color: var(--text-muted);
  font-size: 11px; padding: 4px var(--space-md); min-width: 56px; border-radius: var(--radius-sm);
  transition: color 0.15s var(--ease-out-quart);
}
.bottomnav .bn-item .bn-icon { font-size: 22px; line-height: 1; transition: transform 0.2s var(--ease-out-quart); }
.bottomnav .bn-item.active { color: var(--primary-deep); font-weight: 600; }
.bottomnav .bn-item.active .bn-icon { transform: translateY(-2px) scale(1.1); }

/* ---- 「更多」抽屉 ---- */
.sheet-mask { position: fixed; inset: 0; background: oklch(0.2 0.02 50 / 0.35); z-index: var(--z-overlay); animation: fadeIn 0.2s var(--ease-out-quart); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: calc(var(--z-overlay) + 1);
  background: var(--bg-card); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-lg) var(--space-lg) calc(var(--space-lg) + env(safe-area-inset-bottom));
  max-height: 70vh; overflow-y: auto;
  animation: slideUp 0.3s var(--ease-out-quart);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-header { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: var(--space-md); }
.sheet-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-sm); }
.sheet-item {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-xs);
  padding: 14px var(--space-xs); border: 1px solid var(--border-light); border-radius: var(--radius);
  background: var(--bg); color: var(--text); font-size: 12px;
  transition: all 0.2s var(--ease-out-quart);
}
.sheet-item:hover { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-2px); }
.sheet-item .si-icon { font-size: 26px; transition: transform 0.2s var(--ease-out-quart); }
.sheet-item:hover .si-icon { transform: scale(1.15); }

/* ---- 提示 ---- */
.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%) translateY(20px);
  background: oklch(0.25 0.03 50); color: #fff; padding: var(--space-sm) var(--space-lg); border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all 0.3s var(--ease-out-quart); z-index: var(--z-toast);
  max-width: 86vw; text-align: center;
  box-shadow: var(--shadow-md);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- 选择高亮 ---- */
::selection { background: var(--primary-soft); color: var(--primary-deep); }

/* ---- 滚动条 ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ===================== 响应式断点 ===================== */
/* 平板：侧边栏收窄为图标 */
@media (max-width: 1024px) {
  :root { --sidebar-w: 72px; }
  .sidebar { padding: var(--space-lg) var(--space-sm); }
  .brand-name, .nav-item span.nav-label, .sidebar-user { display: none; }
  .nav-item { justify-content: center; padding: 13px 0; }
  .sidebar-brand { justify-content: center; padding-bottom: var(--space-md); }
  .view { padding: var(--space-lg) var(--space-lg) var(--space-md); }
}

/* 手机：隐藏侧边栏，启用底部导航 */
@media (max-width: 640px) {
  :root {
    --text-display: 1.5rem;
    --text-heading: 1.125rem;
    --space-xl: 24px;
    --space-2xl: 32px;
  }
  .sidebar { display: none; }
  .main-area { margin-left: 0; padding-bottom: calc(var(--bottomnav-h) + 20px); }
  .topbar { padding: 0 var(--space-md); }
  .topbar-title h1 { font-size: 1.0625rem; }
  .view { padding: var(--space-md) var(--space-md) var(--space-md); }
  .bottomnav { display: flex; }
  .avatar-chip { display: none; }
}

/* ---- 无障碍：尊重减少动画偏好 ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
