/* ============================================================
 * 天机阁 · 浅色高级版 · 共享设计系统
 * 所有 demo 页面引入此文件
 * ============================================================ */

/* ========== Token ========== */
:root {
  /* 视觉层 - 暖白纸感 */
  --paper-50: #FAF9F7;
  --paper-100: #F5F3EF;
  --paper-200: #EFEBE4;
  --paper-300: #E4DED3;
  --ink-900: #1A1A1A;
  --ink-800: #2C2C2C;
  --ink-700: #454545;
  --ink-600: #6B6B6B;
  --ink-500: #8B8B8B;
  --ink-400: #ABABAB;
  --gold-300: #FCD34D;
  --gold-400: #FBBF24;
  --gold-500: #F59E0B;
  --gold-600: #D97706;
  --gold-700: #B45309;
  /* 语义层 */
  --bg-page: #FAF9F7;
  --bg-surface: #FFFFFF;
  --bg-soft: #F5F3EF;
  --border-subtle: rgba(26,26,26,0.06);
  --border-default: rgba(26,26,26,0.10);
  --border-strong: rgba(26,26,26,0.16);
  --text-primary: #1A1A1A;
  --text-secondary: #454545;
  --text-tertiary: #6B6B6B;
  --text-muted: #8B8B8B;
  --brand: #B45309;
  --brand-glow: #D97706;
}

/* ========== 基础 ========== */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(217,119,6,0.06), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(217,119,6,0.03), transparent 60%);
  pointer-events: none; z-index: 0;
}

main, header, footer, section { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }

/* ========== 排版 ========== */
.serif { font-family: 'Noto Serif SC', serif; }
.text-gradient-gold {
  background: linear-gradient(135deg, #D97706 0%, #F59E0B 50%, #FBBF24 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ========== 布局容器 ========== */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 24px; }

/* ========== 卡片 ========== */
.card {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  transition: all .3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(26,26,26,0.04);
}
.card:hover {
  border-color: rgba(26,26,26,0.12);
  box-shadow: 0 4px 16px -2px rgba(26,26,26,0.06), 0 0 0 1px rgba(217,119,6,0.08);
  transform: translateY(-2px);
}
.card-soft {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  transition: all .2s ease;
}
.card-soft:hover {
  background: var(--bg-page);
  border-color: var(--border-default);
}
.card-flat {
  background: var(--bg-soft);
  border-radius: 12px;
}

/* ========== 按钮 ========== */
.btn-gold {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #FFFFFF; font-weight: 600;
  border-radius: 8px; padding: 8px 18px; font-size: 14px;
  transition: all .2s ease; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  box-shadow: 0 1px 2px rgba(217,119,6,0.2);
}
.btn-gold:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -2px rgba(217,119,6,0.35), 0 0 0 1px rgba(217,119,6,0.15);
}
.btn-ghost {
  background: #FFFFFF; border: 1px solid var(--border-default);
  color: var(--text-primary); border-radius: 8px;
  padding: 7px 16px; font-size: 14px; font-weight: 500;
  transition: all .2s ease; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-ghost:hover { background: var(--bg-page); border-color: var(--border-strong); }
.btn-text {
  color: var(--brand); font-size: 14px; font-weight: 500;
  border-bottom: 1px solid var(--brand); padding-bottom: 2px;
  transition: opacity .2s;
}
.btn-text:hover { opacity: 0.7; }

/* ========== 链接 ========== */
a.link { transition: color .2s ease; }
a.link:hover { color: var(--brand-glow); }

/* ========== Chip 标签 ========== */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 500; letter-spacing: 0.02em;
  background: var(--bg-soft); border: 1px solid var(--border-subtle);
  color: var(--text-tertiary); transition: all .2s ease;
}
.chip-gold {
  background: rgba(217,119,6,0.08);
  border-color: rgba(217,119,6,0.2);
  color: var(--brand);
}
.chip-gold:hover { background: rgba(217,119,6,0.12); }

/* ========== 头像 ========== */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; font-weight: 600; flex-shrink: 0;
  background: rgba(217,119,6,0.10); color: var(--brand);
  border: 1px solid rgba(217,119,6,0.15);
}

/* ========== 顶部导航 ========== */
.nav-blur {
  background: rgba(250, 249, 247, 0.8);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
}
.nav-logo {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Noto Serif SC', serif; font-weight: 700; font-size: 16px;
  background: linear-gradient(135deg, #FBBF24 0%, #D97706 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 20px -4px rgba(217,119,6,0.25);
}
.nav-item {
  padding: 6px 12px; border-radius: 8px; font-size: 14px;
  color: var(--text-secondary); transition: all .2s ease;
}
.nav-item:hover { color: var(--text-primary); background: var(--bg-soft); }
.nav-item.active { color: var(--text-primary); background: var(--paper-200); }

/* ========== 分隔线 ========== */
.divider { border-top: 1px solid var(--border-subtle); }

/* ========== 装饰 ========== */
.gold-line {
  width: 32px; height: 2px;
  background: linear-gradient(90deg, var(--brand-glow), transparent);
  display: inline-block; border-radius: 1px;
}
.section-label {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; font-weight: 600; color: var(--brand);
  letter-spacing: 0.2em; text-transform: uppercase;
  margin-bottom: 20px;
}

/* ========== 表单 ========== */
.input {
  background: #FFFFFF; border: 1px solid var(--border-default);
  border-radius: 8px; padding: 9px 14px; font-size: 14px;
  color: var(--text-primary); transition: all .2s; outline: none;
  width: 100%; font-family: inherit;
}
.input:focus {
  border-color: var(--brand-glow);
  box-shadow: 0 0 0 3px rgba(217,119,6,0.12);
}
.input::placeholder { color: var(--text-muted); }
textarea.input { resize: vertical; min-height: 100px; }
label.field-label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 6px;
}

