/* === 共用基础 === */
:root {
  --primary: #ff6b35;
  --primary-dark: #e55039;
  --secondary: #2c3e50;
  --accent: #2980b9;
  --bg: #f8f9fb;
  --bg-card: #ffffff;
  --text: #2c3e50;
  --text-soft: #6c757d;
  --text-mute: #adb5bd;
  --border: #eef0f3;
  --border-soft: #f5f6f8;
  --success: #22c55e;
  --warning: #f59e0b;
  --shadow-sm: 0 1px 3px rgba(15,23,42,.04), 0 1px 2px rgba(15,23,42,.06);
  --shadow: 0 4px 12px rgba(15,23,42,.06), 0 2px 4px rgba(15,23,42,.04);
  --shadow-lg: 0 12px 28px rgba(15,23,42,.10), 0 4px 10px rgba(15,23,42,.06);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; }

/* === 顶部导航 === */
.site-header {
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.site-brand {
  font-size: 22px;
  font-weight: 800;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -.5px;
}
.site-brand:hover { color: var(--primary); }
.site-brand .logo {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #fbbf24 0%, #f97316 50%, #ef4444 100%);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 4px 12px rgba(249,115,22,.35);
}
.site-tagline { font-size: 11px; color: var(--text-mute); font-weight: 500; display: block; margin-top: 1px; }
.main-nav ul { display: flex; gap: 28px; flex-wrap: wrap; align-items: center; }
.main-nav a {
  color: var(--secondary); font-weight: 500; font-size: 14px;
  padding: 6px 0; border-bottom: 2px solid transparent;
  position: relative;
}
.main-nav a:hover, .main-nav a.active { color: var(--primary); border-bottom-color: var(--primary); }
.main-nav .login-btn {
  background: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
  color: #fff !important; padding: 9px 20px !important;
  border-radius: 10px; border-bottom: none !important;
  font-weight: 600; box-shadow: 0 4px 12px rgba(239,68,68,.30);
  transition: transform .2s, box-shadow .2s;
}
.main-nav .login-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(239,68,68,.40); background: linear-gradient(135deg, #f97316 0%, #ef4444 100%); }

/* === Hero 区(带背景图) === */
.hero {
  position: relative;
  padding: 64px 24px 56px;
  text-align: center;
  color: #fff;
  overflow: hidden;
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background: url('/uploads/covers/hero-banner.png') center/cover no-repeat;
  z-index: -2;
  filter: brightness(.65) saturate(1.05);
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,107,53,.35) 0%, rgba(44,62,80,.55) 100%);
  z-index: -1;
}
.hero h1 {
  font-size: 38px;
  margin-bottom: 14px;
  font-weight: 800;
  letter-spacing: -1px;
  text-shadow: 0 2px 12px rgba(0,0,0,.25);
  line-height: 1.25;
}
.hero p {
  font-size: 16px;
  max-width: 680px;
  margin: 0 auto 22px;
  color: rgba(255,255,255,.92);
  text-shadow: 0 1px 4px rgba(0,0,0,.2);
  line-height: 1.7;
}
.hero-search {
  max-width: 480px;
  margin: 24px auto 0;
  position: relative;
}
.hero-search input {
  width: 100%;
  padding: 14px 50px 14px 20px;
  border: none;
  border-radius: 30px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  font-size: 14px;
  color: var(--secondary);
  outline: none;
}
.hero-search input::placeholder { color: var(--text-mute); }
.hero-search button {
  position: absolute;
  right: 6px; top: 6px;
  background: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
  color: #fff;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.hero-tags {
  margin-top: 18px;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.hero-tags a {
  background: rgba(255,255,255,.18);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  border: 1px solid rgba(255,255,255,.25);
  transition: all .2s;
  backdrop-filter: blur(4px);
}
.hero-tags a:hover { background: #fff; color: var(--primary); border-color: #fff; }

/* === 分类快速入口 === */
.quick-cats {
  max-width: 1280px;
  margin: -32px auto 0;
  padding: 0 24px;
  position: relative;
  z-index: 10;
}
.quick-cats-grid {
  background: #fff;
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
@media (max-width: 900px) { .quick-cats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .quick-cats-grid { grid-template-columns: repeat(2, 1fr); } }
.quick-cat {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  transition: all .2s;
  cursor: pointer;
  border: 1px solid transparent;
}
.quick-cat:hover { background: var(--bg); border-color: var(--border); transform: translateY(-2px); }
.quick-cat-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.quick-cat-icon.tutorial { background: linear-gradient(135deg, #dbeafe, #93c5fd); }
.quick-cat-icon.project { background: linear-gradient(135deg, #fed7aa, #fb923c); }
.quick-cat-name { font-size: 13px; color: var(--text); font-weight: 600; }

/* === 主容器 === */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 36px 24px 48px;
}

/* === 板块标题 === */
.section { margin-bottom: 44px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 20px;
}
.section-title {
  font-size: 24px;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -.5px;
}
.section-title i { color: var(--primary); }
.section-sub {
  font-size: 13px; color: var(--text-mute); margin-top: 2px; font-weight: 400;
}
.section-more {
  font-size: 13px;
  color: var(--text-soft);
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px;
  border-radius: 20px;
  transition: all .2s;
}
.section-more:hover { color: var(--primary); background: var(--bg); }

/* === 卡片网格 === */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
}
@media (max-width: 1100px) { .cards-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .cards-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .3s ease, box-shadow .3s ease;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(249,115,22,.25);
}
.card-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  display: block;
  overflow: hidden;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
}
.card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.card:hover .card-thumb img { transform: scale(1.06); }
.card-thumb .placeholder {
  text-align: center;
  padding: 16px;
  color: #94a3b8;
  font-size: 13px;
}
.card-thumb .placeholder .icon { font-size: 40px; margin-bottom: 6px; }
.card-thumb .video-badge {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(0,0,0,.7);
  color: #fff;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  display: flex; align-items: center; gap: 4px;
  font-weight: 500;
  backdrop-filter: blur(4px);
}
.card-thumb .sticky-badge {
  position: absolute;
  top: 10px; left: 10px;
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #fff;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(239,68,68,.4);
}
.card-thumb .category-tag {
  position: absolute;
  bottom: 10px; left: 10px;
  background: rgba(0,0,0,.55);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  backdrop-filter: blur(4px);
}
.card-price-badge {
  position: absolute;
  bottom: 10px; right: 10px;
  background: rgba(255,255,255,.95);
  color: var(--secondary);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.card-price-badge.unlocked { background: var(--success); color: #fff; }
.card-price-badge.free { background: var(--success); color: #fff; }
.card-body { padding: 16px 18px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.card-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 45px;
  transition: color .2s;
}
.card-title:hover { color: var(--primary); }
.card-excerpt {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-tags {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.card-tag {
  font-size: 10px;
  padding: 2px 8px;
  background: var(--bg);
  color: var(--text-soft);
  border-radius: 10px;
  font-weight: 500;
}
.card-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--text-mute);
  border-top: 1px solid var(--border-soft);
  padding-top: 10px; margin-top: 4px;
}
.card-meta .views { display: inline-flex; align-items: center; gap: 3px; }
.card-project-tag {
  background: #fff5f0;
  color: #e55039;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

/* === 侧边栏 === */
.layout-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 1000px) { .layout-with-sidebar { grid-template-columns: 1fr; } }
.sidebar { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 80px; }
.widget {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.widget-title {
  font-size: 15px;
  color: var(--secondary);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
  font-weight: 700;
  display: flex; align-items: center; gap: 6px;
}
.widget-title i { color: var(--primary); }
.widget ul li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-soft);
  font-size: 13px;
  color: var(--text-soft);
}
.widget ul li:last-child { border-bottom: none; }
.widget ul li a { color: var(--text); }
.widget ul li a:hover { color: var(--primary); }
.promo-box {
  background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
  border: 1px solid #fed7aa;
}
.promo-box h4 { color: var(--primary-dark); }
.promo-box p { color: var(--text-soft); font-size: 13px; line-height: 1.6; margin: 8px 0 14px; }
.promo-box .btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  transition: all .2s;
  box-shadow: 0 4px 12px rgba(249,115,22,.30);
}
.promo-box .btn:hover { background: var(--primary-dark); transform: translateY(-1px); color: #fff; }

/* === 详情页 === */
.detail-wrap { max-width: 1280px; margin: 0 auto; padding: 24px; }
.detail-head {
  background: #fff;
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.detail-head h1 { font-size: 28px; color: var(--secondary); font-weight: 800; letter-spacing: -.5px; line-height: 1.4; }
.detail-head .meta { display: flex; gap: 16px; align-items: center; color: var(--text-mute); font-size: 13px; margin-top: 12px; flex-wrap: wrap; }
.detail-head .meta .price { color: var(--primary); font-weight: 700; font-size: 18px; }
.detail-head .meta .price.free { color: var(--success); }
.detail-cover {
  width: 100%;
  aspect-ratio: 21 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.detail-body {
  background: #fff;
  border-radius: var(--radius);
  padding: 32px 36px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  font-size: 15px;
  line-height: 1.85;
  color: var(--text);
}
.detail-body h2 { font-size: 22px; color: var(--secondary); margin: 28px 0 14px; font-weight: 800; padding-top: 8px; border-top: 1px solid var(--border-soft); }
.detail-body h2:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.detail-body h3 { font-size: 17px; color: var(--secondary); margin: 22px 0 10px; font-weight: 700; }
.detail-body p { margin-bottom: 14px; color: var(--text); }
.detail-body ul, .detail-body ol { margin: 12px 0 14px 24px; }
.detail-body ul li, .detail-body ol li { margin-bottom: 6px; }
.detail-body ul { list-style: disc; }
.detail-body ol { list-style: decimal; }
.detail-body strong { color: var(--secondary); font-weight: 700; }
.detail-body pre { background: #1e293b; color: #e2e8f0; padding: 16px 18px; border-radius: 10px; overflow-x: auto; margin: 14px 0; font-size: 13px; line-height: 1.6; font-family: "Fira Code", Consolas, monospace; }
.detail-body pre code { background: transparent; color: inherit; padding: 0; }
.detail-body code { background: #f1f5f9; color: #e11d48; padding: 2px 6px; border-radius: 4px; font-size: 13px; font-family: "Fira Code", Consolas, monospace; }
.detail-body table { width: 100%; border-collapse: collapse; margin: 14px 0; }
.detail-body table th, .detail-body table td { padding: 10px 12px; border: 1px solid var(--border); text-align: left; }
.detail-body table th { background: var(--bg); color: var(--secondary); font-weight: 700; }
.detail-body blockquote { border-left: 4px solid var(--primary); padding: 12px 16px; background: #fff7ed; color: var(--text-soft); margin: 14px 0; border-radius: 6px; }

.detail-locked {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border: 2px dashed var(--primary);
  border-radius: var(--radius);
  padding: 60px 32px;
  text-align: center;
  color: var(--secondary);
}
.detail-locked .icon { font-size: 56px; margin-bottom: 14px; }
.detail-locked h2 { font-size: 22px; margin-bottom: 10px; color: var(--secondary); border: none; padding: 0; }
.detail-locked p { color: var(--text-soft); margin-bottom: 20px; font-size: 14px; }
.detail-locked .price { color: var(--primary); font-size: 36px; font-weight: 800; margin: 14px 0; }
.detail-locked .btn-unlock {
  display: inline-block;
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #fff;
  padding: 12px 36px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(239,68,68,.30);
  transition: all .2s;
}
.detail-locked .btn-unlock:hover { transform: translateY(-2px); color: #fff; }

.preview-tag {
  display: inline-block;
  background: var(--bg);
  color: var(--text-soft);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  margin-bottom: 18px;
  font-weight: 600;
}

/* === 用户中心 / 表单 === */
.auth-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 420px;
  padding: 36px 32px;
}
.auth-card .brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 8px; }
.auth-card .brand .logo {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, #fbbf24 0%, #f97316 50%, #ef4444 100%);
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 19px;
  box-shadow: 0 6px 16px rgba(249,115,22,.30);
}
.auth-card .brand .name { font-size: 22px; font-weight: 800; color: var(--secondary); }
.auth-card h1 { font-size: 20px; color: var(--secondary); text-align: center; margin: 18px 0 6px; font-weight: 800; }
.auth-card .sub { color: var(--text-mute); text-align: center; margin-bottom: 24px; font-size: 13px; }
.auth-card .form-row { margin-bottom: 16px; }
.auth-card label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-soft); font-weight: 600; }
.auth-card input {
  font-family: inherit; font-size: 14px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  width: 100%; background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.auth-card input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(249,115,22,.10);
}
.auth-card button {
  width: 100%; padding: 12px; margin-top: 10px;
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #fff;
  border: none; border-radius: 10px;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(239,68,68,.30);
  transition: transform .2s, box-shadow .2s;
}
.auth-card button:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(239,68,68,.40); }
.auth-card .alt { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-mute); }
.auth-card .alt a { color: var(--primary); font-weight: 600; }
.auth-card .ref-banner {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 13px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 4px 12px rgba(37,99,235,.25);
}
.auth-card .ref-banner code { background: rgba(255,255,255,.2); padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.auth-card .reward-info {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border: 1px dashed #f97316;
  color: #c2410c;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 12px; line-height: 1.6;
}
.back-home {
  position: absolute; top: 20px; left: 20px;
  color: var(--secondary); font-size: 14px; font-weight: 600;
  background: rgba(255,255,255,.85);
  padding: 8px 16px; border-radius: 20px;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
  backdrop-filter: blur(8px);
}
.back-home:hover { color: var(--primary); }

/* === 响应式 === */
@media (max-width: 600px) {
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 14px; }
  .section-title { font-size: 20px; }
  .detail-head h1 { font-size: 22px; }
  .detail-body { padding: 22px 20px; }
}
