/* ===== 部落盒子官网框架样式（Vue3 + Element Plus · 极简文档风 · 明暗双主题） ===== */

/* Clash：COC 游戏同款英文字体，仅覆盖英文/数字/符号，中文自动回退系统中文字体 */
@font-face {
  font-family: 'Clash';
  src: url('../fonts/Clash-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+20-7E, U+A0-FF, U+2010-2027, U+2030, U+20AC, U+2212;
}

:root {
  --bg: #f7f8fa;
  --sidebar-bg: #ffffff;
  --card: #ffffff;
  --border: #e4e7ed;
  --border-soft: #ebeef5;
  --text: #303133;
  --text-2: #606266;
  --muted: #909399;
  --accent: #409eff;
  --accent-soft: rgba(64, 158, 255, 0.08);
  --on-accent: #ffffff;
  --danger: #f56c6c;
  --hover-bg: #f5f7fa;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  --radius: 10px;
  --sidebar-w: 224px;
  /* 标题字体：英文/数字走 Clash，汉字用微软雅黑（正文同源） */
  --font-display: 'Clash', 'Microsoft YaHei', 'PingFang SC', sans-serif;
}

html.dark {
  --bg: #101014;
  --sidebar-bg: #16161a;
  --card: #1d1e22;
  --border: #2c2d31;
  --border-soft: #26272b;
  --text: #e5eaf3;
  --text-2: #cfd3dc;
  --muted: #8d9095;
  --accent: #d4a84b;
  --accent-soft: rgba(212, 168, 75, 0.1);
  --on-accent: #1d1a12;
  --danger: #f78989;
  --hover-bg: #26272b;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Clash', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.25s ease, color 0.25s ease;
}

[v-cloak] { display: none; }

/* ===== 布局骨架 ===== */
.site { min-height: 100vh; }

/* ===== 侧边栏 ===== */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
}

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

.brand-logo-fallback {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 16px;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text);
  white-space: nowrap;
  font-family: var(--font-display);
}

.nav { flex: 1; padding: 6px 10px; overflow-y: auto; }

.nav-group-label {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 8px 6px;
}

.nav-item,
.side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.nav-item:hover,
.side-item:hover { background: var(--bg); color: var(--text); }

.nav-item.active,
.side-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-item .el-icon,
.side-item .el-icon { font-size: 17px; flex: none; }

/* 侧边栏底部固定功能区 */
.sidebar-foot {
  flex: none;
  padding: 8px 10px 12px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ===== 主内容区：纵向流式单栏 ===== */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.2s ease;
}

.page {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 22px 24px 44px;
  flex: 1;
}

/* 文档风占位视图 */
.doc-view { display: flex; flex-direction: column; }

.doc-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-display);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 14px;
}

.doc-empty {
  color: var(--muted);
  font-size: 14px;
  padding: 40px 0;
  text-align: center;
}

/* ===== 移动端顶栏 ===== */
.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 90;
  height: 50px;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border-soft);
}

.topbar .brand-logo,
.topbar .brand-logo-fallback { width: 28px; height: 28px; border-radius: 6px; }
.topbar .brand-name { font-size: 16px; }
.topbar-menu-btn {
  margin-left: auto;
  font-size: 20px;
  color: var(--text-2);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
}
.topbar-menu-btn:hover { background: var(--bg); color: var(--text); }

/* ===== 移动端适配 ===== */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .topbar { display: flex; }
  .page { padding: 22px 16px 48px; }
}

/* 抽屉内导航复用侧边栏样式 */
.drawer-nav { display: flex; flex-direction: column; gap: 2px; }
.drawer-nav .nav-item.active { background: var(--accent-soft); }

/* ===== 小程序码占位 ===== */
.mini-code-img {
  width: 200px;
  height: 200px;
  margin: 0 auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  display: block;
  object-fit: cover;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* ===== 首页 Hero ===== */
.hero { padding: 2px 0 14px; }
.hero-title { font-size: 26px; font-weight: 700; color: var(--text); font-family: var(--font-display); }
.hero-sub { margin-top: 8px; font-size: 14px; color: var(--text-2); }
.hero-actions { margin-top: 14px; display: flex; gap: 10px; }

/* 功能分组 */
.feat-group { margin-top: 16px; }
.fg-head { display: flex; align-items: center; gap: 8px; color: var(--accent); margin-bottom: 8px; }
.fg-head .el-icon { font-size: 18px; }
.fg-title { font-size: 15px; font-weight: 700; color: var(--text); font-family: var(--font-display); }
.feat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.feat-card {
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--card);
  transition: border-color 0.15s ease;
}
.feat-card:hover { border-color: var(--accent); }
.feat-icon { font-size: 20px; color: var(--accent); flex: none; margin-top: 2px; }
.feat-name { font-size: 14px; font-weight: 600; color: var(--text); }
.feat-desc { margin-top: 3px; font-size: 12px; color: var(--muted); line-height: 1.5; }

