/* ============================================================
   MW4 Wiki — 共用样式
   深色游戏风 · 移动端优先 · 无外部依赖
   ============================================================ */

:root {
  /* 颜色 token：发售日临近，别在配色上纠结，先上线 */
  --bg: #0d1117;
  --bg-raised: #161b22;
  --bg-card: #1a212b;
  --border: #2d333b;
  --text: #e6edf3;
  --text-dim: #9aa4b2;
  --accent: #ff9f1c;        /* 橙：主强调色 */
  --accent-soft: rgba(255, 159, 28, .12);
  --green: #4ade80;         /* 军绿：成功/已核实 */
  --red: #f87171;
  --link: #58a6ff;
  --code-bg: #21262d;
  --radius: 10px;
  --max-w: 1080px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.65;
  font-size: 16px;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

img, iframe { max-width: 100%; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 16px; }

/* ---------- 首页 hero 背景（暗图 + 深色遮罩，保证文字可读） ---------- */
.hero {
  background:
    linear-gradient(180deg, rgba(13, 17, 23, .55), rgba(13, 17, 23, .92) 78%, var(--bg)),
    url("../img/hero-bg.jpg") center / cover no-repeat;
  margin: 0;
  padding: 26px 16px 34px;
  border-bottom: 1px solid var(--border);
}

/* ---------- 卡片封面图 ---------- */
.card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.card-img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: center top; display: block;
  border-bottom: 1px solid var(--border);
  filter: saturate(.9);
}
/* 逐张取景修正：源图带白边/主体偏移时调整 */
.card-img[src$="cards/stranded.png"] { object-position: right top; }    /* 裁掉左侧白边，保住上方主体 */
.card .card-body { padding: 14px 16px 16px; }
.card:hover .card-img { filter: saturate(1.1); }

/* ---------- 倒计时条（仅首页） ---------- */
.countdown {
  background: linear-gradient(90deg, #3d1f00, #7a3e00);
  border-bottom: 1px solid var(--accent);
  text-align: center;
  padding: 10px 16px;
  font-weight: 700;
  letter-spacing: .3px;
}
.countdown .cd-time { color: var(--accent); font-variant-numeric: tabular-nums; }
.countdown a { color: #fff; background: var(--accent); border-radius: 6px; padding: 2px 12px; margin-left: 10px; font-size: .9em; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 56px; flex-wrap: wrap;
}
.logo {
  color: var(--text); font-weight: 800; font-size: 1.15rem; letter-spacing: .5px;
}
.logo span { color: var(--accent); }
.logo:hover { text-decoration: none; }

.nav-toggle { display: none; }
.nav-toggle-label { cursor: pointer; color: var(--text-dim); font-size: 1.5rem; user-select: none; }

.main-nav {
  display: none;                 /* 移动端默认收起 */
  flex-basis: 100%;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 10px;
}
.nav-toggle:checked ~ .main-nav { display: flex; }

.main-nav a {
  color: var(--text-dim); padding: 8px 4px; border-radius: 6px;
}
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--text); background: var(--bg-card); text-decoration: none; }

.search-form { display: flex; gap: 6px; padding: 8px 4px; }
.search-form input {
  background: var(--code-bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 6px 10px; min-width: 0; flex: 1;
}
.search-form button {
  background: var(--accent); color: #1a0e00; border: 0; border-radius: 6px;
  padding: 6px 14px; font-weight: 700; cursor: pointer;
}

@media (min-width: 900px) {
  .nav-toggle-label { display: none; }
  .site-header .container { flex-wrap: nowrap; }
  .main-nav {
    display: flex; flex-direction: row; flex-basis: auto;
    align-items: center; padding: 0; gap: 4px;
  }
  .search-form { padding: 0; }
}

/* ---------- 面包屑 ---------- */
.breadcrumb { padding: 12px 0 0; font-size: .85rem; color: var(--text-dim); }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumb li + li::before { content: "›"; margin-right: 6px; color: var(--border); }
.breadcrumb a { color: var(--text-dim); }
.breadcrumb [aria-current] { color: var(--text); }

/* ---------- 页面通用 ---------- */
.page-title { font-size: 1.7rem; line-height: 1.25; margin: 14px 0 6px; }
@media (min-width: 768px) { .page-title { font-size: 2.2rem; } }

.last-updated {
  display: inline-block; font-size: .85rem; color: var(--text-dim);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 12px; margin: 6px 0 18px;
}
.last-updated time { color: var(--green); }

.page-lead { color: var(--text-dim); max-width: 70ch; margin-bottom: 8px; }

main { padding-bottom: 48px; }

section { margin: 28px 0; }
h2 { font-size: 1.35rem; margin: 0 0 12px; padding-bottom: 6px; border-bottom: 2px solid var(--accent-soft); }
h3 { font-size: 1.1rem; margin: 18px 0 8px; }

/* ---------- TOC 目录 ---------- */
.toc {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 16px; margin: 0 0 20px;
}
.toc summary { cursor: pointer; font-weight: 700; color: var(--text-dim); }
.toc ol { margin: 10px 0 4px 20px; }
.toc li { margin: 3px 0; }

/* ---------- 卡片网格（首页） ---------- */
.card-grid {
  display: grid; grid-template-columns: 1fr; gap: 14px;
}
@media (min-width: 600px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  display: block; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; color: var(--text);
  transition: border-color .15s;
}
.card:hover { border-color: var(--accent); text-decoration: none; }
.card h3 { margin: 0 0 6px; color: var(--accent); }
.card p { color: var(--text-dim); font-size: .92rem; }

/* ---------- 更新列表（首页） ---------- */
.updates { list-style: none; }
.updates li {
  display: flex; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border); align-items: baseline;
}
.updates time { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .9rem; }
.updates .badge {
  font-size: .72rem; font-weight: 700; color: #14330f; background: var(--green);
  border-radius: 4px; padding: 1px 6px; white-space: nowrap;
}

