/* ============ 主题变量 ============ */
:root {
  --bg: #0f1216;
  --bg-soft: #161b21;
  --bg-card: #1b2129;
  --bg-hover: #232b35;
  --line: #2c343f;
  --line-soft: #232a33;
  --fg: #e6ebf2;
  --fg-soft: #a8b3c2;
  --fg-mute: #7b8798;
  --gold: #d9b26a;
  --gold-soft: #f0d9a8;
  --green: #6fbf73;
  --blue: #6aa9e0;
  --red: #e0756a;
  --purple: #a98ae0;
  --cyan: #6fd0d4;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
  --radius: 12px;
  --wrap: 1180px;
}

html[data-theme="light"] {
  --bg: #f7f6f2;
  --bg-soft: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f0efe9;
  --line: #e2ded2;
  --line-soft: #eeebe2;
  --fg: #23282e;
  --fg-soft: #54606e;
  --fg-mute: #8a929c;
  --gold: #a9772a;
  --gold-soft: #7a5518;
  --green: #2f7d3a;
  --blue: #2f6f9e;
  --red: #b4453a;
  --purple: #6f4fa8;
  --cyan: #2c7f83;
  --shadow: 0 4px 16px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--fg-mute); font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ============ 顶栏 ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
/* 单行布局：品牌在左，导航与工具在右，二者都不换行 */
.topbar-inner {
  display: flex; align-items: center; gap: 14px;
  min-height: 60px; padding-top: 8px; padding-bottom: 8px;
  flex-wrap: nowrap;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--fg); flex: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--gold-soft), var(--gold) 55%, #8a6a2f 100%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 40%, transparent);
  flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; letter-spacing: .5px; }
.brand-text small { font-size: 11.5px; color: var(--fg-mute); }

/* 右侧容器：导航 + 工具，整体靠右，内部同一行 */
.topbar-right {
  display: flex; align-items: center; gap: 12px;
  margin-left: auto; min-width: 0; flex-wrap: nowrap;
}

/* 导航：允许收缩但要能滚动，绝不硬裁切。
   英文/日文文案比中文长 10~15%，窄桌面下放不下就必须能横向滚动，
   否则右侧按钮会被 overflow:hidden 直接切掉（历史 bug）。 */
.topnav {
  display: flex; gap: 2px; flex-wrap: nowrap;
  min-width: 0; flex-shrink: 1;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;              /* Firefox：隐藏滚动条但可滚 */
  -ms-overflow-style: none;
  overscroll-behavior-x: contain;
}
.topnav::-webkit-scrollbar { display: none; }   /* WebKit：同上 */
.topnav a {
  color: var(--fg-soft); font-size: 13.5px; padding: 6px 8px; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  flex: 0 0 auto;                     /* 不压缩文字，保证可读 */
}
.topnav a:hover { background: var(--bg-hover); color: var(--fg); text-decoration: none; }
.topnav a.active { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); }
.nav-badge {
  font-size: 11px; background: var(--bg-hover); color: var(--fg-soft);
  border-radius: 999px; padding: 1px 6px; font-weight: 600;
}

/* 工具组：搜索 + 主题 + 汉堡，始终与导航同行 */
.topbar-tools {
  display: flex; align-items: center; gap: 8px;
  flex: none; flex-wrap: nowrap;
}

.search-open {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-soft); color: var(--fg-mute);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; cursor: pointer;
  min-width: 0; width: 150px; font-family: inherit;
  flex: none;
}
.search-open:hover { border-color: var(--gold); color: var(--fg); }
.search-open-label { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon-btn {
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--fg-soft);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 15px;
  display: grid; place-items: center; flex: none;
}
.icon-btn:hover { border-color: var(--gold); color: var(--gold); }

/* 汉堡按钮：仅在窄屏出现 */
.nav-toggle { display: none; }

