/* ============================================================
   澳知电竞导航 · 金铲铲之战栏目（第一阶段）
   视觉由 site.config.json 的 theme 驱动：JS 注入 :root CSS 变量
   ============================================================ */

:root {
  /* 默认值；运行时会由 app.js 按 config.theme 覆盖 */
  --bg: #FFFDF7;
  --bg-alt: #FFF8E8;
  --card: #FFFFFF;
  --primary: #F5A623;
  --primary-soft: #FFF3D6;
  --accent: #FF7A3D;
  --info: #4EA8DE;
  --success: #5FB878;
  --text: #2D2A26;
  --muted: #7A7268;
  --border: #F0E6D2;
  --shadow: 0 4px 16px rgba(245,166,35,.10);
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--text);
  line-height: 1.6;
}

/* ---------- 头部 ---------- */
header {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 20px 18px;
  text-align: center;
}

h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #FFB300, #FF7A3D);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

/* ---------- 游戏 Tab（多游戏预留） ---------- */
.game-bar {
  max-width: 1080px;
  margin: 0 auto 14px;
  padding: 0 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.game-tab {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .18s ease;
  box-shadow: var(--shadow);
}

.game-tab:hover {
  border-color: var(--game-color, var(--primary));
  transform: translateY(-1px);
}

.game-tab.active {
  background: var(--game-color, var(--primary));
  border-color: var(--game-color, var(--primary));
  color: #fff;
}

/* ---------- 工具栏 ---------- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 253, 247, .92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.toolbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

#search {
  flex: 1 1 260px;
  min-width: 200px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: box-shadow .18s ease, border-color .18s ease;
}

#search:focus {
  box-shadow: 0 0 0 3px rgba(245,166,35,.18);
  border-color: var(--primary);
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .18s ease;
}

.tab:hover { border-color: var(--primary); color: var(--primary); }

.tab.active {
  color: var(--tab-color, var(--primary));
  border-color: var(--tab-color, var(--primary));
  background: color-mix(in srgb, var(--tab-color, var(--primary)) 10%, #fff);
}

/* ---------- 主区域 ---------- */
main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 20px 60px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 18px;
}

.section-block {
  margin-bottom: 36px;
}

.section-block:last-child { margin-bottom: 0; }

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--sec-color, var(--text));
}

.section-head::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: var(--sec-color, var(--text));
}

.section-head .section-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--sec-color, var(--text));
  color: #fff;
  padding: 2px 10px;
  border-radius: 999px;
  opacity: .85;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 10px 26px rgba(245,166,35,.18);
}

.card.is-live {
  background: linear-gradient(180deg, var(--primary-soft) 0%, var(--card) 55%);
  border-left: 3px solid var(--success);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-top h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.badge {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--c, var(--primary));
  background: color-mix(in srgb, var(--c, var(--primary)) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--c, var(--primary)) 40%, transparent);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}

.tag {
  font-size: 12px;
  color: var(--muted);
}

.desc {
  font-size: 13px;
  color: var(--text);
  flex: 1;
}

.card .open {
  align-self: flex-start;
  display: inline-block;
  margin-top: 4px;
  padding: 7px 18px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: filter .18s ease;
}

.card .open:hover { filter: brightness(1.08); }

/* ---------- 赛事状态徽章 ---------- */
.event-badge {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.event-badge.ongoing {
  background: color-mix(in srgb, var(--success) 12%, #fff);
  color: var(--success);
}

.event-badge.ongoing::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.8); }
}

.event-badge.upcoming {
  background: color-mix(in srgb, var(--info) 12%, #fff);
  color: var(--info);
}

.event-badge.ended {
  background: #EDEAE4;
  color: var(--muted);
}

.event-time {
  font-size: 12px;
  color: var(--muted);
}

.card.ended-card { opacity: .55; }

/* ---------- 相关视频（懒加载 iframe） ---------- */
.video-block {
  margin-top: 6px;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}

.video-toggle {
  appearance: none;
  border: none;
  background: var(--primary-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: filter .18s ease;
}

.video-toggle:hover { filter: brightness(.97); }

.video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 8px;
  background: #111;
}

/* ---------- 空态与错误 ---------- */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 0;
}