/* ---------- 表格（Codes 页核心） ---------- */
.table-wrap {
  overflow-x: auto;                    /* 移动端横向滚动 */
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
table { border-collapse: collapse; width: 100%; min-width: 640px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
thead th {
  background: var(--bg-raised); color: var(--text-dim);
  font-size: .8rem; text-transform: uppercase; letter-spacing: .5px;
  position: sticky; top: 0;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-card); }

/* code 单元格：点击即全选，方便框选复制 */
td.code-cell {
  font-family: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, Menlo, monospace;
  font-size: 1.05rem; font-weight: 700; color: var(--accent);
  user-select: all; -webkit-user-select: all;
  background: var(--code-bg); border-radius: 6px;
  white-space: nowrap;
}

.copy-hint { font-size: .82rem; color: var(--text-dim); margin: 8px 0 0; }

/* ---------- 分步说明 ---------- */
.code-steps { margin: 10px 0 22px; }
.code-steps figure {
  margin: 10px 0; border: 1px dashed var(--border); border-radius: var(--radius);
  background: var(--bg-card); color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  min-height: 160px; font-size: .9rem; text-align: center; padding: 12px;
}
@media (min-width: 768px) { .code-steps figure { min-height: 240px; } }
.code-steps figcaption { font-size: .82rem; margin-top: 6px; }
.code-steps ol, .prose ol, .prose ul { margin: 8px 0 8px 24px; }
.code-steps li, .prose li { margin: 4px 0; }

/* ---------- 任务攻略页 ---------- */
.mission-meta {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px;
  font-size: .92rem; color: var(--text-dim);
}
.mission-meta strong { color: var(--text); }

.video-embed {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  border: 1px dashed var(--border); border-radius: var(--radius);
  background: var(--bg-card); overflow: hidden;
}
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: .95rem;
}

/* 视频跳转卡片：封面 + 播放按钮，点击新标签页打开 YouTube（Shorts 用 embed 播放不佳） */
.video-link {
  position: relative; display: block; aspect-ratio: 16 / 9;
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
}
.video-link img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-link::after {
  content: "▶";
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 3rem; color: #fff;
  background: rgba(0, 0, 0, .35); text-shadow: 0 2px 12px rgba(0,0,0,.8);
  transition: background .15s;
}
.video-link:hover::after { background: rgba(0, 0, 0, .2); }
.video-link figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 6px 10px; font-size: .82rem; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.75));
}

.step h2 { border: 0; padding: 0; }
.step figure {
  margin: 10px 0; border: 1px dashed var(--border); border-radius: var(--radius);
  background: var(--bg-card); color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  min-height: 180px; font-size: .9rem; text-align: center; padding: 12px;
}

.collectibles { list-style: none; counter-reset: col; }
.collectibles > li {
  counter-increment: col; display: flex; gap: 14px; align-items: flex-start;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
}
.collectibles > li::before {
  content: "#" counter(col);
  color: var(--accent); font-weight: 800; font-variant-numeric: tabular-nums;
  flex-shrink: 0; padding-top: 2px;
}
.collectibles .thumb {
  flex-shrink: 0; width: 96px; height: 64px; border: 1px dashed var(--border);
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: .72rem; text-align: center;
}

/* ---------- FAQ ---------- */
.faq details {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 10px; padding: 12px 16px;
}
.faq summary { cursor: pointer; font-weight: 700; }
.faq details[open] summary { color: var(--accent); margin-bottom: 8px; }

/* ---------- 相关页面内链 ---------- */
.related-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 600px) { .related-grid { grid-template-columns: repeat(2, 1fr); } }
.related-grid a {
  display: block; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
}
.related-grid a:hover { border-color: var(--accent); text-decoration: none; }
.related-grid .rel-title { color: var(--text); font-weight: 700; display: block; }
.related-grid .rel-desc { color: var(--text-dim); font-size: .85rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg-raised); border-top: 1px solid var(--border);
  padding: 28px 0; margin-top: 40px; font-size: .88rem; color: var(--text-dim);
}
.site-footer .container { display: grid; gap: 18px; }
@media (min-width: 768px) { .site-footer .container { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h4 { color: var(--text); margin-bottom: 8px; font-size: .95rem; }
.site-footer ul { list-style: none; }
.site-footer li { margin: 4px 0; }
.site-footer a { color: var(--text-dim); }
.site-footer a:hover { color: var(--text); }
.footer-disclaimer { font-size: .8rem; max-width: 60ch; }
.footer-bottom {
  border-top: 1px solid var(--border); margin-top: 18px; padding-top: 14px;
  text-align: center; font-size: .8rem;
}