/* 语言切换器：紧凑三段式，避免顶栏被撑宽 */
.lang-switch {
  display: flex; align-items: center; gap: 0; flex: none;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 8px; padding: 2px;
}
.lang-btn {
  background: none; border: 0; color: var(--fg-mute);
  font-size: 11.5px; padding: 3px 5px; border-radius: 6px;
  cursor: pointer; font-family: inherit; line-height: 1.4;
  white-space: nowrap; min-width: 26px; text-align: center;
}
.lang-btn:hover { color: var(--fg); background: var(--bg-hover); }
.lang-btn.on { background: var(--gold); color: #1a1a1a; font-weight: 600; }

/* 窄屏：语言切换器只留缩写 */
@media (max-width: 1100px) {
  .lang-btn { font-size: 11px; padding: 3px 5px; }
}
@media (max-width: 860px) {
  .nav-toggle { display: grid; }
  .lang-switch { order: -1; }

  /* 导航变成下拉面板，不再挤占同一行 */
  .topbar-inner { flex-wrap: wrap; position: relative; }
  .topbar-right { flex: 1; justify-content: flex-end; }
  .topnav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 2px; overflow: visible;
    background: var(--bg-soft);
    border: 1px solid var(--line); border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 8px; margin-top: 6px; z-index: 60;
    display: none;
  }
  .topnav.open { display: flex; }
  .topnav a { width: 100%; padding: 10px 12px; font-size: 14px; border-radius: 8px; }

  .hero { padding: 22px; }
  .hero h1 { font-size: 24px; }
  .hero-art { min-height: 220px; }
  .hero-art .hero-content { padding: 22px; }
  .hero-stats { gap: 18px 24px; }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .ring-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  main { padding-top: 20px; padding-bottom: 40px; }

  /* 表格在窄屏改为可横向滚动，避免内容被压扁 */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.data { min-width: 620px; }
}

/* ============ 多语言自适应 ============
   英文/日文的导航文案比中文长 10~20%（Walkthrough vs 主线流程），
   同样的字号下顶栏会溢出。这里按语言收紧字号与间距，
   保证三种语言在 1181px 以上都能完整显示。 */
html[data-lang="en"] .topnav a,
html[data-lang="ja"] .topnav a {
  font-size: 12.5px; padding: 6px 6px; gap: 4px;
}
html[data-lang="en"] .topnav,
html[data-lang="ja"] .topnav {
  gap: 0;
}
html[data-lang="en"] .brand-text small,
html[data-lang="ja"] .brand-text small {
  display: none;                /* 副标题在英日站点隐藏，优先保证导航完整 */
}
html[data-lang="en"] .brand-text strong,
html[data-lang="ja"] .brand-text strong {
  font-size: 15px;
}
html[data-lang="en"] .nav-badge,
html[data-lang="ja"] .nav-badge {
  font-size: 10px; padding: 1px 4px;
}

/* 小桌面：进一步收紧 */
@media (max-width: 1180px) {
  html[data-lang="en"] .topnav a,
  html[data-lang="ja"] .topnav a { font-size: 12px; padding: 6px 5px; }
}

/* ============ 主体 ============ */
main { flex: 1; padding-top: 28px; padding-bottom: 56px; }
.loading { padding: 80px 0; text-align: center; color: var(--fg-mute); }

.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: .5px; }
.page-head p { margin: 0; color: var(--fg-soft); font-size: 14px; }
.crumb { font-size: 12.5px; color: var(--fg-mute); margin-bottom: 10px; }
.crumb a { color: var(--fg-mute); }

/* ============ 首页 ============ */
.hero {
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 12%, var(--bg-card)), var(--bg-card));
  border: 1px solid var(--line); border-radius: 16px; padding: 32px; margin-bottom: 28px;
}
/* 带头图版本：图片铺底 + 深色渐变遮罩保证文字可读 */
.hero-art { position: relative; overflow: hidden; padding: 0; min-height: 260px; }
.hero-bg { position: absolute; inset: 0; }
.hero-bg img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: .5;
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg,
    color-mix(in srgb, var(--bg) 94%, transparent) 0%,
    color-mix(in srgb, var(--bg) 80%, transparent) 45%,
    color-mix(in srgb, var(--bg) 55%, transparent) 100%);
}
.hero-art .hero-content { position: relative; z-index: 1; padding: 32px; }
.hero-art .hero-content > * { max-width: 720px; }
/* 亮色主题下提高遮罩浓度，避免白底文字压不住亮图 */
html[data-theme="light"] .hero-bg img { opacity: .35; }
.hero h1 { font-size: 32px; margin: 0 0 10px; letter-spacing: 1px; }
.hero .lead { color: var(--fg-soft); max-width: 720px; margin: 0 0 20px; }
.hero-stats { display: flex; gap: 28px; flex-wrap: wrap; }
.hero-stat b { display: block; font-size: 24px; color: var(--gold); line-height: 1.2; }
.hero-stat span { font-size: 12.5px; color: var(--fg-mute); }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }

