/* ==========================================================================
   MacDown M 端样式 —— 参考 m.vqs.com 设计，支持 4 套配色
   配色：金黄(默认) / 科技蓝 / 清新绿 / 典雅紫
   ========================================================================== */

/* ---------- 配色变量（默认：金黄） ---------- */
:root {
  --cs-primary: #FFBD0A;
  --cs-primary-dark: #8B5615;
  --cs-primary-light: rgba(255, 189, 10, 0.3);
  --cs-bg: #FFF8E1;
  --cs-bg-grad: linear-gradient(#FFBD0A 0, #FFF8E1 440px, #FFF8E1 100%);
  --cs-header-grad: linear-gradient(-90deg, #FFD700, #FFBD0A);
  --cs-text: #333333;
  --cs-text-light: #999999;
  --cs-border: #EEEEEE;
}
body.macdown-cs-blue {
  --cs-primary: #2F7BFF;
  --cs-primary-dark: #1F4E9E;
  --cs-primary-light: rgba(47, 123, 255, 0.3);
  --cs-bg: #E9EFFB;
  --cs-bg-grad: linear-gradient(#4D9AFF 0, #E9EFFB 440px, #E9EFFB 100%);
  --cs-header-grad: linear-gradient(-90deg, #4D9AFF, #2F7BFF);
}
body.macdown-cs-green {
  --cs-primary: #12B76A;
  --cs-primary-dark: #136B45;
  --cs-primary-light: rgba(18, 183, 106, 0.3);
  --cs-bg: #E6F6EC;
  --cs-bg-grad: linear-gradient(#3CE08F 0, #E6F6EC 440px, #E6F6EC 100%);
  --cs-header-grad: linear-gradient(-90deg, #3CE08F, #12B76A);
}
body.macdown-cs-purple {
  --cs-primary: #7C5CFF;
  --cs-primary-dark: #4A3A9E;
  --cs-primary-light: rgba(124, 92, 255, 0.3);
  --cs-bg: #EEE9FB;
  --cs-bg-grad: linear-gradient(#9D85FF 0, #EEE9FB 440px, #EEE9FB 100%);
  --cs-header-grad: linear-gradient(-90deg, #9D85FF, #7C5CFF);
}

/* ---------- 全局重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 14px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--cs-text);
  background: var(--cs-bg);
  line-height: 1.5;
  min-width: 100%;
  padding-bottom: 60px;
}
a { text-decoration: none; color: inherit; display: block; }
img { display: block; max-width: 100%; }
ul, li { list-style: none; }
.clearfix::after { content: ""; display: block; clear: both; }

/* ---------- 头部 ---------- */
.m-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--cs-header-grad);
  padding: 8px 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.m-header .top-row { display: flex; align-items: center; gap: 10px; }
.m-header .logo { flex-shrink: 0; }
.m-header .logo img { height: 30px; width: auto; }
.m-header .search-bar {
  flex: 1; height: 34px;
  background: rgba(255,255,255,0.95);
  border-radius: 17px;
  display: flex; align-items: center;
  padding: 0 12px;
}
.m-header .search-bar input {
  flex: 1; border: none; outline: none;
  background: transparent;
  font-size: 13px; color: #333;
}
.m-header .search-bar .search-icon {
  width: 18px; height: 18px; flex-shrink: 0;
  background: var(--cs-primary-dark);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7' fill='none' stroke='%23000' stroke-width='2'/%3E%3Cpath d='M21 21l-4.3-4.3' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7' fill='none' stroke='%23000' stroke-width='2'/%3E%3Cpath d='M21 21l-4.3-4.3' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain;
}
.m-header .feedback { flex-shrink: 0; color: #fff; font-size: 12px; }

/* 导航 */
.m-nav {
  display: flex; overflow-x: auto;
  margin-top: 8px; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.m-nav::-webkit-scrollbar { display: none; }
.m-nav a {
  flex-shrink: 0;
  color: #fff; font-size: 15px;
  padding: 6px 14px;
  white-space: nowrap;
  opacity: 0.85;
}
.m-nav a.active { opacity: 1; font-weight: bold; position: relative; }
.m-nav a.active::after {
  content: ""; position: absolute;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px; border-radius: 2px;
  background: #fff;
}

/* ---------- 版块标题 ---------- */
.m-section-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 14px 10px;
}
.m-section-title h3 {
  font-size: 18px; font-weight: bold; color: var(--cs-primary-dark);
  position: relative; padding-left: 12px;
}
.m-section-title h3::before {
  content: ""; position: absolute;
  left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 16px; border-radius: 2px;
  background: var(--cs-primary);
}
.m-section-title .more { font-size: 13px; color: var(--cs-text-light); }

/* ---------- 轮播 ---------- */
.m-swiper { position: relative; margin: 10px 12px 0; border-radius: 10px; overflow: hidden; }
.m-swiper .swiper-box { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.m-swiper .swiper-box::-webkit-scrollbar { display: none; }
.m-swiper .swiper-slide { flex-shrink: 0; width: 100%; scroll-snap-align: start; }
.m-swiper .swiper-slide img { width: 100%; height: 160px; object-fit: cover; }
.m-swiper .dots {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px;
}
.m-swiper .dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.5);
}
.m-swiper .dots span.active { background: #fff; width: 16px; border-radius: 3px; }

/* ---------- 头条/推荐 ---------- */
.m-headline {
  margin: 12px; padding: 12px;
  background: #fff; border-radius: 10px;
  display: flex; gap: 12px;
}
.m-headline img { width: 120px; height: 80px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.m-headline .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-headline .title { font-size: 15px; font-weight: bold; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.m-headline .meta { margin-top: auto; font-size: 12px; color: var(--cs-text-light); }

/* ---------- 4列网格列表（图标+名称+按钮） ---------- */
.m-grid-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 10px;
  padding: 0 12px 16px;
}
.m-grid-list .item { text-align: center; }
.m-grid-list .item .icon {
  width: 56px; height: 56px; margin: 0 auto;
  border-radius: 14px; overflow: hidden;
}
.m-grid-list .item .icon img { width: 100%; height: 100%; object-fit: cover; }
.m-grid-list .item .name {
  font-size: 12px; margin-top: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.m-grid-list .item .btn {
  display: inline-block;
  margin-top: 6px; padding: 3px 14px;
  font-size: 12px; color: var(--cs-primary-dark);
  background: var(--cs-primary-light);
  border-radius: 10px;
  white-space: nowrap;
}

/* ---------- 横向滚动列表（大图标） ---------- */
.m-scroll-list {
  display: flex; overflow-x: auto;
  padding: 0 12px 16px; gap: 12px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.m-scroll-list::-webkit-scrollbar { display: none; }
.m-scroll-list .item { flex-shrink: 0; width: 84px; text-align: center; }
.m-scroll-list .item .icon { width: 72px; height: 72px; margin: 0 auto; border-radius: 18px; overflow: hidden; }
.m-scroll-list .item .icon img { width: 100%; height: 100%; object-fit: cover; }
.m-scroll-list .item .name { font-size: 13px; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 列表项（图标+信息+按钮） ---------- */
.m-list { padding: 0 12px; }
.m-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--cs-border);
}
.m-list li:last-child { border-bottom: none; }
.m-list li .icon { width: 56px; height: 56px; border-radius: 14px; overflow: hidden; flex-shrink: 0; }
.m-list li .icon img { width: 100%; height: 100%; object-fit: cover; }
.m-list li .info { flex: 1; min-width: 0; }
.m-list li .info .name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-list li .info .desc { font-size: 12px; color: var(--cs-text-light); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-list li .info .meta { font-size: 11px; color: var(--cs-text-light); margin-top: 2px; }
.m-list li .btn {
  flex-shrink: 0;
  padding: 6px 16px;
  font-size: 13px; color: var(--cs-primary-dark);
  background: var(--cs-primary-light);
  border-radius: 14px;
  white-space: nowrap;
}

/* ---------- 分类导航入口 ---------- */
.m-cate-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 0;
  padding: 16px 12px;
  background: #fff;
  margin: 0 12px;
  border-radius: 10px;
}
.m-cate-nav .item { text-align: center; }
.m-cate-nav .item .icon {
  width: 44px; height: 44px; margin: 0 auto;
  border-radius: 12px;
  background: var(--cs-primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.m-cate-nav .item .name { font-size: 12px; margin-top: 6px; color: var(--cs-text); }

/* ---------- 详情页 ---------- */
.m-detail { padding: 0; }
.m-detail .app-info {
  display: flex; gap: 12px; padding: 16px 14px;
  background: #fff;
}
.m-detail .app-info .icon { width: 72px; height: 72px; border-radius: 18px; overflow: hidden; flex-shrink: 0; }
.m-detail .app-info .icon img { width: 100%; height: 100%; object-fit: cover; }
.m-detail .app-info .info { flex: 1; min-width: 0; }
.m-detail .app-info .info h1 { font-size: 18px; font-weight: bold; }
.m-detail .app-info .info .meta { font-size: 12px; color: var(--cs-text-light); margin-top: 4px; }
.m-detail .app-info .info .tags { margin-top: 6px; }
.m-detail .app-info .info .tags span {
  display: inline-block; font-size: 11px;
  padding: 2px 8px; margin-right: 6px;
  background: var(--cs-primary-light); color: var(--cs-primary-dark);
  border-radius: 8px;
}
.m-detail .download-bar {
  display: flex; gap: 10px; padding: 12px 14px;
  background: #fff; position: sticky; bottom: 0; z-index: 50;
  border-top: 1px solid var(--cs-border);
}
.m-detail .download-bar .btn {
  flex: 1; height: 42px; line-height: 42px; text-align: center;
  border-radius: 21px; font-size: 15px; font-weight: bold;
  color: #fff; background: var(--cs-primary);
}
.m-detail .download-bar .btn.secondary {
  background: var(--cs-primary-light); color: var(--cs-primary-dark);
}
.m-detail .section {
  background: #fff; margin-top: 10px; padding: 16px 14px;
}
.m-detail .section h3 {
  font-size: 16px; font-weight: bold; margin-bottom: 12px;
  color: var(--cs-primary-dark);
}
.m-detail .section .content { font-size: 14px; line-height: 1.8; }
.m-detail .section .content img { margin: 10px 0; border-radius: 8px; }

/* 截图轮播 */
.m-shots {
  display: flex; overflow-x: auto; gap: 10px;
  padding: 0 14px 16px; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.m-shots::-webkit-scrollbar { display: none; }
.m-shots img { width: 180px; height: 320px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }

/* 信息表 */
.m-info-table { width: 100%; font-size: 13px; }
.m-info-table td { padding: 8px 0; border-bottom: 1px solid var(--cs-border); }
.m-info-table td:first-child { color: var(--cs-text-light); width: 90px; }
.m-info-table td:last-child { color: var(--cs-text); }

/* ---------- 文章页 ---------- */
.m-article { background: #fff; padding: 16px 14px; }
.m-article h1 { font-size: 20px; font-weight: bold; line-height: 1.4; }
.m-article .article-meta { font-size: 12px; color: var(--cs-text-light); margin-top: 10px; }
.m-article .article-content { font-size: 15px; line-height: 1.8; margin-top: 16px; }
.m-article .article-content img { margin: 12px 0; border-radius: 8px; }

/* ---------- 合集页 ---------- */
.m-collection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 12px;
}
.m-collection-grid .card {
  background: #fff; border-radius: 10px; overflow: hidden;
}
.m-collection-grid .card .cover {
  width: 100%; height: 100px; background: var(--cs-primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: var(--cs-primary-dark);
}
.m-collection-grid .card .name {
  padding: 10px; font-size: 14px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 面包屑 ---------- */
.m-breadcrumb {
  padding: 12px 14px; font-size: 13px; color: var(--cs-text-light);
}
.m-breadcrumb a { display: inline; color: var(--cs-text-light); }
.m-breadcrumb .sep { margin: 0 6px; }

/* ---------- 分页 ---------- */
.m-pagebar {
  display: flex; justify-content: center; align-items: center;
  gap: 10px; padding: 20px 0;
}
.m-pagebar a, .m-pagebar span {
  padding: 8px 14px; font-size: 14px;
  background: #fff; border-radius: 8px; color: var(--cs-text);
}
.m-pagebar .current { background: var(--cs-primary); color: #fff; }

/* ---------- 底部 ---------- */
.m-footer {
  padding: 20px 14px; text-align: center;
  font-size: 12px; color: var(--cs-text-light);
  line-height: 1.8;
}
.m-footer a { display: inline; color: var(--cs-text-light); }

/* ---------- 底部导航栏 ---------- */
.m-tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 56px; background: #fff;
  display: flex; border-top: 1px solid var(--cs-border);
  z-index: 100;
}
.m-tabbar a {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 11px; color: var(--cs-text-light);
  gap: 2px;
}
.m-tabbar a .tab-icon {
  width: 22px; height: 22px;
  background: var(--cs-text-light);
}
.m-tabbar a.active { color: var(--cs-primary-dark); }
.m-tabbar a.active .tab-icon { background: var(--cs-primary-dark); }

/* ---------- 空状态 ---------- */
.m-empty { text-align: center; padding: 60px 20px; color: var(--cs-text-light); font-size: 14px; }