.error {
  text-align: center;
  color: #B3261E;
  background: color-mix(in srgb, #B3261E 8%, #fff);
  border: 1px solid color-mix(in srgb, #B3261E 30%, transparent);
  border-radius: var(--radius);
  padding: 28px 18px;
  font-size: 14px;
}

/* ---------- 页脚 ---------- */
footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .toolbar-inner { flex-direction: column; align-items: stretch; }
  #search { flex: 1 1 auto; }
  .tabs { justify-content: center; }
  .card-grid { grid-template-columns: 1fr; }
  main { padding-top: 14px; }
}

/* ============================================================
   频道视频列表页 + 视频播放页（B 站风格高密度网格）
   ============================================================ */
.page-back {
  display: inline-block;
  margin: 18px 0 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
.page-back:hover { color: var(--primary); }

.channel-head { margin: 14px 0 18px; }
.channel-head h2 { margin: 8px 0 4px; font-size: 26px; }
.channel-head .tag { margin: 4px 0; }
.channel-head .desc { margin: 4px 0; }
.space-link {
  display: inline-block;
  margin-top: 6px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.space-link:hover { text-decoration: underline; }
.list-meta { color: var(--muted); font-size: 13px; margin: 10px 0 14px; }

/* 高密度视频网格：宽屏每行 5~6 卡 */
.bili-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(184px, 1fr));
  gap: 18px 14px;
}
@media (max-width: 640px) {
  .bili-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px 10px; }
}

.bili-card { min-width: 0; }
.bili-link { display: block; color: var(--text); text-decoration: none; }

.bili-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-alt);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .18s ease;
}
.bili-cover-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bili-cover.no-cover::after {
  content: "无封面";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}
.bili-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background .18s ease;
  pointer-events: none;
}
.bili-card:hover .bili-cover::before { background: rgba(0, 0, 0, .06); }
.bili-card:hover .bili-cover { transform: translateY(-2px); }

.bili-duration {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: rgba(0, 0, 0, .72);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 4px;
  z-index: 2;
}

.bili-title {
  margin: 8px 0 4px;
  font-size: 14px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
}
.bili-info {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bili-card:hover .bili-title { color: var(--primary); }

/* 播放页 */
.video-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 14px 0 10px;
}
.video-stage-frame { position: absolute; inset: 0; width: 100%; height: 100%; }
.video-title { margin: 8px 0 6px; font-size: 20px; line-height: 1.4; }
.video-meta { margin: 0 0 6px; color: var(--muted); font-size: 14px; }

.rel-title { margin: 22px 0 10px; font-size: 17px; }
.rel-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px 14px;
}
.rel-row {
  display: flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  padding: 6px;
  border-radius: 10px;
}
.rel-row:hover { background: var(--bg-alt); }
.rel-thumb {
  position: relative;
  width: 120px;
  aspect-ratio: 16 / 9;
  flex: none;
  background: var(--bg-alt);
  border-radius: 8px;
  overflow: hidden;
  display: inline-flex;
}
.rel-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rel-thumb .bili-duration { font-size: 10px; padding: 2px 4px; }
.rel-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rel-text {
  font-size: 13px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rel-meta { font-size: 12px; color: var(--muted); }
.rel-row:hover .rel-text { color: var(--primary); }

.channel-link { margin-left: 8px; }

/* ---------- 整卡可点击 ---------- */
a.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius);
  outline-offset: 4px;
}
.card {
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
a.card-link:hover .card,
a.card-link:focus-visible .card {
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(245, 166, 35, .18);
  border-color: var(--primary);
}
a.card-link:hover .card h3,
a.card-link:focus-visible .card h3 { color: var(--primary); }