.home-mini { margin-top: 22px; text-align: center; }
.home-mini-tip { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* ===== 小程序 tab 页 ===== */
.mini-page { text-align: center; padding: 40px 16px; }
.mini-page .mini-code-img { width: 260px; height: 260px; }
.mini-page-tip { margin-top: 16px; font-size: 16px; font-weight: 600; color: var(--text); }
.mini-page-desc { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* ===== 通用：加载/错误/分页 ===== */
.list-loading { min-height: 160px; }
.state-block { padding: 20px 0; }
.pager { margin-top: 16px; display: flex; justify-content: center; }

/* ===== 阵型大全 ===== */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filter-keyword { width: 220px; }
.filter-select { width: 130px; }
.filter-sort { margin-left: auto; }

.formation-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.formation-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.formation-card:hover { border-color: var(--accent); }
.cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-fallback { font-size: 30px; color: var(--muted); opacity: 0.5; }
.cover-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 1;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}
.fc-body { padding: 9px 11px 11px; }
.fc-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.fc-tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  font-size: 11px;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--border-soft);
  padding: 1px 7px;
  border-radius: 5px;
}
.tag-chip.th { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.fc-meta { margin-top: 8px; display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; }
.meta-item { display: inline-flex; align-items: center; gap: 4px; }
.meta-author { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fc-copy { margin-left: auto; flex: none; }
.fc-copy + .fc-copy { margin-left: 0; }

/* ===== 部落图鉴 ===== */
.catalog-head { display: flex; align-items: center; gap: 10px; }
.catalog-head .doc-title { margin-bottom: 0; }
.head-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 20px;
  padding: 2px 10px;
}
.catalog-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0; }
.catalog-search { width: 220px; margin-left: auto; }