.card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; transition: border-color .15s, transform .15s;
}
a.card { display: block; color: var(--fg); }
a.card:hover { border-color: var(--gold); text-decoration: none; transform: translateY(-2px); }
.card h3 { margin: 0 0 6px; font-size: 16px; }
.card p { margin: 0; color: var(--fg-soft); font-size: 13.5px; }
.card .kicker { font-size: 11.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; display: block; }

/* ============ 通用组件 ============ */
.section-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 32px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.section-title h2 { font-size: 19px; margin: 0; }
.section-title .hint { font-size: 12.5px; color: var(--fg-mute); }

.tag {
  display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--fg-soft); background: var(--bg-soft);
  white-space: nowrap; line-height: 1.7;
}
.tag.night { color: var(--purple); border-color: color-mix(in srgb, var(--purple) 45%, transparent); }
.tag.child { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.tag.adult { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 45%, transparent); }
.tag.main { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.tag.opt { color: var(--fg-mute); }

/* 复选框条目 */
.entry {
  display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px;
  border: 1px solid var(--line-soft); border-radius: 10px; background: var(--bg-soft);
  margin-bottom: 8px; transition: background .12s;
}
.entry:hover { background: var(--bg-hover); }
.entry.checked { opacity: .55; }
.entry.checked .entry-text { text-decoration: line-through; }
.entry input { margin-top: 5px; accent-color: var(--green); flex: none; width: 16px; height: 16px; cursor: pointer; }
.entry-body { flex: 1; min-width: 0; }
.entry-text { font-size: 14px; }
.entry-meta { font-size: 12.5px; color: var(--fg-mute); margin-top: 2px; }
.entry-idx {
  flex: none; width: 26px; height: 22px; border-radius: 6px; background: var(--bg-hover);
  display: grid; place-items: center; font-size: 12px; color: var(--fg-mute); margin-top: 1px;
}

/* 折叠分组 */
.group { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; background: var(--bg-card); overflow: hidden; }
.group-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer;
  user-select: none; background: none; border: 0; width: 100%; text-align: left;
  color: var(--fg); font-family: inherit; font-size: 15px;
}
.group-head:hover { background: var(--bg-hover); }
.group-head .chev { color: var(--fg-mute); font-size: 11px; transition: transform .15s; flex: none; }
.group.collapsed .group-head .chev { transform: rotate(-90deg); }
.group.collapsed .group-body { display: none; }
.group-head .g-title { font-weight: 600; }
.group-head .g-sub { font-size: 12.5px; color: var(--fg-mute); }
.group-body { padding: 4px 16px 16px; }
.group-head .grow { flex: 1; }

/* 进度条 */
.bar { height: 6px; border-radius: 999px; background: var(--bg-hover); overflow: hidden; min-width: 90px; flex: none; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--gold)); border-radius: 999px; transition: width .25s; }
.bar-label { font-size: 12px; color: var(--fg-mute); white-space: nowrap; }

/* 筛选 */
.filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.chip {
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--fg-soft);
  border-radius: 999px; padding: 4px 12px; font-size: 12.5px; cursor: pointer; font-family: inherit;
}
.chip:hover { border-color: var(--gold); color: var(--fg); }
.chip.on { background: var(--gold); border-color: var(--gold); color: #1a1a1a; font-weight: 600; }

/* 表格 */
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
table.data th { color: var(--fg-mute); font-weight: 600; font-size: 12.5px; }

/* ============ 地牢卡 ============ */
.dungeon-card { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.dungeon-card a.card-title { display: block; color: var(--fg); }
.dungeon-card a.card-title:hover { text-decoration: none; color: var(--gold); }
.dungeon-num {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--gold) 16%, var(--bg-hover)); color: var(--gold);
  font-weight: 700; font-size: 14px; flex: none;
}
.boss-box {
  border-left: 3px solid var(--red); padding-left: 12px; margin-top: 12px;
  background: color-mix(in srgb, var(--red) 5%, transparent); padding: 10px 12px; border-radius: 0 8px 8px 0;
}
.boss-box h4 { margin: 0 0 4px; font-size: 14px; }
ol.steps { margin: 6px 0 0; padding-left: 20px; }
ol.steps li { margin-bottom: 4px; font-size: 13.5px; color: var(--fg-soft); }

