/* ==========================================================
   前台样式 —— 深色导航站主题（颜色由后台"站点设置"注入变量）
   ========================================================== */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; border: 0; max-width: 100%; }
p { margin: 0 0 8px; }
button { font: inherit; }

.app {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
  background: radial-gradient(120% 60% at 50% 0%, rgba(255, 193, 7, .07), transparent 60%), var(--bg);
}

/* ---------------- 固定头部（公告栏 + 顶栏） ---------------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 60;
}

/* 全站顶部固定公告栏：加粗红字（默认红底白字，可在后台改色） */
.top-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--notice-bg, #E11D48);
  color: var(--notice-fg, #fff);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .2px;
  line-height: 1.4;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .18);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .22);
  word-break: break-word;
}
.top-notice .n-ico { flex: 0 0 auto; font-size: 13px; line-height: 1; }
.top-notice .n-text { min-width: 0; }
a.top-notice { text-decoration: none; }
a.top-notice:hover { filter: brightness(1.06); }

/* ---------------- 顶栏 ---------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(24, 32, 37, .96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #1d262b;
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 4px 14px rgba(255, 193, 7, .28);
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: cover;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 16px; letter-spacing: .3px; }
.brand-text small { font-size: 10px; color: var(--muted); margin-top: 2px; }

.topbar-actions { display: flex; gap: 6px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
  font-size: 15px;
}

/* ---------------- 主区域 ---------------- */
.main { padding: 10px 12px 18px; }

/* ---------------- 轮播横幅 ---------------- */
.banner {
  position: relative;
  margin-bottom: 14px;
  border-radius: 14px;
  overflow: hidden;
  background: #1c262b;
}

.banner-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.banner-track::-webkit-scrollbar { display: none; }

.banner-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
}

.banner .ad-image img,
.banner .ad-image > img {
  width: 100%;
  aspect-ratio: 2.6 / 1;
  object-fit: cover;
}

.banner-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  display: flex;
  justify-content: center;
  gap: 5px;
}
.banner-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .45);
  transition: all .25s;
}
.banner-dots i.on { width: 14px; border-radius: 3px; background: var(--primary); }

/* ---------------- 区块 ---------------- */
.section { margin: 0 0 18px; }

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.section-title {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary2));
  color: #1d262b;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 12px rgba(255, 193, 7, .22);
}
.section-title::before {
  content: "";
  width: 5px;
  height: 5px;
  margin-right: 7px;
  border-radius: 50%;
  background: #1d262b;
  opacity: .55;
}
.section-sub { font-size: 10px; color: var(--muted); }

/* ---------------- 网格与卡片 ---------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 8px;
}

.layout-grid2 .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
.layout-card .grid { grid-template-columns: 1fr; gap: 10px; }

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: transform .15s ease;
}
.card:active { transform: scale(.95); }

.card-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 9px;
  overflow: hidden;
  background: linear-gradient(135deg, #33424a, #1f2a30);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .22);
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease;
}
.card:hover .card-thumb img { transform: scale(1.05); }

.card-name {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.35;
  color: #e7eef2;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.badge {
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 1px 5px;
  border-radius: 5px;
  background: linear-gradient(135deg, #ff4d4f, #ff7a45);
  color: #fff;
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}

.card-grid2 .card-thumb { aspect-ratio: 16 / 10; }
.card-grid2 .card-name { font-size: 12px; font-weight: 600; }
.card-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 3px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
}

/* 横向大卡片 */
.card-row {
  display: flex;
  gap: 10px;
  padding: 9px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .05);
  transition: transform .15s ease;
}
.card-row:active { transform: scale(.985); }
.card-row-thumb {
  flex: 0 0 92px;
  width: 92px;
  height: 92px;
  border-radius: 10px;
  overflow: hidden;
  background: #1f2a30;
}
.card-row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-row-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.card-row-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.card-row-tags {
  align-self: flex-start;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 193, 7, .14);
  color: var(--primary2);
  font-size: 10px;
}
.card-row-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