.cat-section {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--card);
  margin-bottom: 10px;
  overflow: hidden;
}
.cs-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.cs-title { font-size: 15px; font-weight: 700; color: var(--text); font-family: var(--font-display); }
.cs-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 20px;
  padding: 1px 8px;
}
.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  padding: 2px 12px 12px;
}
.unit-card { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.unit-icon-box {
  position: relative;
  width: 60px;
  height: 60px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.unit-icon-box img { width: 84%; height: 84%; object-fit: contain; }
.unit-fallback { font-size: 20px; font-weight: 700; color: var(--accent); opacity: 0.8; }
.unit-lv {
  position: absolute;
  right: 0;
  bottom: 0;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-top-left-radius: 6px;
  background: var(--card);
  color: var(--text-2);
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.unit-name {
  margin-top: 6px;
  max-width: 100%;
  font-size: 11px;
  color: var(--text-2);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ===== 登录 ===== */
.login-card {
  max-width: 460px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--card);
  padding: 22px;
}
.login-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.login-input { margin-bottom: 12px; }
.login-btn { width: 100%; margin-top: 4px; letter-spacing: 4px; }

.user-row { display: flex; align-items: center; gap: 14px; }
.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-name { font-size: 16px; font-weight: 700; color: var(--text); }
.user-uid { margin-top: 4px; font-size: 12px; color: var(--muted); }
.logout-btn { width: 100%; margin-top: 20px; }

.guide-card {
  margin-top: 22px;
  border-top: 1px solid var(--border-soft);
  padding-top: 18px;
}
.guide-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 14px; font-family: var(--font-display); }
.guide-step { display: flex; gap: 12px; margin-bottom: 12px; }
.step-no {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.step-title { font-size: 13px; font-weight: 600; color: var(--text); }
.step-desc { margin-top: 3px; font-size: 12px; color: var(--muted); line-height: 1.55; }
.guide-tip {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.55;
}

/* ===== 响应式补充 ===== */
@media (max-width: 720px) {
  .page { padding: 16px 12px 36px; }
  .filter-keyword { width: 100%; }
  .filter-select { width: calc(50% - 5px); flex: 1; }
  .filter-sort { margin-left: 0; }
  .catalog-search { width: 100%; margin-left: 0; }
  .hero-title { font-size: 22px; }
}

/* ===== 村庄计算器 ===== */
.cd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.cd-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card);
}
.cd-icon { width: 36px; height: 36px; flex: none; object-fit: contain; }
.cd-icon-fb { font-size: 30px; color: var(--accent); flex: none; }
.cd-info { min-width: 0; }
.cd-label { font-size: 12px; color: var(--muted); }
.cd-time { font-size: 14px; font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.v-add-card { margin-top: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); padding: 14px; }
.v-add-head { font-weight: 700; margin-bottom: 10px; }
.v-add-foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.v-add-err { flex: 1; min-width: 0; color: var(--danger); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.v-add-foot .el-button { margin-left: auto; flex: none; }

.v-card { margin-top: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); overflow: hidden; }
.v-card-main { display: flex; align-items: center; gap: 12px; padding: 12px; cursor: pointer; }
.v-card-main:hover { background: var(--hover-bg); }
.v-th-wrap { position: relative; width: 60px; flex: none; }
.v-th-img { width: 60px; height: 60px; object-fit: contain; }
.v-th-badge {
  position: absolute; left: 50%; bottom: -2px; transform: translateX(-50%);
  background: var(--accent); color: var(--on-accent);
  font-size: 11px; font-weight: 700; line-height: 1;
  padding: 3px 7px; border-radius: 8px; white-space: nowrap;
}
.v-info { flex: 1; min-width: 0; }
.v-tag { font-weight: 700; font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.v-prosperity { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.vp-label { font-size: 12px; color: var(--muted); }
.vp-value { font-size: 14px; font-weight: 700; color: var(--accent); }
.v-bar { height: 6px; border-radius: 3px; background: var(--hover-bg); overflow: hidden; margin-top: 5px; }
.v-bar-inner { height: 100%; border-radius: 3px; background: var(--accent); transition: width 0.3s; }
.v-updated { font-size: 11px; color: var(--muted); margin-top: 5px; }
.v-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.v-arrow { color: var(--muted); transition: transform 0.2s; }
.v-arrow.open { transform: rotate(180deg); }

.v-detail { border-top: 1px dashed var(--border); padding: 12px; }
.cg-sub-title { font-size: 12px; color: var(--muted); font-weight: 700; margin: 8px 0 6px; }
.unit-icon-box.locked img { opacity: 0.3; filter: grayscale(1); }
.unit-icon-box.maxed { border-color: var(--accent); }
.unit-lv.locked { background: var(--muted); color: #fff; }
.unit-lv.max { background: var(--accent); color: var(--on-accent); }
.unit-lv.upgrading { background: #e6a23c; color: #fff; }
.cs-count.full { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* ===== 村庄升级情况 ===== */
.v-up-wrap { margin-bottom: 6px; }
.v-sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.v-sec-title { font-weight: 700; font-size: 14px; }
.v-stat-line {
  display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline;
  font-size: 12px; color: var(--text-2, var(--muted));
  background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: 8px; padding: 7px 10px; margin-bottom: 10px;
}
.v-stat-line b { font-weight: 700; }
.v-idle-hint { color: #67c23a; }
.v-plan { color: var(--accent); }
.v-ore-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.v-ore-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-2, var(--muted));
  border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 10px 4px 5px; background: var(--bg);
}
.v-ore-chip img { width: 20px; height: 20px; object-fit: contain; }
.v-ore-chip b { color: var(--text); font-weight: 700; }
.v-dur-row { display: flex; align-items: center; }
.v-dur-block { flex: 1; text-align: center; min-width: 0; }
.v-dur-num { font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-dur-num.blue { color: #4ea1ff; }
.v-dur-label { font-size: 11px; color: var(--muted); margin-top: 3px; }
.v-dur-legend { display: flex; justify-content: center; gap: 12px; font-size: 11px; color: var(--muted); margin-top: 6px; }
.v-cat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 14px; margin-top: 12px; }
.v-cat-item { min-width: 0; }
.v-cat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.v-cat-label { font-size: 12px; color: var(--text-2, var(--muted)); }
.v-cat-count { color: var(--muted); font-size: 11px; }
.v-cat-time { font-size: 12px; color: #4ea1ff; flex: none; }
.v-up-empty { text-align: center; color: var(--muted); font-size: 12px; padding: 14px 0 4px; }
.v-up-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border-soft); }
.v-up-item:first-of-type { margin-top: 8px; }
.u-icon {
  width: 38px; height: 38px; flex: none; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.u-icon img { width: 30px; height: 30px; object-fit: contain; }
.u-info { flex: 1; min-width: 0; }
.u-name-row { display: flex; align-items: center; gap: 6px; }
.u-name { font-size: 13px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.world-badge {
  flex: none; font-size: 10px; color: #4ea1ff;
  border: 1px solid rgba(78, 161, 255, 0.45); border-radius: 4px;
  padding: 1px 4px; line-height: 1.3;
}
.u-lv-row { font-size: 12px; color: var(--muted); margin-top: 3px; }
.u-lv-target { color: var(--accent); font-weight: 700; }
.u-right { flex: none; text-align: right; }
.u-remain { font-size: 13px; font-weight: 700; color: #4ea1ff; }
.u-finish { font-size: 10px; color: var(--muted); margin-top: 2px; }
.u-done { font-size: 12px; color: var(--muted); }

/* 升级时间线 + 毕业进度 */
.v-tl-group { margin-top: 4px; }
.v-tl-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--text-2, var(--muted));
  padding: 8px 0 2px;
}
.v-tl-dot { width: 6px; height: 6px; border-radius: 50%; background: #4ea1ff; flex: none; }
.v-grad { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--border); }
.v-grad-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.v-grad-title { font-weight: 700; font-size: 14px; }
.v-grad-num { font-size: 12px; color: var(--accent); font-weight: 700; }
.v-grad .v-cat-list { margin-top: 10px; }