/* ============ 乐谱 ============ */
.notes { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.note {
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
  font-size: 17px; background: var(--bg-hover); border: 1px solid var(--line); color: var(--fg);
}
.note.a { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 40%, transparent); }
.note.c { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 40%, transparent); }

/* ============ 主线流程 ============ */
.chapter { margin-bottom: 26px; }
.chapter h2 { font-size: 18px; margin: 0 0 10px; padding-left: 12px; border-left: 3px solid var(--gold); }
.step { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.step-no {
  flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--bg-hover);
  display: grid; place-items: center; font-size: 13px; color: var(--fg-mute); font-weight: 600;
}
.step.checked .step-no { background: var(--green); color: #0f1216; }
.step-body { flex: 1; }
.step-body h4 { margin: 0 0 4px; font-size: 15px; }
.step-body p { margin: 0 0 6px; font-size: 13.5px; color: var(--fg-soft); }
.step.checked .step-body h4 { text-decoration: line-through; opacity: .7; }

/* ============ 100% 清单 ============ */
.ring-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.ring-card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-align: center;
}
.ring { --p: 0; --c: var(--gold);
  width: 92px; height: 92px; border-radius: 50%; margin: 0 auto 10px;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--bg-hover) 0);
  display: grid; place-items: center; position: relative;
}
.ring::after {
  content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--bg-card);
}
.ring > span { position: relative; z-index: 1; font-size: 17px; font-weight: 700; }
.ring-card h4 { margin: 0 0 2px; font-size: 14px; }
.ring-card p { margin: 0; font-size: 12px; color: var(--fg-mute); }

/* ============ 搜索弹窗 ============ */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: start center; padding-top: 10vh; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(2px); }
.modal-panel {
  position: relative; width: min(680px, 94vw); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden;
}
.search-field { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--fg-mute); }
.search-field input {
  flex: 1; background: none; border: 0; color: var(--fg); font-size: 15px; outline: none; font-family: inherit;
}
.search-results { max-height: 60vh; overflow-y: auto; padding: 6px; }
.sr-item { display: block; padding: 9px 12px; border-radius: 8px; color: var(--fg); cursor: pointer; }
.sr-item:hover, .sr-item.sel { background: var(--bg-hover); text-decoration: none; }
.sr-item .sr-top { display: flex; align-items: center; gap: 8px; }
.sr-item b { font-weight: 600; }
.sr-item .sr-sub { font-size: 12.5px; color: var(--fg-mute); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-empty { padding: 28px; text-align: center; color: var(--fg-mute); font-size: 13.5px; }

kbd {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px;
  padding: 1px 5px; color: var(--fg-mute); background: var(--bg-card);
}

/* ============ 提示块 ============ */
.callout {
  border: 1px solid color-mix(in srgb, var(--blue) 35%, var(--line));
  background: color-mix(in srgb, var(--blue) 8%, var(--bg-soft));
  border-radius: 10px; padding: 12px 14px; font-size: 13.5px; color: var(--fg-soft); margin-bottom: 16px;
}
.callout b { color: var(--blue); }

.footer { border-top: 1px solid var(--line); padding: 20px 0 32px; font-size: 12.5px; color: var(--fg-mute); }
.footer p { margin: 0 0 4px; }
/* 页脚辅助链接（隐私政策 / 关于）——AdSense 审核要求可达 */
.footer-links { margin-top: 10px !important; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.footer-links a { color: var(--fg-soft); }
.footer-links a:hover { color: var(--gold); }
.footer-links .sep { opacity: .45; }

/* ============ 图片与降级 ============ */
.img-fallback {
  display: inline-grid; place-items: center; flex: none;
  background: var(--bg-hover); border: 1px solid var(--line); border-radius: 8px;
  font-size: 16px; line-height: 1;
}
/* 场景横幅占位：CSS 渐变，无图时依然有视觉层次，不产生裂图 */
.img-placeholder {
  display: block; width: 100%; height: 100%; flex: none;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--gold) 14%, transparent), transparent 60%),
    repeating-linear-gradient(45deg, var(--bg-hover) 0 8px, transparent 8px 16px);
  border-radius: inherit;
}
.thumb {
  width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit;
  background: var(--bg-hover);
}
.thumb-wrap {
  position: relative; overflow: hidden; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg-hover); flex: none;
}