/* ---------------- 广告位 ---------------- */
.ad { display: block; }
.ad-image { display: block; position: relative; border-radius: 12px; overflow: hidden; }
.ad-image img { width: 100%; display: block; }
.ad-image-title {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 14px 10px 8px;
  font-size: 11px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .65));
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ad-text {
  display: block;
  margin: 0 0 14px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(255, 193, 7, .1);
  border: 1px dashed rgba(255, 193, 7, .38);
  color: var(--primary2);
  font-size: 11.5px;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ad-block { margin: 0 0 16px; }
.ad-bottom, .ad-detail, .ad-page { margin: 14px 0; }
.ad-detail .ad-image img { border-radius: 12px; }

/* ---------------- 详情页 ---------------- */
.detail-card {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .06);
}

.detail-cover {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  background: #1f2a30;
}
.detail-cover img {
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
  background: #101a1f;
}

.detail-title {
  margin: 12px 0 8px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}

.detail-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pill {
  padding: 2px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #1d262b;
  font-size: 10.5px;
  font-weight: 700;
}
.pill-soft {
  background: rgba(255, 255, 255, .07);
  color: var(--muted);
  font-weight: 500;
}

.detail-desc {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .18);
  font-size: 12.5px;
  line-height: 1.7;
  color: #cfdae0;
  word-break: break-word;
  margin-bottom: 12px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.gallery img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 8px; }

.btn-primary {
  display: block;
  margin-top: 4px;
  padding: 12px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #1d262b !important;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  letter-spacing: .5px;
  box-shadow: 0 8px 22px rgba(255, 193, 7, .25);
}

/* ---------------- 单页 / 搜索 / 404 ---------------- */
.static-page {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .05);
}
.static-title { margin: 0 0 12px; font-size: 18px; font-weight: 800; }
.static-content { font-size: 13px; line-height: 1.85; color: #cfdae0; word-break: break-word; }
.static-content a { color: var(--primary2); text-decoration: underline; }
.static-content img { border-radius: 10px; margin: 6px 0; }

.search-form { display: flex; gap: 8px; margin-bottom: 14px; }
.search-form input {
  flex: 1;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .05);
  color: #fff;
  font-size: 13px;
  outline: none;
}
.search-form input:focus { border-color: rgba(255, 193, 7, .5); }
.search-form button {
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #1d262b;
  font-weight: 800;
  cursor: pointer;
}
.search-hint { margin: 0 0 10px; font-size: 11px; color: var(--muted); }

.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 18px 0; }
.pager-item {
  min-width: 30px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
  font-size: 12px;
  text-align: center;
}
.pager-item.active { background: linear-gradient(135deg, var(--primary), var(--primary2)); color: #1d262b; font-weight: 800; }
.pager-gap { color: var(--muted); padding: 5px 2px; }

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: #cfdae0;
}
.empty-state .muted { color: var(--muted); font-size: 12px; }
.error-code {
  font-size: 64px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.error-page .btn-primary { display: inline-block; margin-top: 14px; }

/* ---------------- 页脚 ---------------- */
.site-footer {
  padding: 18px 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  line-height: 1.8;
}
.copyright { opacity: .85; }

/* ---------------- 底部导航 ---------------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(24, 32, 37, .96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, .07);
}
.tabbar-inner {
  display: flex;
  max-width: 560px;
  margin: 0 auto;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  height: 56px;
  color: #8ea0a9;
  font-size: 10px;
  position: relative;
  transition: color .2s;
}
.tab-icon { font-size: 18px; line-height: 1; filter: grayscale(.7); }
.tab-label { line-height: 1.2; }
.tab.active { color: var(--primary2); }
.tab.active .tab-icon { filter: none; transform: translateY(-1px); }
.tab.active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 22px;
  height: 2px;
  border-radius: 0 0 3px 3px;
  background: var(--primary);
}

/* ---------------- 悬浮按钮 / 弹窗 ---------------- */
.float-ads {
  position: fixed;
  right: 14px;
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 52px;
  padding: 0 12px;
  border-radius: 26px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #1d262b !important;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(255, 193, 7, .32);
  text-align: center;
}
.float-ads img { width: 100%; height: 100%; object-fit: cover; border-radius: 26px; }

.popup {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.popup[hidden] { display: none; }
.popup-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, .72); }
.popup-box { position: relative; z-index: 1; }
.popup-close {
  position: absolute;
  top: -38px;
  right: 0;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}

/* ---------------- 桌面端微调 ---------------- */
@media (min-width: 600px) {
  .app { box-shadow: 0 0 60px rgba(0, 0, 0, .35); }
  .main { padding: 14px 16px 22px; }
  .card-name { font-size: 12px; }
}