/* ========== 选中色 ========== */
::selection { background: rgba(217,119,6,0.2); color: var(--text-primary); }

/* ========== 滚动条 ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(26,26,26,0.12); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(26,26,26,0.2); }
::-webkit-scrollbar-track { background: transparent; }

/* ========== Glow ========== */
.glow-gold { box-shadow: 0 4px 20px -4px rgba(217,119,6,0.25); }

/* ========== 月度热力图 ========== */
.heatmap-mo {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 4px;
  padding: 8px;
  background: var(--bg-soft, #F5F3EE);
  border-radius: 10px;
  border: 1px solid var(--border-subtle, rgba(0,0,0,0.06));
}
.hmm {
  aspect-ratio: 1;
  border-radius: 3px;
  background: rgba(217,119,6, calc(var(--o, 0.3) * 0.85));
  border: 1px solid rgba(217,119,6, calc(var(--o, 0.3) * 0.2));
  transition: transform .15s ease, box-shadow .15s ease;
  cursor: default;
}
.hmm:hover {
  transform: scale(1.35);
  box-shadow: 0 2px 8px rgba(217,119,6,0.35);
  z-index: 2;
}
.hmm-empty {
  background: rgba(0,0,0,0.025);
  border: 1px solid rgba(0,0,0,0.04);
}
.hmm-empty:hover { transform: none; box-shadow: none; }

/* ========== 文章卡 hover ========== */
.post-card { transition: all .3s cubic-bezier(0.16, 1, 0.3, 1); }
.post-card:hover { transform: translateY(-2px); }
.post-card:hover .post-title { color: var(--brand); }

/* ========== 时间轴 ========== */
.timeline-item { position: relative; padding-left: 28px; padding-bottom: 28px; }
.timeline-item::before {
  content: ''; position: absolute; left: 6px; top: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand-glow);
  box-shadow: 0 0 0 3px rgba(217,119,6,0.15);
}
.timeline-item::after {
  content: ''; position: absolute; left: 9px; top: 18px; bottom: 0;
  width: 2px; background: var(--border-subtle);
}
.timeline-item:last-child::after { display: none; }

/* ========== 表格 ========== */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600;
  color: var(--text-tertiary); text-transform: uppercase;
  letter-spacing: 0.05em; padding: 12px 16px;
  border-bottom: 1px solid var(--border-default);
}
.table td {
  padding: 14px 16px; font-size: 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.table tr:hover td { background: var(--bg-soft); }

/* ========== 徽章 ========== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 500;
}
.badge-gold { background: rgba(217,119,6,0.1); color: var(--brand); }
.badge-green { background: rgba(16,185,129,0.1); color: #059669; }
.badge-red { background: rgba(244,63,94,0.1); color: #E11D48; }
.badge-gray { background: var(--bg-soft); color: var(--text-tertiary); }

/* ========== 空状态 ========== */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon {
  font-size: 48px; margin-bottom: 12px; opacity: 0.4;
}

/* ========== 页面头部 ========== */
.page-hero {
  text-align: center; padding: 48px 0 40px;
}
.page-hero h1 {
  font-family: 'Noto Serif SC', serif;
  font-size: 36px; font-weight: 700;
  color: var(--text-primary); margin: 0 0 12px;
}
.page-hero p {
  color: var(--text-secondary); font-size: 15px; margin: 0;
}

/* ========== 圆角工具类（Tailwind 兼容） ========== */
.rounded-prem-sm { border-radius: 6px; }
.rounded-prem { border-radius: 10px; }
.rounded-prem-lg { border-radius: 14px; }

/* ========== 数据卡 stat-card ========== */
.stat-card {
  transition: transform .3s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow .3s cubic-bezier(0.16, 1, 0.3, 1);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -8px rgba(26,26,26,0.08);
}

/* ========== 月度柱状图 ========== */
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
}
.bar-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-family: 'Noto Serif SC', serif;
}
.bar-gold {
  width: 100%;
  max-width: 22px;
  background: linear-gradient(180deg, #FBBF24 0%, #D97706 100%);
  border-radius: 4px 4px 2px 2px;
  transition: height .4s cubic-bezier(0.16, 1, 0.3, 1),
              filter .2s ease;
  box-shadow: 0 2px 6px -1px rgba(217,119,6,0.25);
  min-height: 2px;
}
.bar-col:hover .bar-gold {
  filter: brightness(1.1);
  box-shadow: 0 4px 12px -2px rgba(217,119,6,0.4);
}
.bar-month {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  font-family: 'Noto Serif SC', serif;
}

/* ========== 进度条（派别/标签分布） ========== */
.bar-track {
  width: 100%;
  height: 8px;
  background: var(--bg-soft, #F5F3EE);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #FBBF24 0%, #D97706 100%);
  border-radius: 4px;
  transition: width .6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ========== 勋章格子 ========== */
.medal-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 8px;
  background: var(--bg-paper, #FFFFFF);
  border: 1px solid var(--border-subtle, rgba(0,0,0,0.06));
  border-radius: 10px;
  transition: transform .25s ease, box-shadow .25s ease;
  text-align: center;
}
.medal-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -6px rgba(217,119,6,0.2);
  border-color: rgba(217,119,6,0.2);
}
.medal-icon-emoji {
  font-size: 28px;
  line-height: 1;
}
.medal-icon-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

/* ========== 排名编号 ========== */
.rank-num {
  font-family: 'Noto Serif SC', serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}