/* 收集品徽标行（图鉴页顶部） */
.badge-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.badge-cell {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px;
}
.badge-cell .bc-img { width: 40px; height: 40px; display: grid; place-items: center; flex: none; }
.badge-cell .bc-txt b { display: block; font-size: 13.5px; }
.badge-cell .bc-txt span { font-size: 12px; color: var(--fg-mute); }

/* 地牢卡头图 */
.dungeon-art { height: 96px; margin: -18px -18px 14px; }
.dungeon-card { overflow: hidden; }

/* 道具图标（表格/卡片内） */
.item-ico { width: 28px; height: 28px; display: grid; place-items: center; flex: none; }
.boss-ico { width: 64px; height: 64px; display: grid; place-items: center; flex: none; }
.boss-ico .thumb { width: 100%; height: 100%; object-fit: contain; padding: 2px; }

/* 带图标的卡片 */
.card-ico { display: flex; gap: 14px; align-items: flex-start; }
.card-ico-img {
  width: 44px; height: 44px; display: grid; place-items: center; flex: none;
  background: var(--bg-hover); border: 1px solid var(--line); border-radius: 10px;
}
.card-ico-img .img-fallback { font-size: 20px; background: none; border: 0; }
.card-ico-img img { width: 32px; height: 32px; object-fit: contain; }
.card-ico-txt { flex: 1; min-width: 0; }

/* 章节 / 分类标题旁的小图标 */
.ch-ico {
  display: inline-grid; place-items: center; width: 26px; height: 26px;
  margin-right: 8px; flex: none;
}
.ch-ico img { width: 24px; height: 24px; object-fit: contain; }
.ch-ico .img-fallback { font-size: 14px; width: 24px; height: 24px; }
.ch-ico.sm { width: 30px; height: 30px; margin-right: 0; }
.ch-ico.sm img { width: 28px; height: 28px; }
.section-title h2, .chapter h2 { display: flex; align-items: center; }

/* 清单环形卡片上的图标 */
.ring-ico { display: grid; place-items: center; height: 26px; margin-bottom: 4px; }
.ring-ico img { width: 24px; height: 24px; object-fit: contain; }
.ring-ico .img-fallback { font-size: 15px; width: 24px; height: 24px; }


.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.btn {
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--fg-soft);
  border-radius: 8px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; font-family: inherit;
}
.btn:hover { border-color: var(--gold); color: var(--fg); }
.btn.danger:hover { border-color: var(--red); color: var(--red); }

/* ============================================================
   响应式适配
   断点：
     ≥1100px  桌面全宽：导航全部展开
     860–1100 小桌面/横屏平板：收起搜索文字，导航保留
     640–860  竖屏平板/大屏手机：导航折叠进汉堡菜单
     <640     手机：单列、缩小间距、触控友好
   ============================================================ */

/* --- 小桌面 / 横屏平板 --- */
/* 断点取 1180px（内容区最大宽度）：窗口一开始收窄就先把搜索框缩成图标，
   给导航留出空间，避免工具按钮被挤到第二行。 */
@media (max-width: 1180px) {
  .search-open { width: 44px; padding: 6px; justify-content: center; }
  .search-open-label, .search-open-kbd { display: none; }
  .topnav a { padding: 6px 7px; font-size: 13px; }
}

@media (max-width: 1100px) {
  .topnav a { padding: 6px 6px; font-size: 12.5px; }
  .topbar-inner { gap: 10px; }
  .topbar-right { gap: 8px; }
}

