:root{
  /* 主题色样（来自截图） */
  --c-pink:   #f6c1ff;   /* 粉紫 */
  --c-mint:   #aefbe8;   /* 薄荷绿 */
  --c-lemon:  #f7f3a0;   /* 浅柠黄 */
  --c-peach:  #f9b7b5;   /* 桃粉 */
  --c-teal:   #58b9c3;   /* 青绿 */
  --c-teal2:  #3b8f96;   /* 深青 */
  --c-orange: #ff7a12;   /* 橙 */
  --bg: #0b0f14;         /* 背景（深） */
  --panel: #0f141a;      /* 面板 */
  --muted: rgba(255,255,255,.65);
  --line:  rgba(255,255,255,.12); /* 分割线对比色 */
  --shadow: 0 12px 28px rgba(0,0,0,.35);
  --radius: 16px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", Arial, sans-serif;
  background: linear-gradient(180deg, #0b0f14 0%, #0a0e13 100%);
  color:#e8f0f6;
}

/* 顶部：轮播 */
.hero{position:relative; max-width:980px; margin:14px auto 10px; padding:0 14px;}
.slider{
  position:relative; height:200px; border-radius:var(--radius);
  overflow:hidden; box-shadow: var(--shadow); background:#111;
}
.slide{position:absolute; inset:0; opacity:0; transition:opacity .8s ease}
.slide.current{opacity:1}
.slide img{width:100%; height:100%; object-fit:cover}

/* 跑马灯：灰色透明，左右吃满 */
.marquee{
  position:absolute; left:14px; right:14px; top:10px; height:34px;
  display:flex; align-items:center; overflow:hidden;
  border-radius:999px;
  background:rgba(24,28,34,.52);
  backdrop-filter: saturate(1.1) blur(4px);
  border:1px solid var(--line);
  pointer-events:none;
}
.marquee .track{
  display:inline-block; white-space:nowrap; will-change:transform;
  animation: marquee 18s linear infinite;
  color:#fff; font-size:13px; padding-left:100%;
}
.marquee .track span{opacity:.95}
@keyframes marquee {
  0% { transform: translateX(0) }
  100% { transform: translateX(-100%) }
}

/* 两行三列的胶囊按钮 */
.quick-grid{
  max-width:980px; margin:14px auto; padding:0 14px;
  display:grid; grid-template-columns:repeat(3,1fr); gap:12px;
}
.pill{
  display:inline-flex; align-items:center; justify-content:center;
  padding:12px 16px; border-radius:999px; font-weight:600;
  border:1px solid var(--line);
  color:#0b0f14; text-decoration:none; transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
  box-shadow: 0 6px 14px rgba(0,0,0,.22);
}
.pill.small{padding:8px 12px; font-weight:600; font-size:13px}
.pill:hover{transform: translateY(-1px); filter:saturate(1.15); box-shadow:0 10px 22px rgba(0,0,0,.28)}
.pill:active{transform: translateY(0); filter:saturate(1.3)}

/* 自动分配颜色（按位置轮换） */
.pill.auto:nth-child(6n+1){ background:var(--c-pink) }
.pill.auto:nth-child(6n+2){ background:var(--c-mint) }
.pill.auto:nth-child(6n+3){ background:var(--c-lemon) }
.pill.auto:nth-child(6n+4){ background:var(--c-peach) }
.pill.auto:nth-child(6n+5){ background:var(--c-teal); color:#fff }
.pill.auto:nth-child(6n+6){ background:var(--c-orange) }

/* 单列卡片：左图右文 */
.cards{max-width:980px; margin:8px auto 28px; padding:0 14px; display:grid; gap:14px}
.card{
  display:grid; grid-template-columns: 160px 1fr;
  gap:16px; background:var(--panel); border:1px solid var(--line);
  border-radius:var(--radius); overflow:hidden; box-shadow: var(--shadow);
  transition: box-shadow .15s ease, transform .15s ease;
}
.card:hover{ box-shadow: 0 20px 36px rgba(0,0,0,.45); transform: translateY(-1px) }

.card .thumb{position:relative; background:#111}
.card .thumb img{width:100%; height:100%; object-fit:cover; display:block}

.card .meta{padding:14px 14px 16px}
/* 标题两行截断 */
.card .meta h3{
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;   /* 现今主流浏览器实际生效 */
  line-clamp: 2;           /* 标准草案，给编辑器看也给未来浏览器用 */
  overflow: hidden;
  word-break: break-word;
}

/* 文案三行截断 */
.card .meta p{
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;   /* 现今主流浏览器实际生效 */
  line-clamp: 3;           /* 标准草案 */
  overflow: hidden;
  word-break: break-word;
}
.card .actions{display:flex; gap:10px; flex-wrap:wrap}

/* 小屏适配 */
@media (max-width:640px){
  .slider{height:180px}
  .quick-grid{grid-template-columns:repeat(3,1fr)}
  .card{grid-template-columns: 120px 1fr}
}
@media (max-width:520px){
  .quick-grid{grid-template-columns:repeat(2,1fr)}
  .card{grid-template-columns: 1fr}
  .card .thumb{height:180px}
}

/* =========================================================
   小程序（Telegram WebApp/移动端）通用适配与防撑破兜底
   直接追加在文件末尾即可
   ======================================================= */

/* 1) 系统级适配：禁用橡皮筋、字体缩放，启用安全区，避免点击延迟 */
html, body { -webkit-text-size-adjust:100%; overscroll-behavior:contain; touch-action:manipulation; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

/* 2) 媒体元素永不撑破容器，默认以宽自适应 */
img, video, canvas, svg, iframe { max-width:100%; height:auto; display:block; }

/* 3) 任何可滚动容器都隐藏横向溢出（防止细节抖动） */
* { min-width:0; }
[style*="overflow"], .cards, .quick-grid, .hero, .slider, .card, .thumb, .meta { overflow:hidden; }

/* 4) 轮播区域：用 aspect-ratio 约束盒子，随屏幕缩放且不变形 */
.slider{
  aspect-ratio: 21 / 9;                      /* 宽屏比例；会随容器宽度缩放 */
  height: auto;                               /* 交给 aspect-ratio 控制高度 */
  max-height: clamp(150px, 28vh, 260px);      /* 上限保护：小屏不至于过高 */
}
.slide img{ width:100%; height:100%; object-fit:cover; }

/* 5) 跑马灯在小屏收窄行高，避免压住轮播内容 */
.marquee{ height:32px; line-height:32px; }
@media (max-width:420px){ .marquee{ height:28px; line-height:28px; font-size:12px } }

/* 6) 胶囊按钮在任何宽度下都不换行挤爆；文字过长省略号处理 */
.pill{ white-space:nowrap; text-overflow:ellipsis; overflow:hidden; }

/* 7) 卡片：在不同屏宽自动切换布局并限制尺寸，防图文撑破 */
.card{
  width:100%;
  grid-template-columns: minmax(120px, 32%) 1fr;   /* 左图最小 120px，最多占 1/3 */
  align-items: stretch;
}
.card .thumb{
  position:relative;
  aspect-ratio: 16 / 10;                            /* 中性矩形，防过高/过窄 */
  max-height: 240px;                                 /* 上限兜底：避免图片太高 */
  background:#0b0f14;
}
.card .thumb img{ width:100%; height:100%; object-fit:cover; }

/* 手机竖屏：改为上下结构，图片给固定比例，绝不撑破 */
@media (max-width:520px){
  .card{ grid-template-columns: 1fr; }
  .card .thumb{ aspect-ratio: 16 / 9; max-height: none; }
}

/* 8) 网格：更紧凑的间距，防止小屏拥挤 */
@media (max-width:640px){
  .quick-grid{ gap:10px }
  .cards{ gap:12px }
}

/* 9) 降噪：用户偏好减少动效时，禁用动画与过渡 */
@media (prefers-reduced-motion: reduce){
  * { animation: none !important; transition: none !important }
}

/* 10) 极端长标题/文案保护：两行截断，不会把卡片撑高到离谱 */
.card .meta h3{
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; line-clamp:2;
  overflow:hidden; word-break:break-word;
}
.card .meta p{
  display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; line-clamp:3;
  overflow:hidden; word-break:break-word;
}

/* 11) 防止第三方样式把图片设为 inline 导致出现行内空隙 */
img { vertical-align: middle; }

/* 12) iOS Safari 小瑕疵：点击态不保留蓝色高亮 */
a, button { -webkit-tap-highlight-color: transparent; }

/* === 覆盖移动端卡片布局：横向两列 50/50，图片完整显示（contain） === */
@media (max-width:520px){
  /* 卡片横向排布，左右各占 50% */
  .card{
    grid-template-columns: 1fr 1fr;   /* 左图右文各占一半 */
    align-items: center;
    min-height: 120px;                /* 防止内容过少太扁 */
  }

  /* 图片容器：铺满左半区，内部留点内边距以免图片贴边 */
  .card .thumb{
    height: 100%;
    max-height: none;
    aspect-ratio: auto;               /* 交由高度自适应 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;                     /* 让 contain 的图片有呼吸空间 */
    background: #0b0f14;
  }

  /* 图片完整显示（不裁剪），自适应不撑破容器 */
  .card .thumb img{
    width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;              /* 关键：完整显示图片内容 */
  }

  /* 右侧文案区域：适度压缩内边距以适配小屏 */
  .card .meta{
    padding: 12px;
  }
}

/* =============== Light / Fresh theme override =============== */
/* 调亮基础变量与阴影，对比线转为浅灰 */
:root{
  --bg: #f7fbff;                    /* 全局背景（浅） */
  --panel: #ffffff;                 /* 卡片/面板底色（白） */
  --line: rgba(0,0,0,.08);          /* 分割线（浅灰） */
  --shadow: 0 8px 24px rgba(0,0,0,.08); /* 柔和阴影 */
}

/* 全局背景：淡彩渐变，文字改为深色 */
body{
  background: radial-gradient(1200px 600px at 20% -10%, #fffbe8 0%, #f7fbff 40%, #eef6ff 100%);
  color: #1b2330;
}

/* 顶部 slider 与公告条适配浅色 */
.slider{ background:#f4f8ff; }
.marquee{
  background: rgba(255,255,255,.7);
  border-color: rgba(0,0,0,.08);
  color:#1b2330;
}

/* 胶囊按钮：边框更轻，深色底的按钮强制白字保证对比度 */
.pill{ border-color: rgba(0,0,0,.08); }
.pill:hover{ box-shadow: 0 12px 30px rgba(0,0,0,.12); }
.pill.auto:nth-child(6n+5),
.pill.auto:nth-child(6n+6){ color:#fff; } /* 青绿/橙色按钮白字 */

/* 卡片：白底、浅灰边、柔和阴影；缩略图容器给微亮底色 */
.card{
  background: var(--panel);
  border-color: var(--line);
  box-shadow: var(--shadow);
}
.card .thumb{ background:#eff4ff; }

/* 标题更清晰一些 */
h1,h2,h3{ color:#0c1a2b; }

/* 分割线等通用 */
hr, .line{ border-color: var(--line); }

/* ========== 卡片渐变粗边（橙→紫→浅蓝） ========== */
/* 不改结构：用 ::before 做“镂空描边环”，兼容 Safari 的 -webkit-mask */
.cards .card{
  position: relative;
  border: none;                 /* 去掉原有细线 */
  background: var(--panel);
  box-shadow: var(--shadow);
}

.cards .card::before{
  content:"";
  position:absolute;
  inset:0;                      /* 贴边覆盖 */
  padding:3px;                  /* ← 边框粗细（改这里） */
  border-radius: var(--radius);
  background:
    conic-gradient(
      from 0deg,
      #ff7a12 0deg,   /* 橙 */
      #8b5cf6 120deg, /* 紫 */
      #5ab3ff 240deg, /* 浅蓝 */
      #ff7a12 360deg  /* 回到橙，首尾衔接 */
    );
  /* “镂空”出中间，保留彩色环 */
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0); 
  -webkit-mask-composite: xor;  /* Safari */
          mask-composite: exclude;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  transition: transform .6s linear, filter .2s ease;
}

/* 悬停：轻微旋转 + 锐化一点，用滤镜提神 */
.cards .card:hover::before{
  transform: rotate(8deg);
  filter: saturate(1.1) brightness(1.02);
}

/* 让内容盖在描边环之上 */
.cards .card > *{
  position: relative;
  z-index: 1;
  border-radius: inherit;
}

/* 小屏保持一致效果，无需额外规则 */