/* --- 竖屏平板 / 大屏手机：导航折叠 --- */
@media (max-width: 860px) {
  .nav-toggle { display: grid; }

  /* 导航变成下拉面板，不再挤占同一行 */
  .topbar-inner { flex-wrap: wrap; position: relative; }
  .topbar-right { flex: 1; justify-content: flex-end; }
  .topnav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 2px; overflow: visible;
    background: var(--bg-soft);
    border: 1px solid var(--line); border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 8px; margin-top: 6px; z-index: 60;
    display: none;
  }
  .topnav.open { display: flex; }
  .topnav a { width: 100%; padding: 10px 12px; font-size: 14px; border-radius: 8px; }

  .hero { padding: 22px; }
  .hero h1 { font-size: 24px; }
  .hero-art { min-height: 220px; }
  .hero-art .hero-content { padding: 22px; }
  .hero-stats { gap: 18px 24px; }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .ring-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  main { padding-top: 20px; padding-bottom: 40px; }

  /* 表格在窄屏改为可横向滚动，避免内容被压扁 */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.data { min-width: 620px; }
}

/* --- 手机 --- */
@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .brand-text small { display: none; }
  .brand-text strong { font-size: 15px; }
  .brand-mark { width: 26px; height: 26px; }
  .topbar-inner { min-height: 54px; gap: 10px; }
  .topbar-right { gap: 8px; }

  .page-head h1 { font-size: 20px; }
  .page-head p { font-size: 13px; }
  .hero { padding: 18px; border-radius: 12px; }
  .hero h1 { font-size: 20px; }
  .hero .lead { font-size: 13.5px; }
  .hero-stat b { font-size: 19px; }
  .hero-stat span { font-size: 11.5px; }
  .hero-stats { gap: 14px 20px; }
  .hero-art { min-height: 190px; }
  .hero-art .hero-content { padding: 18px; }

  /* 触控友好：按钮与复选框加大点击区域 */
  .icon-btn { width: 36px; height: 36px; }
  .chip { padding: 7px 13px; font-size: 13px; }
  .btn { padding: 8px 14px; font-size: 13px; }
  .entry input { width: 18px; height: 18px; }
  .entry { padding: 11px 12px; }
  .group-head { padding: 12px 14px; }
  .group-body { padding: 4px 12px 14px; }

  .section-title { margin: 24px 0 12px; }
  .section-title h2 { font-size: 17px; }
  .chapter h2 { font-size: 16px; }
  .step { gap: 10px; padding: 10px 0; }
  .step-body h4 { font-size: 14.5px; }
  .step-body p { font-size: 13px; }

  .card { padding: 14px; }
  .card h3 { font-size: 15px; }
  .dungeon-card { padding: 14px; }
  .dungeon-art { height: 76px; margin: -14px -14px 12px; }
  .boss-ico { width: 48px; height: 48px; }
  .boss-box { padding: 10px; }
  ol.steps { padding-left: 18px; }
  ol.steps li { font-size: 13px; }

  .ring-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .ring { width: 74px; height: 74px; }
  .ring > span { font-size: 15px; }

  .note { width: 30px; height: 30px; font-size: 15px; }
  .notes { gap: 5px; }

  .modal { padding-top: 4vh; }
  .modal-panel { width: 96vw; border-radius: 12px; }
  .search-results { max-height: 72vh; }

  .card-ico { gap: 10px; }
  .card-ico-img { width: 38px; height: 38px; }
  .card-ico-img img { width: 28px; height: 28px; }

  .badge-row { gap: 10px; }
  .badge-cell { padding: 8px 11px; flex: 1 1 140px; }
}

/* --- 超小屏（iPhone SE 等） --- */
@media (max-width: 380px) {
  .brand-text strong { font-size: 14px; }
  .hero-stat b { font-size: 17px; }
  .hero-stat span { font-size: 11px; }
  .ring-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- 横屏矮视口：避免顶栏占用过多高度 --- */
@media (max-height: 480px) and (orientation: landscape) {
  .topbar { position: static; }
  .topnav { max-height: 60vh; overflow-y: auto; }
}

/* --- 打印 --- */
@media print {
  .topbar, .footer, .toolbar, .filters, .modal, .icon-btn, .nav-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  .group.collapsed .group-body { display: block; }
  a { color: #000; text-decoration: underline; }
}

/* --- 降低动态效果偏好 --- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
